mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 14:47:23 +00:00
145 lines
4.3 KiB
Dart
145 lines
4.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:syncrow_web/pages/device_managment/all_devices/helper/route_controls_based_code.dart';
|
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
|
|
import 'package:syncrow_web/utils/color_manager.dart';
|
|
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
|
|
|
class DeviceBatchControlDialog extends StatelessWidget
|
|
with RouteControlsBasedCode {
|
|
final List<AllDevicesModel> devices;
|
|
|
|
const DeviceBatchControlDialog({super.key, required this.devices});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Dialog(
|
|
backgroundColor: Colors.white,
|
|
insetPadding: const EdgeInsets.all(20),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: SizedBox(
|
|
width: devices.length < 2 ? 600 : 800,
|
|
// height: context.screenHeight * 0.7,
|
|
child: SingleChildScrollView(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(20.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
const SizedBox(),
|
|
Column(
|
|
children: [
|
|
Text(
|
|
getBatchDialogName(devices.first),
|
|
style: context.textTheme.titleLarge!.copyWith(
|
|
color: ColorsManager.dialogBlueTitle,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
const SizedBox(
|
|
height: 8,
|
|
),
|
|
Text(
|
|
"Batch Control",
|
|
style: context.textTheme.bodySmall!.copyWith(
|
|
color: ColorsManager.dialogBlueTitle,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Container(
|
|
width: 25,
|
|
decoration: BoxDecoration(
|
|
color: Colors.transparent,
|
|
shape: BoxShape.circle,
|
|
border: Border.all(
|
|
color: Colors.grey,
|
|
width: 1.0,
|
|
),
|
|
),
|
|
child: IconButton(
|
|
padding: const EdgeInsets.all(1),
|
|
icon: const Icon(
|
|
Icons.close,
|
|
color: Colors.grey,
|
|
size: 18,
|
|
),
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
|
|
const SizedBox(height: 20),
|
|
//// BUILD DEVICE CONTROLS
|
|
///
|
|
//// ROUTE TO SPECIFIC CONTROL VIEW BASED ON DEVICE CATEGORY
|
|
routeBatchControlsWidgets(devices: devices),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
String getBatchDialogName(AllDevicesModel device) {
|
|
/*
|
|
3G:
|
|
1G:
|
|
2G:
|
|
GW:
|
|
DL:
|
|
WPS:
|
|
CPS:
|
|
AC:
|
|
CUR:
|
|
WH:
|
|
*/
|
|
switch (device.productType) {
|
|
case '1G':
|
|
return "Smart Light Switch";
|
|
case '2G':
|
|
return "Smart Light Switch";
|
|
case '3G':
|
|
return "Smart Light Switch";
|
|
case 'GW':
|
|
return "Gateway";
|
|
case 'DL':
|
|
return "Door Lock";
|
|
case 'WPS':
|
|
return "White Presence Sensor";
|
|
case 'CPS':
|
|
return "Black Presence Sensor";
|
|
case 'CUR':
|
|
return "Smart Curtains";
|
|
case 'WH':
|
|
return "Smart Water Heater";
|
|
case 'AC':
|
|
return "Smart AC";
|
|
case 'DS':
|
|
return "Door / Window Sensor";
|
|
case '1GT':
|
|
return "Touch Switch";
|
|
case '2GT':
|
|
return "Touch Switch";
|
|
case '3GT':
|
|
return "Touch Switch";
|
|
case 'GD':
|
|
return "Garage Door Opener";
|
|
case 'WL':
|
|
return "Water Leak Sensor";
|
|
case 'SOS':
|
|
return "SOS";
|
|
default:
|
|
return device.categoryName ?? 'Device Control';
|
|
}
|
|
}
|