From 4e80262139ac71b983c2ba04486f7ea1005f7243 Mon Sep 17 00:00:00 2001 From: Bagus Subagja Date: Thu, 8 Dec 2022 22:52:00 +0700 Subject: [PATCH 1/3] Remove Http Protocol Override --- lib/main.dart | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index f2aa632..e13f48e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -7,17 +7,8 @@ import 'package:healthy_buddy_mobile_app/routes/routes.dart'; import 'package:provider/provider.dart'; import 'package:sizer/sizer.dart'; -class MyHttpOverrides extends HttpOverrides { - @override - HttpClient createHttpClient(SecurityContext? context) { - return super.createHttpClient(context) - ..badCertificateCallback = - (X509Certificate cert, String host, int port) => true; - } -} void main() { - HttpOverrides.global = MyHttpOverrides(); runApp(const HealthyBuddy()); } From aa47f17d2bf40631976d64407fa3f2b4a9340f95 Mon Sep 17 00:00:00 2001 From: Bagus Subagja Date: Sat, 10 Dec 2022 11:37:06 +0700 Subject: [PATCH 2/3] Add WillPopScope widget to prevent back action in biodata screen --- .../authentication/biodata_screen.dart | 80 ++++++++++++------- 1 file changed, 50 insertions(+), 30 deletions(-) diff --git a/lib/screens/authentication/biodata_screen.dart b/lib/screens/authentication/biodata_screen.dart index 7fb3a59..9774dd1 100644 --- a/lib/screens/authentication/biodata_screen.dart +++ b/lib/screens/authentication/biodata_screen.dart @@ -72,7 +72,24 @@ class _BiodataScreenState extends State { String? _idUser; - + Future _onWillPop() async { + return (await showDialog( + context: context, + builder: (context) => AlertDialog( + title: const Text('Peringatan!'), + content: + const Text('Kamu harus mengisi form biodata terlebih dahulu'), + actions: [ + TextButton( + onPressed: () => + Navigator.of(context).pop(false), //<-- SEE HERE + child: const Text('Kembali'), + ), + ], + ), + )) ?? + false; + } @override void initState() { @@ -86,35 +103,38 @@ class _BiodataScreenState extends State { @override Widget build(BuildContext context) { - return GestureDetector( - onTap: () { - FocusScopeNode currentFocus = FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } - }, - child: Scaffold( - backgroundColor: bgColor, - appBar: AppBar( - backgroundColor: Colors.transparent, - elevation: 0, - ), - body: SafeArea( - child: Padding( - padding: defaultPadding, - child: ListView( - shrinkWrap: true, - children: [ - _headerSection(), - MarginHeight(height: 5.h), - _textFieldSection(), - MarginHeight(height: 3.h), - _dropDownSection(), - MarginHeight(height: 3.h), - _confirmationButton() - ], + return WillPopScope( + onWillPop: _onWillPop, + child: GestureDetector( + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + }, + child: Scaffold( + backgroundColor: bgColor, + appBar: AppBar( + backgroundColor: Colors.transparent, + elevation: 0, ), - )), + body: SafeArea( + child: Padding( + padding: defaultPadding, + child: ListView( + shrinkWrap: true, + children: [ + _headerSection(), + MarginHeight(height: 5.h), + _textFieldSection(), + MarginHeight(height: 3.h), + _dropDownSection(), + MarginHeight(height: 3.h), + _confirmationButton() + ], + ), + )), + ), ), ); } @@ -165,7 +185,7 @@ class _BiodataScreenState extends State { MarginHeight(height: 3.h), CustomTextField( titleText: "Berat Badan", - hintText: "ex. 50 (dalam satuan kg)58", + hintText: "ex. 50 (dalam satuan kg)", color: Colors.white, controller: _weightController, textInputType: TextInputType.number, From 810a0a8f27256c46da5bbc8eb1f92a8e6b3fd407 Mon Sep 17 00:00:00 2001 From: Bagus Subagja Date: Tue, 13 Dec 2022 11:21:21 +0700 Subject: [PATCH 3/3] Fix some bugs and typos --- lib/core/authentication/user_notifier.dart | 6 +- lib/main.dart | 9 + lib/routes/routes.dart | 6 +- .../home/favorites/favorite_screen.dart | 2 +- lib/screens/home/home_page.dart | 185 ++++++++++-------- lib/screens/home/profile_screen.dart | 5 +- .../settings/about_us/about_us_screen.dart | 9 +- .../account/account_settings_screen.dart | 6 +- .../food_recipe_detail_screen.dart} | 88 ++++++--- .../food_recipe_menu.dart} | 4 +- .../food_store_detail_screen.dart | 2 +- .../food_store_main_screen.dart | 181 +---------------- .../foodies/foodies_main_screen.dart | 5 +- .../detail_screen/mydoc_detail_screen.dart | 8 +- .../mydoc/mydoc_search_result_screen.dart | 10 + .../sport_store_main_screen.dart | 37 ++-- .../topup_balance_screen.dart} | 0 17 files changed, 248 insertions(+), 315 deletions(-) rename lib/screens/main_features_screens/foodies/{food-receipt-screen/food_receipt_detail_screen.dart => food-recipe-screen/food_recipe_detail_screen.dart} (78%) rename lib/screens/main_features_screens/foodies/{food-receipt-screen/food_receipt_menu.dart => food-recipe-screen/food_recipe_menu.dart} (99%) rename lib/screens/main_features_screens/{topup/topup_screen.dart => topup_balance/topup_balance_screen.dart} (100%) diff --git a/lib/core/authentication/user_notifier.dart b/lib/core/authentication/user_notifier.dart index 04d1992..1db0717 100644 --- a/lib/core/authentication/user_notifier.dart +++ b/lib/core/authentication/user_notifier.dart @@ -70,11 +70,11 @@ class UserUpdateSelfDataClass extends ChangeNotifier { Future updateSelfData( UserModel body, String idUser, BuildContext context) async { notifyListeners(); - http.Response response = (await updateSelfDataUser(body, idUser, context))!; - if (response.statusCode == 204) { + http.Response? response = (await updateSelfDataUser(body, idUser, context)); + if (response?.statusCode == 204) { debugPrint('Update Berhasil'); } else { - debugPrint(response.statusCode.toString()); + debugPrint(response?.statusCode.toString()); } notifyListeners(); } diff --git a/lib/main.dart b/lib/main.dart index e13f48e..f2aa632 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -7,8 +7,17 @@ import 'package:healthy_buddy_mobile_app/routes/routes.dart'; import 'package:provider/provider.dart'; import 'package:sizer/sizer.dart'; +class MyHttpOverrides extends HttpOverrides { + @override + HttpClient createHttpClient(SecurityContext? context) { + return super.createHttpClient(context) + ..badCertificateCallback = + (X509Certificate cert, String host, int port) => true; + } +} void main() { + HttpOverrides.global = MyHttpOverrides(); runApp(const HealthyBuddy()); } diff --git a/lib/routes/routes.dart b/lib/routes/routes.dart index 2747439..e6f4aed 100644 --- a/lib/routes/routes.dart +++ b/lib/routes/routes.dart @@ -15,8 +15,8 @@ import 'package:healthy_buddy_mobile_app/screens/home/top_article/top_article_sc import 'package:healthy_buddy_mobile_app/screens/home/wishslist/wishslist_screen.dart'; import 'package:healthy_buddy_mobile_app/screens/main_features_screens/foodies/food-article-screen/food_article_screen.dart'; import 'package:healthy_buddy_mobile_app/screens/main_features_screens/foodies/food-calculator-screen/food_calculator_screen.dart'; -import 'package:healthy_buddy_mobile_app/screens/main_features_screens/foodies/food-receipt-screen/food_receipt_detail_screen.dart'; -import 'package:healthy_buddy_mobile_app/screens/main_features_screens/foodies/food-receipt-screen/food_receipt_menu.dart'; +import 'package:healthy_buddy_mobile_app/screens/main_features_screens/foodies/food-recipe-screen/food_recipe_detail_screen.dart'; +import 'package:healthy_buddy_mobile_app/screens/main_features_screens/foodies/food-recipe-screen/food_recipe_menu.dart'; import 'package:healthy_buddy_mobile_app/screens/main_features_screens/foodies/food-store-screen/food_store_detail_screen.dart'; import 'package:healthy_buddy_mobile_app/screens/main_features_screens/foodies/food-store-screen/food_store_main_screen.dart'; import 'package:healthy_buddy_mobile_app/screens/main_features_screens/foodies/food-store-screen/food_store_status_order_screen.dart'; @@ -34,7 +34,7 @@ import 'package:healthy_buddy_mobile_app/screens/main_features_screens/sport/spo import 'package:healthy_buddy_mobile_app/screens/main_features_screens/sport/sport-website-screen/sport_website_screen.dart'; import 'package:healthy_buddy_mobile_app/screens/main_features_screens/sport/sport_exercise_screen/sport_exercise_screen.dart'; import 'package:healthy_buddy_mobile_app/screens/main_features_screens/sport/sport_main_screen.dart'; -import 'package:healthy_buddy_mobile_app/screens/main_features_screens/topup/topup_screen.dart'; +import 'package:healthy_buddy_mobile_app/screens/main_features_screens/topup_balance/topup_balance_screen.dart'; import 'package:healthy_buddy_mobile_app/screens/extras/no_internet_found_screen.dart'; diff --git a/lib/screens/home/favorites/favorite_screen.dart b/lib/screens/home/favorites/favorite_screen.dart index 25351a4..3409082 100644 --- a/lib/screens/home/favorites/favorite_screen.dart +++ b/lib/screens/home/favorites/favorite_screen.dart @@ -5,7 +5,7 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:healthy_buddy_mobile_app/core/favorites/favorites_notifier.dart'; -import 'package:healthy_buddy_mobile_app/screens/main_features_screens/foodies/food-receipt-screen/food_receipt_detail_screen.dart'; +import 'package:healthy_buddy_mobile_app/screens/main_features_screens/foodies/food-recipe-screen/food_recipe_detail_screen.dart'; import 'package:healthy_buddy_mobile_app/screens/main_features_screens/mydoc/detail_screen/mydoc_detail_screen.dart'; import 'package:healthy_buddy_mobile_app/screens/widgets/margin_height.dart'; import 'package:healthy_buddy_mobile_app/shared/theme.dart'; diff --git a/lib/screens/home/home_page.dart b/lib/screens/home/home_page.dart index 0e55dd7..1af1ad4 100644 --- a/lib/screens/home/home_page.dart +++ b/lib/screens/home/home_page.dart @@ -1,6 +1,7 @@ import 'package:cache_manager/cache_manager.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:healthy_buddy_mobile_app/core/authentication/user_notifier.dart'; import 'package:healthy_buddy_mobile_app/core/extras/top_article_notifier.dart'; import 'package:healthy_buddy_mobile_app/routes/routes.dart'; @@ -25,7 +26,6 @@ class HomePage extends StatefulWidget { } class _HomePageState extends State { - final List _categoryIcon = [ 'foodies.png', 'sport.png', @@ -48,97 +48,122 @@ class _HomePageState extends State { }); } + Future _onWillPop() async { + return (await showDialog( + context: context, + builder: (context) => AlertDialog( + title: const Text('Konfirmasi?'), + content: const Text( + 'Apakah kamu yakin untuk keluar dari aplikasi Healthy Buddy Mobile App?'), + actions: [ + TextButton( + onPressed: () => SystemNavigator.pop(), + child: const Text('Ya'), + ), + TextButton( + onPressed: () => Navigator.of(context).pop(true), + child: const Text('Tidak'), + ), + ], + ), + )) ?? + false; + } + @override Widget build(BuildContext context) { final AuthenticationNotifier authenticationNotifier = Provider.of(context, listen: false); - return GestureDetector( - onTap: () { - FocusScopeNode currentFocus = FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } - }, - child: Scaffold( - backgroundColor: greenColor, - appBar: AppBar( + return WillPopScope( + onWillPop: _onWillPop, + child: GestureDetector( + onTap: () { + FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + }, + child: Scaffold( backgroundColor: greenColor, - elevation: 0, - actions: [ - PopupMenuButton( - elevation: 0, - icon: const Icon(Icons.more_horiz_rounded), - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(4))), - color: bgColor, - itemBuilder: (context) => [ - PopupMenuItem( - child: GestureDetector( - onTap: () async { - DeleteCache.deleteKey( - "cache", - Navigator.pushNamedAndRemoveUntil(context, - AppRoutes.loginScreen, (route) => false)); + appBar: AppBar( + backgroundColor: greenColor, + elevation: 0, + actions: [ + PopupMenuButton( + elevation: 0, + icon: const Icon(Icons.more_horiz_rounded), + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(4))), + color: bgColor, + itemBuilder: (context) => [ + PopupMenuItem( + child: GestureDetector( + onTap: () async { + DeleteCache.deleteKey( + "cache", + Navigator.pushNamedAndRemoveUntil(context, + AppRoutes.loginScreen, (route) => false)); - await authenticationNotifier.logOut(); - }, - child: Row( - children: [ - Icon( - Icons.exit_to_app, - color: greyTextColor, - ), - Text( - 'Log Out', - style: regularStyle, - ), - ], + await authenticationNotifier.logOut(); + }, + child: Row( + children: [ + Icon( + Icons.exit_to_app, + color: greyTextColor, + ), + Text( + 'Log Out', + style: regularStyle, + ), + ], + ), ), ), - ), - ]) - ], - ), - drawer: _drawer(), - body: SafeArea( - child: ListView( - shrinkWrap: true, - children: [ - MarginHeight(height: 15), - Padding( - padding: defaultPadding, - child: _headerIdentity(), - ), - Padding( - padding: defaultPadding, - child: CustomTextField( - color: bgColor, - onTap: () { - showSearch( - context: context, delegate: SearchTopArticleResult()); - }, - readOnly: true, - prefixIcon: const Icon( - Icons.search, - ), - hintText: "Cari artikel terhangat disini...", + ]) + ], + ), + drawer: _drawer(), + body: SafeArea( + child: ListView( + shrinkWrap: true, + children: [ + MarginHeight(height: 15), + Padding( + padding: defaultPadding, + child: _headerIdentity(), ), - ), - MarginHeight(height: 3.h), - Container( - width: double.infinity, - decoration: BoxDecoration( - borderRadius: const BorderRadius.vertical( - top: Radius.circular(30), - ), - color: bgColor), - child: Padding( + Padding( padding: defaultPadding, - child: _whiteSection(context), + child: CustomTextField( + color: bgColor, + onTap: () { + showSearch( + context: context, delegate: SearchTopArticleResult()); + }, + readOnly: true, + prefixIcon: const Icon( + Icons.search, + ), + hintText: "Cari artikel terhangat disini...", + ), ), - ) - ], + MarginHeight(height: 3.h), + Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: const BorderRadius.vertical( + top: Radius.circular(30), + ), + color: bgColor), + child: Padding( + padding: defaultPadding, + child: _whiteSection(context), + ), + ) + ], + ), ), ), ), diff --git a/lib/screens/home/profile_screen.dart b/lib/screens/home/profile_screen.dart index 49815b5..2a9147e 100644 --- a/lib/screens/home/profile_screen.dart +++ b/lib/screens/home/profile_screen.dart @@ -53,7 +53,7 @@ class _ProfileScreenState extends State { child: ListView( children: [ MarginHeight(height: 2.h), - _headerSection(), + _headerSection(user), MarginHeight(height: 2.h), _mainSection() ], @@ -63,8 +63,7 @@ class _ProfileScreenState extends State { ); } - Widget _headerSection() { - final user = Provider.of(context); + Widget _headerSection(UserClass user) { return Column( children: [ ClipRRect( diff --git a/lib/screens/home/settings/about_us/about_us_screen.dart b/lib/screens/home/settings/about_us/about_us_screen.dart index f173c98..6cf8c54 100644 --- a/lib/screens/home/settings/about_us/about_us_screen.dart +++ b/lib/screens/home/settings/about_us/about_us_screen.dart @@ -1,3 +1,5 @@ +// ignore_for_file: prefer_final_fields + import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:healthy_buddy_mobile_app/screens/widgets/margin_height.dart'; @@ -31,6 +33,9 @@ class AboutUsScreen extends StatelessWidget { 'Project Manager' ]; + String _description = + "Healthy Buddy Mobile App merupakan sebuah aplikasi informatif seputar kesehatan. Aplikasi ini hadir sebagai bentuk kepedulian kami terhadap kesehatan manusia. Dengan menyediakan berbagai macam kebutuhan kesehatan seperti makanan sehat, daftar olahraga yang dapat kamu lakukan, serta layanan dokter yang siap memberikanmu pelayanan terbaik!"; + final List _nimOfGroup = [2002890, 2008315, 2007669, 2008672, 2008656]; @override @@ -70,7 +75,7 @@ class AboutUsScreen extends StatelessWidget { ), MarginHeight(height: 3.h), Text( - 'Healthy Buddy is here as a form of our concern for human health. We created an app that caters to a healthy lifestyle for everyone. By providing various kinds of health needs such as healthy food, sports that can improve body fitness, as well as professional doctors who are ready to provide the best service to you!', + _description, style: regularStyle.copyWith(color: greyTextColor), textAlign: TextAlign.justify, ), @@ -79,6 +84,7 @@ class AboutUsScreen extends StatelessWidget { 'Team Member :', style: regularStyle, ), + MarginHeight(height: 1.5.h), ListView.separated( separatorBuilder: (context, index) { return MarginHeight(height: 2.h); @@ -122,7 +128,6 @@ class AboutUsScreen extends StatelessWidget { style: regularStyle.copyWith( color: whiteColor, fontSize: 10.sp), ), - ], ), ], diff --git a/lib/screens/home/settings/account/account_settings_screen.dart b/lib/screens/home/settings/account/account_settings_screen.dart index 4bbf2a9..2a0cf99 100644 --- a/lib/screens/home/settings/account/account_settings_screen.dart +++ b/lib/screens/home/settings/account/account_settings_screen.dart @@ -1,3 +1,5 @@ +// ignore_for_file: prefer_final_fields + import 'package:awesome_dialog/awesome_dialog.dart'; import 'package:awesome_snackbar_content/awesome_snackbar_content.dart'; import 'package:cache_manager/cache_manager.dart'; @@ -38,7 +40,7 @@ class _AccountSettingScreenState extends State { final _weightController = TextEditingController(); final _heightController = TextEditingController(); - final List _activityLabel = [ + List _activityLabel = [ "Sangat Rendah", "Cukup Rendah", "Normal", @@ -47,7 +49,6 @@ class _AccountSettingScreenState extends State { ]; String? _selectedActivityValue = 'Normal'; - double _calorieCalculator( String gender, int age, int height, int weight, double activityValue) { if (gender == "Laki-laki") { @@ -385,6 +386,7 @@ class _AccountSettingScreenState extends State { var provider = Provider.of(context, listen: false); provider.updateSelfData(self, idUser!, context); + print(self); } else { final snackBar = SnackBar( elevation: 0, diff --git a/lib/screens/main_features_screens/foodies/food-receipt-screen/food_receipt_detail_screen.dart b/lib/screens/main_features_screens/foodies/food-recipe-screen/food_recipe_detail_screen.dart similarity index 78% rename from lib/screens/main_features_screens/foodies/food-receipt-screen/food_receipt_detail_screen.dart rename to lib/screens/main_features_screens/foodies/food-recipe-screen/food_recipe_detail_screen.dart index 7a6ace0..6ea7983 100644 --- a/lib/screens/main_features_screens/foodies/food-receipt-screen/food_receipt_detail_screen.dart +++ b/lib/screens/main_features_screens/foodies/food-recipe-screen/food_recipe_detail_screen.dart @@ -145,9 +145,9 @@ class _FoodReceiptDetailScreenState extends State { await fav.addFavFoodData(body, context); }, - icon: const Icon( + icon: Icon( Icons.favorite_rounded, - color: Colors.pink, + color: greyTextColor, )) ], ); @@ -204,51 +204,91 @@ class _FoodReceiptDetailScreenState extends State { Widget _ingredientSection() { return Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisSize: MainAxisSize.max, children: [ Text( - 'Ingredients', + 'Bahan Baku', style: titleStyle.copyWith(color: blackColor), ), - GridView.builder( - gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( - maxCrossAxisExtent: 15.h, - childAspectRatio: 2 / 2, - crossAxisSpacing: 10, - mainAxisSpacing: 10), - shrinkWrap: true, - primary: false, - itemBuilder: (context, index) { - return Container( + Wrap( + alignment: WrapAlignment.spaceAround, + runSpacing: 10, + children: List.generate( + widget.foodReceiptModel?.ingredients.length ?? + widget.foodReceipt!.ingredients!.length, (index) { + return GestureDetector( + onTap: () {}, + child: Container( alignment: Alignment.center, - margin: const EdgeInsets.all(10), + height: 14.h, + width: 14.h, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), color: greenColor.withOpacity(0.3), + borderRadius: BorderRadius.circular(12), ), - height: 10.h, - width: double.infinity, child: Text( widget.foodReceiptModel?.ingredients[index] ?? widget.foodReceipt!.ingredients![index], style: regularStyle.copyWith(color: blackColor), textAlign: TextAlign.center, ), - ); - }, - itemCount: widget.foodReceiptModel?.ingredients.length ?? - widget.foodReceipt!.ingredients!.length), + ), + ); + }), + ), ], ); } + // Widget _ingredientSection() { + // return Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisSize: MainAxisSize.min, + // children: [ + // Text( + // 'Bahan Baku', + // style: titleStyle.copyWith(color: blackColor), + // ), + // GridView.builder( + // gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( + // maxCrossAxisExtent: 15.h, + // childAspectRatio: 2 / 2, + // crossAxisSpacing: 10, + // mainAxisSpacing: 10), + // shrinkWrap: true, + // primary: false, + // itemBuilder: (context, index) { + // return Container( + // alignment: Alignment.center, + // margin: const EdgeInsets.all(10), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(10), + // color: greenColor.withOpacity(0.3), + // ), + // height: 10.h, + // width: double.infinity, + // child: Text( + // widget.foodReceiptModel?.ingredients[index] ?? + // widget.foodReceipt!.ingredients![index], + // style: regularStyle.copyWith(color: blackColor), + // textAlign: TextAlign.center, + // ), + // ); + // }, + // itemCount: widget.foodReceiptModel?.ingredients.length ?? + // widget.foodReceipt!.ingredients!.length), + // ], + // ); + // } + Widget _foodServiceStyle() { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'Food Service Style', + 'Gaya Penyajian Makanan', style: titleStyle.copyWith( color: blackColor, ), diff --git a/lib/screens/main_features_screens/foodies/food-receipt-screen/food_receipt_menu.dart b/lib/screens/main_features_screens/foodies/food-recipe-screen/food_recipe_menu.dart similarity index 99% rename from lib/screens/main_features_screens/foodies/food-receipt-screen/food_receipt_menu.dart rename to lib/screens/main_features_screens/foodies/food-recipe-screen/food_recipe_menu.dart index 159bd80..5e605ca 100644 --- a/lib/screens/main_features_screens/foodies/food-receipt-screen/food_receipt_menu.dart +++ b/lib/screens/main_features_screens/foodies/food-recipe-screen/food_recipe_menu.dart @@ -2,7 +2,7 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_rating_bar/flutter_rating_bar.dart'; import 'package:healthy_buddy_mobile_app/core/foodies/food_receipt_notifier.dart'; -import 'package:healthy_buddy_mobile_app/screens/main_features_screens/foodies/food-receipt-screen/food_receipt_detail_screen.dart'; +import 'package:healthy_buddy_mobile_app/screens/main_features_screens/foodies/food-recipe-screen/food_recipe_detail_screen.dart'; import 'package:healthy_buddy_mobile_app/screens/widgets/margin_height.dart'; import 'package:healthy_buddy_mobile_app/screens/widgets/margin_width.dart'; import 'package:healthy_buddy_mobile_app/shared/assets_directory.dart'; @@ -79,7 +79,7 @@ class _FoodReceiptMenuScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'Food Receipt', + 'Food Recipe', style: titleStyle.copyWith(color: greenColor), ), MarginHeight(height: 0.75.h), diff --git a/lib/screens/main_features_screens/foodies/food-store-screen/food_store_detail_screen.dart b/lib/screens/main_features_screens/foodies/food-store-screen/food_store_detail_screen.dart index fbc1b3b..186b9f2 100644 --- a/lib/screens/main_features_screens/foodies/food-store-screen/food_store_detail_screen.dart +++ b/lib/screens/main_features_screens/foodies/food-store-screen/food_store_detail_screen.dart @@ -414,7 +414,7 @@ class _FoodStoreDetailScreenState extends State { SizedBox( width: 70.w, child: Text( - '${user.users?[0].address}', + 'Alamat : ${user.users?[0].address}', style: regularStyle, )), OutlinedButton( diff --git a/lib/screens/main_features_screens/foodies/food-store-screen/food_store_main_screen.dart b/lib/screens/main_features_screens/foodies/food-store-screen/food_store_main_screen.dart index d83615a..5b65f4f 100644 --- a/lib/screens/main_features_screens/foodies/food-store-screen/food_store_main_screen.dart +++ b/lib/screens/main_features_screens/foodies/food-store-screen/food_store_main_screen.dart @@ -13,6 +13,7 @@ import 'package:healthy_buddy_mobile_app/core/wishlist/foodies_wishlist_notifier import 'package:healthy_buddy_mobile_app/models/user_model/user_model.dart'; import 'package:healthy_buddy_mobile_app/routes/routes.dart'; import 'package:healthy_buddy_mobile_app/screens/main_features_screens/foodies/food-store-screen/food_store_detail_screen.dart'; +import 'package:healthy_buddy_mobile_app/screens/widgets/content_empty.dart'; import 'package:healthy_buddy_mobile_app/screens/widgets/margin_height.dart'; import 'package:healthy_buddy_mobile_app/shared/assets_directory.dart'; import 'package:healthy_buddy_mobile_app/shared/theme.dart'; @@ -304,176 +305,6 @@ class _FoodStoreMainScreenState extends State { ); } - // Widget _gridViewItemList(int currentIndex) { - // final itemByBuah = Provider.of(context); - // final itemBySayuran = Provider.of(context); - // final itemByInstan = Provider.of(context); - // final itemByMinuman = Provider.of(context); - // int itemCount(int x) { - // if (x == 0) { - // return itemByBuah.foodStoreModel?.length ?? 0; - // } else if (x == 1) { - // return itemBySayuran.foodStoreModel?.length ?? 0; - // } else if (x == 2) { - // return itemByInstan.foodStoreModel?.length ?? 0; - // } else if (x == 3) { - // return itemByMinuman.foodStoreModel?.length ?? 0; - // } else { - // return 0; - // } - // } - - // return GridView.builder( - // shrinkWrap: true, - // primary: false, - // physics: const NeverScrollableScrollPhysics(), - // gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( - // maxCrossAxisExtent: 43.h, - // childAspectRatio: 3 / 2, - // crossAxisSpacing: 20, - // mainAxisSpacing: 20), - // itemCount: itemCount(_currentIndex), - // itemBuilder: (BuildContext ctx, index) { - // return GestureDetector( - // onTap: () { - // if (_currentIndex == 0) { - // final itemBuah = itemByBuah.foodStoreModel?[index]; - // Navigator.push(context, MaterialPageRoute( - // builder: (context) { - // return FoodStoreDetailScreen( - // foodStoreModel: itemBuah, - // ); - // }, - // )); - // } else if (_currentIndex == 1) { - // final itemSayuran = itemBySayuran.foodStoreModel?[index]; - // Navigator.push(context, MaterialPageRoute( - // builder: (context) { - // return FoodStoreDetailScreen( - // foodStoreModel: itemSayuran, - // ); - // }, - // )); - // } else if (_currentIndex == 2) { - // final itemInstan = itemByInstan.foodStoreModel?[index]; - // Navigator.push(context, MaterialPageRoute( - // builder: (context) { - // return FoodStoreDetailScreen( - // foodStoreModel: itemInstan, - // ); - // }, - // )); - // } else if (_currentIndex == 3) { - // final itemMinuman = itemByMinuman.foodStoreModel?[index]; - // Navigator.push(context, MaterialPageRoute( - // builder: (context) { - // return FoodStoreDetailScreen( - // foodStoreModel: itemMinuman, - // ); - // }, - // )); - // } - // }, - // child: ClipRRect( - // borderRadius: BorderRadius.circular(12), - // child: SizedBox( - // child: Stack( - // alignment: Alignment.bottomCenter, - // children: [ - // _currentIndex == 0 - // ? CachedNetworkImage( - // imageUrl: - // itemByBuah.foodStoreModel?[index].gallery[0] ?? - // imgPlaceHolder, - // imageBuilder: (context, imageProvider) => Container( - // decoration: BoxDecoration( - // image: DecorationImage( - // image: imageProvider, - // fit: BoxFit.cover, - // ), - // ), - // ), - // placeholder: (context, url) => const Center( - // child: CircularProgressIndicator(), - // ), - // errorWidget: (context, url, error) => const Center( - // child: Icon(Icons.error), - // ), - // ) - // : _currentIndex == 1 - // ? CachedNetworkImage( - // imageUrl: itemBySayuran - // .foodStoreModel?[index].gallery[0] ?? - // imgPlaceHolder, - // imageBuilder: (context, imageProvider) => - // Container( - // decoration: BoxDecoration( - // image: DecorationImage( - // image: imageProvider, - // fit: BoxFit.cover, - // ), - // ), - // ), - // placeholder: (context, url) => const Center( - // child: CircularProgressIndicator(), - // ), - // errorWidget: (context, url, error) => - // const Center( - // child: Icon(Icons.error), - // ), - // ) - // : _currentIndex == 2 - // ? CachedNetworkImage( - // imageUrl: itemByInstan - // .foodStoreModel?[index].gallery[0] ?? - // imgPlaceHolder, - // imageBuilder: (context, imageProvider) => - // Container( - // decoration: BoxDecoration( - // image: DecorationImage( - // image: imageProvider, - // fit: BoxFit.cover, - // ), - // ), - // ), - // placeholder: (context, url) => const Center( - // child: CircularProgressIndicator(), - // ), - // errorWidget: (context, url, error) => - // const Center( - // child: Icon(Icons.error), - // ), - // ) - // : CachedNetworkImage( - // imageUrl: itemByMinuman - // .foodStoreModel?[index].gallery[0] ?? - // imgPlaceHolder, - // imageBuilder: (context, imageProvider) => - // Container( - // decoration: BoxDecoration( - // image: DecorationImage( - // image: imageProvider, - // fit: BoxFit.cover, - // ), - // ), - // ), - // placeholder: (context, url) => const Center( - // child: CircularProgressIndicator(), - // ), - // errorWidget: (context, url, error) => - // const Center( - // child: Icon(Icons.error), - // ), - // ) - // ], - // ), - // ), - // ), - // ); - // }, - // ); - // } - Widget _listViewItemList(int currentIndex) { final itemByBuah = Provider.of(context); final itemBySayuran = Provider.of(context); @@ -493,6 +324,12 @@ class _FoodStoreMainScreenState extends State { } } + if (itemCount(_currentIndex) == 0) { + return ContentEmptyWidget( + content: "Saat ini item tidak tersedia", + ); + } + return ListView.separated( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), @@ -745,9 +582,9 @@ class _FoodStoreMainScreenState extends State { ], ), Icon( - Icons.arrow_right_alt_rounded, + Icons.shopping_cart_outlined, color: greyTextColor, - ) + ), ], ) ], diff --git a/lib/screens/main_features_screens/foodies/foodies_main_screen.dart b/lib/screens/main_features_screens/foodies/foodies_main_screen.dart index 2e85747..06c1d52 100644 --- a/lib/screens/main_features_screens/foodies/foodies_main_screen.dart +++ b/lib/screens/main_features_screens/foodies/foodies_main_screen.dart @@ -45,7 +45,7 @@ class _FoodiesScreenState extends State { final List _iconLabel = [ "Food Article", "Food Calculator", - "Food Receipt", + "Food Recipe", "Food Store" ]; @@ -230,7 +230,8 @@ class _FoodiesScreenState extends State { if (index == 0) { Navigator.pushNamed(context, AppRoutes.foodArticleMenu); } else if (index == 1) { - Navigator.pushNamed(context, AppRoutes.foodCalculatorScreen); + Navigator.pushNamed( + context, AppRoutes.foodCalculatorScreen); } else if (index == 2) { Navigator.pushNamed(context, AppRoutes.foodReceiptMenu); } else if (index == 3) { diff --git a/lib/screens/main_features_screens/mydoc/detail_screen/mydoc_detail_screen.dart b/lib/screens/main_features_screens/mydoc/detail_screen/mydoc_detail_screen.dart index 3ec8a2b..8b37041 100644 --- a/lib/screens/main_features_screens/mydoc/detail_screen/mydoc_detail_screen.dart +++ b/lib/screens/main_features_screens/mydoc/detail_screen/mydoc_detail_screen.dart @@ -46,7 +46,7 @@ class _MyDocDetailScreenState extends State { } else if (widget.myDocModel?.name != null) { numLabel.add(widget.myDocModel!.patients.toString()); numLabel.add(widget.myDocModel!.yearExp.toString()); - numLabel.add(widget.myDocModel!.rating.toString()); + numLabel.add('${widget.myDocModel!.rating.toString()}/5'); } final user = Provider.of(context, listen: false); ReadCache.getString(key: 'cache').then((value) { @@ -110,7 +110,7 @@ class _MyDocDetailScreenState extends State { }, icon: Icon( Icons.arrow_back_ios, - color: blackColor, + color: whiteColor, ), ), IconButton( @@ -123,9 +123,9 @@ class _MyDocDetailScreenState extends State { '${idUser}_${widget.myDocModel?.id ?? widget.myDoc?.id}'); await fav.addFavDocData(body, context); }, - icon: const Icon( + icon: Icon( Icons.favorite, - color: Colors.pink, + color: whiteColor, ), ), ], diff --git a/lib/screens/main_features_screens/mydoc/mydoc_search_result_screen.dart b/lib/screens/main_features_screens/mydoc/mydoc_search_result_screen.dart index 28e6342..fb20395 100644 --- a/lib/screens/main_features_screens/mydoc/mydoc_search_result_screen.dart +++ b/lib/screens/main_features_screens/mydoc/mydoc_search_result_screen.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:healthy_buddy_mobile_app/models/mydoc_model/mydoc_model.dart'; +import 'package:healthy_buddy_mobile_app/screens/main_features_screens/mydoc/detail_screen/mydoc_detail_screen.dart'; import 'package:healthy_buddy_mobile_app/services/search_data_services/search_toparticle_service.dart'; import 'package:sizer/sizer.dart'; @@ -64,6 +65,15 @@ class MyDocSearchResultScreen extends SearchDelegate { return Card( elevation: 0, child: ListTile( + onTap: () { + Navigator.push(context, MaterialPageRoute( + builder: (context) { + return MyDocDetailScreen( + myDocModel: data?[index], + ); + }, + )); + }, title: Row( children: [ ClipRRect( diff --git a/lib/screens/main_features_screens/sport/sport-store-screen/sport_store_main_screen.dart b/lib/screens/main_features_screens/sport/sport-store-screen/sport_store_main_screen.dart index 2d6f0d3..f892ebb 100644 --- a/lib/screens/main_features_screens/sport/sport-store-screen/sport_store_main_screen.dart +++ b/lib/screens/main_features_screens/sport/sport-store-screen/sport_store_main_screen.dart @@ -6,6 +6,7 @@ import 'package:cache_manager/cache_manager.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:healthy_buddy_mobile_app/screens/main_features_screens/sport/sport-store-screen/sport_store_detail_screen.dart'; +import 'package:healthy_buddy_mobile_app/screens/widgets/content_empty.dart'; import 'package:healthy_buddy_mobile_app/shared/theme.dart'; import 'package:indonesia/indonesia.dart'; import 'package:provider/provider.dart'; @@ -36,6 +37,16 @@ class _SportStoreMainScreenState extends State { int? _foodQuantity; int? _sportQuantity; + List selectedToogle = [true, false, false, false, false]; + + List foodStoreCategory = [ + "General", + "Soccer", + "Athletic", + "Badminton", + "Swimming" + ]; + @override void initState() { super.initState(); @@ -100,7 +111,7 @@ class _SportStoreMainScreenState extends State { color: whiteColor, ), onPressed: () { - Navigator.pushNamed(context, AppRoutes.wishlistScreen); + Navigator.pushNamed(context, AppRoutes.wishlistScreen); }, ), ), @@ -232,15 +243,6 @@ class _SportStoreMainScreenState extends State { } Widget _sportStoreToogleButton() { - List selectedToogle = [true, false, false, false, false]; - - List foodStoreCategory = [ - "General", - "Soccer", - "Athletic", - "Badminton", - "Swimming" - ]; return Center( child: SizedBox( height: 5.h, @@ -316,6 +318,12 @@ class _SportStoreMainScreenState extends State { } } + if (itemCount(_currentIndex) == 0) { + return ContentEmptyWidget( + content: "Saat ini item tidak tersedia", + ); + } + return ListView.separated( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), @@ -633,12 +641,9 @@ class _SportStoreMainScreenState extends State { ) ], ), - GestureDetector( - onTap: () {}, - child: Icon( - Icons.shopping_cart_outlined, - color: greyTextColor, - ), + Icon( + Icons.shopping_cart_outlined, + color: greyTextColor, ), ], ) diff --git a/lib/screens/main_features_screens/topup/topup_screen.dart b/lib/screens/main_features_screens/topup_balance/topup_balance_screen.dart similarity index 100% rename from lib/screens/main_features_screens/topup/topup_screen.dart rename to lib/screens/main_features_screens/topup_balance/topup_balance_screen.dart