Added syncrow icons, changed the description, increased the width of the control button

This commit is contained in:
Abdullah Alassaf
2024-09-25 00:23:47 +03:00
parent e690ddc23a
commit 58938d4598
11 changed files with 31 additions and 50 deletions

View File

@ -1,7 +1,5 @@
# syncrow_web # syncrow_web
A new Flutter project.
## Getting Started ## Getting Started
This project is a starting point for a Flutter application. This project is a starting point for a Flutter application.

View File

@ -42,39 +42,36 @@ class DefaultButton extends StatelessWidget {
? null ? null
: customButtonStyle ?? : customButtonStyle ??
ButtonStyle( ButtonStyle(
textStyle: MaterialStateProperty.all( textStyle: WidgetStateProperty.all(
customTextStyle ?? customTextStyle ??
Theme.of(context).textTheme.bodySmall!.copyWith( Theme.of(context).textTheme.bodySmall!.copyWith(
fontSize: 13, fontSize: 13, color: foregroundColor, fontWeight: FontWeight.normal),
color: foregroundColor,
fontWeight: FontWeight.normal),
), ),
foregroundColor: MaterialStateProperty.all( foregroundColor: WidgetStateProperty.all(
isSecondary isSecondary
? Colors.black ? Colors.black
: enabled : enabled
? foregroundColor ?? Colors.white ? foregroundColor ?? Colors.white
: Colors.black, : Colors.black,
), ),
backgroundColor: MaterialStateProperty.resolveWith<Color>( backgroundColor: WidgetStateProperty.resolveWith<Color>((Set<WidgetState> states) {
(Set<MaterialState> states) {
return enabled return enabled
? backgroundColor ?? ColorsManager.primaryColor ? backgroundColor ?? ColorsManager.primaryColor
: Colors.black.withOpacity(0.2); : Colors.black.withOpacity(0.2);
}), }),
shape: MaterialStateProperty.all( shape: WidgetStateProperty.all(
RoundedRectangleBorder( RoundedRectangleBorder(
side: BorderSide(color: borderColor ?? Colors.transparent), side: BorderSide(color: borderColor ?? Colors.transparent),
borderRadius: BorderRadius.circular(borderRadius ?? 20), borderRadius: BorderRadius.circular(borderRadius ?? 20),
), ),
), ),
fixedSize: MaterialStateProperty.all( fixedSize: WidgetStateProperty.all(
const Size.fromHeight(50), const Size.fromHeight(50),
), ),
padding: MaterialStateProperty.all( padding: WidgetStateProperty.all(
EdgeInsets.all(padding ?? 10), EdgeInsets.all(padding ?? 10),
), ),
minimumSize: MaterialStateProperty.all( minimumSize: WidgetStateProperty.all(
const Size.fromHeight(50), const Size.fromHeight(50),
), ),
), ),

View File

@ -37,8 +37,8 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
offlineCount = state.offlineCount; offlineCount = state.offlineCount;
lowBatteryCount = state.lowBatteryCount; lowBatteryCount = state.lowBatteryCount;
isControlButtonEnabled = state.isControlButtonEnabled; isControlButtonEnabled = state.isControlButtonEnabled;
selectedDevices = state.selectedDevice ?? selectedDevices =
context.read<DeviceManagementBloc>().selectedDevices; state.selectedDevice ?? context.read<DeviceManagementBloc>().selectedDevices;
} else if (state is DeviceManagementFiltered) { } else if (state is DeviceManagementFiltered) {
devicesToShow = state.filteredDevices; devicesToShow = state.filteredDevices;
selectedIndex = state.selectedIndex; selectedIndex = state.selectedIndex;
@ -46,8 +46,8 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
offlineCount = state.offlineCount; offlineCount = state.offlineCount;
lowBatteryCount = state.lowBatteryCount; lowBatteryCount = state.lowBatteryCount;
isControlButtonEnabled = state.isControlButtonEnabled; isControlButtonEnabled = state.isControlButtonEnabled;
selectedDevices = state.selectedDevice ?? selectedDevices =
context.read<DeviceManagementBloc>().selectedDevices; state.selectedDevice ?? context.read<DeviceManagementBloc>().selectedDevices;
} else if (state is DeviceManagementInitial) { } else if (state is DeviceManagementInitial) {
devicesToShow = []; devicesToShow = [];
selectedIndex = 0; selectedIndex = 0;
@ -61,15 +61,13 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
'Low Battery ($lowBatteryCount)', 'Low Battery ($lowBatteryCount)',
]; ];
final buttonLabel = final buttonLabel = (selectedDevices.length > 1) ? 'Batch Control' : 'Control';
(selectedDevices.length > 1) ? 'Batch Control' : 'Control';
return Column( return Column(
children: [ children: [
Container( Container(
padding: isLargeScreenSize(context) padding:
? const EdgeInsets.all(30) isLargeScreenSize(context) ? const EdgeInsets.all(30) : const EdgeInsets.all(15),
: const EdgeInsets.all(15),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -78,9 +76,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
tabs: tabs, tabs: tabs,
selectedIndex: selectedIndex, selectedIndex: selectedIndex,
onTabChanged: (index) { onTabChanged: (index) {
context context.read<DeviceManagementBloc>().add(SelectedFilterChanged(index));
.read<DeviceManagementBloc>()
.add(SelectedFilterChanged(index));
}, },
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
@ -88,7 +84,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
const SizedBox(height: 12), const SizedBox(height: 12),
Container( Container(
height: 45, height: 45,
width: 100, width: 125,
decoration: containerDecoration, decoration: containerDecoration,
child: Center( child: Center(
child: DefaultButton( child: DefaultButton(
@ -102,14 +98,12 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
), ),
); );
} else if (selectedDevices.length > 1) { } else if (selectedDevices.length > 1) {
final productTypes = selectedDevices final productTypes =
.map((device) => device.productType) selectedDevices.map((device) => device.productType).toSet();
.toSet();
if (productTypes.length == 1) { if (productTypes.length == 1) {
showDialog( showDialog(
context: context, context: context,
builder: (context) => builder: (context) => DeviceBatchControlDialog(
DeviceBatchControlDialog(
devices: selectedDevices, devices: selectedDevices,
), ),
); );
@ -123,9 +117,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: isControlButtonEnabled color: isControlButtonEnabled ? Colors.white : Colors.grey,
? Colors.white
: Colors.grey,
), ),
), ),
), ),
@ -144,9 +136,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
cellDecoration: containerDecoration, cellDecoration: containerDecoration,
onRowSelected: (index, isSelected, row) { onRowSelected: (index, isSelected, row) {
final selectedDevice = devicesToShow[index]; final selectedDevice = devicesToShow[index];
context context.read<DeviceManagementBloc>().add(SelectDevice(selectedDevice));
.read<DeviceManagementBloc>()
.add(SelectDevice(selectedDevice));
}, },
withCheckBox: true, withCheckBox: true,
size: context.screenSize, size: context.screenSize,
@ -169,20 +159,16 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
device.uuid ?? '', device.uuid ?? '',
device.unit?.name ?? '', device.unit?.name ?? '',
device.room?.name ?? '', device.room?.name ?? '',
device.batteryLevel != null device.batteryLevel != null ? '${device.batteryLevel}%' : '-',
? '${device.batteryLevel}%' formatDateTime(
: '-', DateTime.fromMillisecondsSinceEpoch((device.createTime ?? 0) * 1000)),
formatDateTime(DateTime.fromMillisecondsSinceEpoch(
(device.createTime ?? 0) * 1000)),
device.online == true ? 'Online' : 'Offline', device.online == true ? 'Online' : 'Offline',
formatDateTime(DateTime.fromMillisecondsSinceEpoch( formatDateTime(
(device.updateTime ?? 0) * 1000)), DateTime.fromMillisecondsSinceEpoch((device.updateTime ?? 0) * 1000)),
]; ];
}).toList(), }).toList(),
onSelectionChanged: (selectedRows) { onSelectionChanged: (selectedRows) {
context context.read<DeviceManagementBloc>().add(UpdateSelection(selectedRows));
.read<DeviceManagementBloc>()
.add(UpdateSelection(selectedRows));
}, },
initialSelectedIds: context initialSelectedIds: context
.read<DeviceManagementBloc>() .read<DeviceManagementBloc>()

View File

@ -1,5 +1,5 @@
name: syncrow_web name: syncrow_web
description: "A new Flutter project." description: "Smart Home Solutions"
# The following line prevents the package from being accidentally published to # The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages. # pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: 'none' # Remove this line if you wish to publish to pub.dev

Binary file not shown.

Before

Width:  |  Height:  |  Size: 917 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -18,7 +18,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible"> <meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A new Flutter project."> <meta name="description" content="Smart Home Solutions.">
<!-- iOS meta tags & icons --> <!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">

View File

@ -5,7 +5,7 @@
"display": "standalone", "display": "standalone",
"background_color": "#0175C2", "background_color": "#0175C2",
"theme_color": "#0175C2", "theme_color": "#0175C2",
"description": "A new Flutter project.", "description": "Smart Home Solutions",
"orientation": "portrait-primary", "orientation": "portrait-primary",
"prefer_related_applications": false, "prefer_related_applications": false,
"icons": [ "icons": [