mirror of
https://github.com/SyncrowIOT/web.git
synced 2026-10-27 07:27:58 +00:00
push centered 2 gang switch
This commit is contained in:
@@ -35,51 +35,46 @@ class TwoGangDeviceControlView extends StatelessWidget
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildStatusControls(BuildContext context, TwoGangStatusModel status) {
|
Widget _buildStatusControls(BuildContext context, TwoGangStatusModel status) {
|
||||||
final isExtraLarge = isExtraLargeScreenSize(context);
|
return Center(
|
||||||
final isLarge = isLargeScreenSize(context);
|
child: Wrap(
|
||||||
final isMedium = isMediumScreenSize(context);
|
alignment: WrapAlignment.center,
|
||||||
return GridView(
|
spacing: 12,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 50),
|
runSpacing: 12,
|
||||||
shrinkWrap: true,
|
children: [
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
SizedBox(
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
width: 200,
|
||||||
crossAxisCount: isLarge || isExtraLarge
|
child: ToggleWidget(
|
||||||
? 3
|
value: status.switch1,
|
||||||
: isMedium
|
code: 'switch_1',
|
||||||
? 2
|
deviceId: deviceId,
|
||||||
: 1,
|
label: 'Wall Light',
|
||||||
mainAxisExtent: 140,
|
onChange: (value) {
|
||||||
crossAxisSpacing: 12,
|
context.read<TwoGangSwitchBloc>().add(TwoGangSwitchControl(
|
||||||
mainAxisSpacing: 12,
|
deviceId: deviceId,
|
||||||
|
code: 'switch_1',
|
||||||
|
value: value,
|
||||||
|
));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 200,
|
||||||
|
child: ToggleWidget(
|
||||||
|
value: status.switch2,
|
||||||
|
code: 'switch_2',
|
||||||
|
deviceId: deviceId,
|
||||||
|
label: 'Ceiling Light',
|
||||||
|
onChange: (value) {
|
||||||
|
context.read<TwoGangSwitchBloc>().add(TwoGangSwitchControl(
|
||||||
|
deviceId: deviceId,
|
||||||
|
code: 'switch_2',
|
||||||
|
value: value,
|
||||||
|
));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
children: [
|
|
||||||
ToggleWidget(
|
|
||||||
value: status.switch1,
|
|
||||||
code: 'switch_1',
|
|
||||||
deviceId: deviceId,
|
|
||||||
label: 'Wall Light',
|
|
||||||
onChange: (value) {
|
|
||||||
context.read<TwoGangSwitchBloc>().add(TwoGangSwitchControl(
|
|
||||||
deviceId: deviceId,
|
|
||||||
code: 'switch_1',
|
|
||||||
value: value,
|
|
||||||
));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ToggleWidget(
|
|
||||||
value: status.switch2,
|
|
||||||
code: 'switch_2',
|
|
||||||
deviceId: deviceId,
|
|
||||||
label: 'Ceiling Light',
|
|
||||||
onChange: (value) {
|
|
||||||
context.read<TwoGangSwitchBloc>().add(TwoGangSwitchControl(
|
|
||||||
deviceId: deviceId,
|
|
||||||
code: 'switch_2',
|
|
||||||
value: value,
|
|
||||||
));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user