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