| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'home_page.dart';
- import 'util/api.dart';
- class LoginPage extends StatefulWidget {
- LoginPage({
- Key key,
- }): super(key: key);
- _LoginPageState createState() => _LoginPageState();
- }
- class _LoginPageState extends State < LoginPage > {
- String phone;
- String password;
- @override
- void initState() {
- // TODO: implement initState
- super.initState();
- getData();
- }
- @override
- Widget build(BuildContext context) {
- ScreenUtil.instance = ScreenUtil(width: 750, height: 1334,allowFontScaling:false)..init(context);
- return Scaffold(
- body: Container(
- color: Colors.white,
- child: ListView(
- children: < Widget > [
- Container(
- padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setHeight(55), 0, ScreenUtil.getInstance().setHeight(55), 0),
- child: Column(
- children: < Widget > [
- Padding(
- padding: EdgeInsets.fromLTRB(0, ScreenUtil.getInstance().setHeight(150), 0, ScreenUtil.getInstance().setHeight(60)),
- child: Center(
- child: Image.asset(
- 'lib/images/icon_logo.png',
- width: ScreenUtil.getInstance().setWidth(210),
- height: ScreenUtil.getInstance().setHeight(210),
- fit: BoxFit.cover,
- ),
- ),
- ),
- Padding(
- padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(60)),
- child: TextField(
- keyboardType: TextInputType.phone,
- decoration: InputDecoration(
- border: UnderlineInputBorder(),
- hintText: "请输入手机号",
- hintStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(32), color: Color.fromRGBO(155, 155, 155, 1)),
- ),
- onChanged: (value){
- setState(() {
- phone = value;
- });
- print(phone);
- },
- ),
- ),
- Padding(
- padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(125)),
- child: TextField(
- cursorColor: Color.fromRGBO(153, 153, 153, 0.5),
- keyboardType: TextInputType.text,
- obscureText:true,
- decoration: InputDecoration(
- hintText: "请输入密码",
- hintStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(32), color: Color.fromRGBO(155, 155, 155, 1)),
- ),
- onChanged: (value){
- setState(() {
- password =value;
- });
- print(password);
- print('111');
- },
- )
- ),
- GestureDetector(
- child: Container(
- height: ScreenUtil.getInstance().setHeight(100),
- decoration: BoxDecoration(
- color: Color.fromRGBO(64, 98, 254, 1),
- borderRadius: BorderRadius.circular(4),
- ),
- child: Center(
- child: Text('登录', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(36), color: Colors.white)),
- ),
- ),
- onTap: () {
- Navigator.pushReplacement(context, MaterialPageRoute(builder: (context){
- return HomePage();
- }));
- },
- )
- ],
- ),
- )
- ],
- ),
- ),
- );
- }
- }
|