| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- import 'package:flutter/material.dart';
- import 'package:flutter/cupertino.dart';
- import '../styles/colors.dart';
- import 'dart:ui';
- import '../styles/totast.dart';
- import '../styles/api.dart';
- import 'loginSecond.dart'; //登录第二页面
- class LoginFirst extends StatefulWidget {
- @override
- LoginFirstState createState() => LoginFirstState();
- }
- class LoginFirstState extends State<LoginFirst> {
- String inputVal;
- @override
- Widget build(BuildContext context) {
- return new WillPopScope(
- child: Scaffold(
- appBar: AppBar(
- backgroundColor: BG_SUB_COLOR,
- centerTitle: true,
- elevation: 0,
- leading: Container(),
- ),
- body: Container(
- width: double.infinity,
- padding: EdgeInsets.symmetric(vertical: 20, horizontal: 15),
- color: BG_SUB_COLOR,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Text(
- 'LOGO',
- style: TextStyle(
- color: Colors.white,
- fontSize: 64,
- ),
- ),
- 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(0xFFC2524D),
- child: Text("下一步"),
- onPressed: () {
- print(inputVal);
- if (!checkPhone(inputVal)) {
- Toast.show(context, '手机号格式错误', 1500, 'info');
- } else {
- Navigator.push(
- context,
- new CupertinoPageRoute(
- builder: (context) =>
- new LoginSecond(phone: inputVal),
- ),
- );
- }
- },
- ),
- )
- ],
- ),
- ),
- ),
- onWillPop: () {
- Toast.hide();
- print("返回键点击了");
- // Navigator.pop(context);
- });
- }
- }
|