|
| 1 | +import 'package:flutter/material.dart'; |
| 2 | +import 'package:flutter_icons/flutter_icons.dart'; |
| 3 | +import 'package:get/get.dart'; |
| 4 | +import 'package:symptom_tracker/screens/screens.dart'; |
| 5 | +import 'package:symptom_tracker/shared/shared.dart'; |
| 6 | + |
| 7 | +class DashboardScreen extends StatelessWidget { |
| 8 | + @override |
| 9 | + Widget build(BuildContext context) { |
| 10 | + return Scaffold( |
| 11 | + appBar: SharedAppBar( |
| 12 | + title: 'Dashboard', |
| 13 | + actions: [ |
| 14 | + IconButton(icon: Icon(Icons.close), onPressed: () => Get.offAll(HomeScreen())), |
| 15 | + ], |
| 16 | + ), |
| 17 | + body: SafeArea( |
| 18 | + child: _buildBody(), |
| 19 | + ), |
| 20 | + ); |
| 21 | + } |
| 22 | + |
| 23 | + Widget _buildBody() { |
| 24 | + return ListView( |
| 25 | + children: [ |
| 26 | + Padding( |
| 27 | + padding: const EdgeInsets.symmetric(vertical: 28), |
| 28 | + child: Text( |
| 29 | + 'Good morning, AMIA', |
| 30 | + style: Get.theme.textTheme.headline3, |
| 31 | + textAlign: TextAlign.center, |
| 32 | + ), |
| 33 | + ), |
| 34 | + _listTile( |
| 35 | + icon: Icons.check_circle_outline, |
| 36 | + title: 'Check-in', |
| 37 | + subtitle: 'Enter your temperature, symptoms, and relevant tests', |
| 38 | + isGrey: true, |
| 39 | + onPressed: () => Get.to(CheckinScreen()), |
| 40 | + ), |
| 41 | + _listTile( |
| 42 | + icon: FlutterIcons.calendar_oct, |
| 43 | + title: 'History', |
| 44 | + subtitle: 'See/edit your past entries', |
| 45 | + ), |
| 46 | + _listTile( |
| 47 | + icon: FlutterIcons.map_clock_outline_mco, |
| 48 | + title: 'Contact tracing', |
| 49 | + subtitle: 'Toggle method:\nlocation / bluetooth / both / off', |
| 50 | + ), |
| 51 | + _listTile( |
| 52 | + icon: FlutterIcons.information_variant_mco, |
| 53 | + title: 'Info', |
| 54 | + subtitle: 'Learn more about COVID-19', |
| 55 | + ), |
| 56 | + ], |
| 57 | + ); |
| 58 | + } |
| 59 | + |
| 60 | + Widget _listTile( |
| 61 | + {@required IconData icon, |
| 62 | + @required String title, |
| 63 | + @required String subtitle, |
| 64 | + bool isGrey, |
| 65 | + void Function() onPressed}) { |
| 66 | + var _txtTheme = Get.theme.textTheme; |
| 67 | + return Container( |
| 68 | + margin: const EdgeInsets.symmetric(horizontal: 24, vertical: 8), |
| 69 | + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 16), |
| 70 | + decoration: BoxDecoration( |
| 71 | + border: Border.all(color: Get.theme.unselectedWidgetColor), borderRadius: BorderRadius.circular(16)), |
| 72 | + child: ListTile( |
| 73 | + leading: Icon( |
| 74 | + icon, |
| 75 | + size: 24, |
| 76 | + color: (isGrey ?? false) ? Get.theme.disabledColor : Get.theme.primaryColor, |
| 77 | + ), |
| 78 | + title: Text(title, style: _txtTheme.subtitle1), |
| 79 | + subtitle: Text(subtitle, style: _txtTheme.subtitle2), |
| 80 | + onTap: onPressed, |
| 81 | + ), |
| 82 | + ); |
| 83 | + } |
| 84 | +} |
0 commit comments