Skip to content

Commit

Permalink
Improve temperature styling and allow it to accept decimals
Browse files Browse the repository at this point in the history
  • Loading branch information
ferndot committed Mar 21, 2020
1 parent ce9b844 commit a2923bd
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 76 deletions.
6 changes: 3 additions & 3 deletions lib/src/ui/assets/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
),
),
Expand Down
145 changes: 74 additions & 71 deletions lib/src/ui/screens/checkup/steps/intro.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,85 +41,88 @@ class _IntroStepState extends State<IntroStep> {
}

final CheckupStateInProgress checkupState = state;
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
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: <Widget>[
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<PageController>(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<PageController>(context, listen: false)
.nextPage(
duration: Duration(milliseconds: 400),
curve: Curves.easeInOut,
);
},
child: Text('Start checkup'),
),
),
),
],
],
),
);
},
);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/ui/screens/checkup/steps/subjective.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class _SubjectiveStepState extends State<SubjectiveStep> {

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),
Expand Down
3 changes: 2 additions & 1 deletion lib/src/ui/screens/checkup/steps/temperature.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ class _TemperatureStepState extends State<TemperatureStep> {
),
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);
Expand Down

0 comments on commit a2923bd

Please sign in to comment.