From b7dddcb8dd18e559c24c604aec59ac2fc905888c Mon Sep 17 00:00:00 2001 From: mohammad Date: Sun, 27 Oct 2024 12:36:32 +0300 Subject: [PATCH] shadow and text color --- .../access_management/bloc/access_bloc.dart | 158 ++++++++++++------ .../view/access_management.dart | 64 +++---- lib/pages/common/date_time_widget.dart | 5 +- .../common/text_field/custom_text_field.dart | 30 ++-- .../text_field/custom_web_textfield.dart | 30 ++-- .../widgets/device_managment_body.dart | 51 ++++-- .../widgets/device_search_filters.dart | 36 ++-- lib/utils/color_manager.dart | 2 +- lib/utils/style.dart | 9 +- pubspec.lock | 24 +-- 10 files changed, 255 insertions(+), 154 deletions(-) diff --git a/lib/pages/access_management/bloc/access_bloc.dart b/lib/pages/access_management/bloc/access_bloc.dart index 55b525b4..3e74dbff 100644 --- a/lib/pages/access_management/bloc/access_bloc.dart +++ b/lib/pages/access_management/bloc/access_bloc.dart @@ -5,6 +5,7 @@ import 'package:syncrow_web/pages/access_management/bloc/access_state.dart'; import 'package:syncrow_web/pages/access_management/model/password_model.dart'; import 'package:syncrow_web/pages/common/hour_picker_dialog.dart'; import 'package:syncrow_web/services/access_mang_api.dart'; +import 'package:syncrow_web/utils/color_manager.dart'; import 'package:syncrow_web/utils/constants/app_enum.dart'; import 'package:syncrow_web/utils/snack_bar.dart'; @@ -26,7 +27,8 @@ class AccessBloc extends Bloc { List filteredData = []; List data = []; - Future _onFetchTableData(FetchTableData event, Emitter emit) async { + Future _onFetchTableData( + FetchTableData event, Emitter emit) async { try { emit(AccessLoaded()); data = await AccessMangApi().fetchVisitorPassword(); @@ -39,19 +41,28 @@ class AccessBloc extends Bloc { } void updateTabsCount() { - int toBeEffectiveCount = - data.where((item) => item.passwordStatus.value == 'To be effective').length; - int effectiveCount = data.where((item) => item.passwordStatus.value == 'Effective').length; - int expiredCount = data.where((item) => item.passwordStatus.value == 'Expired').length; + int toBeEffectiveCount = data + .where((item) => item.passwordStatus.value == 'To be effective') + .length; + int effectiveCount = + data.where((item) => item.passwordStatus.value == 'Effective').length; + int expiredCount = + data.where((item) => item.passwordStatus.value == 'Expired').length; tabs[1] = 'To Be Effective ($toBeEffectiveCount)'; tabs[2] = 'Effective ($effectiveCount)'; tabs[3] = 'Expired ($expiredCount)'; } int selectedIndex = 0; - final List tabs = ['All', 'To Be Effective (0)', 'Effective (0)', 'Expired']; + final List tabs = [ + 'All', + 'To Be Effective (0)', + 'Effective (0)', + 'Expired' + ]; - Future selectFilterTap(TabChangedEvent event, Emitter emit) async { + Future selectFilterTap( + TabChangedEvent event, Emitter emit) async { try { emit(AccessLoaded()); selectedIndex = event.selectedIndex; @@ -73,6 +84,23 @@ class AccessBloc extends Bloc { initialDate: DateTime.now(), firstDate: DateTime.now().add(const Duration(days: -5095)), lastDate: DateTime.now().add(const Duration(days: 2095)), + builder: (BuildContext context, Widget? child) { + return Theme( + data: ThemeData.light().copyWith( + colorScheme: ColorScheme.light( + primary: ColorsManager.blackColor, + onPrimary: Colors.white, + onSurface: ColorsManager.grayColor, + ), + textButtonTheme: TextButtonThemeData( + style: TextButton.styleFrom( + foregroundColor: Colors.blue, + ), + ), + ), + child: child!, + ); + }, ); if (picked != null) { final TimeOfDay? timePicked = await showHourPicker( @@ -88,16 +116,20 @@ class AccessBloc extends Bloc { timePicked.hour, timePicked.minute, ); - final int selectedTimestamp = selectedDateTime.millisecondsSinceEpoch ~/ 1000; + final int selectedTimestamp = + selectedDateTime.millisecondsSinceEpoch ~/ 1000; if (event.isStart) { - if (expirationTimeTimeStamp != null && selectedTimestamp > expirationTimeTimeStamp!) { - CustomSnackBar.displaySnackBar('Effective Time cannot be later than Expiration Time.'); + if (expirationTimeTimeStamp != null && + selectedTimestamp > expirationTimeTimeStamp!) { + CustomSnackBar.displaySnackBar( + 'Effective Time cannot be later than Expiration Time.'); } else { startTime = selectedDateTime.toString().split('.').first; effectiveTimeTimeStamp = selectedTimestamp; } } else { - if (effectiveTimeTimeStamp != null && selectedTimestamp < effectiveTimeTimeStamp!) { + if (effectiveTimeTimeStamp != null && + selectedTimestamp < effectiveTimeTimeStamp!) { CustomSnackBar.displaySnackBar( 'Expiration Time cannot be earlier than Effective Time.'); } else { @@ -110,7 +142,8 @@ class AccessBloc extends Bloc { emit(ChangeTimeState()); } - Future _filterData(FilterDataEvent event, Emitter emit) async { + Future _filterData( + FilterDataEvent event, Emitter emit) async { emit(AccessLoaded()); try { // Convert search text to lower case for case-insensitive search @@ -119,29 +152,40 @@ class AccessBloc extends Bloc { filteredData = data.where((item) { bool matchesCriteria = true; // Convert timestamp to DateTime and extract date component - DateTime effectiveDate = - DateTime.fromMillisecondsSinceEpoch(int.parse(item.effectiveTime.toString()) * 1000) - .toUtc() - .toLocal(); - DateTime invalidDate = - DateTime.fromMillisecondsSinceEpoch(int.parse(item.invalidTime.toString()) * 1000) - .toUtc() - .toLocal(); - DateTime effectiveDateAndTime = DateTime(effectiveDate.year, effectiveDate.month, - effectiveDate.day, effectiveDate.hour, effectiveDate.minute); - DateTime invalidDateAndTime = DateTime(invalidDate.year, invalidDate.month, invalidDate.day, - invalidDate.hour, invalidDate.minute); + DateTime effectiveDate = DateTime.fromMillisecondsSinceEpoch( + int.parse(item.effectiveTime.toString()) * 1000) + .toUtc() + .toLocal(); + DateTime invalidDate = DateTime.fromMillisecondsSinceEpoch( + int.parse(item.invalidTime.toString()) * 1000) + .toUtc() + .toLocal(); + DateTime effectiveDateAndTime = DateTime( + effectiveDate.year, + effectiveDate.month, + effectiveDate.day, + effectiveDate.hour, + effectiveDate.minute); + DateTime invalidDateAndTime = DateTime( + invalidDate.year, + invalidDate.month, + invalidDate.day, + invalidDate.hour, + invalidDate.minute); // Filter by password name, making the search case-insensitive if (searchText.isNotEmpty) { - final bool matchesName = item.passwordName.toString().toLowerCase().contains(searchText); + final bool matchesName = + item.passwordName.toString().toLowerCase().contains(searchText); if (!matchesName) { matchesCriteria = false; } } if (searchEmailText.isNotEmpty) { - final bool matchesName = - item.authorizerEmail.toString().toLowerCase().contains(searchEmailText); + final bool matchesName = item.authorizerEmail + .toString() + .toLowerCase() + .contains(searchEmailText); if (!matchesName) { matchesCriteria = false; } @@ -149,9 +193,11 @@ class AccessBloc extends Bloc { // Filter by start date only if (event.startTime != null && event.endTime == null) { DateTime startDateTime = - DateTime.fromMillisecondsSinceEpoch(event.startTime! * 1000).toUtc().toLocal(); - startDateTime = DateTime(startDateTime.year, startDateTime.month, startDateTime.day, - startDateTime.hour, startDateTime.minute); + DateTime.fromMillisecondsSinceEpoch(event.startTime! * 1000) + .toUtc() + .toLocal(); + startDateTime = DateTime(startDateTime.year, startDateTime.month, + startDateTime.day, startDateTime.hour, startDateTime.minute); if (effectiveDateAndTime.isBefore(startDateTime)) { matchesCriteria = false; } @@ -159,9 +205,11 @@ class AccessBloc extends Bloc { // Filter by end date only if (event.endTime != null && event.startTime == null) { DateTime startDateTime = - DateTime.fromMillisecondsSinceEpoch(event.endTime! * 1000).toUtc().toLocal(); - startDateTime = DateTime(startDateTime.year, startDateTime.month, startDateTime.day, - startDateTime.hour, startDateTime.minute); + DateTime.fromMillisecondsSinceEpoch(event.endTime! * 1000) + .toUtc() + .toLocal(); + startDateTime = DateTime(startDateTime.year, startDateTime.month, + startDateTime.day, startDateTime.hour, startDateTime.minute); if (invalidDateAndTime.isAfter(startDateTime)) { matchesCriteria = false; } @@ -170,13 +218,17 @@ class AccessBloc extends Bloc { // Filter by both start date and end date if (event.startTime != null && event.endTime != null) { DateTime startDateTime = - DateTime.fromMillisecondsSinceEpoch(event.startTime! * 1000).toUtc().toLocal(); + DateTime.fromMillisecondsSinceEpoch(event.startTime! * 1000) + .toUtc() + .toLocal(); DateTime endDateTime = - DateTime.fromMillisecondsSinceEpoch(event.endTime! * 1000).toUtc().toLocal(); - startDateTime = DateTime(startDateTime.year, startDateTime.month, startDateTime.day, - startDateTime.hour, startDateTime.minute); - endDateTime = DateTime(endDateTime.year, endDateTime.month, endDateTime.day, - endDateTime.hour, endDateTime.minute); + DateTime.fromMillisecondsSinceEpoch(event.endTime! * 1000) + .toUtc() + .toLocal(); + startDateTime = DateTime(startDateTime.year, startDateTime.month, + startDateTime.day, startDateTime.hour, startDateTime.minute); + endDateTime = DateTime(endDateTime.year, endDateTime.month, + endDateTime.day, endDateTime.hour, endDateTime.minute); if (effectiveDateAndTime.isBefore(startDateTime) || invalidDateAndTime.isAfter(endDateTime)) { matchesCriteria = false; @@ -184,11 +236,14 @@ class AccessBloc extends Bloc { } // Filter by selected tab index - if (event.selectedTabIndex == 1 && item.passwordStatus.value != 'To be effective') { + if (event.selectedTabIndex == 1 && + item.passwordStatus.value != 'To be effective') { matchesCriteria = false; - } else if (event.selectedTabIndex == 2 && item.passwordStatus.value != 'Effective') { + } else if (event.selectedTabIndex == 2 && + item.passwordStatus.value != 'Effective') { matchesCriteria = false; - } else if (event.selectedTabIndex == 3 && item.passwordStatus.value != 'Expired') { + } else if (event.selectedTabIndex == 3 && + item.passwordStatus.value != 'Expired') { matchesCriteria = false; } @@ -214,12 +269,14 @@ class AccessBloc extends Bloc { } String timestampToDate(dynamic timestamp) { - DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(int.parse(timestamp) * 1000); + DateTime dateTime = + DateTime.fromMillisecondsSinceEpoch(int.parse(timestamp) * 1000); return "${dateTime.year}/${dateTime.month.toString().padLeft(2, '0')}/${dateTime.day.toString().padLeft(2, '0')} " " ${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}"; } - Future onTabChanged(TabChangedEvent event, Emitter emit) async { + Future onTabChanged( + TabChangedEvent event, Emitter emit) async { try { emit(AccessLoaded()); selectedIndex = event.selectedIndex; @@ -228,14 +285,19 @@ class AccessBloc extends Bloc { filteredData = data; break; case 1: // To Be Effective - filteredData = - data.where((item) => item.passwordStatus.value == "To Be Effective").toList(); + filteredData = data + .where((item) => item.passwordStatus.value == "To Be Effective") + .toList(); break; case 2: // Effective - filteredData = data.where((item) => item.passwordStatus.value == "Effective").toList(); + filteredData = data + .where((item) => item.passwordStatus.value == "Effective") + .toList(); break; case 3: // Expired - filteredData = data.where((item) => item.passwordStatus.value == "Expired").toList(); + filteredData = data + .where((item) => item.passwordStatus.value == "Expired") + .toList(); break; default: filteredData = data; diff --git a/lib/pages/access_management/view/access_management.dart b/lib/pages/access_management/view/access_management.dart index caa5fe28..bed27eea 100644 --- a/lib/pages/access_management/view/access_management.dart +++ b/lib/pages/access_management/view/access_management.dart @@ -27,7 +27,8 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout { final isLargeScreen = isLargeScreenSize(context); final isSmallScreen = isSmallScreenSize(context); final isHalfMediumScreen = isHafMediumScreenSize(context); - final padding = isLargeScreen ? const EdgeInsets.all(30) : const EdgeInsets.all(15); + final padding = + isLargeScreen ? const EdgeInsets.all(30) : const EdgeInsets.all(15); return WebScaffold( enableMenuSidebar: false, @@ -37,23 +38,10 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout { style: Theme.of(context).textTheme.headlineLarge, ), ), - centerBody: Wrap( - children: [ - Padding( - padding: EdgeInsets.only(left: MediaQuery.of(context).size.width * 0.09), - child: Align( - alignment: Alignment.bottomLeft, - child: Text( - 'Physical Access', - style: Theme.of(context).textTheme.headlineMedium!.copyWith(color: Colors.white), - ), - ), - ), - ], - ), rightBody: const NavigateHomeGridView(), scaffoldBody: BlocProvider( - create: (BuildContext context) => AccessBloc()..add(FetchTableData()), + create: (BuildContext context) => + AccessBloc()..add(FetchTableData()), child: BlocConsumer( listener: (context, state) {}, builder: (context, state) { @@ -107,11 +95,14 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout { return [ item.passwordName, item.passwordType.value, - accessBloc.timestampToDate(item.effectiveTime), - accessBloc.timestampToDate(item.invalidTime), + accessBloc + .timestampToDate(item.effectiveTime), + accessBloc + .timestampToDate(item.invalidTime), item.deviceName.toString(), item.authorizerEmail.toString(), - accessBloc.timestampToDate(item.invalidTime), + accessBloc + .timestampToDate(item.invalidTime), item.passwordStatus.value, ]; }).toList(), @@ -122,7 +113,8 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout { }))); } - Wrap _buildVisitorAdminPasswords(BuildContext context, AccessBloc accessBloc) { + Wrap _buildVisitorAdminPasswords( + BuildContext context, AccessBloc accessBloc) { return Wrap( spacing: 10, runSpacing: 10, @@ -147,8 +139,9 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout { }, borderRadius: 8, child: Text( - '+ Create Visitor Password ', - style: context.textTheme.titleSmall!.copyWith(color: Colors.white, fontSize: 12), + 'Create Visitor Password ', + style: context.textTheme.titleSmall! + .copyWith(color: Colors.white, fontSize: 12), )), ), Container( @@ -160,7 +153,8 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout { backgroundColor: ColorsManager.whiteColors, child: Text( 'Admin Password', - style: context.textTheme.titleSmall!.copyWith(color: Colors.black, fontSize: 12), + style: context.textTheme.titleSmall! + .copyWith(color: Colors.black, fontSize: 12), )), ), ], @@ -185,8 +179,10 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout { description: '', onSubmitted: (value) { accessBloc.add(FilterDataEvent( - emailAuthorizer: accessBloc.emailAuthorizer.text.toLowerCase(), - selectedTabIndex: BlocProvider.of(context).selectedIndex, + emailAuthorizer: + accessBloc.emailAuthorizer.text.toLowerCase(), + selectedTabIndex: + BlocProvider.of(context).selectedIndex, passwordName: accessBloc.passwordName.text.toLowerCase(), startTime: accessBloc.effectiveTimeTimeStamp, endTime: accessBloc.expirationTimeTimeStamp)); @@ -204,8 +200,10 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout { description: '', onSubmitted: (value) { accessBloc.add(FilterDataEvent( - emailAuthorizer: accessBloc.emailAuthorizer.text.toLowerCase(), - selectedTabIndex: BlocProvider.of(context).selectedIndex, + emailAuthorizer: + accessBloc.emailAuthorizer.text.toLowerCase(), + selectedTabIndex: + BlocProvider.of(context).selectedIndex, passwordName: accessBloc.passwordName.text.toLowerCase(), startTime: accessBloc.effectiveTimeTimeStamp, endTime: accessBloc.expirationTimeTimeStamp)); @@ -234,7 +232,8 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout { onSearch: () { accessBloc.add(FilterDataEvent( emailAuthorizer: accessBloc.emailAuthorizer.text.toLowerCase(), - selectedTabIndex: BlocProvider.of(context).selectedIndex, + selectedTabIndex: + BlocProvider.of(context).selectedIndex, passwordName: accessBloc.passwordName.text.toLowerCase(), startTime: accessBloc.effectiveTimeTimeStamp, endTime: accessBloc.expirationTimeTimeStamp)); @@ -262,8 +261,10 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout { description: '', onSubmitted: (value) { accessBloc.add(FilterDataEvent( - emailAuthorizer: accessBloc.emailAuthorizer.text.toLowerCase(), - selectedTabIndex: BlocProvider.of(context).selectedIndex, + emailAuthorizer: + accessBloc.emailAuthorizer.text.toLowerCase(), + selectedTabIndex: + BlocProvider.of(context).selectedIndex, passwordName: accessBloc.passwordName.text.toLowerCase(), startTime: accessBloc.effectiveTimeTimeStamp, endTime: accessBloc.expirationTimeTimeStamp)); @@ -287,7 +288,8 @@ class AccessManagementPage extends StatelessWidget with HelperResponsiveLayout { onSearch: () { accessBloc.add(FilterDataEvent( emailAuthorizer: accessBloc.emailAuthorizer.text.toLowerCase(), - selectedTabIndex: BlocProvider.of(context).selectedIndex, + selectedTabIndex: + BlocProvider.of(context).selectedIndex, passwordName: accessBloc.passwordName.text.toLowerCase(), startTime: accessBloc.effectiveTimeTimeStamp, endTime: accessBloc.expirationTimeTimeStamp)); diff --git a/lib/pages/common/date_time_widget.dart b/lib/pages/common/date_time_widget.dart index 0965377e..8dbcc9aa 100644 --- a/lib/pages/common/date_time_widget.dart +++ b/lib/pages/common/date_time_widget.dart @@ -81,7 +81,10 @@ class DateTimeWebWidget extends StatelessWidget { const SizedBox( width: 30, ), - const Icon(Icons.arrow_right_alt), + const Icon( + Icons.arrow_right_alt, + color: ColorsManager.grayColor, + ), const SizedBox( width: 30, ), diff --git a/lib/pages/common/text_field/custom_text_field.dart b/lib/pages/common/text_field/custom_text_field.dart index c85e911d..b695da4a 100644 --- a/lib/pages/common/text_field/custom_text_field.dart +++ b/lib/pages/common/text_field/custom_text_field.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:syncrow_web/utils/extension/build_context_x.dart'; +import 'package:syncrow_web/utils/style.dart'; class StatefulTextField extends StatefulWidget { const StatefulTextField( @@ -25,13 +26,15 @@ class StatefulTextField extends StatefulWidget { class _StatefulTextFieldState extends State { @override Widget build(BuildContext context) { - return CustomTextField( - title: widget.title, - controller: widget.controller, - hintText: widget.hintText, - width: widget.width, - elevation: widget.elevation, - onSubmittedFun: widget.onSubmitted); + return Container( + child: CustomTextField( + title: widget.title, + controller: widget.controller, + hintText: widget.hintText, + width: widget.width, + elevation: widget.elevation, + onSubmittedFun: widget.onSubmitted), + ); } } @@ -73,17 +76,20 @@ class CustomTextField extends StatelessWidget { child: Container( width: width, height: 45, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8), - ), + decoration: containerDecoration, + + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: BorderRadius.circular(8), + // ), child: TextFormField( controller: controller, style: const TextStyle(color: Colors.black), decoration: InputDecoration( hintText: hintText, hintStyle: const TextStyle(fontSize: 12), - contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + contentPadding: + const EdgeInsets.symmetric(horizontal: 12, vertical: 10), border: InputBorder.none, ), onFieldSubmitted: (_) { diff --git a/lib/pages/common/text_field/custom_web_textfield.dart b/lib/pages/common/text_field/custom_web_textfield.dart index d5c64e8d..630e334b 100644 --- a/lib/pages/common/text_field/custom_web_textfield.dart +++ b/lib/pages/common/text_field/custom_web_textfield.dart @@ -39,11 +39,17 @@ class CustomWebTextField extends StatelessWidget { if (isRequired) Text( '* ', - style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.red), + style: Theme.of(context) + .textTheme + .bodyMedium! + .copyWith(color: Colors.red), ), Text( textFieldName, - style: Theme.of(context).textTheme.bodySmall!.copyWith(color: Colors.black, fontSize: 13), + style: Theme.of(context) + .textTheme + .bodySmall! + .copyWith(color: Colors.black, fontSize: 13), ), ], ), @@ -53,10 +59,10 @@ class CustomWebTextField extends StatelessWidget { Expanded( child: Text( description ?? '', - style: Theme.of(context) - .textTheme - .bodySmall! - .copyWith(fontSize: 9, fontWeight: FontWeight.w400, color: ColorsManager.textGray), + style: Theme.of(context).textTheme.bodySmall!.copyWith( + fontSize: 9, + fontWeight: FontWeight.w400, + color: ColorsManager.textGray), ), ), ], @@ -66,21 +72,15 @@ class CustomWebTextField extends StatelessWidget { ), Container( height: height ?? 35, - decoration: containerDecoration.copyWith(color: const Color(0xFFF5F6F7), boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.3), - spreadRadius: 2, - blurRadius: 3, - offset: const Offset(1, 1), // changes position of shadow - ), - ]), + decoration: containerDecoration, child: TextFormField( validator: validator, controller: controller, style: const TextStyle(color: Colors.black), decoration: textBoxDecoration()!.copyWith( errorStyle: const TextStyle(height: 0), - hintStyle: context.textTheme.titleSmall!.copyWith(color: Colors.grey, fontSize: 12), + hintStyle: context.textTheme.titleSmall! + .copyWith(color: Colors.grey, fontSize: 12), hintText: hintText ?? 'Please enter'), onFieldSubmitted: onSubmitted, ), diff --git a/lib/pages/device_managment/all_devices/widgets/device_managment_body.dart b/lib/pages/device_managment/all_devices/widgets/device_managment_body.dart index 366775bf..49a4dc35 100644 --- a/lib/pages/device_managment/all_devices/widgets/device_managment_body.dart +++ b/lib/pages/device_managment/all_devices/widgets/device_managment_body.dart @@ -57,12 +57,15 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout { 'Low Battery ($lowBatteryCount)', ]; - final buttonLabel = (selectedDevices.length > 1) ? 'Batch Control' : 'Control'; + final buttonLabel = + (selectedDevices.length > 1) ? 'Batch Control' : 'Control'; return Column( children: [ Container( - padding: isLargeScreenSize(context) ? const EdgeInsets.all(30) : const EdgeInsets.all(15), + padding: isLargeScreenSize(context) + ? const EdgeInsets.all(30) + : const EdgeInsets.all(15), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -71,7 +74,9 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout { tabs: tabs, selectedIndex: selectedIndex, onTabChanged: (index) { - context.read().add(SelectedFilterChanged(index)); + context + .read() + .add(SelectedFilterChanged(index)); }, ), const SizedBox(height: 20), @@ -93,11 +98,14 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout { ), ); } else if (selectedDevices.length > 1) { - final productTypes = selectedDevices.map((device) => device.productType).toSet(); + final productTypes = selectedDevices + .map((device) => device.productType) + .toSet(); if (productTypes.length == 1) { showDialog( context: context, - builder: (context) => DeviceBatchControlDialog( + builder: (context) => + DeviceBatchControlDialog( devices: selectedDevices, ), ); @@ -111,7 +119,9 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout { textAlign: TextAlign.center, style: TextStyle( fontSize: 12, - color: isControlButtonEnabled ? Colors.white : Colors.grey, + color: isControlButtonEnabled + ? Colors.white + : Colors.grey, ), ), ), @@ -122,13 +132,17 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout { ), Expanded( child: Padding( - padding: isLargeScreenSize(context) ? const EdgeInsets.all(30) : const EdgeInsets.all(15), + padding: isLargeScreenSize(context) + ? const EdgeInsets.all(30) + : const EdgeInsets.all(15), child: DynamicTable( withSelectAll: true, cellDecoration: containerDecoration, onRowSelected: (index, isSelected, row) { final selectedDevice = devicesToShow[index]; - context.read().add(SelectDevice(selectedDevice)); + context + .read() + .add(SelectDevice(selectedDevice)); }, withCheckBox: true, size: MediaQuery.of(context).size, @@ -151,17 +165,26 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout { device.uuid ?? '', device.unit?.name ?? '', device.room?.name ?? '', - device.batteryLevel != null ? '${device.batteryLevel}%' : '-', - formatDateTime(DateTime.fromMillisecondsSinceEpoch((device.createTime ?? 0) * 1000)), + device.batteryLevel != null + ? '${device.batteryLevel}%' + : '-', + formatDateTime(DateTime.fromMillisecondsSinceEpoch( + (device.createTime ?? 0) * 1000)), device.online == true ? 'Online' : 'Offline', - formatDateTime(DateTime.fromMillisecondsSinceEpoch((device.updateTime ?? 0) * 1000)), + formatDateTime(DateTime.fromMillisecondsSinceEpoch( + (device.updateTime ?? 0) * 1000)), ]; }).toList(), onSelectionChanged: (selectedRows) { - context.read().add(UpdateSelection(selectedRows)); + context + .read() + .add(UpdateSelection(selectedRows)); }, - initialSelectedIds: - context.read().selectedDevices.map((device) => device.uuid!).toList(), + initialSelectedIds: context + .read() + .selectedDevices + .map((device) => device.uuid!) + .toList(), isEmpty: devicesToShow.isEmpty, ), ), diff --git a/lib/pages/device_managment/all_devices/widgets/device_search_filters.dart b/lib/pages/device_managment/all_devices/widgets/device_search_filters.dart index ddb2bc19..a6c202f4 100644 --- a/lib/pages/device_managment/all_devices/widgets/device_search_filters.dart +++ b/lib/pages/device_managment/all_devices/widgets/device_search_filters.dart @@ -4,6 +4,7 @@ import 'package:syncrow_web/pages/common/text_field/custom_text_field.dart'; import 'package:syncrow_web/pages/device_managment/all_devices/bloc/device_managment_bloc.dart'; import 'package:syncrow_web/pages/common/buttons/search_reset_buttons.dart'; import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart'; +import 'package:syncrow_web/utils/style.dart'; class DeviceSearchFilters extends StatefulWidget { const DeviceSearchFilters({super.key}); @@ -12,7 +13,8 @@ class DeviceSearchFilters extends StatefulWidget { State createState() => _DeviceSearchFiltersState(); } -class _DeviceSearchFiltersState extends State with HelperResponsiveLayout { +class _DeviceSearchFiltersState extends State + with HelperResponsiveLayout { final TextEditingController communityController = TextEditingController(); final TextEditingController unitNameController = TextEditingController(); final TextEditingController productNameController = TextEditingController(); @@ -34,7 +36,8 @@ class _DeviceSearchFiltersState extends State with HelperRe const SizedBox(width: 20), _buildSearchField("Unit Name", unitNameController, 200), const SizedBox(width: 20), - _buildSearchField("Device Name / Product Name", productNameController, 300), + _buildSearchField( + "Device Name / Product Name", productNameController, 300), const SizedBox(width: 20), _buildSearchResetButtons(), ], @@ -59,19 +62,22 @@ class _DeviceSearchFiltersState extends State with HelperRe ); } - Widget _buildSearchField(String title, TextEditingController controller, double width) { - return StatefulTextField( - title: title, - width: width, - elevation: 2, - controller: controller, - onSubmitted: () { - context.read().add(SearchDevices( - productName: productNameController.text, - unitName: unitNameController.text, - community: communityController.text, - searchField: true)); - }, + Widget _buildSearchField( + String title, TextEditingController controller, double width) { + return Container( + child: StatefulTextField( + title: title, + width: width, + elevation: 2, + controller: controller, + onSubmitted: () { + context.read().add(SearchDevices( + productName: productNameController.text, + unitName: unitNameController.text, + community: communityController.text, + searchField: true)); + }, + ), ); } diff --git a/lib/utils/color_manager.dart b/lib/utils/color_manager.dart index 1eaf8845..9b4692bc 100644 --- a/lib/utils/color_manager.dart +++ b/lib/utils/color_manager.dart @@ -42,4 +42,4 @@ abstract class ColorsManager { static const Color textGreen = Color(0xFF008905); static const Color yaGreen = Color(0xFFFFBF44); } -//0036E6 \ No newline at end of file +//background: #999999; diff --git a/lib/utils/style.dart b/lib/utils/style.dart index bda3665f..145cf8a1 100644 --- a/lib/utils/style.dart +++ b/lib/utils/style.dart @@ -33,12 +33,11 @@ InputDecoration? textBoxDecoration({bool suffixIcon = false}) => BoxDecoration containerDecoration = BoxDecoration( boxShadow: [ BoxShadow( - color: Colors.grey.withOpacity(0.5), - spreadRadius: 5, - blurRadius: 8, - offset: const Offset(0, 3), // changes position of shadow + color: Colors.grey.withOpacity(0.3), + spreadRadius: 2, + blurRadius: 4, + offset: const Offset(0, 5), // changes position of shadow ), ], color: ColorsManager.boxColor, borderRadius: const BorderRadius.all(Radius.circular(10))); - diff --git a/pubspec.lock b/pubspec.lock index 2c9cb88c..8b9df6d6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -292,18 +292,18 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "10.0.4" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.0.3" leak_tracker_testing: dependency: transitive description: @@ -340,18 +340,18 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.12.0" nested: dependency: transitive description: @@ -561,10 +561,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.7.0" typed_data: dependency: transitive description: @@ -609,10 +609,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "14.2.5" + version: "14.2.1" web: dependency: transitive description: