From aa9d67bf70f5a2c1dd5d4a4dd0c55ed2734b3e2d Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:03:36 +0530 Subject: [PATCH 01/18] Update pubspec.yaml --- pubspec.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 2909a374..50042e2c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,6 +10,8 @@ dependencies: get: 4.6.6 flutter: sdk: flutter + otp: ^3.0.0 + qr_flutter: ^4.0.0 firebase_core: ^2.31.0 firebase_ui_auth: ^1.14.0 firebase_auth: ^4.19.5 @@ -24,7 +26,7 @@ dependencies: firebase_ui_localizations: ^1.12.0 firebase_remote_config: ^4.4.7 firebase_analytics: ^10.10.7 - + dev_dependencies: flutter_lints: 3.0.2 flutter_test: From 76e2663bb4d7c7b5e15c18dd0ad35fdbff3a94fe Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:04:40 +0530 Subject: [PATCH 02/18] Update auth_service.dart --- lib/services/auth_service.dart | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/lib/services/auth_service.dart b/lib/services/auth_service.dart index 8bf72aaa..ef35ee1e 100644 --- a/lib/services/auth_service.dart +++ b/lib/services/auth_service.dart @@ -199,3 +199,49 @@ parseEmail(String message) { int j = message.indexOf('"', i); return message.substring(i, j - 1); } + +Future setupTOTP() async { + String secret = OTP.randomSecret(); + await storeTOTPSecret(secret); + + String qrCodeData = OTPAuthURL.google( + 'MyApp', + user!.email!, + secret, + issuer: 'MyApp', + ); + + Get.dialog( + AlertDialog( + title: Text('Scan this QR Code'), + content: QrImage(data: qrCodeData, size: 200), + actions: [ + TextButton( + onPressed: () => Get.back(), + child: Text('Done'), + ), + ], + ), + ); + } + + Future verifyTOTP(String code) async { + String secret = await getStoredTOTPSecret(); + bool isValid = OTP.verifyTotp(secret: secret, otp: code, interval: 30); + + if (isValid) { + Get.snackbar('Success', '2FA verification successful.'); + } else { + Get.snackbar('Error', 'Invalid TOTP code.'); + } + } + + Future storeTOTPSecret(String secret) async { + // Implement secure storage, e.g., in Firestore or Firebase Auth custom claims + } + + Future getStoredTOTPSecret() async { + // Retrieve the stored TOTP secret securely + return 'retrieved_secret'; + } +} From f55020818ee489fa74101527e8ac7847eef84740 Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:05:16 +0530 Subject: [PATCH 03/18] Update auth_service.dart --- lib/services/auth_service.dart | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/services/auth_service.dart b/lib/services/auth_service.dart index ef35ee1e..b4125831 100644 --- a/lib/services/auth_service.dart +++ b/lib/services/auth_service.dart @@ -245,3 +245,28 @@ Future setupTOTP() async { return 'retrieved_secret'; } } + +String? validatePassword(String password) { + final RegExp regex = RegExp(r'^(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$'); + if (password.isEmpty) { + return 'Please enter a password'; + } else if (!regex.hasMatch(password)) { + return 'Password must be at least 8 characters long, include an uppercase letter, a number, and a special character'; + } + return null; +} + +Future register(String email, String password) async { + String? passwordError = validatePassword(password); + if (passwordError != null) { + Get.snackbar('Error', passwordError); + return; + } + + try { + await _auth.createUserWithEmailAndPassword(email: email, password: password); + Get.snackbar('Success', 'Registration successful.'); + } catch (e) { + Get.snackbar('Error', e.toString()); + } +} From 53df7d9626182b9b23aae10ed26e41c45c31a460 Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:10:58 +0530 Subject: [PATCH 04/18] Create screen --- lib/screen | 1 + 1 file changed, 1 insertion(+) create mode 100644 lib/screen diff --git a/lib/screen b/lib/screen new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/lib/screen @@ -0,0 +1 @@ + From 32cb5ece41af5ee92813fa019475056029df4147 Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:11:24 +0530 Subject: [PATCH 05/18] Delete lib/screen --- lib/screen | 1 - 1 file changed, 1 deletion(-) delete mode 100644 lib/screen diff --git a/lib/screen b/lib/screen deleted file mode 100644 index 8b137891..00000000 --- a/lib/screen +++ /dev/null @@ -1 +0,0 @@ - From 99e814548f25043aa77987a19c11d222dad4cee8 Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:13:10 +0530 Subject: [PATCH 06/18] Create home_screen.dart --- lib/screen/home_screen.dart | 80 +++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 lib/screen/home_screen.dart diff --git a/lib/screen/home_screen.dart b/lib/screen/home_screen.dart new file mode 100644 index 00000000..485903d5 --- /dev/null +++ b/lib/screen/home_screen.dart @@ -0,0 +1,80 @@ +import 'package:flutter/material.dart'; +import '../widgets/health_summary_widget.dart'; +import '../widgets/notifications_widget.dart'; +import '../widgets/activity_list_widget.dart'; +import '../constants.dart'; // Ensure this contains the necessary constants and configurations. + +class HomeScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Health Dashboard'), + actions: [ + IconButton( + icon: Icon(Icons.account_circle), + onPressed: () { + Navigator.pushNamed(context, '/profile'); + }, + ), + ], + ), + drawer: Drawer( + child: ListView( + children: [ + DrawerHeader(child: Text('Menu')), + ListTile( + title: Text('Profile'), + onTap: () { + Navigator.pushNamed(context, '/profile'); + }, + ), + ListTile( + title: Text('Settings'), + onTap: () { + Navigator.pushNamed(context, '/settings'); + }, + ), + ], + ), + ), + body: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + HealthSummaryWidget(), + NotificationsWidget(), + Expanded( + child: ActivityListWidget(), + ), + ], + ), + ), + bottomNavigationBar: BottomNavigationBar( + items: [ + BottomNavigationBarItem( + icon: Icon(Icons.home), + label: 'Home', + ), + BottomNavigationBarItem( + icon: Icon(Icons.fitness_center), + label: 'Activities', + ), + BottomNavigationBarItem( + icon: Icon(Icons.settings), + label: 'Settings', + ), + ], + currentIndex: 0, + onTap: (index) { + // Handle navigation + if (index == 1) { + Navigator.pushNamed(context, '/activities'); + } else if (index == 2) { + Navigator.pushNamed(context, '/settings'); + } + }, + ), + ); + } +} From a0979a930163bfb7c19327bc82aa0937cd949c46 Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:14:52 +0530 Subject: [PATCH 07/18] Create profile_screen.dart --- lib/screen/profile_screen.dart | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 lib/screen/profile_screen.dart diff --git a/lib/screen/profile_screen.dart b/lib/screen/profile_screen.dart new file mode 100644 index 00000000..ca3df52e --- /dev/null +++ b/lib/screen/profile_screen.dart @@ -0,0 +1,33 @@ +// lib/screens/profile_screen.dart +import 'package:flutter/material.dart'; +import '../widgets/profile_picture_widget.dart'; +import '../widgets/user_info_form.dart'; +import '../widgets/health_data_widget.dart'; + +class ProfileScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Profile'), + ), + body: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + ProfilePictureWidget(), + UserInfoForm(), + HealthDataWidget(), + SizedBox(height: 20), + ElevatedButton( + onPressed: () { + // Save changes + }, + child: Text('Save Changes'), + ), + ], + ), + ), + ); + } +} From c52006c9471064219e5a81b45c7a3f2cc5fe614b Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:15:24 +0530 Subject: [PATCH 08/18] Create activity_screen.dart --- lib/screen/activity_screen.dart | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lib/screen/activity_screen.dart diff --git a/lib/screen/activity_screen.dart b/lib/screen/activity_screen.dart new file mode 100644 index 00000000..de0b2969 --- /dev/null +++ b/lib/screen/activity_screen.dart @@ -0,0 +1,21 @@ +// lib/screens/activity_screen.dart +import 'package:flutter/material.dart'; +import '../widgets/activity_list_widget.dart'; + +class ActivityScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Activities'), + ), + body: ActivityListWidget(), + floatingActionButton: FloatingActionButton( + onPressed: () { + Navigator.pushNamed(context, '/add_activity'); + }, + child: Icon(Icons.add), + ), + ); + } +} From b222c42f24541a16a4c1936c97e329bbb646e75d Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:15:50 +0530 Subject: [PATCH 09/18] Create settings_screen.dart --- lib/screen/settings_screen.dart | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 lib/screen/settings_screen.dart diff --git a/lib/screen/settings_screen.dart b/lib/screen/settings_screen.dart new file mode 100644 index 00000000..c8c887ad --- /dev/null +++ b/lib/screen/settings_screen.dart @@ -0,0 +1,36 @@ +// lib/screens/settings_screen.dart +import 'package:flutter/material.dart'; + +class SettingsScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Settings'), + ), + body: ListView( + children: [ + SwitchListTile( + title: Text('Notifications'), + value: true, // Replace with actual value + onChanged: (bool value) { + // Handle change + }, + ), + ListTile( + title: Text('Privacy Settings'), + onTap: () { + Navigator.pushNamed(context, '/privacy_settings'); + }, + ), + ListTile( + title: Text('Account Settings'), + onTap: () { + Navigator.pushNamed(context, '/account_settings'); + }, + ), + ], + ), + ); + } +} From db296966fe73c07d68828fe2ec25a132bba576f6 Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:16:48 +0530 Subject: [PATCH 10/18] Create health_tips_screen.dart --- lib/screen/health_tips_screen.dart | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/screen/health_tips_screen.dart diff --git a/lib/screen/health_tips_screen.dart b/lib/screen/health_tips_screen.dart new file mode 100644 index 00000000..b0873c70 --- /dev/null +++ b/lib/screen/health_tips_screen.dart @@ -0,0 +1,14 @@ +import 'package:flutter/material.dart'; +import '../widgets/article_list_widget.dart'; + +class HealthTipsScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Health Tips'), + ), + body: ArticleListWidget(), + ); + } +} From af5ada5c10208fa4f7fa0d4ade15650f21209cdf Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:17:30 +0530 Subject: [PATCH 11/18] Create chat_screen.dart --- lib/screen/chat_screen.dart | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/screen/chat_screen.dart diff --git a/lib/screen/chat_screen.dart b/lib/screen/chat_screen.dart new file mode 100644 index 00000000..cd3946c6 --- /dev/null +++ b/lib/screen/chat_screen.dart @@ -0,0 +1,14 @@ +import 'package:flutter/material.dart'; +import '../widgets/chat_interface_widget.dart'; + +class ChatScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Chat with Doctor'), + ), + body: ChatInterfaceWidget(), + ); + } +} From cab924807b193e1ee0ac0c78b0cd85d798f7c0ba Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:18:10 +0530 Subject: [PATCH 12/18] Create booking_screen.dart --- lib/screen/booking_screen.dart | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/screen/booking_screen.dart diff --git a/lib/screen/booking_screen.dart b/lib/screen/booking_screen.dart new file mode 100644 index 00000000..86815f0c --- /dev/null +++ b/lib/screen/booking_screen.dart @@ -0,0 +1,14 @@ +import 'package:flutter/material.dart'; +import '../widgets/booking_form_widget.dart'; + +class BookingScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Book an Appointment'), + ), + body: BookingFormWidget(), + ); + } +} From 10c29b47b5cafc00210744f3deaf9c25476a33f2 Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:23:13 +0530 Subject: [PATCH 13/18] Update app_routes.dart --- lib/app/routes/app_routes.dart | 56 +++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/lib/app/routes/app_routes.dart b/lib/app/routes/app_routes.dart index f3129d21..4a8f61b4 100644 --- a/lib/app/routes/app_routes.dart +++ b/lib/app/routes/app_routes.dart @@ -5,18 +5,22 @@ part of 'app_pages.dart'; abstract class Routes { static const HOME = _Paths.HOME; - // static String PROFILE = Screen.PROFILE.fullPath; - // static String SETTINGS = Screen.SETTINGS.fullPath; - static String LOGIN = Screen.LOGIN.route; - static String REGISTER = Screen.REGISTER.route; + static const PROFILE = _Paths.PROFILE; + static const ACTIVITY = _Paths.ACTIVITY; + static const SETTINGS = _Paths.SETTINGS; + static const HEALTH_TIPS = _Paths.HEALTH_TIPS; + static const CHAT = _Paths.CHAT; + static const BOOKING = _Paths.BOOKING; + + // Uncomment and modify these as needed for your app // static String DASHBOARD = Screen.DASHBOARD.fullPath; // static String PRODUCTS = Screen.PRODUCTS.fullPath; // static String CART = Screen.CART.fullPath; // static String CHECKOUT = Screen.CHECKOUT.fullPath; - // static const CATEGORIES = _Paths.HOME + _Paths.CATEGORIES; - // static const TASKS = _Paths.HOME + _Paths.TASKS; - // static const USERS = _Paths.HOME + _Paths.USERS; - // static const MY_PRODUCTS = _Paths.HOME + _Paths.MY_PRODUCTS; + // static String CATEGORIES = _Paths.HOME + _Paths.CATEGORIES; + // static String TASKS = _Paths.HOME + _Paths.TASKS; + // static String USERS = _Paths.HOME + _Paths.USERS; + // static String MY_PRODUCTS = _Paths.HOME + _Paths.MY_PRODUCTS; static String PRODUCT_DETAILS(String productId) => '${Screen.PRODUCTS.route}/$productId'; @@ -32,23 +36,25 @@ abstract class Routes { '${Screen.REGISTER.route}?then=${Uri.encodeQueryComponent(afterSuccessfulLogin)}'; } -// Keeping this as Get_Cli will require it. Any addition can later be added to Screen abstract class _Paths { static const String HOME = '/home'; - // static const DASHBOARD = '/dashboard'; - // static const PRODUCTS = '/products'; - // static const PROFILE = '/profile'; - // static const SETTINGS = '/settings'; - // static const PRODUCT_DETAILS = '/:productId'; - // static const CART_DETAILS = '/:productId'; - // static const LOGIN = '/login'; - // static const CART = '/cart'; - // static const CHECKOUT = '/checkout'; - // static const REGISTER = '/register'; - // static const CATEGORIES = '/categories'; - // static const TASKS = '/tasks'; - // static const TASK_DETAILS = '/:taskId'; - // static const USERS = '/users'; - // static const USER_PROFILE = '/:uId'; - // static const MY_PRODUCTS = '/my-products'; + static const String PROFILE = '/profile'; + static const String ACTIVITY = '/activity'; + static const String SETTINGS = '/settings'; + static const String HEALTH_TIPS = '/health_tips'; + static const String CHAT = '/chat'; + static const String BOOKING = '/booking'; + + // Uncomment and modify these as needed for your app + // static const String DASHBOARD = '/dashboard'; + // static const String PRODUCTS = '/products'; + // static const String CART = '/cart'; + // static const String CHECKOUT = '/checkout'; + // static const String REGISTER = '/register'; + // static const String CATEGORIES = '/categories'; + // static const String TASKS = '/tasks'; + // static const String TASK_DETAILS = '/:taskId'; + // static const String USERS = '/users'; + // static const String USER_PROFILE = '/:uId'; + // static const String MY_PRODUCTS = '/my-products'; } From 66e9b179bee9bc231de85960fe26be6a2dfb49a6 Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:25:58 +0530 Subject: [PATCH 14/18] Update main.dart --- lib/main.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/main.dart b/lib/main.dart index 30c258f2..e61c47eb 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,6 +9,13 @@ import 'app/routes/app_pages.dart'; import 'firebase_options.dart'; import 'services/auth_service.dart'; +import 'screens/home_screen.dart'; +import 'screens/profile_screen.dart'; +import 'screens/activity_screen.dart'; +import 'screens/settings_screen.dart'; +import 'screens/health_tips_screen.dart'; +import 'screens/chat_screen.dart'; +import 'screens/booking_screen.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); await GetStorage.init(); From 4069afb77d8d70f86e422f51e1d31ce7ed79441c Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:27:34 +0530 Subject: [PATCH 15/18] Update home_screen.dart --- lib/screen/home_screen.dart | 95 +++++++++++++++++++++++++++++-------- 1 file changed, 75 insertions(+), 20 deletions(-) diff --git a/lib/screen/home_screen.dart b/lib/screen/home_screen.dart index 485903d5..bab2f7ca 100644 --- a/lib/screen/home_screen.dart +++ b/lib/screen/home_screen.dart @@ -9,10 +9,14 @@ class HomeScreen extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('Health Dashboard'), + title: Text( + 'Health Dashboard', + style: TextStyle(fontWeight: FontWeight.bold), + ), + backgroundColor: Colors.blueAccent, actions: [ IconButton( - icon: Icon(Icons.account_circle), + icon: Icon(Icons.account_circle, size: 30), onPressed: () { Navigator.pushNamed(context, '/profile'); }, @@ -20,30 +24,80 @@ class HomeScreen extends StatelessWidget { ], ), drawer: Drawer( - child: ListView( - children: [ - DrawerHeader(child: Text('Menu')), - ListTile( - title: Text('Profile'), - onTap: () { - Navigator.pushNamed(context, '/profile'); - }, - ), - ListTile( - title: Text('Settings'), - onTap: () { - Navigator.pushNamed(context, '/settings'); - }, - ), - ], + child: Container( + color: Colors.blueGrey[100], + child: ListView( + padding: EdgeInsets.zero, + children: [ + DrawerHeader( + decoration: BoxDecoration( + color: Colors.blueAccent, + ), + child: Text( + 'Menu', + style: TextStyle( + color: Colors.white, + fontSize: 24, + fontWeight: FontWeight.bold, + ), + ), + ), + ListTile( + leading: Icon(Icons.person), + title: Text('Profile'), + onTap: () { + Navigator.pushNamed(context, '/profile'); + }, + ), + ListTile( + leading: Icon(Icons.settings), + title: Text('Settings'), + onTap: () { + Navigator.pushNamed(context, '/settings'); + }, + ), + Divider(), + ListTile( + leading: Icon(Icons.logout), + title: Text('Logout'), + onTap: () { + // Handle logout + }, + ), + ], + ), ), ), body: Padding( - padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.all(16.0), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + 'Health Summary', + style: Theme.of(context).textTheme.headline6?.copyWith( + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 10), HealthSummaryWidget(), + SizedBox(height: 20), + Text( + 'Notifications', + style: Theme.of(context).textTheme.headline6?.copyWith( + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 10), NotificationsWidget(), + SizedBox(height: 20), + Text( + 'Recent Activities', + style: Theme.of(context).textTheme.headline6?.copyWith( + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 10), Expanded( child: ActivityListWidget(), ), @@ -66,8 +120,9 @@ class HomeScreen extends StatelessWidget { ), ], currentIndex: 0, + selectedItemColor: Colors.blueAccent, + unselectedItemColor: Colors.grey, onTap: (index) { - // Handle navigation if (index == 1) { Navigator.pushNamed(context, '/activities'); } else if (index == 2) { From 7a5c628ffe8e41f7e5620de4c2a009a058b4e018 Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:35:12 +0530 Subject: [PATCH 16/18] Create health_card_widget.dart --- lib/app/widgets/health_card_widget.dart | 48 +++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 lib/app/widgets/health_card_widget.dart diff --git a/lib/app/widgets/health_card_widget.dart b/lib/app/widgets/health_card_widget.dart new file mode 100644 index 00000000..27a1cfc0 --- /dev/null +++ b/lib/app/widgets/health_card_widget.dart @@ -0,0 +1,48 @@ +import 'package:flutter/material.dart'; + +class HealthCardWidget extends StatelessWidget { + final String title; + final String value; + final Color color; + + HealthCardWidget({ + required this.title, + required this.value, + this.color = Colors.blueAccent, + }); + + @override + Widget build(BuildContext context) { + return Card( + color: color.withOpacity(0.1), + elevation: 4, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 8), + Text( + value, + style: TextStyle( + fontSize: 24, + fontWeight: FontWeight.bold, + color: color, + ), + ), + ], + ), + ), + ); + } +} From b2a823002ead3e3a2423a55b63167abb30730db0 Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:35:46 +0530 Subject: [PATCH 17/18] Create health_metric_widget.dart --- lib/app/widgets/health_metric_widget.dart | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 lib/app/widgets/health_metric_widget.dart diff --git a/lib/app/widgets/health_metric_widget.dart b/lib/app/widgets/health_metric_widget.dart new file mode 100644 index 00000000..61604622 --- /dev/null +++ b/lib/app/widgets/health_metric_widget.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'health_card_widget.dart'; + +class HealthMetricWidget extends StatelessWidget { + final List> metrics; + + HealthMetricWidget({required this.metrics}); + + @override + Widget build(BuildContext context) { + return Column( + children: metrics.map((metric) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: HealthCardWidget( + title: metric['title']!, + value: metric['value']!, + color: Colors.teal, + ), + ); + }).toList(), + ); + } +} From 02bd8fec3f8ab00f6551ef97ff690b92357bf641 Mon Sep 17 00:00:00 2001 From: Chinmay Maitre Date: Sun, 1 Sep 2024 01:36:56 +0530 Subject: [PATCH 18/18] Update home_screen.dart --- lib/screen/home_screen.dart | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/screen/home_screen.dart b/lib/screen/home_screen.dart index bab2f7ca..ec52d179 100644 --- a/lib/screen/home_screen.dart +++ b/lib/screen/home_screen.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import '../widgets/health_summary_widget.dart'; import '../widgets/notifications_widget.dart'; import '../widgets/activity_list_widget.dart'; +import '../widgets/health_card_widget.dart'; +import '../widgets/health_metric_widget.dart'; import '../constants.dart'; // Ensure this contains the necessary constants and configurations. class HomeScreen extends StatelessWidget { @@ -82,6 +84,22 @@ class HomeScreen extends StatelessWidget { SizedBox(height: 10), HealthSummaryWidget(), SizedBox(height: 20), + Text( + 'Health Metrics', + style: Theme.of(context).textTheme.headline6?.copyWith( + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 10), + HealthMetricWidget( + metrics: [ + {'title': 'Steps Today', 'value': '8,765'}, + {'title': 'Calories Burned', 'value': '620 kcal'}, + {'title': 'Heart Rate', 'value': '72 bpm'}, + {'title': 'Sleep Duration', 'value': '7 hrs 30 mins'}, + ], + ), + SizedBox(height: 20), Text( 'Notifications', style: Theme.of(context).textTheme.headline6?.copyWith(