mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
setting button
This commit is contained in:
@ -16,50 +16,148 @@ class RoutineSearchAndButtons extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
return Wrap(
|
||||
runSpacing: 16,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
return BlocBuilder<RoutineBloc, RoutineState>(
|
||||
builder: (context, state) {
|
||||
return LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
return Wrap(
|
||||
runSpacing: 16,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Wrap(
|
||||
spacing: 12,
|
||||
runSpacing: 12,
|
||||
crossAxisAlignment: WrapCrossAlignment.end,
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: constraints.maxWidth > 700
|
||||
? 450
|
||||
: constraints.maxWidth - 32),
|
||||
child: StatefulTextField(
|
||||
title: 'Routine Name',
|
||||
height: 40,
|
||||
controller: TextEditingController(),
|
||||
hintText: 'Please enter the name',
|
||||
boxDecoration: containerWhiteDecoration,
|
||||
elevation: 0,
|
||||
borderRadius: 15,
|
||||
isRequired: true,
|
||||
width: 450,
|
||||
onChanged: (value) {
|
||||
context
|
||||
.read<RoutineBloc>()
|
||||
.add(SetRoutineName(value));
|
||||
},
|
||||
),
|
||||
),
|
||||
(constraints.maxWidth <= 1000)
|
||||
? const SizedBox()
|
||||
: SizedBox(
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Wrap(
|
||||
spacing: 12,
|
||||
runSpacing: 12,
|
||||
crossAxisAlignment: WrapCrossAlignment.end,
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: constraints.maxWidth > 700
|
||||
? 450
|
||||
: constraints.maxWidth - 32),
|
||||
child: StatefulTextField(
|
||||
title: 'Routine Name',
|
||||
height: 40,
|
||||
width: 200,
|
||||
child: Center(
|
||||
child: DefaultButton(
|
||||
onPressed: () async {
|
||||
controller: TextEditingController(),
|
||||
hintText: 'Please enter the name',
|
||||
boxDecoration: containerWhiteDecoration,
|
||||
elevation: 0,
|
||||
borderRadius: 15,
|
||||
isRequired: true,
|
||||
width: 450,
|
||||
onChanged: (value) {
|
||||
context
|
||||
.read<RoutineBloc>()
|
||||
.add(SetRoutineName(value));
|
||||
},
|
||||
),
|
||||
),
|
||||
(constraints.maxWidth <= 1000)
|
||||
? const SizedBox()
|
||||
: SizedBox(
|
||||
height: 40,
|
||||
width: 200,
|
||||
child: Center(
|
||||
child: DefaultButton(
|
||||
onPressed: state.isAutomation ||
|
||||
state.isTabToRun
|
||||
? () async {
|
||||
final result = await SettingHelper
|
||||
.showSettingDialog(
|
||||
context: context,
|
||||
);
|
||||
if (result != null) {
|
||||
context.read<RoutineBloc>().add(
|
||||
AddSelectedIcon(result));
|
||||
}
|
||||
}
|
||||
: null,
|
||||
borderRadius: 15,
|
||||
elevation: 0,
|
||||
borderColor: ColorsManager.greyColor,
|
||||
backgroundColor: ColorsManager.boxColor,
|
||||
child: const Text(
|
||||
'Settings',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: ColorsManager.primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (constraints.maxWidth > 1000)
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 40,
|
||||
width: 200,
|
||||
child: Center(
|
||||
child: DefaultButton(
|
||||
onPressed: () {
|
||||
DiscardDialog.show(context);
|
||||
},
|
||||
borderRadius: 15,
|
||||
elevation: 0,
|
||||
borderColor: ColorsManager.greyColor,
|
||||
backgroundColor: ColorsManager.boxColor,
|
||||
child: const Text(
|
||||
'Cancel',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: ColorsManager.blackColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
SizedBox(
|
||||
height: 40,
|
||||
width: 200,
|
||||
child: Center(
|
||||
child: DefaultButton(
|
||||
onPressed: () {
|
||||
SaveRoutineHelper.showSaveRoutineDialog(
|
||||
context);
|
||||
},
|
||||
borderRadius: 15,
|
||||
elevation: 0,
|
||||
backgroundColor: ColorsManager.primaryColor,
|
||||
child: const Text(
|
||||
'Save',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: ColorsManager.whiteColors,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
if (constraints.maxWidth <= 1000)
|
||||
Wrap(
|
||||
runSpacing: 12,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 40,
|
||||
width: 200,
|
||||
child: Center(
|
||||
child: DefaultButton(
|
||||
onPressed: state.isAutomation || state.isTabToRun
|
||||
? () async {
|
||||
final result =
|
||||
await SettingHelper.showSettingDialog(
|
||||
context: context,
|
||||
@ -69,29 +167,24 @@ class RoutineSearchAndButtons extends StatelessWidget {
|
||||
.read<RoutineBloc>()
|
||||
.add(AddSelectedIcon(result));
|
||||
}
|
||||
},
|
||||
borderRadius: 15,
|
||||
elevation: 0,
|
||||
borderColor: ColorsManager.greyColor,
|
||||
backgroundColor: ColorsManager.boxColor,
|
||||
child: const Text(
|
||||
'Settings',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: ColorsManager.primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
}
|
||||
: null,
|
||||
borderRadius: 15,
|
||||
elevation: 0,
|
||||
borderColor: ColorsManager.greyColor,
|
||||
backgroundColor: ColorsManager.boxColor,
|
||||
child: const Text(
|
||||
'Settings',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: ColorsManager.primaryColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (constraints.maxWidth > 1000)
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
SizedBox(
|
||||
height: 40,
|
||||
width: 200,
|
||||
@ -141,91 +234,8 @@ class RoutineSearchAndButtons extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
if (constraints.maxWidth <= 1000)
|
||||
Wrap(
|
||||
runSpacing: 12,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 40,
|
||||
width: 200,
|
||||
child: Center(
|
||||
child: DefaultButton(
|
||||
onPressed: () async {
|
||||
final result = await SettingHelper.showSettingDialog(
|
||||
context: context,
|
||||
);
|
||||
if (result != null) {
|
||||
context
|
||||
.read<RoutineBloc>()
|
||||
.add(AddSelectedIcon(result));
|
||||
}
|
||||
},
|
||||
borderRadius: 15,
|
||||
elevation: 0,
|
||||
borderColor: ColorsManager.greyColor,
|
||||
backgroundColor: ColorsManager.boxColor,
|
||||
child: const Text(
|
||||
'Settings',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: ColorsManager.primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
SizedBox(
|
||||
height: 40,
|
||||
width: 200,
|
||||
child: Center(
|
||||
child: DefaultButton(
|
||||
onPressed: () {
|
||||
DiscardDialog.show(context);
|
||||
},
|
||||
borderRadius: 15,
|
||||
elevation: 0,
|
||||
borderColor: ColorsManager.greyColor,
|
||||
backgroundColor: ColorsManager.boxColor,
|
||||
child: const Text(
|
||||
'Cancel',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: ColorsManager.blackColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
SizedBox(
|
||||
height: 40,
|
||||
width: 200,
|
||||
child: Center(
|
||||
child: DefaultButton(
|
||||
onPressed: () {
|
||||
SaveRoutineHelper.showSaveRoutineDialog(context);
|
||||
},
|
||||
borderRadius: 15,
|
||||
elevation: 0,
|
||||
backgroundColor: ColorsManager.primaryColor,
|
||||
child: const Text(
|
||||
'Save',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: ColorsManager.whiteColors,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
Reference in New Issue
Block a user