mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-26 21:34:56 +00:00
378 lines
19 KiB
Dart
378 lines
19 KiB
Dart
// import 'package:flutter/material.dart';
|
|
// import 'package:flutter_bloc/flutter_bloc.dart';
|
|
// import 'package:flutter_svg/flutter_svg.dart';
|
|
// import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_bloc.dart';
|
|
// import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_event.dart';
|
|
// import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_state.dart';
|
|
// import 'package:syncrow_app/features/devices/model/device_model.dart';
|
|
// import 'package:syncrow_app/features/devices/model/sos_model.dart';
|
|
// import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/sos_profile_page.dart';
|
|
// import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/faq_sos_page.dart';
|
|
// import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/share_sos_page.dart';
|
|
// import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/sos_info_page.dart';
|
|
// import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/sos_update_page.dart';
|
|
// import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/update_dialog_sos.dart';
|
|
// import 'package:syncrow_app/features/shared_widgets/default_container.dart';
|
|
// import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
|
// import 'package:syncrow_app/features/shared_widgets/delete_device_dialogs.dart';
|
|
// import 'package:syncrow_app/features/shared_widgets/setting_widget.dart';
|
|
// import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
|
// import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
|
// import 'package:syncrow_app/generated/assets.dart';
|
|
// import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
|
|
// class SosSettings extends StatelessWidget {
|
|
// final DeviceModel? device;
|
|
// const SosSettings({
|
|
// super.key,
|
|
// this.device,
|
|
// });
|
|
|
|
// @override
|
|
// Widget build(BuildContext context) {
|
|
// return DefaultScaffold(
|
|
// title: 'Device Settings',
|
|
// child: BlocProvider(
|
|
// create: (context) => SosBloc(sosId: device?.uuid ?? '')
|
|
// ..add(const SosInitial())
|
|
// ..add(SosInitialDeviseInfo()),
|
|
// child: BlocBuilder<SosBloc, SosState>(
|
|
// builder: (context, state) {
|
|
// final _bloc = BlocProvider.of<SosBloc>(context);
|
|
// SosModel model =
|
|
// SosModel(batteryPercentage: 0, sosContactState: 'normal');
|
|
// if (state is LoadingNewSate) {
|
|
// model = state.sosSensor;
|
|
// } else if (state is UpdateState) {
|
|
// model = state.sensor;
|
|
// }
|
|
// return state is SosLoadingState
|
|
// ? 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) => SosProfilePage(
|
|
// device: device,
|
|
// ),
|
|
// ),
|
|
// );
|
|
// if (val == true) {
|
|
// _bloc.add(SosInitialDeviseInfo());
|
|
// _bloc.add(const SosInitial());
|
|
// }
|
|
// },
|
|
// 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: [
|
|
// Column(
|
|
// crossAxisAlignment:
|
|
// CrossAxisAlignment.start,
|
|
// children: [
|
|
// BodyMedium(
|
|
// text: _bloc.deviceInfo.name,
|
|
// fontWeight: FontWeight.bold,
|
|
// ),
|
|
// const SizedBox(
|
|
// height: 5,
|
|
// ),
|
|
// BodySmall(
|
|
// text: _bloc.deviceInfo
|
|
// .subspace.subspaceName),
|
|
// ],
|
|
// ),
|
|
// const Icon(
|
|
// Icons.edit_outlined,
|
|
// color: ColorsManager.grayColor,
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// Positioned(
|
|
// top: 0,
|
|
// left: 20,
|
|
// child: CircleAvatar(
|
|
// radius: 40,
|
|
// backgroundColor: Colors.white,
|
|
// child: CircleAvatar(
|
|
// radius: 40,
|
|
// backgroundColor:
|
|
// Colors.white.withOpacity(0),
|
|
// child: ClipOval(
|
|
// child: SvgPicture.asset(
|
|
// Assets.sosHomeIcon,
|
|
// fit: BoxFit.contain,
|
|
// height: 80,
|
|
// ),
|
|
// )),
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// const SizedBox(height: 20),
|
|
// const BodyMedium(
|
|
// text: 'Device Management',
|
|
// fontWeight: FontWeight.w700,
|
|
// fontSize: 12,
|
|
// fontColor: ColorsManager.grayColor,
|
|
// ),
|
|
// DefaultContainer(
|
|
// child: SettingWidget(
|
|
// onTap: () {
|
|
// Navigator.of(context).push(
|
|
// MaterialPageRoute(
|
|
// builder: (context) =>
|
|
// SosInfoPage(device: device!)),
|
|
// );
|
|
// },
|
|
// text: 'Device Information',
|
|
// icon: Assets.infoIcon,
|
|
// ),
|
|
// ),
|
|
// 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<SosBloc>()
|
|
// .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) =>
|
|
// ShareSosPage(device: device!)),
|
|
// );
|
|
// },
|
|
// text: 'Share Device',
|
|
// icon: Assets.shareIcon,
|
|
// ),
|
|
// const Divider(
|
|
// color: ColorsManager.dividerColor,
|
|
// ),
|
|
// SettingWidget(
|
|
// onTap: () {
|
|
// Navigator.of(context).push(
|
|
// MaterialPageRoute(
|
|
// builder: (context) =>
|
|
// FaqSosPage(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 SosUpdatePage()),
|
|
// );
|
|
// },
|
|
// 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,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// );
|
|
// },
|
|
// ),
|
|
// ),
|
|
// );
|
|
// }
|
|
// }
|