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
@@ -24,47 +24,52 @@ class FourSceneScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return DefaultScaffold(
title: '4 Scene Switch',
actions: [
InkWell(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => FourSceneSettings(device: device!)),
);
},
child: SvgPicture.asset(Assets.assetsIconsSettings)),
const SizedBox(
width: 10,
)
],
child: BlocProvider(
create: (context) => FourSceneBloc(fourSceneId: device?.uuid ?? '')
..add(const FourSceneInitial())
..add(const FourSceneInitialInfo())
..add(const FourSceneSwitchInitial()),
child: BlocBuilder<FourSceneBloc, FourSceneState>(
builder: (context, state) {
final _bloc = BlocProvider.of<FourSceneBloc>(context);
FourSceneModelState model = FourSceneModelState(
scene_1: '',
scene_2: '',
scene_3: '',
scene_4: '',
scene_id_group_id: '',
switch_backlight: '');
if (state is LoadingNewSate) {
model = state.device;
} else if (state is UpdateState) {
model = state.device;
}
return state is FourSceneLoadingState
return BlocProvider(
create: (context) => FourSceneBloc(fourSceneId: device?.uuid ?? '')
..add(const FourSceneInitial())
..add(const FourSceneInitialInfo())
..add(const FourSceneSwitchInitial()),
child: BlocBuilder<FourSceneBloc, FourSceneState>(
builder: (context, state) {
final _bloc = BlocProvider.of<FourSceneBloc>(context);
FourSceneModelState model = FourSceneModelState(
scene_1: '',
scene_2: '',
scene_3: '',
scene_4: '',
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.name,
actions: [
InkWell(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => FourSceneSettings(device: device!),
),
);
},
child: SvgPicture.asset(Assets.assetsIconsSettings),
),
const SizedBox(width: 10),
],
child: state is FourSceneLoadingState
? const Center(
child: DefaultContainer(
width: 50,
height: 50,
child: CircularProgressIndicator()),
width: 50,
height: 50,
child: CircularProgressIndicator(),
),
)
: RefreshIndicator(
onRefresh: () async {
@@ -81,22 +86,18 @@ class FourSceneScreen extends StatelessWidget {
title2: model.scene_2,
title3: model.scene_3,
title4: model.scene_4,
switch1:
_bloc.deviceStatus.switch_backlight == true
? Assets.switchOn
: Assets.switchOff,
switch2:
_bloc.deviceStatus.switch_backlight == true
? Assets.switchOn
: Assets.switchOff,
switch3:
_bloc.deviceStatus.switch_backlight == true
? Assets.switchOn
: Assets.switchOff,
switch4:
_bloc.deviceStatus.switch_backlight == true
? Assets.switchOn
: Assets.switchOff,
switch1: _bloc.deviceStatus.switch_backlight
? Assets.switchOn
: Assets.switchOff,
switch2: _bloc.deviceStatus.switch_backlight
? Assets.switchOn
: Assets.switchOff,
switch3: _bloc.deviceStatus.switch_backlight
? Assets.switchOn
: Assets.switchOff,
switch4: _bloc.deviceStatus.switch_backlight
? Assets.switchOn
: Assets.switchOff,
onSwitch1UpTap: () {
debugPrint("Switch 1 Up tapped");
},
@@ -126,13 +127,13 @@ class FourSceneScreen 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(
@@ -145,9 +146,7 @@ class FourSceneScreen extends StatelessWidget {
),
),
),
const SizedBox(
width: 10,
),
const SizedBox(width: 10),
Expanded(
child: DefaultContainer(
onTap: () async {
@@ -162,13 +161,17 @@ class FourSceneScreen extends StatelessWidget {
cancelTab: () {
Navigator.of(context).pop();
},
confirmTab: (switchSelected) async {
confirmTab:
(switchSelected) async {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) =>
FourSelectSceneFourPage(
switchSelected:switchSelected,
deviceId: device!.uuid)),
builder: (context) =>
FourSelectSceneFourPage(
switchSelected:
switchSelected,
deviceId: device!.uuid,
),
),
);
},
);
@@ -190,13 +193,13 @@ class FourSceneScreen 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(
@@ -211,19 +214,16 @@ class FourSceneScreen extends StatelessWidget {
),
],
),
)
),
],
),
),
],
),
);
},
),
),
);
},
),
);
}
}
//MohaM&&&uba1
@@ -69,9 +69,13 @@ class FourSceneInfoPage extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BodySmall(
text: _bloc.deviceInfo.productUuid,
fontColor: ColorsManager.primaryTextColor,
Container(
width:
MediaQuery.of(context).size.width * 0.61,
child: BodySmall(
text: _bloc.deviceInfo.productUuid,
fontColor: ColorsManager.primaryTextColor,
),
),
InkWell(
onTap: () {
@@ -144,6 +144,7 @@ class FourSceneProfilePage extends StatelessWidget {
fontSize: 12,
fontColor: ColorsManager.grayColor,
),
const SizedBox(height: 7),
DefaultContainer(
padding: const EdgeInsets.all(20),
child: InkWell(
@@ -207,7 +207,12 @@ class FourSceneSettings extends StatelessWidget {
child: Column(
children: [
SettingWidget(
onChanged: (p0) {},
value: _bloc.enableAlarm,
onChanged: (p0) {
context
.read<FourSceneBloc>()
.add(ToggleEnableAlarmEvent(p0));
},
isNotification: true,
onTap: () {},
text: 'Offline Notification',
@@ -444,6 +449,7 @@ class FourSceneSettings extends StatelessWidget {
class SettingWidget extends StatelessWidget {
final String? text;
final bool? isUpdate;
final bool? value;
final bool? isNotification;
final String? icon;
final Function()? onTap;
@@ -453,6 +459,7 @@ class SettingWidget extends StatelessWidget {
{super.key,
this.text,
this.icon,
this.value,
this.onTap,
this.isUpdate,
this.onChanged,
@@ -516,7 +523,7 @@ class SettingWidget extends StatelessWidget {
: Transform.scale(
scale: .8,
child: CupertinoSwitch(
value: true,
value: value!,
onChanged: onChanged,
applyTheme: true,
),