Skip to content

Commit

Permalink
Symptom checker intro (#1286)
Browse files Browse the repository at this point in the history
* Symptom checker intro

* Code review feedback
  • Loading branch information
advayDev1 authored May 13, 2020
1 parent f9ab478 commit 875fde5
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 34 deletions.
2 changes: 0 additions & 2 deletions client/flutter/lib/components/page_scaffold/page_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ class PageHeader extends StatelessWidget {
);
}

static const textColor = Color(0xff1A458E);

static Widget buildTitle(String title,
{TextStyle textStyle,
TypographyVariant variant = TypographyVariant.header}) {
Expand Down
4 changes: 2 additions & 2 deletions client/flutter/lib/pages/main_pages/app_tab_router.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import 'package:flutter/cupertino.dart';
import 'package:who_app/api/content/schema/index_content.dart';
import 'package:who_app/constants.dart';
import 'package:who_app/pages/main_pages/check_up_intro_page.dart';
import 'package:who_app/pages/main_pages/recent_numbers.dart';
import 'package:who_app/pages/main_pages/home_page.dart';
import 'package:who_app/pages/main_pages/learn_page.dart';
import 'package:who_app/pages/settings_page.dart';
import 'package:who_app/pages/symptom_checker/symptom_checker_page.dart';
import 'package:flutter/material.dart';

class AppTabRouter extends StatelessWidget {
static final List<Widget Function(BuildContext)> defaultTabs = [
(context) => HomePage(
dataSource: IndexContent.homeIndex,
),
(context) => SymptomCheckerPage(),
(context) => CheckUpIntroPage(),
(context) => LearnPage(
dataSource: IndexContent.learnIndex,
),
Expand Down
150 changes: 150 additions & 0 deletions client/flutter/lib/pages/main_pages/check_up_intro_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:who_app/components/page_button.dart';
import 'package:who_app/components/page_scaffold/page_header.dart';
import 'package:who_app/components/page_scaffold/page_scaffold.dart';
import 'package:who_app/components/themed_text.dart';
import 'package:who_app/constants.dart';

class CheckUpIntroPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return PageScaffold(
disableBackButton: true,
headingBorderColor: Color(0x0),
color: CupertinoColors.white,
// TODO: localize
title: "Check-Up",
header: SliverSafeArea(
top: true,
bottom: false,
sliver: SliverToBoxAdapter(
child: Padding(
padding: EdgeInsets.fromLTRB(16, 36, 16, 20),
// TODO: localize
child: PageHeader.buildTitle("Check-Up",
textStyle: ThemedText.styleForVariant(
TypographyVariant.title)
.merge(
TextStyle(color: Constants.primaryDarkColor)))))),
body: <Widget>[_buildBody(context)],
);
}

Widget _buildBody(BuildContext context) => SliverList(
delegate: SliverChildListDelegate([
...optionWidgets(),
submitWidget(context),
]));

List<Widget> optionWidgets() {
// TODO: localize everything
return <Widget>[
Padding(
padding: const EdgeInsets.only(
left: 24,
right: 60,
bottom: 20,
top: 0,
),
child: ThemedText(
"You should know...",
variant: TypographyVariant.body,
style: TextStyle(fontWeight: FontWeight.bold),
)),
_ListItem(
title:
"Your answers will not be shared with WHO or others without your permission.",
icon: FontAwesomeIcons.lock),
_ListItem(
title:
"By using this tool, you agree to its terms and that WHO will not be liable for any harm relating to your use.",
icon: FontAwesomeIcons.solidCheckCircle,
),
_ListItem(
title:
"Information provided by this tool does not constitute medical advise and should not be used to diagnose or treat medical conditions.",
icon: FontAwesomeIcons.fileMedical,
extra: CupertinoButton(
padding: EdgeInsets.zero,
child: ThemedText(
"See terms ›",
variant: TypographyVariant.body,
style: TextStyle(
color: Constants.whoBackgroundBlueColor,
),
),
onPressed: () {
return launch("https://whoapp.org/terms");
},
),
),
];
}

Widget submitWidget(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(
top: 52,
left: 24,
right: 24,
bottom: 48,
),
child: PageButton(
Constants.whoBackgroundBlueColor,
"Get Started",
() => Navigator.of(context, rootNavigator: true)
.pushNamed('/symptom-checker-survey'),
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
verticalPadding: 12,
borderRadius: 500,
titleStyle: ThemedText.styleForVariant(TypographyVariant.button)
.merge(TextStyle(color: CupertinoColors.white)),
),
);
}
}

class _ListItem extends StatelessWidget {
final String title;
final String subtitle;
final IconData icon;
final Widget extra;

_ListItem(
{@required this.title, @required this.icon, this.subtitle, this.extra});

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(
left: 32,
right: 60,
bottom: 20,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Icon(
icon,
color: Constants.whoBackgroundBlueColor,
size: 24,
),
SizedBox(
width: 12,
),
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
ThemedText(this.title, variant: TypographyVariant.body),
if (extra != null) extra,
]))
],
),
);
}
}
4 changes: 3 additions & 1 deletion client/flutter/lib/pages/main_pages/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:who_app/generated/l10n.dart';
import 'package:who_app/pages/about_page.dart';
import 'package:who_app/pages/facts_carousel_page.dart';
import 'package:who_app/pages/main_pages/app_tab_router.dart';
import 'package:who_app/pages/main_pages/check_up_intro_page.dart';
import 'package:who_app/pages/main_pages/recent_numbers.dart';
import 'package:who_app/pages/news_feed.dart';
import 'package:who_app/pages/onboarding/onboarding_page.dart';
Expand All @@ -32,7 +33,8 @@ class Routes {
dataSource: QuestionContent.yourQuestionsAnswered,
title: S.of(context).homePagePageButtonQuestions,
),
'/symptom-checker': (context) => SymptomCheckerView(),
'/symptom-checker': (context) => CheckUpIntroPage(),
'/symptom-checker-survey': (context) => SymptomCheckerView(),
'/symptom-checker-results': (context) => SymptomCheckerResultsPage(
model:
ModalRoute.of(context).settings.arguments as SymptomCheckerModel),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ class NextButton extends StatelessWidget {
// TODO: Localize
"Next",
enableNext ? onNext : null,
borderRadius: 50,
crossAxisAlignment: CrossAxisAlignment.center,
titleStyle: ThemedText.styleForVariant(TypographyVariant.h4)
mainAxisAlignment: MainAxisAlignment.center,
verticalPadding: 12,
borderRadius: 500,
titleStyle: ThemedText.styleForVariant(TypographyVariant.button)
.merge(TextStyle(color: CupertinoColors.white)),
);
}
Expand Down
27 changes: 0 additions & 27 deletions client/flutter/lib/pages/symptom_checker/symptom_checker_page.dart

This file was deleted.

0 comments on commit 875fde5

Please sign in to comment.