issue fixes

This commit is contained in:
mohammad
2024-11-24 17:04:29 +03:00
parent b365f7e347
commit efe68ecb1a
14 changed files with 332 additions and 269 deletions
@@ -71,9 +71,13 @@ class SixSceneInfoPage extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BodySmall(
text: _bloc.deviceInfo.productUuid,
fontColor: ColorsManager.primaryTextColor,
SizedBox(
width:
MediaQuery.of(context).size.width * 0.61,
child: BodySmall(
text: _bloc.deviceInfo.productUuid,
fontColor: ColorsManager.primaryTextColor,
),
),
InkWell(
onTap: () {
@@ -194,7 +194,12 @@ class SixSceneSettings extends StatelessWidget {
child: Column(
children: [
SettingWidget(
onChanged: (p0) {},
value: _bloc.enableAlarm,
onChanged: (p0) {
context
.read<SixSceneBloc>()
.add(ToggleEnableAlarmEvent(p0));
},
isNotification: true,
onTap: () {},
text: 'Offline Notification',
@@ -430,6 +435,7 @@ class SixSceneSettings extends StatelessWidget {
class SettingWidget extends StatelessWidget {
final String? text;
final bool? isUpdate;
final bool? value;
final bool? isNotification;
final String? icon;
final Function()? onTap;
@@ -440,6 +446,7 @@ class SettingWidget extends StatelessWidget {
this.text,
this.icon,
this.onTap,
this.value,
this.isUpdate,
this.onChanged,
this.isNotification = false,
@@ -502,7 +509,7 @@ class SettingWidget extends StatelessWidget {
: Transform.scale(
scale: .8,
child: CupertinoSwitch(
value: true,
value: value!,
onChanged: onChanged,
applyTheme: true,
),
@@ -24,50 +24,54 @@ class SixSceneScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return DefaultScaffold(
title: '6 Scene Switch',
actions: [
InkWell(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => SixSceneSettings(device: device!)),
);
},
child: SvgPicture.asset(Assets.assetsIconsSettings)),
const SizedBox(
width: 10,
)
],
child: BlocProvider(
create: (context) => SixSceneBloc(sixSceneId: device?.uuid ?? '')
..add(const SixSceneInitial())
..add(const SixSceneInitialInfo())
..add(const SexSceneSwitchInitial()),
child: BlocBuilder<SixSceneBloc, SixSceneState>(
builder: (context, state) {
final _bloc = BlocProvider.of<SixSceneBloc>(context);
SixSceneModel model = SixSceneModel(
scene_1: '',
scene_2: '',
scene_3: '',
scene_4: '',
scene_5: '',
scene_6: '',
scene_id_group_id: '',
switch_backlight: '');
return BlocProvider(
create: (context) => SixSceneBloc(sixSceneId: device?.uuid ?? '')
..add(const SixSceneInitial())
..add(const SixSceneInitialInfo())
..add(const SexSceneSwitchInitial()),
child: BlocBuilder<SixSceneBloc, SixSceneState>(
builder: (context, state) {
final _bloc = BlocProvider.of<SixSceneBloc>(context);
if (state is LoadingNewSate) {
model = state.device;
} else if (state is UpdateState) {
model = state.device;
}
return state is SixSceneLoadingState
SixSceneModel model = SixSceneModel(
scene_1: '',
scene_2: '',
scene_3: '',
scene_4: '',
scene_5: '',
scene_6: '',
scene_id_group_id: '',
switch_backlight: '',
);
if (state is LoadingNewSate) {
model = state.device;
} else if (state is UpdateState) {
model = state.device;
}
return DefaultScaffold(
title: _bloc.deviceInfo.subspace.subspaceName,
actions: [
InkWell(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => SixSceneSettings(device: device!),
),
);
},
child: SvgPicture.asset(Assets.assetsIconsSettings),
),
const SizedBox(width: 10),
],
child: state is SixSceneLoadingState
? const Center(
child: DefaultContainer(
width: 50,
height: 50,
child: CircularProgressIndicator()),
width: 50,
height: 50,
child: CircularProgressIndicator(),
),
)
: RefreshIndicator(
onRefresh: () async {
@@ -86,30 +90,24 @@ class SixSceneScreen extends StatelessWidget {
switch4Title: model.scene_4,
switch5Title: model.scene_5,
switch6Title: model.scene_6,
switch1Down:
_bloc.deviceStatus.switch_backlight == true
? Assets.switchOn
: Assets.switchOff,
switch1Up:
_bloc.deviceStatus.switch_backlight == true
? Assets.switchOn
: Assets.switchOff,
switch2Down:
_bloc.deviceStatus.switch_backlight == true
? Assets.switchOn
: Assets.switchOff,
switch2Up:
_bloc.deviceStatus.switch_backlight == true
? Assets.switchOn
: Assets.switchOff,
switch3Up:
_bloc.deviceStatus.switch_backlight == true
? Assets.switchOn
: Assets.switchOff,
switch3Down:
_bloc.deviceStatus.switch_backlight == true
? Assets.switchOn
: Assets.switchOff,
switch1Down: _bloc.deviceStatus.switch_backlight
? Assets.switchOn
: Assets.switchOff,
switch1Up: _bloc.deviceStatus.switch_backlight
? Assets.switchOn
: Assets.switchOff,
switch2Down: _bloc.deviceStatus.switch_backlight
? Assets.switchOn
: Assets.switchOff,
switch2Up: _bloc.deviceStatus.switch_backlight
? Assets.switchOn
: Assets.switchOff,
switch3Up: _bloc.deviceStatus.switch_backlight
? Assets.switchOn
: Assets.switchOff,
switch3Down: _bloc.deviceStatus.switch_backlight
? Assets.switchOn
: Assets.switchOff,
onSwitch3DownTap: () {
debugPrint("onSwitch3DownTap");
},
@@ -136,7 +134,6 @@ class SixSceneScreen extends StatelessWidget {
child: DefaultContainer(
onTap: () {
_bloc.add(ChangeSwitchStatusEvent());
},
child: Column(
crossAxisAlignment:
@@ -146,13 +143,13 @@ class SixSceneScreen extends StatelessWidget {
children: [
ConstrainedBox(
constraints: const BoxConstraints(
maxHeight: 46, maxWidth: 50),
maxHeight: 46,
maxWidth: 50,
),
child: SvgPicture.asset(
Assets.backlightIcon),
),
const SizedBox(
height: 15,
),
const SizedBox(height: 15),
const Flexible(
child: FittedBox(
child: BodySmall(
@@ -165,9 +162,7 @@ class SixSceneScreen extends StatelessWidget {
),
),
),
const SizedBox(
width: 10,
),
const SizedBox(width: 10),
Expanded(
child: DefaultContainer(
onTap: () async {
@@ -187,12 +182,12 @@ class SixSceneScreen extends StatelessWidget {
confirmTab: (v) {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) =>
SixSelectSceneFourPage(
deviceId:
device!.uuid,
switchSelected: v,
)),
builder: (context) =>
SixSelectSceneFourPage(
deviceId: device!.uuid,
switchSelected: v,
),
),
);
},
);
@@ -214,13 +209,13 @@ class SixSceneScreen extends StatelessWidget {
children: [
ConstrainedBox(
constraints: const BoxConstraints(
maxHeight: 46, maxWidth: 50),
maxHeight: 46,
maxWidth: 50,
),
child: SvgPicture.asset(
Assets.addSceneIcon),
),
const SizedBox(
height: 15,
),
const SizedBox(height: 15),
const Flexible(
child: FittedBox(
child: BodySmall(
@@ -235,15 +230,15 @@ class SixSceneScreen extends StatelessWidget {
),
],
),
)
),
],
),
),
],
),
);
},
),
),
);
},
),
);
}