From ebde81b64de6067b1b49581088ebdf431bb4fcb6 Mon Sep 17 00:00:00 2001 From: ashrafzarkanisala Date: Mon, 7 Oct 2024 07:43:07 +0300 Subject: [PATCH] working on preferences --- .../helper/garage_door_helper.dart | 129 ++++++++++++++++-- .../view/garage_door_control_view.dart | 54 +++++--- .../opening_clsoing_time_dialog_body.dart | 13 ++ .../widgets/schedule__garage_table.dart | 48 +++++-- .../widgets/schedule_garage_view.dart | 8 +- .../widgets/time_out_alarm_dialog_body.dart | 13 ++ .../shared/toggle_widget.dart | 2 + lib/utils/extension/build_context_x.dart | 112 +++++++++++++++ 8 files changed, 330 insertions(+), 49 deletions(-) create mode 100644 lib/pages/device_managment/garage_door/widgets/opening_clsoing_time_dialog_body.dart create mode 100644 lib/pages/device_managment/garage_door/widgets/time_out_alarm_dialog_body.dart diff --git a/lib/pages/device_managment/garage_door/helper/garage_door_helper.dart b/lib/pages/device_managment/garage_door/helper/garage_door_helper.dart index e939ad9e..55957b53 100644 --- a/lib/pages/device_managment/garage_door/helper/garage_door_helper.dart +++ b/lib/pages/device_managment/garage_door/helper/garage_door_helper.dart @@ -4,11 +4,15 @@ import 'package:syncrow_web/pages/common/buttons/default_button.dart'; import 'package:syncrow_web/pages/device_managment/garage_door/bloc/garage_door_bloc.dart'; import 'package:syncrow_web/pages/device_managment/garage_door/bloc/garage_door_event.dart'; import 'package:syncrow_web/pages/device_managment/garage_door/bloc/garage_door_state.dart'; +import 'package:syncrow_web/pages/device_managment/garage_door/widgets/opening_clsoing_time_dialog_body.dart'; +import 'package:syncrow_web/pages/device_managment/garage_door/widgets/time_out_alarm_dialog_body.dart'; +import 'package:syncrow_web/pages/device_managment/shared/sensors_widgets/presence_display_data.dart'; +import 'package:syncrow_web/pages/device_managment/shared/toggle_widget.dart'; import 'package:syncrow_web/pages/device_managment/water_heater/models/schedule_model.dart'; import 'package:syncrow_web/utils/color_manager.dart'; import 'package:syncrow_web/utils/extension/build_context_x.dart'; -class ScheduleGarageDoorDialogHelper { +class GarageDoorDialogHelper { static void showAddGarageDoorScheduleDialog(BuildContext context, {ScheduleModel? schedule, int? index, bool? isEdit}) { final bloc = context.read(); @@ -77,7 +81,8 @@ class ScheduleGarageDoorDialogHelper { : () async { TimeOfDay? time = await showTimePicker( context: context, - initialTime: state.selectedTime ?? TimeOfDay.now(), + initialTime: + state.selectedTime ?? TimeOfDay.now(), builder: (context, child) { return Theme( data: Theme.of(context).copyWith( @@ -97,7 +102,9 @@ class ScheduleGarageDoorDialogHelper { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - state.selectedTime == null ? 'Time' : state.selectedTime!.format(context), + state.selectedTime == null + ? 'Time' + : state.selectedTime!.format(context), style: context.textTheme.bodySmall!.copyWith( color: ColorsManager.grayColor, ), @@ -112,7 +119,8 @@ class ScheduleGarageDoorDialogHelper { ), ), const SizedBox(height: 16), - _buildDayCheckboxes(context, state.selectedDays, isEdit: isEdit), + _buildDayCheckboxes(context, state.selectedDays, + isEdit: isEdit), const SizedBox(height: 16), _buildFunctionSwitch(context, state.functionOn, isEdit), ], @@ -191,7 +199,9 @@ class ScheduleGarageDoorDialogHelper { return daysBoolean; } - static Widget _buildDayCheckboxes(BuildContext context, List selectedDays, {bool? isEdit}) { + static Widget _buildDayCheckboxes( + BuildContext context, List selectedDays, + {bool? isEdit}) { final dayLabels = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; return Row( @@ -203,7 +213,9 @@ class ScheduleGarageDoorDialogHelper { onChanged: isEdit == true ? null : (bool? value) { - context.read().add(UpdateSelectedDayEvent(index, value!)); + context + .read() + .add(UpdateSelectedDayEvent(index, value!)); }, ), Text(dayLabels[index]), @@ -213,12 +225,14 @@ class ScheduleGarageDoorDialogHelper { ); } - static Widget _buildFunctionSwitch(BuildContext context, bool isOn, bool? isEdit) { + static Widget _buildFunctionSwitch( + BuildContext context, bool isOn, bool? isEdit) { return Row( children: [ Text( 'Function:', - style: context.textTheme.bodySmall!.copyWith(color: ColorsManager.grayColor), + style: context.textTheme.bodySmall! + .copyWith(color: ColorsManager.grayColor), ), const SizedBox(width: 10), Radio( @@ -228,7 +242,9 @@ class ScheduleGarageDoorDialogHelper { if (isEdit == true) { return; } else { - context.read().add(const UpdateFunctionOnEvent(functionOn: true)); + context + .read() + .add(const UpdateFunctionOnEvent(functionOn: true)); } }, ), @@ -241,7 +257,9 @@ class ScheduleGarageDoorDialogHelper { if (isEdit == true) { return; } else { - context.read().add(const UpdateFunctionOnEvent(functionOn: false)); + context + .read() + .add(const UpdateFunctionOnEvent(functionOn: false)); } }, ), @@ -249,4 +267,95 @@ class ScheduleGarageDoorDialogHelper { ], ); } + + static void showPreferencesDialog(BuildContext context) { + final bloc = context.read(); + + showDialog( + context: context, + builder: (ctx) { + return BlocProvider.value( + value: bloc, + child: BlocBuilder( + builder: (context, state) { + if (state is GarageDoorLoadedState) { + return AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + ), + content: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const SizedBox(), + Text( + 'Preferences', + style: context.textTheme.titleLarge!.copyWith( + color: ColorsManager.dialogBlueTitle, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(), + ], + ), + const SizedBox(height: 24), + Row( + children: [ + const SizedBox(width: 24), + SizedBox( + width: 190, + height: 150, + child: GestureDetector( + onTap: () { + context.customAlertDialog( + alertBody: TimeOutAlarmDialogBody(), + title: 'Time Out Alarm', + onConfirm: () {}); + }, + child: ToggleWidget( + icon: "-1", + value: bloc.deviceStatus.countdownAlarm > 0, + code: 'countdown_alarm', + deviceId: bloc.deviceId, + label: 'Alarm when door is open', + onChange: (value) {}), + ), + ), + const SizedBox( + width: 20, + ), + SizedBox( + width: 190, + height: 150, + child: GestureDetector( + onTap: () { + context.customAlertDialog( + alertBody: OpeningClosingTimeDialogBody(), + title: 'Opening and Closing Time', + onConfirm: () {}); + }, + child: PresenceDisplayValue( + value: bloc.deviceStatus.trTimeCon.toString(), + postfix: 'sec', + description: 'Opening & Closing Time', + ), + ), + ), + const SizedBox(width: 24), + ], + ) + ], + ), + ); + } + return const SizedBox(); + }, + ), + ); + }, + ); + } } diff --git a/lib/pages/device_managment/garage_door/view/garage_door_control_view.dart b/lib/pages/device_managment/garage_door/view/garage_door_control_view.dart index 1ad3c756..e3c44405 100644 --- a/lib/pages/device_managment/garage_door/view/garage_door_control_view.dart +++ b/lib/pages/device_managment/garage_door/view/garage_door_control_view.dart @@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_web/pages/device_managment/garage_door/bloc/garage_door_bloc.dart'; import 'package:syncrow_web/pages/device_managment/garage_door/bloc/garage_door_event.dart'; import 'package:syncrow_web/pages/device_managment/garage_door/bloc/garage_door_state.dart'; +import 'package:syncrow_web/pages/device_managment/garage_door/helper/garage_door_helper.dart'; import 'package:syncrow_web/pages/device_managment/garage_door/models/garage_door_model.dart'; import 'package:syncrow_web/pages/device_managment/garage_door/widgets/schedule_garage_view.dart'; import 'package:syncrow_web/pages/device_managment/shared/table/report_table.dart'; @@ -14,7 +15,8 @@ import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_la import '../../main_door_sensor/view/main_door_control_view.dart'; -class GarageDoorControlView extends StatelessWidget with HelperResponsiveLayout { +class GarageDoorControlView extends StatelessWidget + with HelperResponsiveLayout { final String deviceId; const GarageDoorControlView({required this.deviceId, super.key}); @@ -22,7 +24,8 @@ class GarageDoorControlView extends StatelessWidget with HelperResponsiveLayout @override Widget build(BuildContext context) { return BlocProvider( - create: (context) => GarageDoorBloc(deviceId: deviceId)..add(GarageDoorInitialEvent(deviceId)), + create: (context) => GarageDoorBloc(deviceId: deviceId) + ..add(GarageDoorInitialEvent(deviceId)), child: BlocBuilder( builder: (context, state) { if (state is GarageDoorLoadingState) { @@ -34,7 +37,9 @@ class GarageDoorControlView extends StatelessWidget with HelperResponsiveLayout garageDoorSensor: true, onRowTap: (index) {}, onClose: () { - context.read().add(BackToGarageDoorGridViewEvent()); + context + .read() + .add(BackToGarageDoorGridViewEvent()); }, ); } else if (state is GarageDoorLoadedState) { @@ -64,7 +69,7 @@ class GarageDoorControlView extends StatelessWidget with HelperResponsiveLayout ? 2 : 1, childAspectRatio: 1.5, - mainAxisExtent: 170, + mainAxisExtent: 140, crossAxisSpacing: 12, mainAxisSpacing: 12, ), @@ -75,17 +80,20 @@ class GarageDoorControlView extends StatelessWidget with HelperResponsiveLayout icon: status.switch1 ? Assets.openedDoor : Assets.closedDoor, onTap: () { context.read().add( - GarageDoorControlEvent(deviceId: status.uuid, value: !status.switch1, code: 'switch_1'), + GarageDoorControlEvent( + deviceId: status.uuid, + value: !status.switch1, + code: 'switch_1'), ); }, status: status.switch1, textColor: ColorsManager.blackColor, - //paddingAmount: 6, ), IconNameStatusContainer( onTap: () { context.read().add( - FetchGarageDoorSchedulesEvent(deviceId: deviceId, category: 'switch_1'), + FetchGarageDoorSchedulesEvent( + deviceId: deviceId, category: 'switch_1'), ); showDialog( context: context, @@ -99,7 +107,6 @@ class GarageDoorControlView extends StatelessWidget with HelperResponsiveLayout status: false, textColor: ColorsManager.blackColor, isFullIcon: false, - //paddingAmount: 15, ), ToggleWidget( label: '', @@ -109,9 +116,9 @@ class GarageDoorControlView extends StatelessWidget with HelperResponsiveLayout children: [ IconButton( onPressed: () { - // if (status.countdown1 != 0) { - context.read().add(DecreaseGarageDoorDelayEvent(deviceId: status.uuid)); - // } + context + .read() + .add(DecreaseGarageDoorDelayEvent(deviceId: status.uuid)); }, icon: const Icon( Icons.remove, @@ -129,7 +136,8 @@ class GarageDoorControlView extends StatelessWidget with HelperResponsiveLayout ), Text( 'h', - style: context.textTheme.bodySmall!.copyWith(color: ColorsManager.blackColor), + style: context.textTheme.bodySmall! + .copyWith(color: ColorsManager.blackColor), ), Text( (status.delay.inMinutes % 60).toString().padLeft(2, '0'), @@ -140,13 +148,14 @@ class GarageDoorControlView extends StatelessWidget with HelperResponsiveLayout ), Text( 'm', - style: context.textTheme.bodySmall!.copyWith(color: ColorsManager.blackColor), + style: context.textTheme.bodySmall! + .copyWith(color: ColorsManager.blackColor), ), IconButton( onPressed: () { - // if (status.countdown1 != 0) { - context.read().add(IncreaseGarageDoorDelayEvent(deviceId: status.uuid)); - // } + context + .read() + .add(IncreaseGarageDoorDelayEvent(deviceId: status.uuid)); }, icon: const Icon( Icons.add, @@ -164,7 +173,9 @@ class GarageDoorControlView extends StatelessWidget with HelperResponsiveLayout onChange: (value) { context.read().add( GarageDoorControlEvent( - deviceId: status.uuid, value: value ? status.delay.inSeconds : 0, code: 'countdown_1'), + deviceId: status.uuid, + value: value ? status.delay.inSeconds : 0, + code: 'countdown_1'), ); }, ), @@ -173,20 +184,21 @@ class GarageDoorControlView extends StatelessWidget with HelperResponsiveLayout name: 'Records', icon: Assets.records, onTap: () { - context.read().add(FetchGarageDoorRecordsEvent(code: 'switch_1', deviceId: status.uuid)); + context.read().add(FetchGarageDoorRecordsEvent( + code: 'switch_1', deviceId: status.uuid)); }, status: false, textColor: ColorsManager.blackColor, - //paddingAmount: 6, ), IconNameStatusContainer( isFullIcon: false, name: 'Preferences', icon: Assets.preferences, - onTap: () {}, + onTap: () { + GarageDoorDialogHelper.showPreferencesDialog(context); + }, status: false, textColor: ColorsManager.blackColor, - // paddingAmount: 6, ), ], ); diff --git a/lib/pages/device_managment/garage_door/widgets/opening_clsoing_time_dialog_body.dart b/lib/pages/device_managment/garage_door/widgets/opening_clsoing_time_dialog_body.dart new file mode 100644 index 00000000..ea76d901 --- /dev/null +++ b/lib/pages/device_managment/garage_door/widgets/opening_clsoing_time_dialog_body.dart @@ -0,0 +1,13 @@ +import 'package:flutter/material.dart'; + +class OpeningClosingTimeDialogBody extends StatelessWidget { + const OpeningClosingTimeDialogBody({super.key}); + + @override + Widget build(BuildContext context) { + return Container( + width: 350, + child: Text('asdasd'), + ); + } +} diff --git a/lib/pages/device_managment/garage_door/widgets/schedule__garage_table.dart b/lib/pages/device_managment/garage_door/widgets/schedule__garage_table.dart index 9bd75094..48ebbcad 100644 --- a/lib/pages/device_managment/garage_door/widgets/schedule__garage_table.dart +++ b/lib/pages/device_managment/garage_door/widgets/schedule__garage_table.dart @@ -26,7 +26,8 @@ class ScheduleGarageTableWidget extends StatelessWidget { Table( border: TableBorder.all( color: ColorsManager.graysColor, - borderRadius: const BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20)), + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(20), topRight: Radius.circular(20)), ), children: [ TableRow( @@ -50,17 +51,21 @@ class ScheduleGarageTableWidget extends StatelessWidget { BlocBuilder( builder: (context, state) { if (state is ScheduleGarageLoadingState) { - return const SizedBox(height: 200, child: Center(child: CircularProgressIndicator())); + return const SizedBox( + height: 200, + child: Center(child: CircularProgressIndicator())); } - if (state is GarageDoorLoadedState && state.status.schedules == null) { + if (state is GarageDoorLoadedState && + state.status.schedules == null) { return _buildEmptyState(context); } else if (state is GarageDoorLoadedState) { return Container( height: 200, decoration: BoxDecoration( border: Border.all(color: ColorsManager.graysColor), - borderRadius: - const BorderRadius.only(bottomLeft: Radius.circular(20), bottomRight: Radius.circular(20)), + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(20), + bottomRight: Radius.circular(20)), ), child: _buildTableBody(state, context)); } @@ -78,7 +83,8 @@ class ScheduleGarageTableWidget extends StatelessWidget { height: 200, decoration: BoxDecoration( border: Border.all(color: ColorsManager.graysColor), - borderRadius: const BorderRadius.only(bottomLeft: Radius.circular(20), bottomRight: Radius.circular(20)), + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(20), bottomRight: Radius.circular(20)), ), child: Center( child: Column( @@ -112,7 +118,8 @@ class ScheduleGarageTableWidget extends StatelessWidget { children: [ if (state.status.schedules != null) for (int i = 0; i < state.status.schedules!.length; i++) - _buildScheduleRow(state.status.schedules![i], i, context, state), + _buildScheduleRow( + state.status.schedules![i], i, context, state), ], ), ), @@ -134,7 +141,8 @@ class ScheduleGarageTableWidget extends StatelessWidget { ); } - TableRow _buildScheduleRow(ScheduleModel schedule, int index, BuildContext context, GarageDoorLoadedState state) { + TableRow _buildScheduleRow(ScheduleModel schedule, int index, + BuildContext context, GarageDoorLoadedState state) { return TableRow( children: [ Center( @@ -152,7 +160,8 @@ class ScheduleGarageTableWidget extends StatelessWidget { width: 24, height: 24, child: schedule.enable - ? const Icon(Icons.radio_button_checked, color: ColorsManager.blueColor) + ? const Icon(Icons.radio_button_checked, + color: ColorsManager.blueColor) : const Icon( Icons.radio_button_unchecked, color: ColorsManager.grayColor, @@ -160,7 +169,9 @@ class ScheduleGarageTableWidget extends StatelessWidget { ), ), ), - Center(child: Text(_getSelectedDays(ScheduleModel.parseSelectedDays(schedule.days)))), + Center( + child: Text(_getSelectedDays( + ScheduleModel.parseSelectedDays(schedule.days)))), Center(child: Text(formatIsoStringToTime(schedule.time, context))), Center(child: Text(schedule.function.value ? 'On' : 'Off')), Center( @@ -170,18 +181,24 @@ class ScheduleGarageTableWidget extends StatelessWidget { TextButton( style: TextButton.styleFrom(padding: EdgeInsets.zero), onPressed: () { - ScheduleGarageDoorDialogHelper.showAddGarageDoorScheduleDialog(context, - schedule: schedule, index: index, isEdit: true); + GarageDoorDialogHelper.showAddGarageDoorScheduleDialog( + context, + schedule: schedule, + index: index, + isEdit: true); }, child: Text( 'Edit', - style: context.textTheme.bodySmall!.copyWith(color: ColorsManager.blueColor), + style: context.textTheme.bodySmall! + .copyWith(color: ColorsManager.blueColor), ), ), TextButton( style: TextButton.styleFrom(padding: EdgeInsets.zero), onPressed: () { - context.read().add(DeleteGarageDoorScheduleEvent( + context + .read() + .add(DeleteGarageDoorScheduleEvent( index: index, scheduleId: schedule.scheduleId, deviceId: state.status.uuid, @@ -189,7 +206,8 @@ class ScheduleGarageTableWidget extends StatelessWidget { }, child: Text( 'Delete', - style: context.textTheme.bodySmall!.copyWith(color: ColorsManager.blueColor), + style: context.textTheme.bodySmall! + .copyWith(color: ColorsManager.blueColor), ), ), ], diff --git a/lib/pages/device_managment/garage_door/widgets/schedule_garage_view.dart b/lib/pages/device_managment/garage_door/widgets/schedule_garage_view.dart index 8303f4b3..107c8e0a 100644 --- a/lib/pages/device_managment/garage_door/widgets/schedule_garage_view.dart +++ b/lib/pages/device_managment/garage_door/widgets/schedule_garage_view.dart @@ -34,7 +34,8 @@ class _BuildScheduleViewState extends State { width: 700, child: SingleChildScrollView( child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 40.0, vertical: 20), + padding: + const EdgeInsets.symmetric(horizontal: 40.0, vertical: 20), child: BlocBuilder( builder: (context, state) { if (state is GarageDoorLoadedState) { @@ -46,8 +47,9 @@ class _BuildScheduleViewState extends State { ScheduleGarageManagementUI( state: state, onAddSchedule: () { - ScheduleGarageDoorDialogHelper.showAddGarageDoorScheduleDialog(context, - schedule: null, index: null, isEdit: false); + GarageDoorDialogHelper + .showAddGarageDoorScheduleDialog(context, + schedule: null, index: null, isEdit: false); }, ), const SizedBox(height: 20), diff --git a/lib/pages/device_managment/garage_door/widgets/time_out_alarm_dialog_body.dart b/lib/pages/device_managment/garage_door/widgets/time_out_alarm_dialog_body.dart new file mode 100644 index 00000000..948f8190 --- /dev/null +++ b/lib/pages/device_managment/garage_door/widgets/time_out_alarm_dialog_body.dart @@ -0,0 +1,13 @@ +import 'package:flutter/material.dart'; + +class TimeOutAlarmDialogBody extends StatelessWidget { + const TimeOutAlarmDialogBody({super.key}); + + @override + Widget build(BuildContext context) { + return Container( + width: 350, + child: Text('asdasd'), + ); + } +} diff --git a/lib/pages/device_managment/shared/toggle_widget.dart b/lib/pages/device_managment/shared/toggle_widget.dart index ee76d442..942c1b32 100644 --- a/lib/pages/device_managment/shared/toggle_widget.dart +++ b/lib/pages/device_managment/shared/toggle_widget.dart @@ -13,6 +13,7 @@ class ToggleWidget extends StatelessWidget { final Widget? labelWidget; final Function(dynamic value) onChange; final bool showToggle; + final bool showIcon; const ToggleWidget({ super.key, @@ -24,6 +25,7 @@ class ToggleWidget extends StatelessWidget { this.icon, this.labelWidget, this.showToggle = true, + this.showIcon = true, }); @override diff --git a/lib/utils/extension/build_context_x.dart b/lib/utils/extension/build_context_x.dart index 50bc5972..dbdbb347 100644 --- a/lib/utils/extension/build_context_x.dart +++ b/lib/utils/extension/build_context_x.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:syncrow_web/utils/color_manager.dart'; extension BuildContextExt on BuildContext { ThemeData get theme => Theme.of(this); @@ -14,4 +15,115 @@ extension BuildContextExt on BuildContext { double get screenHeight => MediaQuery.of(this).size.height; double get textScale => MediaQuery.textScalerOf(this).scale(1); + + void customAlertDialog({ + required Widget alertBody, + required String title, + required VoidCallback onConfirm, + VoidCallback? onDismiss, + bool? hideConfirmButton, + final double? dialogWidth, + }) { + showDialog( + context: this, + builder: (BuildContext context) { + return AlertDialog( + contentPadding: EdgeInsets.zero, + content: Container( + width: dialogWidth ?? 360, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), + ), + padding: const EdgeInsets.only(top: 20), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + /// header widget + Text( + title, + style: context.textTheme.bodyMedium!.copyWith( + color: ColorsManager.primaryColorWithOpacity, + fontWeight: FontWeight.bold, + ), + ), + Padding( + padding: const EdgeInsets.symmetric( + vertical: 15, + horizontal: 50, + ), + child: Container( + height: 1, + width: double.infinity, + color: ColorsManager.greyColor, + ), + ), + + /// custom body content + Flexible(child: SingleChildScrollView(child: alertBody)), + + /// Footer buttons + Container( + height: 1, + width: double.infinity, + color: ColorsManager.greyColor, + ), + hideConfirmButton != true + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GestureDetector( + onTap: onDismiss ?? + () { + Navigator.pop(context); + }, + child: Center( + child: Text( + 'Cancel', + style: context.textTheme.bodyMedium! + .copyWith(color: ColorsManager.greyColor), + ), + ), + ), + Container( + height: 50, + width: 1, + color: ColorsManager.greyColor, + ), + GestureDetector( + onTap: onConfirm, + child: Center( + child: Text( + 'Confirm', + style: context.textTheme.bodyMedium!.copyWith( + color: + ColorsManager.primaryColorWithOpacity), + ), + ), + ), + ], + ) + : Padding( + padding: const EdgeInsets.symmetric(vertical: 16.0), + child: GestureDetector( + onTap: onDismiss ?? + () { + Navigator.pop(context); + }, + child: Center( + child: Text( + 'Cancel', + style: context.textTheme.bodyMedium! + .copyWith(color: ColorsManager.greyColor), + ), + ), + ), + ), + ], + ), + ), + ); + }, + ); + } }