From 5d09e800ca871d4e203cdae0dbae373148f74f98 Mon Sep 17 00:00:00 2001 From: Anmol Verma Date: Thu, 9 Apr 2020 13:03:50 +0530 Subject: [PATCH 1/3] WIP added UI screens for dev-161 --- assets/locales/en.json | 18 +- lib/ui_v1_1/common/ui/CTCommonRadioGroup.dart | 62 +++++ .../home_checkin/WatchForSymptomsWidget.dart | 245 ++++++++++++++++++ .../home_atrisk_notificationdetail.dart | 170 +----------- .../home_checkin/home_check_issick.dart | 115 ++++++++ .../home_checkin/home_checkin_questions.dart | 88 +++++++ .../home_checkin/home_confirm_not_sick.dart | 186 +++++++++++++ .../home_checkin/home_first_checkin.dart | 5 +- .../thanks_doing_part_screen.dart | 72 +++++ 9 files changed, 793 insertions(+), 168 deletions(-) create mode 100644 lib/ui_v1_1/common/ui/CTCommonRadioGroup.dart create mode 100644 lib/ui_v1_1/home_checkin/WatchForSymptomsWidget.dart create mode 100644 lib/ui_v1_1/home_checkin/home_check_issick.dart create mode 100644 lib/ui_v1_1/home_checkin/home_checkin_questions.dart create mode 100644 lib/ui_v1_1/home_checkin/home_confirm_not_sick.dart create mode 100644 lib/ui_v1_1/home_checkin/thanks_doing_part_screen.dart diff --git a/assets/locales/en.json b/assets/locales/en.json index 395fa2f..7e9f7f8 100644 --- a/assets/locales/en.json +++ b/assets/locales/en.json @@ -116,5 +116,21 @@ "Cough": "Cough", "shortness.breath": "Shortness of breath", "when.seek.medical": "When to seek medical attention", - "if.you.develop": "If you develop emergency warning signs for COVID-19 get medical attention immediately. Emergency warning signs include*:" + "if.you.develop": "If you develop emergency warning signs for COVID-19 get medical attention immediately. Emergency warning signs include*:", + "have.you.been.tested": "Have you been tested for COVID-19?", + "yes.tested.for": "Yes, I have been tested for COVID-19", + "not.tested.for": "No, I have not been tested for COVID-19", + "next": "Next", + "are.feeling.sick": "Are you feeling sick?", + "yes.feel.sick": "Yes, I feel sick", + "not.feel.sick": "No, I don’t feel sick", + "yes.feel.sick.message": "I feel sick and have not tested for COVID-19", + "confirm.your.answer": "Confirm your answer & submit your check-in status", + "go.back": "Go Back", + "prev.ques": "Previous Question", + "by.responding": "By Responding, I accept the ", + "thank.you.for.part": "Thank you for doing your part in the fight against COVID-19.", + "we.will.now.cross": "We will now cross-reference your location information with existing location information and notify you if you could be at risk.", + "done": "Done", + "is.sick.not.tested.message": "Please make sure you monitor your symptoms and update your status if you stop experiencing symptoms or test for COVID-19." } \ No newline at end of file diff --git a/lib/ui_v1_1/common/ui/CTCommonRadioGroup.dart b/lib/ui_v1_1/common/ui/CTCommonRadioGroup.dart new file mode 100644 index 0000000..ef6258b --- /dev/null +++ b/lib/ui_v1_1/common/ui/CTCommonRadioGroup.dart @@ -0,0 +1,62 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class CTCommonRadioGroup extends StatefulWidget { + final List list; + final Function(int selected) selectedCallback; + + CTCommonRadioGroup(this.list, this.selectedCallback); + + @override + State createState() { + return CTCommonRadioGroupState(); + } +} + +class CTCommonRadioGroupState extends State { + String _selectedItem; + + @override + void initState() { + assert(widget.list != null && widget.list.isNotEmpty); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Column( + children: widget.list.map((e) => getRadioListTileContainer(e)).toList(), + ); + } + + Widget getRadioListTileContainer(String item) { + return Container( + height: 80, + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(bottom: 20), + decoration: BoxDecoration( + color: Color(0xffF3F4FC), + border: Border.all( + color: _selectedItem != null && _selectedItem == item + ? Color(0xff475DF3) + : Colors.white, + width: 1.0), + borderRadius: BorderRadius.all(Radius.circular(10.0))), + child: RadioListTile( + activeColor: Color(0xff475DF3), + controlAffinity: ListTileControlAffinity.trailing, + title: Text( + item, + style: TextStyle(fontSize: 17, color: Color(0xff1A1D4A)), + ), + value: item, + groupValue: _selectedItem, + onChanged: (newValue) { + setState(() { + _selectedItem = newValue; + widget.selectedCallback.call(widget.list.indexOf(_selectedItem)); + }); + }), + ); + } +} diff --git a/lib/ui_v1_1/home_checkin/WatchForSymptomsWidget.dart b/lib/ui_v1_1/home_checkin/WatchForSymptomsWidget.dart new file mode 100644 index 0000000..feeaf1b --- /dev/null +++ b/lib/ui_v1_1/home_checkin/WatchForSymptomsWidget.dart @@ -0,0 +1,245 @@ +import 'package:corona_trace/utils/app_localization.dart'; +import 'package:flutter/material.dart'; + +import 'home_confirm_not_sick.dart'; + +class WatchForSymptomsWidget extends StatelessWidget { + final bool showBottomButtons; + + WatchForSymptomsWidget({this.showBottomButtons}); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SingleChildScrollView(child: Column( + children: [ + SizedBox(height: 32), + getWatchForSymptomsColumn(), + getWhenToSeekMedical(), + SizedBox(height: 20), + getHowToProtect(), + showBottomButtons ? bottomContent(context) : Container() + ], + ),), + ); + } + + getWatchForSymptomsColumn() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListTile( + title: Text( + AppLocalization.text("watch.for.symptoms"), + style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold), + ), + subtitle: Padding( + child: Text( + AppLocalization.text("this.guidance.was"), + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold, + color: Color(0xff1A1D4A)), + ), + padding: EdgeInsets.only(top: 16), + ), + ), + ListTile( + title: Text(AppLocalization.text("these.symptoms.may.appear"), + style: TextStyle(fontSize: 17, color: Color(0xff1A1D4A))), + ), + SizedBox(height: 10), + ListTile( + title: Text( + "• " + AppLocalization.text("Fever"), + style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + ), + ), + Divider( + height: 0.5, + indent: 20, + color: Color(0xffBAC8E1), + ), + ListTile( + title: Text( + "• " + AppLocalization.text("Cough"), + style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + ), + ), + Divider( + height: 0.5, + indent: 20, + color: Color(0xffBAC8E1), + ), + ListTile( + title: Text( + "• " + AppLocalization.text("shortness.breath"), + style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + ), + ) + ], + ); + } + + getWhenToSeekMedical() { + return Container( + padding: EdgeInsets.only(left: 20,right: 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 20), + Text( + AppLocalization.text("when.seek.medical"), + style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + ), + SizedBox(height: 10), + Text(AppLocalization.text("if.you.develop"), + style: TextStyle(fontSize: 17)), + SizedBox(height: 10), + ListTile( + title: Text( + "• Trouble breathing", + style: + TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + ), + ), + Divider( + height: 0.5, + indent: 20, + color: Color(0xffBAC8E1), + ), + ListTile( + title: Text( + "• Persistent pain or pressure in the chest", + style: + TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + ), + ), + Divider( + height: 0.5, + indent: 20, + color: Color(0xffBAC8E1), + ), + ListTile( + title: Text( + "• New confusion or inability to around", + style: + TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + ), + ), + Divider( + height: 0.5, + indent: 20, + color: Color(0xffBAC8E1), + ), + ListTile( + title: Text( + "• Bluish lips or face", + style: + TextStyle(color: Colors.black, fontWeight: FontWeight.bold), + ), + ) + ], + ), + color: Color(0xffF3F4FC), + ); + } + + getHowToProtect() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListTile( + title: Text( + "Learn how to protect yourself", + style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold), + ), + trailing: Icon(Icons.arrow_forward_ios), + ), + Divider( + height: 0.5, + color: Color(0xffBAC8E1), + indent: 20, + ), + SizedBox( + height: 10, + ), + ListTile( + title: Text("How to care for someone who is sick", + style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold)), + trailing: Icon(Icons.arrow_forward_ios), + ), + Divider( + height: 0.5, + color: Color(0xffBAC8E1), + indent: 20, + ), + SizedBox( + height: 10, + ), + ListTile( + title: Text("What to do if you are sick", + style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold)), + trailing: Icon(Icons.arrow_forward_ios), + ), + Divider( + height: 0.5, + color: Color(0xffBAC8E1), + indent: 20, + ), + ], + ); + } + + + Widget bottomContent(BuildContext context) { + return Column( + children: [ + SizedBox(height: 30), + Container( + child: Material( + child: MaterialButton( + height: 50, + minWidth: MediaQuery.of(context).size.width * 0.85, + color: Color(0xff475DF3), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(8))), + child: Text( + AppLocalization.text( + "next", + ), + style: TextStyle(color: Colors.white, fontSize: 17), + ), + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => HomeConfirmProcessSick(isSick: true,))); + }, + ), + ), + margin: EdgeInsets.only(bottom: 20), + ), + Container( + child: MaterialButton( + height: 50, + minWidth: MediaQuery.of(context).size.width * 0.85, + color: Color(0xffDFE3FF), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(8))), + child: Text( + AppLocalization.text( + "go.back", + ), + style: TextStyle(color: Color(0xff475DF3), fontSize: 17), + ), + onPressed: () { + Navigator.pop(context); + }, + ), + margin: EdgeInsets.only(bottom: 20), + ) + ], + ); + } +} diff --git a/lib/ui_v1_1/home_checkin/home_atrisk_notificationdetail.dart b/lib/ui_v1_1/home_checkin/home_atrisk_notificationdetail.dart index 40ecc41..d07642e 100644 --- a/lib/ui_v1_1/home_checkin/home_atrisk_notificationdetail.dart +++ b/lib/ui_v1_1/home_checkin/home_atrisk_notificationdetail.dart @@ -1,3 +1,4 @@ +import 'package:corona_trace/ui_v1_1/home_checkin/WatchForSymptomsWidget.dart'; import 'package:corona_trace/ui_v1_1/home_checkin/home_checkin_dashboard.dart'; import 'package:corona_trace/utils/app_localization.dart'; import 'package:flutter/material.dart'; @@ -17,55 +18,17 @@ class AtRiskNotificationDetail extends StatelessWidget { topListTileWithMap(), SizedBox(height: 20), getNextSteps(), - SizedBox(height: 20), - getWatchForSymptomsColumn(), - getWhenToSeekMedical(), - SizedBox(height: 20), - ListTile( - title: Text( - "Learn how to protect yourself", - style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold), - ), - trailing: Icon(Icons.arrow_forward_ios), - ), - Divider( - height: 0.5, - color: Color(0xffBAC8E1), - indent: 20, - ), - SizedBox( - height: 30, - ), - ListTile( - title: Text("How to care for someone who is sick", - style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold)), - trailing: Icon(Icons.arrow_forward_ios), - ), - Divider( - height: 0.5, - color: Color(0xffBAC8E1), - indent: 20, - ), - SizedBox( - height: 30, - ), - ListTile( - title: Text("What to do if you are sick", - style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold)), - trailing: Icon(Icons.arrow_forward_ios), - ), - Divider( - height: 0.5, - color: Color(0xffBAC8E1), - indent: 20, - ), + WatchForSymptomsWidget(showBottomButtons: false), SizedBox( height: 30, ), Container( child: MaterialButton( height: 50, - minWidth: MediaQuery.of(context).size.width * 0.85, + minWidth: MediaQuery + .of(context) + .size + .width * 0.85, color: Color(0xff475DF3), shape: RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(8))), @@ -158,125 +121,4 @@ class AtRiskNotificationDetail extends StatelessWidget { ), ); } - - getWatchForSymptomsColumn() { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ListTile( - title: Text( - AppLocalization.text("watch.for.symptoms"), - style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold), - ), - subtitle: Padding( - child: Text( - AppLocalization.text("this.guidance.was"), - style: TextStyle( - fontSize: 17, - fontWeight: FontWeight.bold, - color: Color(0xff1A1D4A)), - ), - padding: EdgeInsets.only(top: 16), - ), - ), - ListTile( - title: Text(AppLocalization.text("these.symptoms.may.appear"), - style: TextStyle(fontSize: 17, color: Color(0xff1A1D4A))), - ), - SizedBox(height: 10), - ListTile( - title: Text( - "• "+AppLocalization.text("Fever"), - style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - ), - ), - Divider( - height: 0.5, - indent: 20, - color: Color(0xffBAC8E1), - ), - ListTile( - title: Text( - "• "+AppLocalization.text("Cough"), - style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - ), - ), - Divider( - height: 0.5, - indent: 20, - color: Color(0xffBAC8E1), - ), - ListTile( - title: Text( - "• "+AppLocalization.text("shortness.breath"), - style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - ), - ) - ], - ); - } - - getWhenToSeekMedical() { - return Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 20), - Text( - AppLocalization.text("when.seek.medical"), - style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), - ), - SizedBox(height: 10), - Text( - AppLocalization.text("if.you.develop"), - style: TextStyle(fontSize: 17)), - SizedBox(height: 10), - ListTile( - title: Text( - "• Trouble breathing", - style: - TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - ), - ), - Divider( - height: 0.5, - indent: 20, - color: Color(0xffBAC8E1), - ), - ListTile( - title: Text( - "• Persistent pain or pressure in the chest", - style: - TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - ), - ), - Divider( - height: 0.5, - indent: 20, - color: Color(0xffBAC8E1), - ), - ListTile( - title: Text( - "• New confusion or inability to around", - style: - TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - ), - ), - Divider( - height: 0.5, - indent: 20, - color: Color(0xffBAC8E1), - ), - ListTile( - title: Text( - "• Bluish lips or face", - style: - TextStyle(color: Colors.black, fontWeight: FontWeight.bold), - ), - ) - ], - ), - color: Color(0xffF3F4FC), - ); - } } diff --git a/lib/ui_v1_1/home_checkin/home_check_issick.dart b/lib/ui_v1_1/home_checkin/home_check_issick.dart new file mode 100644 index 0000000..55bf57a --- /dev/null +++ b/lib/ui_v1_1/home_checkin/home_check_issick.dart @@ -0,0 +1,115 @@ +import 'package:corona_trace/ui_v1_1/common/ui/CTCommonRadioGroup.dart'; +import 'package:corona_trace/ui_v1_1/home_checkin/WatchForSymptomsWidget.dart'; +import 'package:corona_trace/ui_v1_1/home_checkin/home_confirm_not_sick.dart'; +import 'package:corona_trace/utils/app_localization.dart'; +import 'package:flutter/material.dart'; + +class HomeCheckIsSick extends StatefulWidget { + @override + _HomeCheckIsSickState createState() => _HomeCheckIsSickState(); +} + +class _HomeCheckIsSickState extends State { + int _selectedItem; + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + margin: EdgeInsets.all(20), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [topContent(), bottomContent(context)], + ), + ), + ); + } + + Widget topContent() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 32, + ), + Text( + AppLocalization.text("are.feeling.sick"), + style: TextStyle( + fontSize: 28, + color: Color(0xff1A1D4A), + fontWeight: FontWeight.bold), + ), + SizedBox( + height: 32, + ), + CTCommonRadioGroup([ + AppLocalization.text("yes.feel.sick"), + AppLocalization.text("not.feel.sick") + ], (int selected) { + _selectedItem = selected; + setState(() {}); + }) + ], + ); + } + + Widget bottomContent(BuildContext context) { + return Column( + children: [ + Container( + child: Material( + child: MaterialButton( + height: 50, + minWidth: MediaQuery.of(context).size.width * 0.85, + color: + _selectedItem != null ? Color(0xff475DF3) : Color(0xffB5BEFF), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(8))), + child: Text( + AppLocalization.text( + "next", + ), + style: TextStyle(color: Colors.white, fontSize: 17), + ), + onPressed: () { + if (_selectedItem != null) { + if (_selectedItem == 0) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => WatchForSymptomsWidget(showBottomButtons: true,))); + } else { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => HomeConfirmProcessSick(isSick: false,))); + } + } + }, + ), + ), + margin: EdgeInsets.only(bottom: 20), + ), + Container( + child: MaterialButton( + height: 50, + minWidth: MediaQuery.of(context).size.width * 0.85, + color: Color(0xffDFE3FF), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(8))), + child: Text( + AppLocalization.text( + "prev.ques", + ), + style: TextStyle(color: Color(0xff475DF3), fontSize: 17), + ), + onPressed: () { + Navigator.pop(context); + }, + ), + margin: EdgeInsets.only(bottom: 20), + ) + ], + ); + } +} diff --git a/lib/ui_v1_1/home_checkin/home_checkin_questions.dart b/lib/ui_v1_1/home_checkin/home_checkin_questions.dart new file mode 100644 index 0000000..4988744 --- /dev/null +++ b/lib/ui_v1_1/home_checkin/home_checkin_questions.dart @@ -0,0 +1,88 @@ +import 'package:corona_trace/ui_v1_1/common/ui/CTCommonRadioGroup.dart'; +import 'package:corona_trace/ui_v1_1/home_checkin/home_check_issick.dart'; +import 'package:corona_trace/ui_v1_1/home_checkin/home_checkin_dashboard.dart'; +import 'package:corona_trace/utils/app_localization.dart'; +import 'package:flutter/material.dart'; + +class HomeCheckinQuestions extends StatefulWidget { + @override + State createState() { + return HomeCheckinQuestionsState(); + } +} + +class HomeCheckinQuestionsState extends State { + int _selectedItem; + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + margin: EdgeInsets.all(20), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [topContent(), bottomContent()], + ), + ), + ); + } + + Widget topContent() { + return Column( + children: [ + SizedBox( + height: 16, + ), + Text( + AppLocalization.text("have.you.been.tested"), + style: TextStyle( + fontSize: 28, + color: Color(0xff1A1D4A), + fontWeight: FontWeight.bold), + ), + SizedBox( + height: 16, + ), + CTCommonRadioGroup([ + AppLocalization.text("yes.tested.for"), + AppLocalization.text("not.tested.for") + ], (int selected) { + _selectedItem = selected; + setState(() {}); + }) + ], + ); + } + + Widget bottomContent() { + return Container( + child: Material( + child: MaterialButton( + height: 50, + minWidth: MediaQuery.of(context).size.width * 0.85, + color: _selectedItem != null ? Color(0xff475DF3) : Color(0xffB5BEFF), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(8))), + child: Text( + AppLocalization.text( + "next", + ), + style: TextStyle(color: Colors.white, fontSize: 17), + ), + onPressed: () { + if (_selectedItem != null) { + if (_selectedItem == 0) { + Navigator.push(context, + MaterialPageRoute(builder: (context) => HomeCheckinDashboard())); + } else { + Navigator.push(context, + MaterialPageRoute(builder: (context) => HomeCheckIsSick())); + } + } + }, + ), + ), + margin: EdgeInsets.only(bottom: 20), + ); + } +} diff --git a/lib/ui_v1_1/home_checkin/home_confirm_not_sick.dart b/lib/ui_v1_1/home_checkin/home_confirm_not_sick.dart new file mode 100644 index 0000000..41b2c90 --- /dev/null +++ b/lib/ui_v1_1/home_checkin/home_confirm_not_sick.dart @@ -0,0 +1,186 @@ +import 'package:corona_trace/analytics/CTAnalyticsManager.dart'; +import 'package:corona_trace/app_constants.dart'; +import 'package:corona_trace/network/api_repository.dart'; +import 'package:corona_trace/ui_v1_1/home_checkin/thanks_doing_part_screen.dart'; +import 'package:corona_trace/utils/app_localization.dart'; +import 'package:flutter/material.dart'; + +class HomeConfirmProcessSick extends StatelessWidget { + final bool isSick; + + HomeConfirmProcessSick({this.isSick}); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [topContent(), bottomContent(context)], + ), + ), + ); + } + + Widget topContent() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 32, + ), + Padding( + padding: EdgeInsets.only(left: 20, right: 20, top: 20), + child: Text( + AppLocalization.text("confirm.your.answer"), + style: TextStyle( + fontSize: 28, + color: Color(0xff1A1D4A), + fontWeight: FontWeight.bold), + ), + ), + SizedBox( + height: 32, + ), + getNotFeelSickContainer(), + SizedBox( + height: 32, + ), + Padding( + padding: EdgeInsets.only(left: 20), + child: Text( + AppLocalization.text("by.responding"), + style: TextStyle(fontSize: 13), + ), + ), + SizedBox( + height: 32, + ), + ListTile( + title: Text( + AppLocalization.text("Legal.Terms.Conditions"), + ), + trailing: Icon(Icons.arrow_forward_ios), + onTap: () { + CTAnalyticsManager.instance.logClickTermsAndConditions(); + AppConstants.launchUrl(ApiRepository.TERMS_AND_CONDITIONS); + }, + ), + Divider( + height: 0.5, + indent: 20, + color: Colors.grey, + ), + ListTile( + title: Text( + AppLocalization.text("Legal.Privacy.Policy"), + ), + trailing: Icon(Icons.arrow_forward_ios), + onTap: () { + CTAnalyticsManager.instance.logClickPrivacyPolicy(); + AppConstants.launchUrl(ApiRepository.PRIVACY_POLICY); + }, + ), + Divider( + height: 0.5, + indent: 20, + color: Colors.grey, + ), + ], + ); + } + + Container getNotFeelSickContainer() { + return Container( + padding: EdgeInsets.only(top: 30, bottom: 30), + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(bottom: 20), + decoration: BoxDecoration( + color: Color(0xffF3F4FC), + borderRadius: BorderRadius.all(Radius.circular(10.0))), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + width: 20, + ), + Icon( + Icons.done, + color: Color(0xff475DF3), + ), + SizedBox( + width: 20, + ), + Text( + AppLocalization.text( + !isSick ? "not.feel.sick" : "yes.feel.sick.message"), + style: TextStyle(fontSize: 17), + ) + ], + ), + isSick + ? Padding( + padding: + EdgeInsets.only(left: 20, right: 20, top: 20, bottom: 10), + child: + Text(AppLocalization.text("is.sick.not.tested.message")), + ) + : Container() + ], + ), + ); + } + + Widget bottomContent(BuildContext context) { + return Column( + children: [ + Container( + child: Material( + child: MaterialButton( + height: 50, + minWidth: MediaQuery.of(context).size.width * 0.85, + color: Color(0xff475DF3), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(8))), + child: Text( + AppLocalization.text( + "submit", + ), + style: TextStyle(color: Colors.white, fontSize: 17), + ), + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (builder) => ThanksDoingPartScreen())); + }, + ), + ), + margin: EdgeInsets.only(bottom: 20), + ), + Container( + child: MaterialButton( + height: 50, + minWidth: MediaQuery.of(context).size.width * 0.85, + color: Color(0xffDFE3FF), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(8))), + child: Text( + AppLocalization.text( + "go.back", + ), + style: TextStyle(color: Color(0xff475DF3), fontSize: 17), + ), + onPressed: () { + Navigator.pop(context); + }, + ), + margin: EdgeInsets.only(bottom: 20), + ) + ], + ); + } +} diff --git a/lib/ui_v1_1/home_checkin/home_first_checkin.dart b/lib/ui_v1_1/home_checkin/home_first_checkin.dart index b612026..f40a67d 100644 --- a/lib/ui_v1_1/home_checkin/home_first_checkin.dart +++ b/lib/ui_v1_1/home_checkin/home_first_checkin.dart @@ -1,6 +1,5 @@ -import 'package:corona_trace/ui/screens/user_info_collector_screen.dart'; import 'package:corona_trace/ui_v1_1/home_checkin/home_checkin_dashboard.dart'; -import 'package:corona_trace/ui_v1_1/privacy/privacy_screen.dart'; +import 'package:corona_trace/ui_v1_1/home_checkin/home_checkin_questions.dart'; import 'package:corona_trace/utils/app_localization.dart'; import 'package:flutter/material.dart'; @@ -39,7 +38,7 @@ class HomeFirstTimeCheckInScreen extends StatelessWidget { Navigator.pushAndRemoveUntil( context, MaterialPageRoute( - builder: (BuildContext context) => HomeCheckinDashboard()), + builder: (BuildContext context) => HomeCheckinQuestions()), (route) => false); }, ), diff --git a/lib/ui_v1_1/home_checkin/thanks_doing_part_screen.dart b/lib/ui_v1_1/home_checkin/thanks_doing_part_screen.dart new file mode 100644 index 0000000..1e8d2c5 --- /dev/null +++ b/lib/ui_v1_1/home_checkin/thanks_doing_part_screen.dart @@ -0,0 +1,72 @@ +import 'package:corona_trace/utils/app_localization.dart'; +import 'package:flutter/material.dart'; + +class ThanksDoingPartScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return SafeArea( + child: Scaffold( + backgroundColor: Colors.white, + body: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + topContent(), + bottomContent(context), + ], + ), + )); + } + + Container bottomContent(BuildContext context) { + return Container( + child: Material( + child: MaterialButton( + height: 50, + minWidth: MediaQuery.of(context).size.width * 0.85, + color: Color(0xff475DF3), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(8))), + child: Text( + AppLocalization.text( + "done", + ), + style: TextStyle(color: Colors.white, fontSize: 17), + ), + onPressed: () { + + }, + ), + ), + margin: EdgeInsets.only(bottom: 20), + ); + } + + Container topContent() { + return Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + Text( + AppLocalization.text("thank.you.for.part"), + style: TextStyle( + fontSize: 28, + color: Color(0xff1A1D4A), + fontWeight: FontWeight.bold), + ), + SizedBox( + height: 16, + ), + Text( + AppLocalization.text("we.will.now.cross"), + style: TextStyle(fontSize: 17), + ), + ], + ), + margin: EdgeInsets.all(20), + ); + } +} From e252a99013b6d135970edf155bc2ef68ca58a6b8 Mon Sep 17 00:00:00 2001 From: Anmol Verma Date: Thu, 9 Apr 2020 14:31:26 +0530 Subject: [PATCH 2/3] WIP added UI screens for dev-161 --- .../home_checkin/WatchForSymptomsWidget.dart | 38 ++++++---- .../home_atrisk_notificationdetail.dart | 9 ++- .../home_checkin/home_check_issick.dart | 21 +++--- .../home_checkin/home_checkin_questions.dart | 17 +++-- .../home_checkin/home_confirm_not_sick.dart | 10 ++- .../home_checkin/home_first_checkin.dart | 72 ++++++++++++++----- .../thanks_doing_part_screen.dart | 26 ++++--- lib/ui_v1_1/models/CheckinResponse.dart | 1 + .../{ => models}/OnboardingStatus.dart | 4 +- lib/ui_v1_1/onboarding_how_works.dart | 2 +- .../page_app_availability.dart | 2 +- .../page_enter_zip_one.dart | 2 +- 12 files changed, 133 insertions(+), 71 deletions(-) create mode 100644 lib/ui_v1_1/models/CheckinResponse.dart rename lib/ui_v1_1/{ => models}/OnboardingStatus.dart (88%) diff --git a/lib/ui_v1_1/home_checkin/WatchForSymptomsWidget.dart b/lib/ui_v1_1/home_checkin/WatchForSymptomsWidget.dart index feeaf1b..a515526 100644 --- a/lib/ui_v1_1/home_checkin/WatchForSymptomsWidget.dart +++ b/lib/ui_v1_1/home_checkin/WatchForSymptomsWidget.dart @@ -3,15 +3,26 @@ import 'package:flutter/material.dart'; import 'home_confirm_not_sick.dart'; -class WatchForSymptomsWidget extends StatelessWidget { +class WatchForSymptomsWidget { final bool showBottomButtons; + final Function(Widget response) onNextScreen; + final bool needsScroll; - WatchForSymptomsWidget({this.showBottomButtons}); + WatchForSymptomsWidget( + {this.showBottomButtons, this.onNextScreen, this.needsScroll}); - @override - Widget build(BuildContext context) { - return Scaffold( - body: SingleChildScrollView(child: Column( + Widget get(context) { + if (needsScroll) { + return SingleChildScrollView( + child: getInnerContent(context), + ); + } + return getInnerContent(context); + } + + Container getInnerContent(context) { + return Container( + child: Column( children: [ SizedBox(height: 32), getWatchForSymptomsColumn(), @@ -20,7 +31,7 @@ class WatchForSymptomsWidget extends StatelessWidget { getHowToProtect(), showBottomButtons ? bottomContent(context) : Container() ], - ),), + ), ); } @@ -83,7 +94,7 @@ class WatchForSymptomsWidget extends StatelessWidget { getWhenToSeekMedical() { return Container( - padding: EdgeInsets.only(left: 20,right: 20), + padding: EdgeInsets.only(left: 20, right: 20), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -191,7 +202,6 @@ class WatchForSymptomsWidget extends StatelessWidget { ); } - Widget bottomContent(BuildContext context) { return Column( children: [ @@ -211,10 +221,10 @@ class WatchForSymptomsWidget extends StatelessWidget { style: TextStyle(color: Colors.white, fontSize: 17), ), onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => HomeConfirmProcessSick(isSick: true,))); + onNextScreen.call(HomeConfirmProcessSick( + isSick: true, + onNextScreen: onNextScreen, + )); }, ), ), @@ -234,7 +244,7 @@ class WatchForSymptomsWidget extends StatelessWidget { style: TextStyle(color: Color(0xff475DF3), fontSize: 17), ), onPressed: () { - Navigator.pop(context); + onNextScreen.call(null); }, ), margin: EdgeInsets.only(bottom: 20), diff --git a/lib/ui_v1_1/home_checkin/home_atrisk_notificationdetail.dart b/lib/ui_v1_1/home_checkin/home_atrisk_notificationdetail.dart index d07642e..6546584 100644 --- a/lib/ui_v1_1/home_checkin/home_atrisk_notificationdetail.dart +++ b/lib/ui_v1_1/home_checkin/home_atrisk_notificationdetail.dart @@ -18,17 +18,16 @@ class AtRiskNotificationDetail extends StatelessWidget { topListTileWithMap(), SizedBox(height: 20), getNextSteps(), - WatchForSymptomsWidget(showBottomButtons: false), + WatchForSymptomsWidget( + showBottomButtons: false, needsScroll: false) + .get(context), SizedBox( height: 30, ), Container( child: MaterialButton( height: 50, - minWidth: MediaQuery - .of(context) - .size - .width * 0.85, + minWidth: MediaQuery.of(context).size.width * 0.85, color: Color(0xff475DF3), shape: RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(8))), diff --git a/lib/ui_v1_1/home_checkin/home_check_issick.dart b/lib/ui_v1_1/home_checkin/home_check_issick.dart index 55bf57a..5ec9d27 100644 --- a/lib/ui_v1_1/home_checkin/home_check_issick.dart +++ b/lib/ui_v1_1/home_checkin/home_check_issick.dart @@ -5,6 +5,10 @@ import 'package:corona_trace/utils/app_localization.dart'; import 'package:flutter/material.dart'; class HomeCheckIsSick extends StatefulWidget { + final Function(Widget response) onNextScreen; + + HomeCheckIsSick({this.onNextScreen}); + @override _HomeCheckIsSickState createState() => _HomeCheckIsSickState(); } @@ -74,15 +78,14 @@ class _HomeCheckIsSickState extends State { onPressed: () { if (_selectedItem != null) { if (_selectedItem == 0) { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => WatchForSymptomsWidget(showBottomButtons: true,))); + widget.onNextScreen.call(WatchForSymptomsWidget( + showBottomButtons: true, + onNextScreen: widget.onNextScreen, + needsScroll: true) + .get(context)); } else { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => HomeConfirmProcessSick(isSick: false,))); + widget.onNextScreen.call(HomeConfirmProcessSick( + isSick: false, onNextScreen: widget.onNextScreen)); } } }, @@ -104,7 +107,7 @@ class _HomeCheckIsSickState extends State { style: TextStyle(color: Color(0xff475DF3), fontSize: 17), ), onPressed: () { - Navigator.pop(context); + widget.onNextScreen.call(null); }, ), margin: EdgeInsets.only(bottom: 20), diff --git a/lib/ui_v1_1/home_checkin/home_checkin_questions.dart b/lib/ui_v1_1/home_checkin/home_checkin_questions.dart index 4988744..23f7a99 100644 --- a/lib/ui_v1_1/home_checkin/home_checkin_questions.dart +++ b/lib/ui_v1_1/home_checkin/home_checkin_questions.dart @@ -1,10 +1,14 @@ import 'package:corona_trace/ui_v1_1/common/ui/CTCommonRadioGroup.dart'; +import 'package:corona_trace/ui_v1_1/home_checkin/WatchForSymptomsWidget.dart'; import 'package:corona_trace/ui_v1_1/home_checkin/home_check_issick.dart'; -import 'package:corona_trace/ui_v1_1/home_checkin/home_checkin_dashboard.dart'; import 'package:corona_trace/utils/app_localization.dart'; import 'package:flutter/material.dart'; class HomeCheckinQuestions extends StatefulWidget { + final Function(Widget response) onNextScreen; + + HomeCheckinQuestions({this.onNextScreen}); + @override State createState() { return HomeCheckinQuestionsState(); @@ -72,11 +76,14 @@ class HomeCheckinQuestionsState extends State { onPressed: () { if (_selectedItem != null) { if (_selectedItem == 0) { - Navigator.push(context, - MaterialPageRoute(builder: (context) => HomeCheckinDashboard())); + widget.onNextScreen.call(WatchForSymptomsWidget( + showBottomButtons: true, + onNextScreen: widget.onNextScreen, + needsScroll: true) + .get(context)); } else { - Navigator.push(context, - MaterialPageRoute(builder: (context) => HomeCheckIsSick())); + widget.onNextScreen + .call(HomeCheckIsSick(onNextScreen: widget.onNextScreen)); } } }, diff --git a/lib/ui_v1_1/home_checkin/home_confirm_not_sick.dart b/lib/ui_v1_1/home_checkin/home_confirm_not_sick.dart index 41b2c90..83c3fe3 100644 --- a/lib/ui_v1_1/home_checkin/home_confirm_not_sick.dart +++ b/lib/ui_v1_1/home_checkin/home_confirm_not_sick.dart @@ -7,8 +7,9 @@ import 'package:flutter/material.dart'; class HomeConfirmProcessSick extends StatelessWidget { final bool isSick; + final Function(Widget response) onNextScreen; - HomeConfirmProcessSick({this.isSick}); + HomeConfirmProcessSick({this.isSick,this.onNextScreen}); @override Widget build(BuildContext context) { @@ -152,10 +153,7 @@ class HomeConfirmProcessSick extends StatelessWidget { style: TextStyle(color: Colors.white, fontSize: 17), ), onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (builder) => ThanksDoingPartScreen())); + onNextScreen.call(ThanksDoingPartScreen()); }, ), ), @@ -175,7 +173,7 @@ class HomeConfirmProcessSick extends StatelessWidget { style: TextStyle(color: Color(0xff475DF3), fontSize: 17), ), onPressed: () { - Navigator.pop(context); + onNextScreen.call(null); }, ), margin: EdgeInsets.only(bottom: 20), diff --git a/lib/ui_v1_1/home_checkin/home_first_checkin.dart b/lib/ui_v1_1/home_checkin/home_first_checkin.dart index f40a67d..f388ed2 100644 --- a/lib/ui_v1_1/home_checkin/home_first_checkin.dart +++ b/lib/ui_v1_1/home_checkin/home_first_checkin.dart @@ -1,22 +1,33 @@ -import 'package:corona_trace/ui_v1_1/home_checkin/home_checkin_dashboard.dart'; import 'package:corona_trace/ui_v1_1/home_checkin/home_checkin_questions.dart'; import 'package:corona_trace/utils/app_localization.dart'; import 'package:flutter/material.dart'; -class HomeFirstTimeCheckInScreen extends StatelessWidget { +class HomeFirstTimeCheckInScreen extends StatefulWidget { + @override + State createState() { + return HomeFirstTimeCheckInScreenState(); + } +} + +class HomeFirstTimeCheckInScreenState + extends State { + final PageController _pageController = PageController(); + + final List _pageList = List(); + @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( - backgroundColor: Colors.white, - body: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - topContent(), - bottomContent(context), - ], - ), - )); + backgroundColor: Colors.white, + body: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + topContent(), + bottomContent(context), + ], + ), + )); } Container bottomContent(BuildContext context) { @@ -35,11 +46,7 @@ class HomeFirstTimeCheckInScreen extends StatelessWidget { style: TextStyle(color: Colors.white, fontSize: 17), ), onPressed: () { - Navigator.pushAndRemoveUntil( - context, - MaterialPageRoute( - builder: (BuildContext context) => HomeCheckinQuestions()), - (route) => false); + bottomSheetQuestions(context); }, ), ), @@ -75,4 +82,37 @@ class HomeFirstTimeCheckInScreen extends StatelessWidget { margin: EdgeInsets.all(20), ); } + + void bottomSheetQuestions(context) { + _pageList.clear(); + _pageList.add(HomeCheckinQuestions(onNextScreen: onNextScreen)); + showModalBottomSheet( + context: context, + isScrollControlled: true, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + builder: (context) { + print("building bottom sheet again"); + return FractionallySizedBox( + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _pageController, + children: _pageList, + ), + heightFactor: 0.85, + ); + }); + } + + void onNextScreen(Widget response) { + if (response == null) { + _pageList.removeLast(); + _pageController.jumpToPage(_pageList.length - 1); + } else { + _pageList.add(response); + setState(() {}); + _pageController.jumpToPage(_pageList.length - 1); + } + } } diff --git a/lib/ui_v1_1/home_checkin/thanks_doing_part_screen.dart b/lib/ui_v1_1/home_checkin/thanks_doing_part_screen.dart index 1e8d2c5..02633e1 100644 --- a/lib/ui_v1_1/home_checkin/thanks_doing_part_screen.dart +++ b/lib/ui_v1_1/home_checkin/thanks_doing_part_screen.dart @@ -1,3 +1,5 @@ +import 'package:corona_trace/ui_v1_1/home_checkin/home_atrisk_notificationdetail.dart'; +import 'package:corona_trace/ui_v1_1/home_checkin/home_checkin_dashboard.dart'; import 'package:corona_trace/utils/app_localization.dart'; import 'package:flutter/material.dart'; @@ -6,15 +8,15 @@ class ThanksDoingPartScreen extends StatelessWidget { Widget build(BuildContext context) { return SafeArea( child: Scaffold( - backgroundColor: Colors.white, - body: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - topContent(), - bottomContent(context), - ], - ), - )); + backgroundColor: Colors.white, + body: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + topContent(), + bottomContent(context), + ], + ), + )); } Container bottomContent(BuildContext context) { @@ -33,7 +35,11 @@ class ThanksDoingPartScreen extends StatelessWidget { style: TextStyle(color: Colors.white, fontSize: 17), ), onPressed: () { - + Navigator.pushAndRemoveUntil( + context, + MaterialPageRoute( + builder: (builder) => HomeCheckinDashboard()), + (route) => false); }, ), ), diff --git a/lib/ui_v1_1/models/CheckinResponse.dart b/lib/ui_v1_1/models/CheckinResponse.dart new file mode 100644 index 0000000..ebe670f --- /dev/null +++ b/lib/ui_v1_1/models/CheckinResponse.dart @@ -0,0 +1 @@ +class CheckinResponse{} \ No newline at end of file diff --git a/lib/ui_v1_1/OnboardingStatus.dart b/lib/ui_v1_1/models/OnboardingStatus.dart similarity index 88% rename from lib/ui_v1_1/OnboardingStatus.dart rename to lib/ui_v1_1/models/OnboardingStatus.dart index d8ff10e..f782aa5 100644 --- a/lib/ui_v1_1/OnboardingStatus.dart +++ b/lib/ui_v1_1/models/OnboardingStatus.dart @@ -1,6 +1,4 @@ -class OnboaringStatus{ - -} +class OnboaringStatus{} class OnboaringStatusZip extends OnboaringStatus{ diff --git a/lib/ui_v1_1/onboarding_how_works.dart b/lib/ui_v1_1/onboarding_how_works.dart index eb6d4bb..811912c 100644 --- a/lib/ui_v1_1/onboarding_how_works.dart +++ b/lib/ui_v1_1/onboarding_how_works.dart @@ -1,4 +1,4 @@ -import 'package:corona_trace/ui_v1_1/OnboardingStatus.dart'; +import 'package:corona_trace/ui_v1_1/models/OnboardingStatus.dart'; import 'package:corona_trace/ui_v1_1/onboarding_zip_pages/page_app_availability.dart'; import 'package:corona_trace/ui_v1_1/onboarding_zip_pages/page_app_available_status.dart'; import 'package:corona_trace/ui_v1_1/onboarding_zip_pages/page_enter_zip_one.dart'; diff --git a/lib/ui_v1_1/onboarding_zip_pages/page_app_availability.dart b/lib/ui_v1_1/onboarding_zip_pages/page_app_availability.dart index 1a76ccf..c596a0b 100644 --- a/lib/ui_v1_1/onboarding_zip_pages/page_app_availability.dart +++ b/lib/ui_v1_1/onboarding_zip_pages/page_app_availability.dart @@ -1,4 +1,4 @@ -import 'package:corona_trace/ui_v1_1/OnboardingStatus.dart'; +import 'package:corona_trace/ui_v1_1/models/OnboardingStatus.dart'; import 'package:corona_trace/utils/app_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; diff --git a/lib/ui_v1_1/onboarding_zip_pages/page_enter_zip_one.dart b/lib/ui_v1_1/onboarding_zip_pages/page_enter_zip_one.dart index be8c1ae..bb28e3b 100644 --- a/lib/ui_v1_1/onboarding_zip_pages/page_enter_zip_one.dart +++ b/lib/ui_v1_1/onboarding_zip_pages/page_enter_zip_one.dart @@ -1,4 +1,4 @@ -import 'package:corona_trace/ui_v1_1/OnboardingStatus.dart'; +import 'package:corona_trace/ui_v1_1/models/OnboardingStatus.dart'; import 'package:corona_trace/utils/app_localization.dart'; import 'package:flutter/material.dart'; From c129ea0795a351829e13b514b4107d9a079da6e3 Mon Sep 17 00:00:00 2001 From: Anmol Verma Date: Thu, 9 Apr 2020 15:24:34 +0530 Subject: [PATCH 3/3] added UI screens for dev-161 --- .../home_checkin/home_check_issick.dart | 2 + .../home_checkin/home_checkin_questions.dart | 13 +++-- .../home_checkin/home_first_checkin.dart | 51 +++++++++++-------- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/lib/ui_v1_1/home_checkin/home_check_issick.dart b/lib/ui_v1_1/home_checkin/home_check_issick.dart index 5ec9d27..8e78a34 100644 --- a/lib/ui_v1_1/home_checkin/home_check_issick.dart +++ b/lib/ui_v1_1/home_checkin/home_check_issick.dart @@ -78,12 +78,14 @@ class _HomeCheckIsSickState extends State { onPressed: () { if (_selectedItem != null) { if (_selectedItem == 0) { + print("gone watch for symptoms"); widget.onNextScreen.call(WatchForSymptomsWidget( showBottomButtons: true, onNextScreen: widget.onNextScreen, needsScroll: true) .get(context)); } else { + print("HomeConfirmProcessSick 1"); widget.onNextScreen.call(HomeConfirmProcessSick( isSick: false, onNextScreen: widget.onNextScreen)); } diff --git a/lib/ui_v1_1/home_checkin/home_checkin_questions.dart b/lib/ui_v1_1/home_checkin/home_checkin_questions.dart index 23f7a99..32cbed2 100644 --- a/lib/ui_v1_1/home_checkin/home_checkin_questions.dart +++ b/lib/ui_v1_1/home_checkin/home_checkin_questions.dart @@ -1,6 +1,7 @@ import 'package:corona_trace/ui_v1_1/common/ui/CTCommonRadioGroup.dart'; import 'package:corona_trace/ui_v1_1/home_checkin/WatchForSymptomsWidget.dart'; import 'package:corona_trace/ui_v1_1/home_checkin/home_check_issick.dart'; +import 'package:corona_trace/ui_v1_1/home_checkin/home_confirm_not_sick.dart'; import 'package:corona_trace/utils/app_localization.dart'; import 'package:flutter/material.dart'; @@ -75,16 +76,14 @@ class HomeCheckinQuestionsState extends State { ), onPressed: () { if (_selectedItem != null) { + print(_selectedItem); if (_selectedItem == 0) { - widget.onNextScreen.call(WatchForSymptomsWidget( - showBottomButtons: true, - onNextScreen: widget.onNextScreen, - needsScroll: true) - .get(context)); + //TODO (API ? or LOCAL) } else { - widget.onNextScreen - .call(HomeCheckIsSick(onNextScreen: widget.onNextScreen)); + //TODO (API ? or LOCAL) } + widget.onNextScreen + .call(HomeCheckIsSick(onNextScreen: widget.onNextScreen)); } }, ), diff --git a/lib/ui_v1_1/home_checkin/home_first_checkin.dart b/lib/ui_v1_1/home_checkin/home_first_checkin.dart index f388ed2..51fe3f2 100644 --- a/lib/ui_v1_1/home_checkin/home_first_checkin.dart +++ b/lib/ui_v1_1/home_checkin/home_first_checkin.dart @@ -1,5 +1,6 @@ import 'package:corona_trace/ui_v1_1/home_checkin/home_checkin_questions.dart'; import 'package:corona_trace/utils/app_localization.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class HomeFirstTimeCheckInScreen extends StatefulWidget { @@ -11,8 +12,6 @@ class HomeFirstTimeCheckInScreen extends StatefulWidget { class HomeFirstTimeCheckInScreenState extends State { - final PageController _pageController = PageController(); - final List _pageList = List(); @override @@ -84,35 +83,47 @@ class HomeFirstTimeCheckInScreenState } void bottomSheetQuestions(context) { + print("cleared pages"); _pageList.clear(); - _pageList.add(HomeCheckinQuestions(onNextScreen: onNextScreen)); showModalBottomSheet( context: context, isScrollControlled: true, + useRootNavigator: true, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ), builder: (context) { print("building bottom sheet again"); - return FractionallySizedBox( - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: _pageController, - children: _pageList, + return BottomSheet( + onClosing: () {}, + builder: (context) { + return StatefulBuilder(builder: (builder, setState) { + void onNextScreen(Widget response) { + if (response == null) { + _pageList.removeLast(); + setState(() {}); + } else { + _pageList.add(response); + setState(() {}); + } + print(_pageList.length); + } + + if (_pageList.isEmpty) { + _pageList + .add(HomeCheckinQuestions(onNextScreen: onNextScreen)); + } + + return FractionallySizedBox( + child: _pageList.last, + heightFactor: 0.85, + ); + }); + }, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), ), - heightFactor: 0.85, ); }); } - - void onNextScreen(Widget response) { - if (response == null) { - _pageList.removeLast(); - _pageController.jumpToPage(_pageList.length - 1); - } else { - _pageList.add(response); - setState(() {}); - _pageController.jumpToPage(_pageList.length - 1); - } - } }