From 8a4c736ec9fb5f5bff039b94e293070f1fa121a7 Mon Sep 17 00:00:00 2001 From: Avinath Gunasekara Date: Mon, 23 Mar 2020 12:58:41 +0530 Subject: [PATCH 1/2] removed email and made all form fields mandatory --- lib/page/screen/user_register_screen.dart | 76 ++++++++++++----------- 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/lib/page/screen/user_register_screen.dart b/lib/page/screen/user_register_screen.dart index e60d978..752c459 100644 --- a/lib/page/screen/user_register_screen.dart +++ b/lib/page/screen/user_register_screen.dart @@ -64,14 +64,14 @@ class _UserRegisterScreenState extends State { String _name; String _age; - String _email; + String _email = ""; String _mobileNumber; String _address; String _citizenStatus = "Yes"; String _nic = ""; - String _country = "Sri Lanka"; + String _country = "Afghanistan"; String _passport = ""; - String _gender; + String _gender = "Female"; final AsyncMemoizer> _memorizier = AsyncMemoizer>(); @@ -273,35 +273,35 @@ class _UserRegisterScreenState extends State { SizedBox( height: 15.0, ), - TextFormField( - validator: (val) { - if (val.isEmpty || !val.contains("@")) { - return AppLocalizations.of(context).translate( - "user_register_screen_invalid_email"); - } - }, - onSaved: (val) { - setState(() { - _email = val; - }); - }, - keyboardType: TextInputType.emailAddress, - decoration: InputDecoration( - labelText: AppLocalizations.of(context) - .translate("user_register_screen_email"), - icon: Icon( - Icons.email, - color: TrackerColors.primaryColor, - ), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(15.0), - borderSide: BorderSide( - color: TrackerColors.primaryColor, - ), - ))), - SizedBox( - height: 15.0, - ), + // TextFormField( + // validator: (val) { + // if (val.isEmpty || !val.contains("@")) { + // return AppLocalizations.of(context).translate( + // "user_register_screen_invalid_email"); + // } + // }, + // onSaved: (val) { + // setState(() { + // _email = val; + // }); + // }, + // keyboardType: TextInputType.emailAddress, + // decoration: InputDecoration( + // labelText: AppLocalizations.of(context) + // .translate("user_register_screen_email"), + // icon: Icon( + // Icons.email, + // color: TrackerColors.primaryColor, + // ), + // border: OutlineInputBorder( + // borderRadius: BorderRadius.circular(15.0), + // borderSide: BorderSide( + // color: TrackerColors.primaryColor, + // ), + // ))), + // SizedBox( + // height: 15.0, + // ), TextFormField( validator: (val) { if (val.isEmpty) { @@ -350,6 +350,8 @@ class _UserRegisterScreenState extends State { onChanged: (value) { setState(() { _citizenStatus = value; + _passport = ""; + _country = "Sri Lanka"; }); }, ), @@ -368,6 +370,7 @@ class _UserRegisterScreenState extends State { onChanged: (value) { setState(() { _citizenStatus = value; + _nic = ""; }); }, ), @@ -507,7 +510,7 @@ class _UserRegisterScreenState extends State { TextFormField( validator: (val) { if (val.isEmpty) { - "Passport number is invalid"; + return "Passport number is invalid"; } }, onSaved: (val) { @@ -572,8 +575,8 @@ class _UserRegisterScreenState extends State { Icon(Icons.person), Expanded( child: Container( - margin: const EdgeInsets.only(left: 15.0), height: 60.0, + margin: const EdgeInsets.only(left: 15.0), child: DropdownButtonHideUnderline( child: DropdownButton( hint: Padding( @@ -620,6 +623,7 @@ class _UserRegisterScreenState extends State { SizedBox( height: 15.0, ), + AnimatedTrackerButton( child: _currentBtnChild, active: _registerBtnStatus, @@ -650,7 +654,9 @@ class _UserRegisterScreenState extends State { _registerBtnHeight = 50.0; _registerBtnStatus = false; }); - + if (_citizenStatus == "Yes") { + _country = "Sri Lanka"; + } List _cases = Provider.of(context, listen: false).reportedCases; // Position position = await Geolocator() From 693fe7cc6fdfc515df3f03fdb016f3e2d23943fb Mon Sep 17 00:00:00 2001 From: Avinath Gunasekara Date: Mon, 23 Mar 2020 13:37:10 +0530 Subject: [PATCH 2/2] added popup for terms and conditions --- lib/page/screen/welcome_screen.dart | 112 +++++++++++++++++++++++++--- 1 file changed, 102 insertions(+), 10 deletions(-) diff --git a/lib/page/screen/welcome_screen.dart b/lib/page/screen/welcome_screen.dart index 8cd91a2..38d02d5 100644 --- a/lib/page/screen/welcome_screen.dart +++ b/lib/page/screen/welcome_screen.dart @@ -29,13 +29,15 @@ class _WelcomeScreenState extends State { "Next", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ); + + Widget _btnChild; String _appName = "Sri Lanka COVID-19"; String _version = "1.0.0"; @override void initState() { super.initState(); - + _btnChild = _nextBtnChild; PackageInfo.fromPlatform().then((PackageInfo packageInfo) { setState(() { _appName = packageInfo.appName; @@ -264,27 +266,21 @@ class _WelcomeScreenState extends State { AnimatedTrackerButton( width: _nextBtnWidth, height: _nextBtnHeight, - child: _nextBtnChild, + child: _btnChild, onPressed: () { setState(() { _nextBtnWidth = 100.0; _nextBtnHeight = 60.0; - _nextBtnChild = _registerCircleProgress; - + _btnChild = _registerCircleProgress; SharedPreferences.getInstance().then((pref) { String language = AppLocalizations.of(context) .locale .languageCode; pref.setString("language", language); print("Languge $language"); - Future.delayed(Duration(seconds: 1), () { - Navigator.pushReplacement( - context, - MaterialPageRoute( - builder: (context) => RootScreen())); - }); }); }); + _showDialog(); }, ) ], @@ -296,4 +292,100 @@ class _WelcomeScreenState extends State { ), ); } + + void _showDialog() { + Future.delayed(Duration(seconds: 1), () { + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20.0)), + actions: [ + FlatButton( + onPressed: () { + Navigator.of(context).pop(); + setState(() { + _nextBtnWidth = 400.0; + _nextBtnHeight = 20.0; + _btnChild = _nextBtnChild; + }); + }, + child: Text("I Decline", + style: TextStyle(color: Colors.black45)), + ), + Column( + mainAxisSize: MainAxisSize.min, + children: [ + RaisedButton( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.all(Radius.circular(20.0))), + onPressed: () { + Navigator.of(context).pop(); + Navigator.pushReplacement( + context, + MaterialPageRoute( + builder: (context) => RootScreen())); + }, + color: TrackerColors.primaryColor, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + "I Accept", + style: TextStyle(color: Colors.white), + ), + ), + ), + ], + ) + ], + contentPadding: const EdgeInsets.all(0), + content: Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Colors.black12, + style: BorderStyle.solid, + width: 3.0))), + height: 400, + child: SingleChildScrollView( + child: Scrollbar( + child: Container( + padding: const EdgeInsets.all(20.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + "Terms of Service", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.black, + fontSize: 20.0, + fontWeight: FontWeight.bold), + ), + SizedBox( + height: 20.0, + ), + Text( + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.black, + fontSize: 15.0, + fontWeight: FontWeight.normal), + ), + ], + ), + ), + ), + ), + ), + ); + }); + }); + } }