From 45dab6bd5846a872495c32fd028c8a15cfe20949 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 25 Mar 2025 12:48:03 +0300 Subject: [PATCH] bottomsheet added. --- lib/config/localized_values.dart | 2 +- lib/screens/home/home_screen.dart | 72 ++++++++++++++++--- .../translations_delegate_base_utils.dart | 1 + 3 files changed, 63 insertions(+), 12 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 5546e8e6..4e27e62c 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1252,5 +1252,5 @@ const Map> localizedValues = { "selectReaction": {"en": "Select Reaction", "ar":"حدد رد الفعل"}, "progressNoteCanNotBeEmpty": {"en": "Progress Note Can Not Be Empty", "ar":"تعذر تنفيذ الإجراء"}, "youHavePendingInterventions": {"en": "You Have Pending Interventions. That need your attention", "ar":"لديك تدخلات معلقة. التي تحتاج إلى اهتمامك"}, - + "open": {"en": "Open", "ar":"يفتح"}, }; diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index 9f378c72..857e48e8 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -26,6 +26,7 @@ import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; @@ -34,6 +35,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; import 'package:sticky_headers/sticky_headers/widget.dart'; +import '../patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'label.dart'; class HomeScreen extends StatefulWidget { @@ -311,17 +313,19 @@ class _HomeScreenState extends State { } showPendingInfectiousDiseaseDialog(DashboardViewModel model) { - Utils.showConfirmationDialog( - context, TranslationBase.of(context).youHavePendingInterventions, - () async { - Navigator.pop(context); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PharmacyIntervention(), - settings: RouteSettings(name: 'PharmacyIntervention'), - )); - }, isShowCancelButton: false); + // Utils.showConfirmationDialog( + // context, TranslationBase.of(context).youHavePendingInterventions, + // () async { + // Navigator.pop(context); + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => PharmacyIntervention(), + // settings: RouteSettings(name: 'PharmacyIntervention'), + // )); + // }, isShowCancelButton: false); + + _showErrorBottomSheet(context, TranslationBase.of(context).youHavePendingInterventions); } List homePatientsCardsWidget( @@ -568,4 +572,50 @@ class _HomeScreenState extends State { colorIndex = 0; } } + void _showErrorBottomSheet(BuildContext context, String errorMessage) { + showModalBottomSheet( + context: context, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.vertical(top: Radius.circular(20)), + ), + backgroundColor: Colors.red[50], // Light red background + builder: (context) { + return Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.error_outline, color: Colors.red, size: 40), + const SizedBox(height: 10), + Text( + TranslationBase.of(context).pharmacyIntervention, + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.red), + ), + const SizedBox(height: 25), + Text( + errorMessage, + style: TextStyle(fontSize: 16, color: Colors.black87), + textAlign: TextAlign.center, + ), + const SizedBox(height: 15), + SizedBox( + width: SizeConfig.realScreenWidth! * .4, + child:AppButton( + color: Colors.green, + onPressed: () => { // Navigator.pop(context); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PharmacyIntervention(), + settings: RouteSettings(name: 'PharmacyIntervention'), + ))}, + title: TranslationBase.of(context).open, + + )), + ], + ), + ); + }, + ); + } } diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index 224ce272..c5370de5 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -1994,6 +1994,7 @@ class TranslationBase { String get youHavePendingInterventions => localizedValues['youHavePendingInterventions']![locale.languageCode]!; String get dateToCanNotBeEmpty => localizedValues['dateToCanNotBeEmpty']![locale.languageCode]!; String get dateFromCanNotBeEmpty => localizedValues['dateFromCanNotBeEmpty']![locale.languageCode]!; + String get open => localizedValues['open']![locale.languageCode]!; } class TranslationBaseDelegate extends LocalizationsDelegate {