mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-26 03:17:55 +00:00
Fixed design issues
This commit is contained in:
+12
-14
@@ -1,14 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/effect_period_helper.dart';
|
||||
import 'package:syncrow_app/features/scene/widgets/effective_period_setting/period_options.dart';
|
||||
import 'package:syncrow_app/features/scene/widgets/effective_period_setting/repeat_days.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
||||
|
||||
import '../../helper/effect_period_helper.dart';
|
||||
|
||||
class EffectPeriodBottomSheetContent extends StatelessWidget {
|
||||
const EffectPeriodBottomSheetContent({super.key});
|
||||
|
||||
@@ -22,17 +19,18 @@ class EffectPeriodBottomSheetContent extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// Expanded(
|
||||
// child: TextButton(
|
||||
// onPressed: () => Navigator.pop(context),
|
||||
// child: BodySmall(
|
||||
// text: 'Save',
|
||||
// style:
|
||||
// context.bodySmall.copyWith(color: ColorsManager.primaryColorWithOpacity),
|
||||
// )),
|
||||
// ),
|
||||
const Spacer(),
|
||||
Expanded(
|
||||
child: TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: BodySmall(
|
||||
text: 'Save',
|
||||
style: context.bodySmall.copyWith(
|
||||
color: ColorsManager.primaryColorWithOpacity),
|
||||
)),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
// flex: 2,
|
||||
child: BodyMedium(
|
||||
text: 'Effective Period',
|
||||
fontColor: ColorsManager.primaryColorWithOpacity,
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'package:syncrow_app/features/scene/model/scenes_model.dart';
|
||||
import 'package:syncrow_app/features/scene/model/smart_scene_enable.dart';
|
||||
import 'package:syncrow_app/features/scene/widgets/scene_list_tile.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
@@ -21,12 +20,10 @@ class SmartSceneSelectAutomationList extends StatefulWidget {
|
||||
final List<ScenesModel> automationList;
|
||||
|
||||
@override
|
||||
State<SmartSceneSelectAutomationList> createState() =>
|
||||
_SmartSceneSelectAutomationListState();
|
||||
State<SmartSceneSelectAutomationList> createState() => _SmartSceneSelectAutomationListState();
|
||||
}
|
||||
|
||||
class _SmartSceneSelectAutomationListState
|
||||
extends State<SmartSceneSelectAutomationList> {
|
||||
class _SmartSceneSelectAutomationListState extends State<SmartSceneSelectAutomationList> {
|
||||
final List<Color> colorList = _generateDarkColors(100);
|
||||
|
||||
static List<Color> _generateDarkColors(int count) {
|
||||
@@ -34,8 +31,7 @@ class _SmartSceneSelectAutomationListState
|
||||
final colors = <Color>[];
|
||||
|
||||
while (colors.length < count) {
|
||||
final color =
|
||||
Color((random.nextDouble() * 0xFFFFFF).toInt()).withOpacity(1.0);
|
||||
final color = Color((random.nextDouble() * 0xFFFFFF).toInt()).withOpacity(1.0);
|
||||
if (_isDark(color)) {
|
||||
colors.add(color);
|
||||
}
|
||||
@@ -44,8 +40,7 @@ class _SmartSceneSelectAutomationListState
|
||||
}
|
||||
|
||||
static bool _isDark(Color color) {
|
||||
final brightness =
|
||||
((color.red * 299) + (color.green * 587) + (color.blue * 114)) / 1000;
|
||||
final brightness = ((color.red * 299) + (color.green * 587) + (color.blue * 114)) / 1000;
|
||||
return brightness < 128;
|
||||
}
|
||||
|
||||
@@ -57,15 +52,16 @@ class _SmartSceneSelectAutomationListState
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: BodySmall(
|
||||
text: 'Save',
|
||||
style: context.bodySmall
|
||||
.copyWith(color: ColorsManager.primaryColorWithOpacity),
|
||||
)),
|
||||
),
|
||||
// Expanded(
|
||||
// child: TextButton(
|
||||
// onPressed: () => Navigator.pop(context),
|
||||
// child: BodySmall(
|
||||
// text: 'Save',
|
||||
// style: context.bodySmall
|
||||
// .copyWith(color: ColorsManager.primaryColorWithOpacity),
|
||||
// )),
|
||||
// ),
|
||||
const Spacer(),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Padding(
|
||||
@@ -74,8 +70,7 @@ class _SmartSceneSelectAutomationListState
|
||||
text: 'Automation',
|
||||
textAlign: TextAlign.center,
|
||||
style: context.bodyMedium.copyWith(
|
||||
color: ColorsManager.primaryColorWithOpacity,
|
||||
fontWeight: FontWeight.bold),
|
||||
color: ColorsManager.primaryColorWithOpacity, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -97,12 +92,9 @@ class _SmartSceneSelectAutomationListState
|
||||
itemCount: widget.automationList.length,
|
||||
itemBuilder: (context, index) {
|
||||
final automation = widget.automationList[index];
|
||||
final isSelected =
|
||||
smartSceneEnable?.entityId == automation.id;
|
||||
final isSelected = smartSceneEnable?.entityId == automation.id;
|
||||
final descriptionSelected = isSelected
|
||||
? (smartSceneEnable?.actionExecutor == 'rule_enable'
|
||||
? 'Enable'
|
||||
: 'Disable')
|
||||
? (smartSceneEnable?.actionExecutor == 'rule_enable' ? 'Enable' : 'Disable')
|
||||
: automation.status == 'enable'
|
||||
? 'Enable'
|
||||
: 'Disable';
|
||||
@@ -136,17 +128,14 @@ class _SmartSceneSelectAutomationListState
|
||||
Navigator.pop(context);
|
||||
},
|
||||
onDismiss: () {
|
||||
context
|
||||
.read<SmartSceneSelectBloc>()
|
||||
.add(const SmartSceneClearEvent());
|
||||
context.read<SmartSceneSelectBloc>().add(const SmartSceneClearEvent());
|
||||
Navigator.pop(context);
|
||||
},
|
||||
);
|
||||
},
|
||||
label: BodyMedium(
|
||||
text: _capitalizeFirst(descriptionSelected),
|
||||
style: context.bodyMedium
|
||||
.copyWith(color: ColorsManager.greyColor),
|
||||
style: context.bodyMedium.copyWith(color: ColorsManager.greyColor),
|
||||
),
|
||||
icon: const Icon(
|
||||
Icons.arrow_forward_ios_rounded,
|
||||
@@ -173,9 +162,7 @@ class _SmartSceneSelectAutomationListState
|
||||
Navigator.pop(context);
|
||||
},
|
||||
onDismiss: () {
|
||||
context
|
||||
.read<SmartSceneSelectBloc>()
|
||||
.add(const SmartSceneClearEvent());
|
||||
context.read<SmartSceneSelectBloc>().add(const SmartSceneClearEvent());
|
||||
Navigator.pop(context);
|
||||
},
|
||||
);
|
||||
@@ -211,12 +198,10 @@ class EnableDisableAutomationDialog extends StatefulWidget {
|
||||
final String type;
|
||||
|
||||
@override
|
||||
State<EnableDisableAutomationDialog> createState() =>
|
||||
_EnableDisableAutomationDialogState();
|
||||
State<EnableDisableAutomationDialog> createState() => _EnableDisableAutomationDialogState();
|
||||
}
|
||||
|
||||
class _EnableDisableAutomationDialogState
|
||||
extends State<EnableDisableAutomationDialog> {
|
||||
class _EnableDisableAutomationDialogState extends State<EnableDisableAutomationDialog> {
|
||||
String? groupValue;
|
||||
final List<SceneOperationalValue> values = [
|
||||
SceneOperationalValue(
|
||||
@@ -234,16 +219,14 @@ class _EnableDisableAutomationDialogState
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
groupValue =
|
||||
widget.descriptionSelected == 'Enable' ? 'rule_enable' : 'rule_disable';
|
||||
groupValue = widget.descriptionSelected == 'Enable' ? 'rule_enable' : 'rule_disable';
|
||||
|
||||
context.read<SmartSceneSelectBloc>().add(SmartSceneEnableEvent(
|
||||
SmartSceneEnable(
|
||||
entityId: widget.automationId,
|
||||
actionExecutor: groupValue!,
|
||||
sceneORAutomationName: widget.sceneORAutomationName,
|
||||
type: widget.type,
|
||||
isAutomation: true)));
|
||||
context.read<SmartSceneSelectBloc>().add(SmartSceneEnableEvent(SmartSceneEnable(
|
||||
entityId: widget.automationId,
|
||||
actionExecutor: groupValue!,
|
||||
sceneORAutomationName: widget.sceneORAutomationName,
|
||||
type: widget.type,
|
||||
isAutomation: true)));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -269,14 +252,11 @@ class _EnableDisableAutomationDialogState
|
||||
setState(() {
|
||||
groupValue = value;
|
||||
});
|
||||
context
|
||||
.read<SmartSceneSelectBloc>()
|
||||
.add(SmartSceneEnableEvent(
|
||||
context.read<SmartSceneSelectBloc>().add(SmartSceneEnableEvent(
|
||||
SmartSceneEnable(
|
||||
entityId: widget.automationId,
|
||||
actionExecutor: value!,
|
||||
sceneORAutomationName:
|
||||
widget.sceneORAutomationName,
|
||||
sceneORAutomationName: widget.sceneORAutomationName,
|
||||
type: widget.type,
|
||||
isAutomation: true),
|
||||
));
|
||||
@@ -286,9 +266,7 @@ class _EnableDisableAutomationDialogState
|
||||
setState(() {
|
||||
groupValue = operation.value;
|
||||
});
|
||||
context
|
||||
.read<SmartSceneSelectBloc>()
|
||||
.add(SmartSceneEnableEvent(
|
||||
context.read<SmartSceneSelectBloc>().add(SmartSceneEnableEvent(
|
||||
SmartSceneEnable(
|
||||
entityId: widget.automationId,
|
||||
actionExecutor: operation.value,
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:syncrow_app/features/scene/model/scenes_model.dart';
|
||||
import 'package:syncrow_app/features/scene/model/smart_scene_enable.dart';
|
||||
import 'package:syncrow_app/features/scene/widgets/scene_list_tile.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
@@ -18,12 +17,10 @@ class SmartSceneSelectTabToRunList extends StatefulWidget {
|
||||
final List<ScenesModel> scenes;
|
||||
|
||||
@override
|
||||
State<SmartSceneSelectTabToRunList> createState() =>
|
||||
_SmartSceneSelectTabToRunListState();
|
||||
State<SmartSceneSelectTabToRunList> createState() => _SmartSceneSelectTabToRunListState();
|
||||
}
|
||||
|
||||
class _SmartSceneSelectTabToRunListState
|
||||
extends State<SmartSceneSelectTabToRunList> {
|
||||
class _SmartSceneSelectTabToRunListState extends State<SmartSceneSelectTabToRunList> {
|
||||
String groupValue = '';
|
||||
|
||||
@override
|
||||
@@ -34,15 +31,16 @@ class _SmartSceneSelectTabToRunListState
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: BodySmall(
|
||||
text: 'Save',
|
||||
style: context.bodySmall
|
||||
.copyWith(color: ColorsManager.primaryColorWithOpacity),
|
||||
)),
|
||||
),
|
||||
// Expanded(
|
||||
// child: TextButton(
|
||||
// onPressed: () => Navigator.pop(context),
|
||||
// child: BodySmall(
|
||||
// text: 'Save',
|
||||
// style: context.bodySmall
|
||||
// .copyWith(color: ColorsManager.primaryColorWithOpacity),
|
||||
// )),
|
||||
// ),
|
||||
const Spacer(),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Padding(
|
||||
@@ -51,8 +49,7 @@ class _SmartSceneSelectTabToRunListState
|
||||
text: 'Tab To Run',
|
||||
textAlign: TextAlign.center,
|
||||
style: context.bodyMedium.copyWith(
|
||||
color: ColorsManager.primaryColorWithOpacity,
|
||||
fontWeight: FontWeight.bold),
|
||||
color: ColorsManager.primaryColorWithOpacity, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -68,8 +65,7 @@ class _SmartSceneSelectTabToRunListState
|
||||
itemCount: widget.scenes.length,
|
||||
itemBuilder: (context, index) {
|
||||
final scene = widget.scenes[index];
|
||||
final selectedScene =
|
||||
context.read<SmartSceneSelectBloc>().smartSceneEnable;
|
||||
final selectedScene = context.read<SmartSceneSelectBloc>().smartSceneEnable;
|
||||
if (selectedScene != null) {
|
||||
if (scene.id == selectedScene.entityId) {
|
||||
groupValue = scene.id;
|
||||
@@ -111,9 +107,7 @@ class _SmartSceneSelectTabToRunListState
|
||||
setState(() {
|
||||
groupValue = scene.id;
|
||||
});
|
||||
context
|
||||
.read<SmartSceneSelectBloc>()
|
||||
.add(SmartSceneEnableEvent(SmartSceneEnable(
|
||||
context.read<SmartSceneSelectBloc>().add(SmartSceneEnableEvent(SmartSceneEnable(
|
||||
entityId: scene.id,
|
||||
actionExecutor: 'rule_enable',
|
||||
sceneORAutomationName: scene.name,
|
||||
|
||||
Reference in New Issue
Block a user