From 1cafd9dac2d09f2eda41ded4f234230d207d483e Mon Sep 17 00:00:00 2001 From: laiiihz Date: Mon, 2 Nov 2020 11:37:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=99=BB=E9=99=86=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ui/login/login_page.dart | 33 +++++++++++++++++++++++++++++--- pubspec.lock | 37 +++++++++++++++++++++++++++++++++++- pubspec.yaml | 2 ++ 3 files changed, 68 insertions(+), 4 deletions(-) diff --git a/lib/ui/login/login_page.dart b/lib/ui/login/login_page.dart index 5d7fad1..5a2dcab 100644 --- a/lib/ui/login/login_page.dart +++ b/lib/ui/login/login_page.dart @@ -5,6 +5,7 @@ import 'package:aku_community_manager/tools/widget_tool.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_back_button.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:common_utils/common_utils.dart'; import 'package:extended_text/extended_text.dart'; import 'package:flutter/material.dart'; import 'package:aku_community_manager/tools/screen_tool.dart'; @@ -17,6 +18,18 @@ class LoginPage extends StatefulWidget { } class _LoginPageState extends State { + TextEditingController _textController = TextEditingController(); + + bool get phoneValid { + return RegexUtil.isMobileSimple(_textController.text); + } + + @override + void dispose() { + _textController?.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { return AkuScaffold( @@ -54,6 +67,10 @@ class _LoginPageState extends State { width: double.infinity, child: TextField( autofocus: true, + controller: _textController, + onChanged: (text) { + setState(() {}); + }, keyboardType: TextInputType.phone, decoration: InputDecoration( border: UnderlineInputBorder( @@ -75,10 +92,20 @@ class _LoginPageState extends State { Padding( padding: EdgeInsets.symmetric(horizontal: 32.w), child: AkuMaterialButton( - color: AppStyle.minorColor, - onPressed: () {}, + color: AppStyle.primaryColor, + onPressed: phoneValid ? () {} : null, + nullColor: Color(0xFFFFE67D), radius: 8.w, - child: Text('获取验证码'), + child: Text( + '获取验证码', + style: TextStyle( + color: phoneValid + ? AppStyle.primaryTextColor + : AppStyle.minorTextColor, + fontSize: 32.sp, + fontWeight: FontWeight.bold, + ), + ), ), ), ], diff --git a/pubspec.lock b/pubspec.lock index 3ece33e..3018540 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -6,7 +6,7 @@ packages: description: path: "." ref: HEAD - resolved-ref: e57b6920e49f325c041fac955e1f3297dc9f1d09 + resolved-ref: "89d1e665c372461ed87be46c9227377b305050b2" url: "http://test.akuhotel.com:8099/aku_fe/aku_ui.git" source: git version: "0.0.1" @@ -66,6 +66,27 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.15.0-nullsafety.3" + common_utils: + dependency: "direct main" + description: + name: common_utils + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.1" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.5" cupertino_icons: dependency: "direct main" description: @@ -73,6 +94,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" + decimal: + dependency: transitive + description: + name: decimal + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.5" extended_text: dependency: "direct main" description: @@ -167,6 +195,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.0.13" + rational: + dependency: transitive + description: + name: rational + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.8" sky_engine: dependency: transitive description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index 0248e80..92a0519 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -44,6 +44,8 @@ dependencies: extended_text: ^4.0.0 + common_utils: ^1.2.1 + aku_ui: git: url: http://test.akuhotel.com:8099/aku_fe/aku_ui.git