From a2923bdb655883c706663eb69fc18d17e9caf16d Mon Sep 17 00:00:00 2001 From: Josh Smith Date: Sat, 21 Mar 2020 01:22:36 -0700 Subject: [PATCH] Improve temperature styling and allow it to accept decimals --- lib/src/ui/assets/theme.dart | 6 +- lib/src/ui/screens/checkup/steps/intro.dart | 145 +++++++++--------- .../ui/screens/checkup/steps/subjective.dart | 2 +- .../ui/screens/checkup/steps/temperature.dart | 3 +- 4 files changed, 80 insertions(+), 76 deletions(-) diff --git a/lib/src/ui/assets/theme.dart b/lib/src/ui/assets/theme.dart index e4e6c3e..3d63c3c 100644 --- a/lib/src/ui/assets/theme.dart +++ b/lib/src/ui/assets/theme.dart @@ -14,11 +14,11 @@ final ThemeData appTheme = ThemeData.light().copyWith( inputDecorationTheme: InputDecorationTheme( labelStyle: TextStyle(color: Colors.black), border: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10)), + borderRadius: BorderRadius.circular(5), borderSide: BorderSide.none, ), enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(10)), + borderRadius: BorderRadius.circular(5), borderSide: BorderSide.none, ), filled: true, @@ -37,7 +37,7 @@ final ThemeData appTheme = ThemeData.light().copyWith( buttonColor: Colors.white.withOpacity(0.8), textTheme: ButtonTextTheme.primary, shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(10)), + borderRadius: BorderRadius.circular(10), side: BorderSide.none, ), ), diff --git a/lib/src/ui/screens/checkup/steps/intro.dart b/lib/src/ui/screens/checkup/steps/intro.dart index 63b2e47..2419e08 100644 --- a/lib/src/ui/screens/checkup/steps/intro.dart +++ b/lib/src/ui/screens/checkup/steps/intro.dart @@ -41,85 +41,88 @@ class _IntroStepState extends State { } final CheckupStateInProgress checkupState = state; - return Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only(bottom: 20), - padding: EdgeInsets.symmetric(horizontal: 40), - child: FaIcon( - FontAwesomeIcons.heartbeat, - color: Colors.white, - size: 100, - ), - ), - Container( - margin: EdgeInsets.only(bottom: 20), - padding: EdgeInsets.symmetric(horizontal: 40), - child: Text( - "It's time for your checkup.", - style: Theme.of(context).textTheme.title, - textAlign: TextAlign.center, - ), - ), - Container( - margin: EdgeInsets.only(bottom: 20), - padding: EdgeInsets.symmetric(horizontal: 40), - child: Text( - "We will ask you a few questions and have you take your temperature.", - style: Theme.of(context).textTheme.subtitle, - textAlign: TextAlign.center, + return SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.only(bottom: 20), + padding: EdgeInsets.symmetric(horizontal: 40), + child: FaIcon( + FontAwesomeIcons.heartbeat, + color: Colors.white, + size: 100, + ), ), - ), - Container( - margin: EdgeInsets.only(bottom: 20), - padding: EdgeInsets.symmetric(horizontal: 40), - child: Text( - "At the end, you will receive a personalized COVID-19 risk assessment and recommendations for staying healthy.", - style: Theme.of(context).textTheme.subtitle, - textAlign: TextAlign.center, + Container( + margin: EdgeInsets.only(bottom: 20), + padding: EdgeInsets.symmetric(horizontal: 40), + child: Text( + "It's time for your checkup.", + style: Theme.of(context).textTheme.title, + textAlign: TextAlign.center, + ), ), - ), - Container( - margin: EdgeInsets.symmetric(vertical: 20), - color: Colors.white.withOpacity(0.2), - child: SwitchListTile( - contentPadding: EdgeInsets.all(20), - secondary: FaIcon( - FontAwesomeIcons.handHoldingHeart, - color: Colors.white, - size: 35, + Container( + margin: EdgeInsets.only(bottom: 20), + padding: EdgeInsets.symmetric(horizontal: 40), + child: Text( + "We will ask you a few questions and have you take your temperature.", + style: Theme.of(context).textTheme.subtitle, + textAlign: TextAlign.center, ), - title: Text( - 'Contribute my data to the COVID-19 response effort.', + ), + Container( + margin: EdgeInsets.only(bottom: 20), + padding: EdgeInsets.symmetric(horizontal: 40), + child: Text( + "At the end, you will receive a personalized COVID-19 risk assessment and recommendations for staying healthy.", + style: Theme.of(context).textTheme.subtitle, + textAlign: TextAlign.center, ), - subtitle: Container( - margin: EdgeInsets.only(top: 5), - child: Text( - 'We will collect your postal code.', + ), + Container( + margin: EdgeInsets.symmetric(vertical: 20), + color: Colors.white.withOpacity(0.2), + child: SwitchListTile( + contentPadding: EdgeInsets.all(20), + secondary: FaIcon( + FontAwesomeIcons.handHoldingHeart, + color: Colors.white, + size: 35, + ), + title: Text( + 'Contribute my data to the COVID-19 response effort.', ), + subtitle: Container( + margin: EdgeInsets.only(top: 5), + child: Text( + 'We will collect your postal code.', + ), + ), + activeColor: Colors.white, + onChanged: (bool value) => + _updateDataContributionPreference(value, checkupState), + value: checkupState.checkup.dataContributionPreference, ), - activeColor: Colors.white, - onChanged: (bool value) => - _updateDataContributionPreference(value, checkupState), - value: checkupState.checkup.dataContributionPreference, ), - ), - Container( - margin: EdgeInsets.symmetric(vertical: 20), - padding: EdgeInsets.symmetric(horizontal: 40), - child: RaisedButton( - onPressed: () { - Provider.of(context, listen: false).nextPage( - duration: Duration(milliseconds: 400), - curve: Curves.easeInOut, - ); - }, - child: Text('Start checkup'), + Container( + margin: EdgeInsets.symmetric(vertical: 20), + padding: EdgeInsets.symmetric(horizontal: 40), + child: RaisedButton( + onPressed: () { + Provider.of(context, listen: false) + .nextPage( + duration: Duration(milliseconds: 400), + curve: Curves.easeInOut, + ); + }, + child: Text('Start checkup'), + ), ), - ), - ], + ], + ), ); }, ); diff --git a/lib/src/ui/screens/checkup/steps/subjective.dart b/lib/src/ui/screens/checkup/steps/subjective.dart index 342dc50..d54ee10 100644 --- a/lib/src/ui/screens/checkup/steps/subjective.dart +++ b/lib/src/ui/screens/checkup/steps/subjective.dart @@ -70,7 +70,7 @@ class _SubjectiveStepState extends State { final CheckupStateInProgress checkupState = state; return QuestionView( - padding: EdgeInsets.only(bottom: 50), + padding: EdgeInsets.only(bottom: 80), questions: questionState.questions, onChange: (Question question, dynamic value) => _updateCheckup(question, value, checkupState), diff --git a/lib/src/ui/screens/checkup/steps/temperature.dart b/lib/src/ui/screens/checkup/steps/temperature.dart index 0a50182..d002b9f 100644 --- a/lib/src/ui/screens/checkup/steps/temperature.dart +++ b/lib/src/ui/screens/checkup/steps/temperature.dart @@ -107,9 +107,10 @@ class _TemperatureStepState extends State { ), keyboardType: TextInputType.number, inputFormatters: [ - WhitelistingTextInputFormatter.digitsOnly, + WhitelistingTextInputFormatter(RegExp(r'^\d+\.?\d{0,1}$')), ], autovalidate: true, + autofocus: true, validator: (String value) { if (value != '') { final double numberValue = double.parse(value);