mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-09 22:57:18 +00:00
Refactor screen titles to use bloc device info
This commit is contained in:
@ -28,406 +28,449 @@ class SettingsPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DefaultScaffold(
|
||||
title: 'Device Settings',
|
||||
child: BlocProvider(
|
||||
create: (context) => DeviceSettingBloc(deviceId: device?.uuid ?? '')
|
||||
..add(const DeviceSettingInitial())
|
||||
..add(const DeviceSettingInitialInfo()),
|
||||
child: BlocBuilder<DeviceSettingBloc, DeviceSettingState>(
|
||||
builder: (context, state) {
|
||||
final _bloc = BlocProvider.of<DeviceSettingBloc>(context);
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (didPop) {
|
||||
if (didPop) {
|
||||
return;
|
||||
}
|
||||
Navigator.of(context).pop(true);
|
||||
},
|
||||
child: DefaultScaffold(
|
||||
title: 'Device Settings',
|
||||
child: BlocProvider(
|
||||
create: (context) => DeviceSettingBloc(deviceId: device?.uuid ?? '')
|
||||
..add(const DeviceSettingInitial())
|
||||
..add(const DeviceSettingInitialInfo()),
|
||||
child: BlocBuilder<DeviceSettingBloc, DeviceSettingState>(
|
||||
builder: (context, state) {
|
||||
final _bloc = BlocProvider.of<DeviceSettingBloc>(context);
|
||||
|
||||
return state is DeviceSettingLoadingState
|
||||
? const Center(
|
||||
child:
|
||||
DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
|
||||
)
|
||||
: ListView(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 10,
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
bool val = await Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => SettingProfilePage(
|
||||
device: device,
|
||||
),
|
||||
),
|
||||
);
|
||||
if (val == true) {
|
||||
_bloc.add(const DeviceSettingInitialInfo());
|
||||
}
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
DefaultContainer(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(30)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 90),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
child: Text(
|
||||
_bloc.deviceInfo.name,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: ColorsManager.grayColor,
|
||||
),
|
||||
overflow: TextOverflow
|
||||
.ellipsis, // Adds ellipsis (...) when the text overflows.
|
||||
maxLines:
|
||||
1, // Restricts the text to a single line.
|
||||
)),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
BodySmall(
|
||||
text: _bloc.deviceInfo.subspace.subspaceName),
|
||||
],
|
||||
),
|
||||
),
|
||||
SvgPicture.asset(
|
||||
Assets.editNameSetting,
|
||||
fit: BoxFit.contain,
|
||||
height: 30,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: 20,
|
||||
child: CircleAvatar(
|
||||
radius: 43,
|
||||
backgroundColor: Colors.white,
|
||||
child: CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundColor: Colors.white,
|
||||
child: CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundColor: ColorsManager.backgroundColor,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
device!.type == 'NCPS'
|
||||
? SizedBox(
|
||||
height: 80,
|
||||
width: 50,
|
||||
child: SvgPicture.asset(
|
||||
Assets.flushIcon,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
):
|
||||
device!.type == "SOS"
|
||||
? ClipOval(
|
||||
child: SvgPicture.asset(
|
||||
Assets.sosHomeIcon,
|
||||
fit: BoxFit.contain,
|
||||
height: 70,
|
||||
),
|
||||
)
|
||||
: Padding(
|
||||
padding: device!.type == "4S"
|
||||
? const EdgeInsets.only(top: 5)
|
||||
: const EdgeInsets.only(top: 0),
|
||||
child: SizedBox(
|
||||
height: 70,
|
||||
child: SvgPicture.asset(
|
||||
device!.type == "4S"
|
||||
? Assets.fourSceneIcon
|
||||
: Assets.sixSceneIcon,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
],
|
||||
return state is DeviceSettingLoadingState
|
||||
? const Center(
|
||||
child: DefaultContainer(
|
||||
width: 50,
|
||||
height: 50,
|
||||
child: CircularProgressIndicator()),
|
||||
)
|
||||
: ListView(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const BodyMedium(
|
||||
text: 'Device Management',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 12,
|
||||
fontColor: ColorsManager.grayColor,
|
||||
),
|
||||
DefaultContainer(
|
||||
child: Column(
|
||||
children: [
|
||||
SettingWidget(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => SettingInfoPage(
|
||||
device: device!,
|
||||
)),
|
||||
);
|
||||
},
|
||||
text: 'Device Information',
|
||||
icon: Assets.infoIcon,
|
||||
),
|
||||
// const Divider(
|
||||
// color: ColorsManager.dividerColor,
|
||||
// ),
|
||||
// SettingWidget(
|
||||
// onTap: () {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// ShareFourScenePage(
|
||||
// device: device!)),
|
||||
// );
|
||||
// },
|
||||
// text: 'Tap-to Run and Automation',
|
||||
// icon: Assets.tapRunIcon,
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
// const BodyMedium(
|
||||
// text: 'Device Offline Notification',
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 12,
|
||||
// fontColor: ColorsManager.grayColor,
|
||||
// ),
|
||||
// DefaultContainer(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// SettingWidget(
|
||||
// value: _bloc.enableAlarm,
|
||||
// onChanged: (p0) {
|
||||
// context
|
||||
// .read<DeviceSettingBloc>()
|
||||
// .add(ToggleEnableAlarmEvent(p0));
|
||||
// },
|
||||
// isNotification: true,
|
||||
// onTap: () {},
|
||||
// text: 'Offline Notification',
|
||||
// icon: Assets.notificationIcon,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(height: 20),
|
||||
// const BodyMedium(
|
||||
// text: 'Others',
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 12,
|
||||
// fontColor: ColorsManager.grayColor,
|
||||
// ),
|
||||
// const SizedBox(height: 5),
|
||||
// DefaultContainer(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// SettingWidget(
|
||||
// onTap: () {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// ShareDevicePage(device: device!)),
|
||||
// );
|
||||
// },
|
||||
// text: 'Share Device',
|
||||
// icon: Assets.shareIcon,
|
||||
// ),
|
||||
// // const Divider(
|
||||
// // color: ColorsManager.dividerColor,
|
||||
// // ),
|
||||
// // SettingWidget(
|
||||
// // onTap: () {
|
||||
// // Navigator.of(context).push(
|
||||
// // MaterialPageRoute(
|
||||
// // builder: (context) =>
|
||||
// // FourSceneCreateGroup(
|
||||
// // device: device!)),
|
||||
// // );
|
||||
// // },
|
||||
// // text: 'Create Group',
|
||||
// // icon: Assets.createGroupIcon,
|
||||
// // ),
|
||||
// const Divider(
|
||||
// color: ColorsManager.dividerColor,
|
||||
// ),
|
||||
// SettingWidget(
|
||||
// onTap: () {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// FaqSettingPage(device: device!)),
|
||||
// );
|
||||
// },
|
||||
// text: 'Device FAQ',
|
||||
// icon: Assets.faqIcon,
|
||||
// ),
|
||||
// const Divider(
|
||||
// color: ColorsManager.dividerColor,
|
||||
// ),
|
||||
// SettingWidget(
|
||||
// onTapUpdate: () {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return UpdateInfoDialog(
|
||||
// cancelTab: () {
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// confirmTab: () {
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// isUpdate: true,
|
||||
// onTap: () {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// const UpdatePageSetting()),
|
||||
// );
|
||||
// },
|
||||
// text: 'Device Update',
|
||||
// icon: Assets.updateIcon,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
const SizedBox(height: 20),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return Container(
|
||||
height: 200,
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
bool val = await Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => SettingProfilePage(
|
||||
device: device,
|
||||
),
|
||||
),
|
||||
);
|
||||
if (val == true) {
|
||||
_bloc.add(const DeviceSettingInitialInfo());
|
||||
}
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const BodyMedium(
|
||||
text: 'Remove Device',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 16,
|
||||
fontColor: ColorsManager.red,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const SizedBox(
|
||||
width: 250,
|
||||
child: Divider(
|
||||
color: ColorsManager.dividerColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return DisconnectDeviceDialog(
|
||||
cancelTab: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
confirmTab: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: const BodyMedium(
|
||||
text: 'Disconnect Device',
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 15,
|
||||
fontColor: ColorsManager.textPrimaryColor,
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: ColorsManager.textGray,
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return DisconnectWipeData(
|
||||
cancelTab: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
confirmTab: () {
|
||||
_bloc.add(DeleteDeviceEvent());
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: const BodyMedium(
|
||||
text: 'Disconnect Device and Wipe Data',
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 15,
|
||||
fontColor: ColorsManager.textPrimaryColor,
|
||||
DefaultContainer(
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(30)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 90),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
child: Text(
|
||||
_bloc.deviceInfo.name,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight:
|
||||
FontWeight.w700,
|
||||
color: ColorsManager
|
||||
.grayColor,
|
||||
),
|
||||
overflow: TextOverflow
|
||||
.ellipsis, // Adds ellipsis (...) when the text overflows.
|
||||
maxLines:
|
||||
1, // Restricts the text to a single line.
|
||||
)),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
BodySmall(
|
||||
text: _bloc
|
||||
.deviceInfo
|
||||
.subspace
|
||||
.subspaceName),
|
||||
],
|
||||
),
|
||||
),
|
||||
SvgPicture.asset(
|
||||
Assets.editNameSetting,
|
||||
fit: BoxFit.contain,
|
||||
height: 30,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: ColorsManager.textGray,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: const Center(
|
||||
child: BodyMedium(
|
||||
text: 'Remove Device',
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 15,
|
||||
fontColor: ColorsManager.red,
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: 20,
|
||||
child: CircleAvatar(
|
||||
radius: 43,
|
||||
backgroundColor: Colors.white,
|
||||
child: CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundColor: Colors.white,
|
||||
child: CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundColor:
|
||||
ColorsManager.backgroundColor,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
device!.type == 'NCPS'
|
||||
? SizedBox(
|
||||
height: 80,
|
||||
width: 50,
|
||||
child: SvgPicture.asset(
|
||||
Assets.flushIcon,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
)
|
||||
: device!.type == "SOS"
|
||||
? ClipOval(
|
||||
child:
|
||||
SvgPicture.asset(
|
||||
Assets.sosHomeIcon,
|
||||
fit: BoxFit.contain,
|
||||
height: 70,
|
||||
),
|
||||
)
|
||||
: Padding(
|
||||
padding: device!
|
||||
.type ==
|
||||
"4S"
|
||||
? const EdgeInsets
|
||||
.only(top: 5)
|
||||
: const EdgeInsets
|
||||
.only(top: 0),
|
||||
child: SizedBox(
|
||||
height: 70,
|
||||
child: SvgPicture
|
||||
.asset(
|
||||
device!.type ==
|
||||
"4S"
|
||||
? Assets
|
||||
.fourSceneIcon
|
||||
: Assets
|
||||
.sixSceneIcon,
|
||||
fit: BoxFit
|
||||
.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
const SizedBox(height: 20),
|
||||
const BodyMedium(
|
||||
text: 'Device Management',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 12,
|
||||
fontColor: ColorsManager.grayColor,
|
||||
),
|
||||
DefaultContainer(
|
||||
child: Column(
|
||||
children: [
|
||||
SettingWidget(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => SettingInfoPage(
|
||||
device: device!,
|
||||
)),
|
||||
);
|
||||
},
|
||||
text: 'Device Information',
|
||||
icon: Assets.infoIcon,
|
||||
),
|
||||
// const Divider(
|
||||
// color: ColorsManager.dividerColor,
|
||||
// ),
|
||||
// SettingWidget(
|
||||
// onTap: () {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// ShareFourScenePage(
|
||||
// device: device!)),
|
||||
// );
|
||||
// },
|
||||
// text: 'Tap-to Run and Automation',
|
||||
// icon: Assets.tapRunIcon,
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
// const BodyMedium(
|
||||
// text: 'Device Offline Notification',
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 12,
|
||||
// fontColor: ColorsManager.grayColor,
|
||||
// ),
|
||||
// DefaultContainer(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// SettingWidget(
|
||||
// value: _bloc.enableAlarm,
|
||||
// onChanged: (p0) {
|
||||
// context
|
||||
// .read<DeviceSettingBloc>()
|
||||
// .add(ToggleEnableAlarmEvent(p0));
|
||||
// },
|
||||
// isNotification: true,
|
||||
// onTap: () {},
|
||||
// text: 'Offline Notification',
|
||||
// icon: Assets.notificationIcon,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(height: 20),
|
||||
// const BodyMedium(
|
||||
// text: 'Others',
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 12,
|
||||
// fontColor: ColorsManager.grayColor,
|
||||
// ),
|
||||
// const SizedBox(height: 5),
|
||||
// DefaultContainer(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// SettingWidget(
|
||||
// onTap: () {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// ShareDevicePage(device: device!)),
|
||||
// );
|
||||
// },
|
||||
// text: 'Share Device',
|
||||
// icon: Assets.shareIcon,
|
||||
// ),
|
||||
// // const Divider(
|
||||
// // color: ColorsManager.dividerColor,
|
||||
// // ),
|
||||
// // SettingWidget(
|
||||
// // onTap: () {
|
||||
// // Navigator.of(context).push(
|
||||
// // MaterialPageRoute(
|
||||
// // builder: (context) =>
|
||||
// // FourSceneCreateGroup(
|
||||
// // device: device!)),
|
||||
// // );
|
||||
// // },
|
||||
// // text: 'Create Group',
|
||||
// // icon: Assets.createGroupIcon,
|
||||
// // ),
|
||||
// const Divider(
|
||||
// color: ColorsManager.dividerColor,
|
||||
// ),
|
||||
// SettingWidget(
|
||||
// onTap: () {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// FaqSettingPage(device: device!)),
|
||||
// );
|
||||
// },
|
||||
// text: 'Device FAQ',
|
||||
// icon: Assets.faqIcon,
|
||||
// ),
|
||||
// const Divider(
|
||||
// color: ColorsManager.dividerColor,
|
||||
// ),
|
||||
// SettingWidget(
|
||||
// onTapUpdate: () {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return UpdateInfoDialog(
|
||||
// cancelTab: () {
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// confirmTab: () {
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// isUpdate: true,
|
||||
// onTap: () {
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (context) =>
|
||||
// const UpdatePageSetting()),
|
||||
// );
|
||||
// },
|
||||
// text: 'Device Update',
|
||||
// icon: Assets.updateIcon,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
const SizedBox(height: 20),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return Container(
|
||||
height: 200,
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const BodyMedium(
|
||||
text: 'Remove Device',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 16,
|
||||
fontColor: ColorsManager.red,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const SizedBox(
|
||||
width: 250,
|
||||
child: Divider(
|
||||
color: ColorsManager.dividerColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return DisconnectDeviceDialog(
|
||||
cancelTab: () {
|
||||
Navigator.of(context)
|
||||
.pop();
|
||||
},
|
||||
confirmTab: () {
|
||||
Navigator.of(context)
|
||||
.pop();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: const BodyMedium(
|
||||
text: 'Disconnect Device',
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 15,
|
||||
fontColor: ColorsManager
|
||||
.textPrimaryColor,
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: ColorsManager.textGray,
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return DisconnectWipeData(
|
||||
cancelTab: () {
|
||||
Navigator.of(context)
|
||||
.pop();
|
||||
},
|
||||
confirmTab: () {
|
||||
_bloc.add(
|
||||
DeleteDeviceEvent());
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: const BodyMedium(
|
||||
text:
|
||||
'Disconnect Device and Wipe Data',
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 15,
|
||||
fontColor: ColorsManager
|
||||
.textPrimaryColor,
|
||||
),
|
||||
),
|
||||
const Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: ColorsManager.textGray,
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: const Center(
|
||||
child: BodyMedium(
|
||||
text: 'Remove Device',
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 15,
|
||||
fontColor: ColorsManager.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -46,7 +46,7 @@ class SixSceneScreen extends StatelessWidget {
|
||||
model = state.device;
|
||||
}
|
||||
return DefaultScaffold(
|
||||
title: device?.name ?? '6 Scene Switch',
|
||||
title: bloc.deviceInfo.name ,
|
||||
actions: [
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
@ -55,7 +55,7 @@ class SixSceneScreen extends StatelessWidget {
|
||||
builder: (context) => SettingsPage(device: device!),
|
||||
),
|
||||
);
|
||||
if (val == null) {
|
||||
if (val == null || val == true) {
|
||||
bloc.add(const SixSceneInitialInfo());
|
||||
bloc.add(const SixSceneInitial());
|
||||
bloc.add(const SexSceneSwitchInitial());
|
||||
@ -195,8 +195,8 @@ class SixSceneScreen extends StatelessWidget {
|
||||
);
|
||||
if (value == true) {
|
||||
Future.delayed(
|
||||
const Duration(milliseconds: 200),
|
||||
() {
|
||||
const Duration(
|
||||
milliseconds: 200), () {
|
||||
bloc.add(
|
||||
const SexSceneSwitchInitial());
|
||||
});
|
||||
|
@ -47,7 +47,7 @@ class FourSceneScreen extends StatelessWidget {
|
||||
}
|
||||
|
||||
return DefaultScaffold(
|
||||
title: device?.name ?? '4 Scene',
|
||||
title: _bloc.deviceInfo.name,
|
||||
actions: [
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
@ -56,7 +56,7 @@ class FourSceneScreen extends StatelessWidget {
|
||||
builder: (context) => SettingsPage(device: device!),
|
||||
),
|
||||
);
|
||||
if (val == null) {
|
||||
if (val == null || val == true) {
|
||||
_bloc.add(const FourSceneInitial());
|
||||
_bloc.add(const FourSceneInitialInfo());
|
||||
_bloc.add(const FourSceneSwitchInitial());
|
||||
@ -164,8 +164,7 @@ class FourSceneScreen extends StatelessWidget {
|
||||
cancelTab: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
confirmTab:
|
||||
(switchSelected) {
|
||||
confirmTab: (switchSelected) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
|
@ -29,7 +29,7 @@ class SosScreen extends StatelessWidget {
|
||||
builder: (context, state) {
|
||||
final sensor = BlocProvider.of<SosBloc>(context);
|
||||
return DefaultScaffold(
|
||||
title: device?.name,
|
||||
title: sensor.deviceInfo.name,
|
||||
actions: [
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
@ -38,7 +38,7 @@ class SosScreen extends StatelessWidget {
|
||||
builder: (context) => SettingsPage(device: device!),
|
||||
),
|
||||
);
|
||||
if (val == null) {
|
||||
if (val == null || val == true) {
|
||||
sensor.add(SosInitialDeviseInfo());
|
||||
sensor.add(const SosInitial());
|
||||
}
|
||||
@ -72,33 +72,38 @@ class SosScreen extends StatelessWidget {
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: InkWell(
|
||||
overlayColor:
|
||||
WidgetStateProperty.all(Colors.transparent),
|
||||
overlayColor: WidgetStateProperty.all(
|
||||
Colors.transparent),
|
||||
onTap: () {
|
||||
// Add functionality for the main SOS button here
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(890),
|
||||
borderRadius:
|
||||
BorderRadius.circular(890),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.white.withOpacity(0.1),
|
||||
color:
|
||||
Colors.white.withOpacity(0.1),
|
||||
blurRadius: 24,
|
||||
offset: const Offset(-5, -5),
|
||||
blurStyle: BlurStyle.outer,
|
||||
),
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.11),
|
||||
color: Colors.black
|
||||
.withOpacity(0.11),
|
||||
blurRadius: 25,
|
||||
offset: const Offset(5, 5),
|
||||
blurStyle: BlurStyle.outer,
|
||||
),
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.13),
|
||||
color: Colors.black
|
||||
.withOpacity(0.13),
|
||||
blurRadius: 30,
|
||||
offset: const Offset(5, 5),
|
||||
blurStyle: BlurStyle.inner,
|
||||
@ -125,8 +130,9 @@ class SosScreen extends StatelessWidget {
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => SosRecordsScreen(
|
||||
sosId: device!.uuid!),
|
||||
builder: (context) =>
|
||||
SosRecordsScreen(
|
||||
sosId: device!.uuid!),
|
||||
),
|
||||
);
|
||||
},
|
||||
@ -181,8 +187,8 @@ class SosScreen extends StatelessWidget {
|
||||
maxHeight: 46,
|
||||
maxWidth: 50,
|
||||
),
|
||||
child: SvgPicture.asset(
|
||||
Assets.doorNotificationSetting),
|
||||
child: SvgPicture.asset(Assets
|
||||
.doorNotificationSetting),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
const Flexible(
|
||||
|
Reference in New Issue
Block a user