import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:syncrow_web/utils/extension/build_context_x.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'; class DeviceBatchControlDialog extends StatelessWidget with RouteControlsBasedCode { final List 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 ? 500 : 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( devices.first.categoryName ?? 'Device Control', 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: 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), ], ), ), ), ), ); } }