mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-08-26 07:19:39 +00:00
changed titles of devices views, and responsiness of device card.
This commit is contained in:
@ -1,6 +1,4 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_bloc.dart';
|
import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_bloc.dart';
|
||||||
@ -31,7 +29,7 @@ class SixSceneScreen extends StatelessWidget {
|
|||||||
..add(const SexSceneSwitchInitial()),
|
..add(const SexSceneSwitchInitial()),
|
||||||
child: BlocBuilder<SixSceneBloc, SixSceneState>(
|
child: BlocBuilder<SixSceneBloc, SixSceneState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final _bloc = BlocProvider.of<SixSceneBloc>(context);
|
final bloc = BlocProvider.of<SixSceneBloc>(context);
|
||||||
SixSceneModel model = SixSceneModel(
|
SixSceneModel model = SixSceneModel(
|
||||||
scene_1: '',
|
scene_1: '',
|
||||||
scene_2: '',
|
scene_2: '',
|
||||||
@ -48,7 +46,7 @@ class SixSceneScreen extends StatelessWidget {
|
|||||||
model = state.device;
|
model = state.device;
|
||||||
}
|
}
|
||||||
return DefaultScaffold(
|
return DefaultScaffold(
|
||||||
title: _bloc.deviceInfo.name,
|
title: device?.name ?? '6 Scene Switch',
|
||||||
actions: [
|
actions: [
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
@ -58,9 +56,9 @@ class SixSceneScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (val == null) {
|
if (val == null) {
|
||||||
_bloc.add(const SixSceneInitialInfo());
|
bloc.add(const SixSceneInitialInfo());
|
||||||
_bloc.add(const SixSceneInitial());
|
bloc.add(const SixSceneInitial());
|
||||||
_bloc.add(const SexSceneSwitchInitial());
|
bloc.add(const SexSceneSwitchInitial());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: SvgPicture.asset(Assets.assetsIconsSettings),
|
child: SvgPicture.asset(Assets.assetsIconsSettings),
|
||||||
@ -77,7 +75,7 @@ class SixSceneScreen extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
: RefreshIndicator(
|
: RefreshIndicator(
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
_bloc.add(const SixSceneInitial());
|
bloc.add(const SixSceneInitial());
|
||||||
},
|
},
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
@ -92,22 +90,22 @@ class SixSceneScreen extends StatelessWidget {
|
|||||||
switch4Title: model.scene_4,
|
switch4Title: model.scene_4,
|
||||||
switch5Title: model.scene_5,
|
switch5Title: model.scene_5,
|
||||||
switch6Title: model.scene_6,
|
switch6Title: model.scene_6,
|
||||||
switch1Down: _bloc.deviceStatus.switch_backlight
|
switch1Down: bloc.deviceStatus.switch_backlight
|
||||||
? Assets.switchOn
|
? Assets.switchOn
|
||||||
: Assets.switchOff,
|
: Assets.switchOff,
|
||||||
switch1Up: _bloc.deviceStatus.switch_backlight
|
switch1Up: bloc.deviceStatus.switch_backlight
|
||||||
? Assets.switchOn
|
? Assets.switchOn
|
||||||
: Assets.switchOff,
|
: Assets.switchOff,
|
||||||
switch2Down: _bloc.deviceStatus.switch_backlight
|
switch2Down: bloc.deviceStatus.switch_backlight
|
||||||
? Assets.switchOn
|
? Assets.switchOn
|
||||||
: Assets.switchOff,
|
: Assets.switchOff,
|
||||||
switch2Up: _bloc.deviceStatus.switch_backlight
|
switch2Up: bloc.deviceStatus.switch_backlight
|
||||||
? Assets.switchOn
|
? Assets.switchOn
|
||||||
: Assets.switchOff,
|
: Assets.switchOff,
|
||||||
switch3Up: _bloc.deviceStatus.switch_backlight
|
switch3Up: bloc.deviceStatus.switch_backlight
|
||||||
? Assets.switchOn
|
? Assets.switchOn
|
||||||
: Assets.switchOff,
|
: Assets.switchOff,
|
||||||
switch3Down: _bloc.deviceStatus.switch_backlight
|
switch3Down: bloc.deviceStatus.switch_backlight
|
||||||
? Assets.switchOn
|
? Assets.switchOn
|
||||||
: Assets.switchOff,
|
: Assets.switchOff,
|
||||||
onSwitch3DownTap: () {
|
onSwitch3DownTap: () {
|
||||||
@ -135,7 +133,7 @@ class SixSceneScreen extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: DefaultContainer(
|
child: DefaultContainer(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_bloc.add(ChangeSwitchStatusEvent());
|
bloc.add(ChangeSwitchStatusEvent());
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
@ -197,9 +195,9 @@ class SixSceneScreen extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
if (value == true) {
|
if (value == true) {
|
||||||
Future.delayed(
|
Future.delayed(
|
||||||
const Duration(
|
const Duration(milliseconds: 200),
|
||||||
milliseconds: 200), () {
|
() {
|
||||||
_bloc.add(
|
bloc.add(
|
||||||
const SexSceneSwitchInitial());
|
const SexSceneSwitchInitial());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -22,14 +22,15 @@ class DoorSensorScreen extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DefaultScaffold(
|
return DefaultScaffold(
|
||||||
title: 'Door Sensor',
|
title: device?.name,
|
||||||
child: BlocProvider(
|
child: BlocProvider(
|
||||||
create: (context) =>
|
create: (context) =>
|
||||||
DoorSensorBloc(DSId: device?.uuid ?? '')..add(const DoorSensorInitial()),
|
DoorSensorBloc(DSId: device?.uuid ?? '')..add(const DoorSensorInitial()),
|
||||||
child: BlocBuilder<DoorSensorBloc, DoorSensorState>(
|
child: BlocBuilder<DoorSensorBloc, DoorSensorState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final doorSensorBloc = BlocProvider.of<DoorSensorBloc>(context);
|
final doorSensorBloc = BlocProvider.of<DoorSensorBloc>(context);
|
||||||
DoorSensorModel model = DoorSensorModel(batteryPercentage: 0, doorContactState: false);
|
DoorSensorModel model =
|
||||||
|
DoorSensorModel(batteryPercentage: 0, doorContactState: false);
|
||||||
if (state is LoadingNewSate) {
|
if (state is LoadingNewSate) {
|
||||||
model = state.doorSensor;
|
model = state.doorSensor;
|
||||||
} else if (state is UpdateState) {
|
} else if (state is UpdateState) {
|
||||||
@ -37,8 +38,8 @@ class DoorSensorScreen extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
return state is DoorSensorLoadingState
|
return state is DoorSensorLoadingState
|
||||||
? const Center(
|
? const Center(
|
||||||
child:
|
child: DefaultContainer(
|
||||||
DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
|
width: 50, height: 50, child: CircularProgressIndicator()),
|
||||||
)
|
)
|
||||||
: RefreshIndicator(
|
: RefreshIndicator(
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
@ -56,7 +57,8 @@ class DoorSensorScreen extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
flex: 4,
|
flex: 4,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
overlayColor: WidgetStateProperty.all(Colors.transparent),
|
overlayColor:
|
||||||
|
WidgetStateProperty.all(Colors.transparent),
|
||||||
onTap: () {},
|
onTap: () {},
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -107,17 +109,21 @@ class DoorSensorScreen extends StatelessWidget {
|
|||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
DoorRecordsScreen(DSId: device!.uuid!)),
|
DoorRecordsScreen(
|
||||||
|
DSId: device!.uuid!)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment:
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints:
|
constraints: const BoxConstraints(
|
||||||
const BoxConstraints(maxHeight: 46, maxWidth: 50),
|
maxHeight: 46, maxWidth: 50),
|
||||||
child: SvgPicture.asset(Assets.doorRecordsIcon),
|
child: SvgPicture.asset(
|
||||||
|
Assets.doorRecordsIcon),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
@ -143,18 +149,21 @@ class DoorSensorScreen extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => NotificationSettingsPage()),
|
builder: (context) =>
|
||||||
|
NotificationSettingsPage()),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment:
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints:
|
constraints: const BoxConstraints(
|
||||||
const BoxConstraints(maxHeight: 46, maxWidth: 50),
|
maxHeight: 46, maxWidth: 50),
|
||||||
child:
|
child: SvgPicture.asset(
|
||||||
SvgPicture.asset(Assets.doorNotificationSetting),
|
Assets.doorNotificationSetting),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
|
@ -21,7 +21,8 @@ class GateWayView extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => GatewayBloc()..add(GatewayInitial(gatewayId: gatewayObj.uuid ?? '')),
|
create: (context) =>
|
||||||
|
GatewayBloc()..add(GatewayInitial(gatewayId: gatewayObj.uuid ?? '')),
|
||||||
child: BlocBuilder<GatewayBloc, GatewayState>(builder: (context, state) {
|
child: BlocBuilder<GatewayBloc, GatewayState>(builder: (context, state) {
|
||||||
List<DeviceModel> devicesList = [];
|
List<DeviceModel> devicesList = [];
|
||||||
if (state is UpdateGatewayState) {
|
if (state is UpdateGatewayState) {
|
||||||
@ -37,7 +38,7 @@ class GateWayView extends StatelessWidget {
|
|||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
appBar: DeviceAppbar(
|
appBar: DeviceAppbar(
|
||||||
deviceName: 'Gateway',
|
deviceName: gatewayObj.name ?? 'Gateway',
|
||||||
deviceUuid: gatewayObj.uuid!,
|
deviceUuid: gatewayObj.uuid!,
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Container(
|
||||||
@ -60,7 +61,7 @@ class GateWayView extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
SizedBox(
|
||||||
height: MediaQuery.of(context).size.height,
|
height: MediaQuery.of(context).size.height,
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -90,7 +91,8 @@ class GateWayView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
if (devicesList.isEmpty && state is UpdateGatewayState)
|
if (devicesList.isEmpty &&
|
||||||
|
state is UpdateGatewayState)
|
||||||
Container(
|
Container(
|
||||||
width: MediaQuery.sizeOf(context).width,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
alignment: AlignmentDirectional.center,
|
alignment: AlignmentDirectional.center,
|
||||||
@ -115,7 +117,8 @@ class GateWayView extends StatelessWidget {
|
|||||||
margin: const EdgeInsets.only(top: 20),
|
margin: const EdgeInsets.only(top: 20),
|
||||||
height: 50,
|
height: 50,
|
||||||
width: 50,
|
width: 50,
|
||||||
child: const RefreshProgressIndicator()),
|
child:
|
||||||
|
const RefreshProgressIndicator()),
|
||||||
)
|
)
|
||||||
: Expanded(
|
: Expanded(
|
||||||
child: GridView.builder(
|
child: GridView.builder(
|
||||||
@ -130,7 +133,8 @@ class GateWayView extends StatelessWidget {
|
|||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: devicesList.length,
|
itemCount: devicesList.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return RoomPageSwitch(device: devicesList[index]);
|
return RoomPageSwitch(
|
||||||
|
device: devicesList[index]);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -51,7 +51,7 @@ class _PowerClampPageState extends State<PowerClampPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DefaultScaffold(
|
return DefaultScaffold(
|
||||||
title: 'Power Clamp',
|
title: widget.device?.name ?? 'Power Clamp',
|
||||||
child: BlocProvider(
|
child: BlocProvider(
|
||||||
create: (context) => PowerClampBloc(PCId: widget.device?.uuid ?? '')
|
create: (context) => PowerClampBloc(PCId: widget.device?.uuid ?? '')
|
||||||
..add(const PowerClampInitial()),
|
..add(const PowerClampInitial()),
|
||||||
@ -153,41 +153,6 @@ class _PowerClampPageState extends State<PowerClampPage> {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> _buildPowerClampCards(PowerClampModel model,
|
|
||||||
List<EnergyData> chartData, PowerClampBloc blocProvider) {
|
|
||||||
return [
|
|
||||||
_buildPowerClampCard(
|
|
||||||
phaseType: '',
|
|
||||||
title: 'Total Energy \nConsumption',
|
|
||||||
phase: model.status.general,
|
|
||||||
isGeneral: true,
|
|
||||||
chartData: chartData,
|
|
||||||
blocProvider: blocProvider,
|
|
||||||
),
|
|
||||||
_buildPowerClampCard(
|
|
||||||
phaseType: 'Phase A consumption',
|
|
||||||
title: 'Phase A Energy \nConsumption',
|
|
||||||
phase: model.status.phaseA,
|
|
||||||
chartData: chartData,
|
|
||||||
blocProvider: blocProvider,
|
|
||||||
),
|
|
||||||
_buildPowerClampCard(
|
|
||||||
phaseType: 'Phase B consumption',
|
|
||||||
title: 'Phase B Energy \nConsumption',
|
|
||||||
phase: model.status.phaseB,
|
|
||||||
chartData: chartData,
|
|
||||||
blocProvider: blocProvider,
|
|
||||||
),
|
|
||||||
_buildPowerClampCard(
|
|
||||||
phaseType: 'Phase C consumption',
|
|
||||||
title: 'Phase C Energy \nConsumption',
|
|
||||||
phase: model.status.phaseC,
|
|
||||||
chartData: chartData,
|
|
||||||
blocProvider: blocProvider,
|
|
||||||
),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildPowerClampCard({
|
Widget _buildPowerClampCard({
|
||||||
required String title,
|
required String title,
|
||||||
required String phaseType,
|
required String phaseType,
|
||||||
@ -209,10 +174,8 @@ class _PowerClampPageState extends State<PowerClampPage> {
|
|||||||
blocProvider.add(SelectDateEvent(context: context));
|
blocProvider.add(SelectDateEvent(context: context));
|
||||||
},
|
},
|
||||||
totalActiveGeneral: isGeneral ? _getValueOrNA(phase.dataPoints, 2) : null,
|
totalActiveGeneral: isGeneral ? _getValueOrNA(phase.dataPoints, 2) : null,
|
||||||
totalCurrentGeneral:
|
totalCurrentGeneral: isGeneral ? _getValueOrNA(phase.dataPoints, 1) : null,
|
||||||
isGeneral ? _getValueOrNA(phase.dataPoints, 1) : null,
|
totalFrequencyGeneral: isGeneral ? _getValueOrNA(phase.dataPoints, 4) : null,
|
||||||
totalFrequencyGeneral:
|
|
||||||
isGeneral ? _getValueOrNA(phase.dataPoints, 4) : null,
|
|
||||||
totalFactor: !isGeneral ? _getValueOrNA(phase.dataPoints, 3) : null,
|
totalFactor: !isGeneral ? _getValueOrNA(phase.dataPoints, 3) : null,
|
||||||
totalActive: !isGeneral ? _getValueOrNA(phase.dataPoints, 2) : null,
|
totalActive: !isGeneral ? _getValueOrNA(phase.dataPoints, 2) : null,
|
||||||
totalCurrent: !isGeneral ? _getValueOrNA(phase.dataPoints, 1) : null,
|
totalCurrent: !isGeneral ? _getValueOrNA(phase.dataPoints, 1) : null,
|
||||||
@ -223,9 +186,7 @@ class _PowerClampPageState extends State<PowerClampPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _getValueOrNA(List<DataPoint> dataPoints, int index) {
|
String _getValueOrNA(List<DataPoint> dataPoints, int index) {
|
||||||
return dataPoints.length > index
|
return dataPoints.length > index ? dataPoints[index].value.toString() : 'N/A';
|
||||||
? dataPoints[index].value.toString()
|
|
||||||
: 'N/A';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildPageIndicator() {
|
Widget _buildPageIndicator() {
|
||||||
@ -240,8 +201,7 @@ class _PowerClampPageState extends State<PowerClampPage> {
|
|||||||
height: 10.0,
|
height: 10.0,
|
||||||
width: _currentPage == index ? 10.0 : 10.0,
|
width: _currentPage == index ? 10.0 : 10.0,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color:
|
color: _currentPage == index ? Colors.grey : ColorsManager.greyColor,
|
||||||
_currentPage == index ? Colors.grey : ColorsManager.greyColor,
|
|
||||||
borderRadius: BorderRadius.circular(5.0),
|
borderRadius: BorderRadius.circular(5.0),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -10,6 +10,7 @@ import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
|||||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/6_scene_switch/six_scene_screen.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/6_scene_switch/six_scene_screen.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/ACs/acs_view.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/ACs/acs_view.dart';
|
||||||
|
import 'package:syncrow_app/features/devices/view/widgets/ceiling_sensor/ceiling_sensor_interface.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/curtains/curtain_view.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/curtains/curtain_view.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/door_sensor/door_sensor_screen.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/door_sensor/door_sensor_screen.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_screen.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_screen.dart';
|
||||||
@ -19,14 +20,13 @@ import 'package:syncrow_app/features/devices/view/widgets/lights/light_interface
|
|||||||
import 'package:syncrow_app/features/devices/view/widgets/one_gang/one_gang_Interface.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/one_gang/one_gang_Interface.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/one_touch/one_touch_screen.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/one_touch/one_touch_screen.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/power_clamp/power_clamp_page.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/power_clamp/power_clamp_page.dart';
|
||||||
|
import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_interface.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/sos/sos_screen.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/sos/sos_screen.dart';
|
||||||
|
import 'package:syncrow_app/features/devices/view/widgets/three_gang/three_gang_interface.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/three_touch/three_touch_interface.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/three_touch/three_touch_interface.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/two_gang/two_gang_Interface.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/two_gang/two_gang_Interface.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/two_touch/two_touch_Interface.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/two_touch/two_touch_Interface.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/wall_sensor/wall_sensor_interface.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/wall_sensor/wall_sensor_interface.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/ceiling_sensor/ceiling_sensor_interface.dart';
|
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/smart_door/door_interface.dart';
|
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/three_gang/three_gang_interface.dart';
|
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/water_heater/water_heater_page.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/water_heater/water_heater_page.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/water_leak/water_leak_screen.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/water_leak/water_leak_screen.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/custom_switch.dart';
|
import 'package:syncrow_app/features/shared_widgets/custom_switch.dart';
|
||||||
@ -73,48 +73,31 @@ class RoomPageSwitch extends StatelessWidget {
|
|||||||
? CustomSwitch(
|
? CustomSwitch(
|
||||||
device: device,
|
device: device,
|
||||||
)
|
)
|
||||||
: const SizedBox(),
|
: const SizedBox.shrink(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
LayoutBuilder(
|
|
||||||
builder: (context, constraints) {
|
|
||||||
final text = device.name ?? "";
|
|
||||||
final textPainter = TextPainter(
|
|
||||||
text: TextSpan(
|
|
||||||
text: text,
|
|
||||||
style: context.bodyLarge.copyWith(
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 20,
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
maxLines: 1,
|
|
||||||
textDirection: TextDirection.ltr,
|
|
||||||
);
|
|
||||||
|
|
||||||
textPainter.layout(maxWidth: constraints.maxWidth);
|
|
||||||
|
|
||||||
final exceeded = textPainter.didExceedMaxLines;
|
|
||||||
|
|
||||||
return Text(
|
|
||||||
exceeded ? '${text.substring(0, 10)}...' : text,
|
|
||||||
style: context.bodyLarge.copyWith(
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 20,
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
overflow: TextOverflow.clip,
|
|
||||||
maxLines: 1,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
Text(
|
Text(
|
||||||
device.subspace!.subspaceName ?? '',
|
device.name ?? '',
|
||||||
overflow: TextOverflow.ellipsis,
|
textScaler: TextScaler.linear(1),
|
||||||
style: context.bodySmall.copyWith(
|
style: context.bodyLarge.copyWith(
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 10,
|
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
maxLines: 1,
|
||||||
|
),
|
||||||
|
FittedBox(
|
||||||
|
fit: BoxFit.scaleDown,
|
||||||
|
child: Text(
|
||||||
|
device.subspace!.subspaceName ?? '',
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
textScaler: TextScaler.linear(1),
|
||||||
|
style: context.bodySmall.copyWith(
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontSize: 9,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -132,7 +115,6 @@ Future<void> showDeviceInterface(
|
|||||||
required BuildContext context,
|
required BuildContext context,
|
||||||
required isAllDevices,
|
required isAllDevices,
|
||||||
List<DeviceModel>? allDevices}) async {
|
List<DeviceModel>? allDevices}) async {
|
||||||
|
|
||||||
final devicesCubit = context.read<DevicesCubit>();
|
final devicesCubit = context.read<DevicesCubit>();
|
||||||
|
|
||||||
switch (device.productType) {
|
switch (device.productType) {
|
||||||
|
@ -5,7 +5,6 @@ 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_event.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_state.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/device_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/sos_model.dart';
|
|
||||||
import 'package:syncrow_app/features/devices/view/device_settings/settings_page.dart';
|
import 'package:syncrow_app/features/devices/view/device_settings/settings_page.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/sos/sos_alarm_management_page.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/sos/sos_alarm_management_page.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/sos/sos_records_screen.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/sos/sos_records_screen.dart';
|
||||||
@ -29,17 +28,8 @@ class SosScreen extends StatelessWidget {
|
|||||||
child: BlocBuilder<SosBloc, SosState>(
|
child: BlocBuilder<SosBloc, SosState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final sensor = BlocProvider.of<SosBloc>(context);
|
final sensor = BlocProvider.of<SosBloc>(context);
|
||||||
SosModel model = SosModel(
|
|
||||||
batteryPercentage: 0,
|
|
||||||
sosContactState: '',
|
|
||||||
);
|
|
||||||
if (state is LoadingNewSate) {
|
|
||||||
model = state.sosSensor;
|
|
||||||
} else if (state is UpdateState) {
|
|
||||||
model = state.sensor;
|
|
||||||
}
|
|
||||||
return DefaultScaffold(
|
return DefaultScaffold(
|
||||||
title: sensor.deviceInfo.name,
|
title: device?.name,
|
||||||
actions: [
|
actions: [
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
@ -82,38 +72,33 @@ class SosScreen extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
flex: 4,
|
flex: 4,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
overlayColor: MaterialStateProperty.all(
|
overlayColor:
|
||||||
Colors.transparent),
|
WidgetStateProperty.all(Colors.transparent),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// Add functionality for the main SOS button here
|
// Add functionality for the main SOS button here
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment:
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
CrossAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius:
|
borderRadius: BorderRadius.circular(890),
|
||||||
BorderRadius.circular(890),
|
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color:
|
color: Colors.white.withOpacity(0.1),
|
||||||
Colors.white.withOpacity(0.1),
|
|
||||||
blurRadius: 24,
|
blurRadius: 24,
|
||||||
offset: const Offset(-5, -5),
|
offset: const Offset(-5, -5),
|
||||||
blurStyle: BlurStyle.outer,
|
blurStyle: BlurStyle.outer,
|
||||||
),
|
),
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black
|
color: Colors.black.withOpacity(0.11),
|
||||||
.withOpacity(0.11),
|
|
||||||
blurRadius: 25,
|
blurRadius: 25,
|
||||||
offset: const Offset(5, 5),
|
offset: const Offset(5, 5),
|
||||||
blurStyle: BlurStyle.outer,
|
blurStyle: BlurStyle.outer,
|
||||||
),
|
),
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black
|
color: Colors.black.withOpacity(0.13),
|
||||||
.withOpacity(0.13),
|
|
||||||
blurRadius: 30,
|
blurRadius: 30,
|
||||||
offset: const Offset(5, 5),
|
offset: const Offset(5, 5),
|
||||||
blurStyle: BlurStyle.inner,
|
blurStyle: BlurStyle.inner,
|
||||||
@ -140,9 +125,8 @@ class SosScreen extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) => SosRecordsScreen(
|
||||||
SosRecordsScreen(
|
sosId: device!.uuid!),
|
||||||
sosId: device!.uuid!),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -197,8 +181,8 @@ class SosScreen extends StatelessWidget {
|
|||||||
maxHeight: 46,
|
maxHeight: 46,
|
||||||
maxWidth: 50,
|
maxWidth: 50,
|
||||||
),
|
),
|
||||||
child: SvgPicture.asset(Assets
|
child: SvgPicture.asset(
|
||||||
.doorNotificationSetting),
|
Assets.doorNotificationSetting),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
const Flexible(
|
const Flexible(
|
||||||
|
@ -9,7 +9,10 @@ import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|||||||
|
|
||||||
class GangSwitch extends StatelessWidget {
|
class GangSwitch extends StatelessWidget {
|
||||||
const GangSwitch(
|
const GangSwitch(
|
||||||
{super.key, required this.threeGangSwitch, required this.value, required this.action});
|
{super.key,
|
||||||
|
required this.threeGangSwitch,
|
||||||
|
required this.value,
|
||||||
|
required this.action});
|
||||||
|
|
||||||
final DeviceModel threeGangSwitch;
|
final DeviceModel threeGangSwitch;
|
||||||
final bool value;
|
final bool value;
|
||||||
|
@ -21,7 +21,7 @@ class WaterHeaterPage extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DefaultScaffold(
|
return DefaultScaffold(
|
||||||
title: 'Water heater',
|
title: device?.name?? 'Water heater',
|
||||||
child: BlocProvider(
|
child: BlocProvider(
|
||||||
create: (context) => WaterHeaterBloc(switchCode: 'switch_1', whId: device?.uuid ?? '')
|
create: (context) => WaterHeaterBloc(switchCode: 'switch_1', whId: device?.uuid ?? '')
|
||||||
..add(const WaterHeaterInitial()),
|
..add(const WaterHeaterInitial()),
|
||||||
|
@ -22,7 +22,7 @@ class WaterLeakScreen extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DefaultScaffold(
|
return DefaultScaffold(
|
||||||
title: 'Water Leak Sensor',
|
title: device?.name ?? 'Water Leak',
|
||||||
child: BlocProvider(
|
child: BlocProvider(
|
||||||
create: (context) => WaterLeakBloc(WLId: device?.uuid ?? '')
|
create: (context) => WaterLeakBloc(WLId: device?.uuid ?? '')
|
||||||
..add(const WaterLeakInitial()),
|
..add(const WaterLeakInitial()),
|
||||||
|
Reference in New Issue
Block a user