Enhance scheduling UI in glass switch control views with improved layout and dialog integration

This commit is contained in:
mohammad
2025-06-19 16:38:45 +03:00
parent 0b774a6dfc
commit 8cf73e3efc
2 changed files with 193 additions and 42 deletions

View File

@ -106,14 +106,123 @@ class ThreeGangGlassSwitchControlView extends StatelessWidget
); );
}, },
), ),
ToggleWidget( GestureDetector(
value: false, onTap: () {
code: '', showDialog<void>(
deviceId: deviceId, context: context,
label: 'Preferences', builder: (ctx) => BlocProvider.value(
icon: Assets.preferences, value: BlocProvider.of<ThreeGangGlassSwitchBloc>(context),
onChange: (value) {}, child: BuildScheduleView(
showToggle: false, category: 'switch_1',
deviceUuid: deviceId,
),
));
},
child: DeviceControlsContainer(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 60,
height: 60,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: ColorsManager.whiteColors,
),
margin: const EdgeInsets.symmetric(horizontal: 4),
padding: const EdgeInsets.all(12),
child: ClipOval(
child: SvgPicture.asset(
Assets.scheduling,
fit: BoxFit.fill,
),
),
),
const Spacer(),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Wall Light',
textAlign: TextAlign.center,
style: context.textTheme.titleMedium!.copyWith(
fontWeight: FontWeight.w200,
fontSize: 12,
color: ColorsManager.blackColor,
),
),
Text(
'Scheduling',
textAlign: TextAlign.center,
style: context.textTheme.titleMedium!.copyWith(
fontWeight: FontWeight.w400,
color: ColorsManager.blackColor,
),
),
],
),
],
),
),
),
GestureDetector(
onTap: () {
showDialog<void>(
context: context,
builder: (ctx) => BlocProvider.value(
value: BlocProvider.of<ThreeGangGlassSwitchBloc>(context),
child: BuildScheduleView(
category: 'switch_2',
deviceUuid: deviceId,
),
));
},
child: DeviceControlsContainer(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 60,
height: 60,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: ColorsManager.whiteColors,
),
margin: const EdgeInsets.symmetric(horizontal: 4),
padding: const EdgeInsets.all(12),
child: ClipOval(
child: SvgPicture.asset(
Assets.scheduling,
fit: BoxFit.fill,
),
),
),
const Spacer(),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Ceiling Light',
textAlign: TextAlign.center,
style: context.textTheme.titleMedium!.copyWith(
fontWeight: FontWeight.w200,
fontSize: 12,
color: ColorsManager.blackColor,
),
),
Text(
'Scheduling',
textAlign: TextAlign.center,
style: context.textTheme.titleMedium!.copyWith(
fontWeight: FontWeight.w400,
color: ColorsManager.blackColor,
),
),
],
),
],
),
),
), ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
@ -148,18 +257,41 @@ class ThreeGangGlassSwitchControlView extends StatelessWidget
), ),
), ),
const Spacer(), const Spacer(),
Text( Column(
'Scheduling', crossAxisAlignment: CrossAxisAlignment.start,
textAlign: TextAlign.center, children: [
style: context.textTheme.titleMedium!.copyWith( Text(
fontWeight: FontWeight.w400, 'SpotLight',
color: ColorsManager.blackColor, textAlign: TextAlign.center,
), style: context.textTheme.titleMedium!.copyWith(
fontWeight: FontWeight.w200,
fontSize: 12,
color: ColorsManager.blackColor,
),
),
Text(
'Scheduling',
textAlign: TextAlign.center,
style: context.textTheme.titleMedium!.copyWith(
fontWeight: FontWeight.w400,
color: ColorsManager.blackColor,
),
),
],
), ),
], ],
), ),
), ),
) ),
ToggleWidget(
value: false,
code: '',
deviceId: deviceId,
label: 'Preferences',
icon: Assets.preferences,
onChange: (value) {},
showToggle: false,
),
], ],
); );
} }

View File

@ -98,18 +98,9 @@ class TwoGangGlassSwitchControlView extends StatelessWidget
onChange: (value) {}, onChange: (value) {},
showToggle: false, showToggle: false,
), ),
// ToggleWidget(
// value: false,
// code: '',
// deviceId: deviceId,
// label: 'Scheduling',
// icon: Assets.scheduling,
// onChange: (value) {},
// showToggle: false,
// ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
showDialog( showDialog<void>(
context: context, context: context,
builder: (ctx) => BlocProvider.value( builder: (ctx) => BlocProvider.value(
value: BlocProvider.of<TwoGangGlassSwitchBloc>(context), value: BlocProvider.of<TwoGangGlassSwitchBloc>(context),
@ -140,21 +131,35 @@ class TwoGangGlassSwitchControlView extends StatelessWidget
), ),
), ),
const Spacer(), const Spacer(),
Text( Column(
'Scheduling', crossAxisAlignment: CrossAxisAlignment.start,
textAlign: TextAlign.center, children: [
style: context.textTheme.titleMedium!.copyWith( Text(
fontWeight: FontWeight.w400, 'Wall Light',
color: ColorsManager.blackColor, textAlign: TextAlign.center,
), style: context.textTheme.titleMedium!.copyWith(
fontWeight: FontWeight.w200,
fontSize: 12,
color: ColorsManager.blackColor,
),
),
Text(
'Scheduling',
textAlign: TextAlign.center,
style: context.textTheme.titleMedium!.copyWith(
fontWeight: FontWeight.w400,
color: ColorsManager.blackColor,
),
),
],
), ),
], ],
), ),
), ),
), ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
showDialog( showDialog<void>(
context: context, context: context,
builder: (ctx) => BlocProvider.value( builder: (ctx) => BlocProvider.value(
value: BlocProvider.of<TwoGangGlassSwitchBloc>(context), value: BlocProvider.of<TwoGangGlassSwitchBloc>(context),
@ -185,13 +190,27 @@ class TwoGangGlassSwitchControlView extends StatelessWidget
), ),
), ),
const Spacer(), const Spacer(),
Text( Column(
'Scheduling', crossAxisAlignment: CrossAxisAlignment.start,
textAlign: TextAlign.center, children: [
style: context.textTheme.titleMedium!.copyWith( Text(
fontWeight: FontWeight.w400, 'Ceiling Light',
color: ColorsManager.blackColor, textAlign: TextAlign.center,
), style: context.textTheme.titleMedium!.copyWith(
fontWeight: FontWeight.w200,
fontSize: 12,
color: ColorsManager.blackColor,
),
),
Text(
'Scheduling',
textAlign: TextAlign.center,
style: context.textTheme.titleMedium!.copyWith(
fontWeight: FontWeight.w400,
color: ColorsManager.blackColor,
),
),
],
), ),
], ],
), ),