setting button

This commit is contained in:
ashraf_personal
2024-11-27 01:29:15 +03:00
parent 070fc8b78b
commit 75aa2042c1

View File

@ -16,6 +16,8 @@ class RoutineSearchAndButtons extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocBuilder<RoutineBloc, RoutineState>(
builder: (context, state) {
return LayoutBuilder( return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) { builder: (BuildContext context, BoxConstraints constraints) {
return Wrap( return Wrap(
@ -59,17 +61,19 @@ class RoutineSearchAndButtons extends StatelessWidget {
width: 200, width: 200,
child: Center( child: Center(
child: DefaultButton( child: DefaultButton(
onPressed: () async { onPressed: state.isAutomation ||
final result = state.isTabToRun
await SettingHelper.showSettingDialog( ? () async {
final result = await SettingHelper
.showSettingDialog(
context: context, context: context,
); );
if (result != null) { if (result != null) {
context context.read<RoutineBloc>().add(
.read<RoutineBloc>() AddSelectedIcon(result));
.add(AddSelectedIcon(result));
} }
}, }
: null,
borderRadius: 15, borderRadius: 15,
elevation: 0, elevation: 0,
borderColor: ColorsManager.greyColor, borderColor: ColorsManager.greyColor,
@ -122,7 +126,8 @@ class RoutineSearchAndButtons extends StatelessWidget {
child: Center( child: Center(
child: DefaultButton( child: DefaultButton(
onPressed: () { onPressed: () {
SaveRoutineHelper.showSaveRoutineDialog(context); SaveRoutineHelper.showSaveRoutineDialog(
context);
}, },
borderRadius: 15, borderRadius: 15,
elevation: 0, elevation: 0,
@ -151,8 +156,10 @@ class RoutineSearchAndButtons extends StatelessWidget {
width: 200, width: 200,
child: Center( child: Center(
child: DefaultButton( child: DefaultButton(
onPressed: () async { onPressed: state.isAutomation || state.isTabToRun
final result = await SettingHelper.showSettingDialog( ? () async {
final result =
await SettingHelper.showSettingDialog(
context: context, context: context,
); );
if (result != null) { if (result != null) {
@ -160,7 +167,8 @@ class RoutineSearchAndButtons extends StatelessWidget {
.read<RoutineBloc>() .read<RoutineBloc>()
.add(AddSelectedIcon(result)); .add(AddSelectedIcon(result));
} }
}, }
: null,
borderRadius: 15, borderRadius: 15,
elevation: 0, elevation: 0,
borderColor: ColorsManager.greyColor, borderColor: ColorsManager.greyColor,
@ -229,5 +237,7 @@ class RoutineSearchAndButtons extends StatelessWidget {
); );
}, },
); );
},
);
} }
} }