From 2fea02a452fc8da50715746bf92660c866422c44 Mon Sep 17 00:00:00 2001 From: Jerome Date: Tue, 24 Aug 2021 06:13:57 +0800 Subject: [PATCH 1/3] add widgets to the scope of signup state --- lib/screens/signup.dart | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/lib/screens/signup.dart b/lib/screens/signup.dart index fb04f97..f08b07d 100644 --- a/lib/screens/signup.dart +++ b/lib/screens/signup.dart @@ -38,7 +38,7 @@ class _SignupScreenState extends State { style: TextStyle(color: MLColors.primary), ), onPressed: () {}), - AlreadyUser(), + _alreadyUser(context), ], ), ), @@ -46,32 +46,29 @@ class _SignupScreenState extends State { ), ); } -} //Message -Column _welcome() => Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Text( - "Hello!", - style: TextStyle( - color: Colors.white, - fontSize: getProportionateScreenWidth(14), - fontWeight: FontWeight.bold, + Column _welcome() => Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text( + "Hello!", + style: TextStyle( + color: Colors.white, + fontSize: getProportionateScreenWidth(14), + fontWeight: FontWeight.bold, + ), ), - ), - MLText( - 'Create a new Account', - color: Colors.white54, - ), - ], - ); + MLText( + 'Create a new Account', + color: Colors.white54, + ), + ], + ); //SignIn -class AlreadyUser extends StatelessWidget { - @override - Widget build(BuildContext context) { + Row _alreadyUser(BuildContext context) { return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ From e9ee7526749c86e26fbd30091b2043851f8abc51 Mon Sep 17 00:00:00 2001 From: Jerome Date: Tue, 24 Aug 2021 06:16:20 +0800 Subject: [PATCH 2/3] make signUpHere private and move it inside LoginScreenState --- lib/screens/login.dart | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/screens/login.dart b/lib/screens/login.dart index 8546204..16cf5e8 100644 --- a/lib/screens/login.dart +++ b/lib/screens/login.dart @@ -35,7 +35,7 @@ class _LoginScreenState extends State { ), _loginButton(), SizedBox(width: SizeMQ.height! * .03), - SignUpHere(), + _signUpHere(context), ], ), ), @@ -86,12 +86,9 @@ class _LoginScreenState extends State { print('Login'); }, ); -} //SignUp -class SignUpHere extends StatelessWidget { - @override - Widget build(BuildContext context) { + Row _signUpHere(BuildContext context) { return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ From 48a17e54ee6fb9197951ec5197be1275f3d47d8a Mon Sep 17 00:00:00 2001 From: Jerome Date: Tue, 24 Aug 2021 06:19:59 +0800 Subject: [PATCH 3/3] use MLText instead of Text --- lib/form/ml_form.dart | 28 ++++++++++++++-------------- lib/screens/login.dart | 12 +++++------- lib/screens/signup.dart | 23 +++++++++++------------ 3 files changed, 30 insertions(+), 33 deletions(-) diff --git a/lib/form/ml_form.dart b/lib/form/ml_form.dart index 6ef54d0..e814042 100644 --- a/lib/form/ml_form.dart +++ b/lib/form/ml_form.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:memory_lamp/defaults/ml_text.dart'; import 'package:memory_lamp/helpers/size_mq.dart'; import 'package:memory_lamp/theming/ml_colors.dart'; @@ -89,18 +90,16 @@ class _MLFormState extends State { Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( + MLText( "I agree with the ", - style: TextStyle( - color: Colors.white, - fontSize: getProportionateScreenWidth(7)), + color: Colors.white, + fontSize: getProportionateScreenWidth(7), ), - Text( + MLText( "Terms and Conditions", - style: TextStyle( - decoration: TextDecoration.underline, - color: Colors.white, - fontSize: getProportionateScreenWidth(7)), + textDecoration: TextDecoration.underline, + color: Colors.white, + fontSize: getProportionateScreenWidth(7), ), ], ) @@ -123,10 +122,10 @@ class _MLFormState extends State { }), data: ThemeData(unselectedWidgetColor: Colors.white38), ), - Text( + MLText( "Remember Me ", - style: TextStyle( - color: Colors.white, fontSize: getProportionateScreenWidth(7)), + color: Colors.white, + fontSize: getProportionateScreenWidth(7), ), ], ); @@ -144,8 +143,9 @@ class _MLFormState extends State { focusedBorder: UnderlineInputBorder( borderSide: BorderSide(color: Colors.white), ), - enabledBorder: - UnderlineInputBorder(borderSide: BorderSide(color: Colors.white)), + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Colors.white), + ), ); } } diff --git a/lib/screens/login.dart b/lib/screens/login.dart index 16cf5e8..b412b91 100644 --- a/lib/screens/login.dart +++ b/lib/screens/login.dart @@ -53,7 +53,7 @@ class _LoginScreenState extends State { children: [ Align( alignment: Alignment.topLeft, - child: Text( + child: MLText( "Welcome Back! ", style: TextStyle( color: Colors.white, @@ -65,11 +65,9 @@ class _LoginScreenState extends State { ), Align( alignment: Alignment.topLeft, - child: Text( + child: MLText( 'Log in to continue', - style: (TextStyle( - color: Colors.white54, - )), + color: Colors.white54, ), ), ], @@ -77,9 +75,9 @@ class _LoginScreenState extends State { //LoginButton MLElevatedButton _loginButton() => MLElevatedButton( - child: Text( + child: MLText( 'Log in', - style: TextStyle(color: MLColors.primary), + color: MLColors.primary, ), color: Colors.white, onPressed: () { diff --git a/lib/screens/signup.dart b/lib/screens/signup.dart index f08b07d..ab44bca 100644 --- a/lib/screens/signup.dart +++ b/lib/screens/signup.dart @@ -32,12 +32,13 @@ class _SignupScreenState extends State { loadForSignup: true, ), MLElevatedButton( - color: Colors.white, - child: Text( - 'Create Account', - style: TextStyle(color: MLColors.primary), - ), - onPressed: () {}), + color: Colors.white, + child: MLText( + 'Create Account', + style: TextStyle(color: MLColors.primary), + ), + onPressed: () {}, + ), _alreadyUser(context), ], ), @@ -52,13 +53,11 @@ class _SignupScreenState extends State { mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Text( + MLText( "Hello!", - style: TextStyle( - color: Colors.white, - fontSize: getProportionateScreenWidth(14), - fontWeight: FontWeight.bold, - ), + color: Colors.white, + fontSize: getProportionateScreenWidth(14), + fontWeight: FontWeight.bold, ), MLText( 'Create a new Account',