import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import '../styles/colors.dart'; import 'dart:ui'; import '../styles/totast.dart'; import 'LoginSecond.dart'; import '../utils/Utils.dart'; class LoginFirst extends StatefulWidget { @override LoginFirstState createState() => LoginFirstState(); } class LoginFirstState extends State { String inputVal; @override Widget build(BuildContext context) { return WillPopScope( child: Scaffold( body: Container( color: BG_SUB_COLOR, child: CustomScrollView( slivers: [ SliverAppBar( backgroundColor: BG_SUB_COLOR, centerTitle: true, elevation: 0, leading: Container(), ), SliverToBoxAdapter( child: Container( width: double.infinity, padding: EdgeInsets.symmetric(vertical: 20, horizontal: 15), color: BG_SUB_COLOR, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // Text( // 'LOGO', // style: TextStyle( // color: Colors.white, // fontSize: 64, // ), // ), Image.asset('images/icon_logo.png'), Container( margin: EdgeInsets.only(top: 30), child: Text('手机快捷登录', style: TextStyle(color: Colors.white, fontSize: 28, fontWeight: FontWeight.w500)), ), Container( margin: EdgeInsets.only(top: 20), child: TextField( autofocus: true, keyboardType: TextInputType.phone, maxLength: 11, style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.w500), decoration: InputDecoration( hintText: '输入手机号', hintStyle: TextStyle( fontSize: 16, color: Color(0xFF727785), ), prefixIcon: Container( padding: EdgeInsets.all(10), // color: PRIMARY_COLOR, child: Image.asset( 'images/list_icon_shouji.png', width: 20, ), ), // suffixIcon:Container( // padding: EdgeInsets.all(10), // // color: PRIMARY_COLOR, // child: Image.asset( // 'images/list_icon_shouji.png', // width: 20, // ), // ), counterStyle: TextStyle(color: BG_SUB_COLOR, fontSize: 0)), onChanged: (value) { inputVal = value; })), Text('未注册的手机号验证后自动创建账户', style: TextStyle(color: Color(0xFF727785), fontSize: 13)), Container( margin: EdgeInsets.symmetric(vertical: 22), width: double.infinity, height: 48, child: FlatButton( textColor: Colors.white, color: PRIMARY_COLOR, highlightColor: Color(0xFF763434), child: Text('下一步'), onPressed: () { if (!checkPhone(inputVal)) { Toast.show(context, '手机号格式错误', 1500, 'info'); } else { Navigator.push( context, CupertinoPageRoute( builder: (context) => LoginSecond(phone: inputVal), ), ); } }, ), ) ], ), ), ) ], ), )), onWillPop: () { Toast.hide(); // Navigator.pop(context); return Future.value(false); }); } }