mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-25 15:59:40 +00:00
Refactor color management and UI components for consistency
- Updated color references in various widgets to use the new `opaquePrimary` color for better visual consistency. - Refactored `ColorsManager` to improve color definitions and removed redundant color declarations. - Enhanced UI elements across multiple dialogs and widgets to ensure a cohesive design language. This change promotes maintainability and aligns with the updated color scheme.
This commit is contained in:
@ -61,8 +61,9 @@ class _RoutineSearchAndButtonsState extends State<RoutineSearchAndButtons> {
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth:
|
||||
constraints.maxWidth > 700 ? 450 : constraints.maxWidth - 32),
|
||||
maxWidth: constraints.maxWidth > 700
|
||||
? 450
|
||||
: constraints.maxWidth - 32),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@ -71,7 +72,9 @@ class _RoutineSearchAndButtonsState extends State<RoutineSearchAndButtons> {
|
||||
children: [
|
||||
Text('* ',
|
||||
style: context.textTheme.bodyMedium!
|
||||
.copyWith(color: ColorsManager.red, fontSize: 13)),
|
||||
.copyWith(
|
||||
color: ColorsManager.red,
|
||||
fontSize: 13)),
|
||||
Text(
|
||||
'Routine Name',
|
||||
style: context.textTheme.bodyMedium!.copyWith(
|
||||
@ -93,9 +96,11 @@ class _RoutineSearchAndButtonsState extends State<RoutineSearchAndButtons> {
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Please enter the name',
|
||||
hintStyle: context.textTheme.bodyMedium!
|
||||
.copyWith(fontSize: 12, color: ColorsManager.grayColor),
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
||||
.copyWith(
|
||||
fontSize: 12,
|
||||
color: ColorsManager.grayColor),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12, vertical: 10),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
onTapOutside: (_) {
|
||||
@ -121,9 +126,11 @@ class _RoutineSearchAndButtonsState extends State<RoutineSearchAndButtons> {
|
||||
width: 200,
|
||||
child: Center(
|
||||
child: DefaultButton(
|
||||
onPressed: state.isAutomation || state.isTabToRun
|
||||
onPressed: state.isAutomation ||
|
||||
state.isTabToRun
|
||||
? () async {
|
||||
final result = await SettingHelper.showSettingDialog(
|
||||
final result = await SettingHelper
|
||||
.showSettingDialog(
|
||||
context: context,
|
||||
iconId: state.selectedIcon ?? '',
|
||||
);
|
||||
@ -186,10 +193,12 @@ class _RoutineSearchAndButtonsState extends State<RoutineSearchAndButtons> {
|
||||
child: Center(
|
||||
child: DefaultButton(
|
||||
onPressed: () async {
|
||||
if (state.routineName == null || state.routineName!.isEmpty) {
|
||||
if (state.routineName == null ||
|
||||
state.routineName!.isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: const Text('Please enter the routine name'),
|
||||
content: const Text(
|
||||
'Please enter the routine name'),
|
||||
duration: const Duration(seconds: 2),
|
||||
backgroundColor: ColorsManager.red,
|
||||
action: SnackBarAction(
|
||||
@ -203,10 +212,12 @@ class _RoutineSearchAndButtonsState extends State<RoutineSearchAndButtons> {
|
||||
return;
|
||||
}
|
||||
|
||||
if (state.ifItems.isEmpty || state.thenItems.isEmpty) {
|
||||
if (state.ifItems.isEmpty ||
|
||||
state.thenItems.isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: const Text('Please add if and then condition'),
|
||||
content: const Text(
|
||||
'Please add if and then condition'),
|
||||
duration: const Duration(seconds: 2),
|
||||
backgroundColor: ColorsManager.red,
|
||||
action: SnackBarAction(
|
||||
@ -221,7 +232,8 @@ class _RoutineSearchAndButtonsState extends State<RoutineSearchAndButtons> {
|
||||
}
|
||||
// final result =
|
||||
// await
|
||||
BlocProvider.of<RoutineBloc>(context).add(ResetErrorMessage());
|
||||
BlocProvider.of<RoutineBloc>(context)
|
||||
.add(ResetErrorMessage());
|
||||
SaveRoutineHelper.showSaveRoutineDialog(context);
|
||||
// if (result != null && result) {
|
||||
// BlocProvider.of<RoutineBloc>(context).add(
|
||||
@ -240,7 +252,7 @@ class _RoutineSearchAndButtonsState extends State<RoutineSearchAndButtons> {
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: ColorsManager.whiteColors,
|
||||
color: ColorsManager.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -261,10 +273,14 @@ class _RoutineSearchAndButtonsState extends State<RoutineSearchAndButtons> {
|
||||
child: DefaultButton(
|
||||
onPressed: state.isAutomation || state.isTabToRun
|
||||
? () async {
|
||||
final result = await SettingHelper.showSettingDialog(
|
||||
context: context, iconId: state.selectedIcon ?? '');
|
||||
final result =
|
||||
await SettingHelper.showSettingDialog(
|
||||
context: context,
|
||||
iconId: state.selectedIcon ?? '');
|
||||
if (result != null) {
|
||||
context.read<RoutineBloc>().add(AddSelectedIcon(result));
|
||||
context
|
||||
.read<RoutineBloc>()
|
||||
.add(AddSelectedIcon(result));
|
||||
}
|
||||
}
|
||||
: null,
|
||||
@ -314,10 +330,12 @@ class _RoutineSearchAndButtonsState extends State<RoutineSearchAndButtons> {
|
||||
child: Center(
|
||||
child: DefaultButton(
|
||||
onPressed: () async {
|
||||
if (state.routineName == null || state.routineName!.isEmpty) {
|
||||
if (state.routineName == null ||
|
||||
state.routineName!.isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: const Text('Please enter the routine name'),
|
||||
content:
|
||||
const Text('Please enter the routine name'),
|
||||
duration: const Duration(seconds: 2),
|
||||
backgroundColor: ColorsManager.red,
|
||||
action: SnackBarAction(
|
||||
@ -334,7 +352,8 @@ class _RoutineSearchAndButtonsState extends State<RoutineSearchAndButtons> {
|
||||
if (state.ifItems.isEmpty || state.thenItems.isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: const Text('Please add if and then condition'),
|
||||
content: const Text(
|
||||
'Please add if and then condition'),
|
||||
duration: const Duration(seconds: 2),
|
||||
backgroundColor: ColorsManager.red,
|
||||
action: SnackBarAction(
|
||||
@ -349,7 +368,8 @@ class _RoutineSearchAndButtonsState extends State<RoutineSearchAndButtons> {
|
||||
}
|
||||
// final result =
|
||||
// await
|
||||
BlocProvider.of<RoutineBloc>(context).add(ResetErrorMessage());
|
||||
BlocProvider.of<RoutineBloc>(context)
|
||||
.add(ResetErrorMessage());
|
||||
SaveRoutineHelper.showSaveRoutineDialog(context);
|
||||
// if (result != null && result) {
|
||||
// BlocProvider.of<RoutineBloc>(context).add(
|
||||
@ -368,7 +388,7 @@ class _RoutineSearchAndButtonsState extends State<RoutineSearchAndButtons> {
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: ColorsManager.whiteColors,
|
||||
color: ColorsManager.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
Reference in New Issue
Block a user