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
A new Flutter project.
## Getting Started
This project is a starting point for a Flutter application.

View File

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

View File

@ -37,8 +37,8 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
offlineCount = state.offlineCount;
lowBatteryCount = state.lowBatteryCount;
isControlButtonEnabled = state.isControlButtonEnabled;
selectedDevices = state.selectedDevice ??
context.read<DeviceManagementBloc>().selectedDevices;
selectedDevices =
state.selectedDevice ?? context.read<DeviceManagementBloc>().selectedDevices;
} else if (state is DeviceManagementFiltered) {
devicesToShow = state.filteredDevices;
selectedIndex = state.selectedIndex;
@ -46,8 +46,8 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
offlineCount = state.offlineCount;
lowBatteryCount = state.lowBatteryCount;
isControlButtonEnabled = state.isControlButtonEnabled;
selectedDevices = state.selectedDevice ??
context.read<DeviceManagementBloc>().selectedDevices;
selectedDevices =
state.selectedDevice ?? context.read<DeviceManagementBloc>().selectedDevices;
} else if (state is DeviceManagementInitial) {
devicesToShow = [];
selectedIndex = 0;
@ -61,15 +61,13 @@ 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: [
@ -78,9 +76,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
tabs: tabs,
selectedIndex: selectedIndex,
onTabChanged: (index) {
context
.read<DeviceManagementBloc>()
.add(SelectedFilterChanged(index));
context.read<DeviceManagementBloc>().add(SelectedFilterChanged(index));
},
),
const SizedBox(height: 20),
@ -88,7 +84,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
const SizedBox(height: 12),
Container(
height: 45,
width: 100,
width: 125,
decoration: containerDecoration,
child: Center(
child: DefaultButton(
@ -102,14 +98,12 @@ 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,
),
);
@ -123,9 +117,7 @@ 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,
),
),
),
@ -144,9 +136,7 @@ class DeviceManagementBody extends StatelessWidget with HelperResponsiveLayout {
cellDecoration: containerDecoration,
onRowSelected: (index, isSelected, row) {
final selectedDevice = devicesToShow[index];
context
.read<DeviceManagementBloc>()
.add(SelectDevice(selectedDevice));
context.read<DeviceManagementBloc>().add(SelectDevice(selectedDevice));
},
withCheckBox: true,
size: context.screenSize,
@ -169,20 +159,16 @@ 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<DeviceManagementBloc>()
.add(UpdateSelection(selectedRows));
context.read<DeviceManagementBloc>().add(UpdateSelection(selectedRows));
},
initialSelectedIds: context
.read<DeviceManagementBloc>()

View File

@ -1,5 +1,5 @@
name: syncrow_web
description: "A new Flutter project."
description: "Smart Home Solutions"
# The following line prevents the package from being accidentally published to
# 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

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 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 -->
<meta name="apple-mobile-web-app-capable" content="yes">

View File

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