mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Refactor Widgets for Improved UI Consistency and Usability:
- Replaced Text with SelectableText in AddDeviceTypeWidget and AssignTagsTable for better text selection and accessibility. - Simplified onCancel action in AssignTagsDialog for improved readability. - Enhanced ProductsGrid layout by removing unnecessary Column widget, streamlining the widget structure for better performance and maintainability.
This commit is contained in:
@ -17,7 +17,7 @@ class AddDeviceTypeWidget extends StatelessWidget {
|
|||||||
..add(const LoadProducts()),
|
..add(const LoadProducts()),
|
||||||
child: Builder(
|
child: Builder(
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
title: const Text('Add Devices'),
|
title: const SelectableText('Add Devices'),
|
||||||
backgroundColor: ColorsManager.whiteColors,
|
backgroundColor: ColorsManager.whiteColors,
|
||||||
content: BlocBuilder<ProductsBloc, ProductsState>(
|
content: BlocBuilder<ProductsBloc, ProductsState>(
|
||||||
builder: (context, state) => switch (state) {
|
builder: (context, state) => switch (state) {
|
||||||
|
@ -25,12 +25,10 @@ class AssignTagsDialog extends StatelessWidget {
|
|||||||
actions: [
|
actions: [
|
||||||
SpaceDetailsActionButtons(
|
SpaceDetailsActionButtons(
|
||||||
onSave: () {},
|
onSave: () {},
|
||||||
onCancel: () {
|
onCancel: () => showDialog<void>(
|
||||||
showDialog<void>(
|
context: context,
|
||||||
context: context,
|
builder: (context) => const AddDeviceTypeWidget(),
|
||||||
builder: (context) => const AddDeviceTypeWidget(),
|
),
|
||||||
);
|
|
||||||
},
|
|
||||||
cancelButtonLabel: 'Add New Device',
|
cancelButtonLabel: 'Add New Device',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -42,7 +42,8 @@ class _AssignTagsTableState extends State<AssignTagsTable> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DataColumn _buildDataColumn(String label) {
|
DataColumn _buildDataColumn(String label) {
|
||||||
return DataColumn(label: Text(label, style: context.textTheme.bodyMedium));
|
return DataColumn(
|
||||||
|
label: SelectableText(label, style: context.textTheme.bodyMedium));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -69,7 +70,7 @@ class _AssignTagsTableState extends State<AssignTagsTable> {
|
|||||||
cells: [
|
cells: [
|
||||||
DataCell(
|
DataCell(
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: SelectableText(
|
||||||
'No Devices Available',
|
'No Devices Available',
|
||||||
style: context.textTheme.bodyMedium?.copyWith(
|
style: context.textTheme.bodyMedium?.copyWith(
|
||||||
color: ColorsManager.lightGrayColor,
|
color: ColorsManager.lightGrayColor,
|
||||||
|
@ -25,31 +25,26 @@ class ProductsGrid extends StatelessWidget {
|
|||||||
color: ColorsManager.textFieldGreyColor,
|
color: ColorsManager.textFieldGreyColor,
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Expanded(
|
||||||
children: [
|
child: GridView.builder(
|
||||||
const SizedBox(height: 16),
|
padding: const EdgeInsets.symmetric(
|
||||||
Expanded(
|
horizontal: 20,
|
||||||
child: GridView.builder(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 20,
|
|
||||||
),
|
|
||||||
shrinkWrap: true,
|
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
crossAxisCount: crossAxisCount,
|
|
||||||
mainAxisSpacing: 6,
|
|
||||||
crossAxisSpacing: 4,
|
|
||||||
childAspectRatio: 0.8,
|
|
||||||
),
|
|
||||||
itemCount: products.length,
|
|
||||||
itemBuilder: (context, index) => ProductTypeCard(
|
|
||||||
product: products[index],
|
|
||||||
count: 0,
|
|
||||||
onIncrement: () {},
|
|
||||||
onDecrement: () {},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
shrinkWrap: true,
|
||||||
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: crossAxisCount,
|
||||||
|
mainAxisSpacing: 6,
|
||||||
|
crossAxisSpacing: 4,
|
||||||
|
childAspectRatio: 0.8,
|
||||||
|
),
|
||||||
|
itemCount: products.length,
|
||||||
|
itemBuilder: (context, index) => ProductTypeCard(
|
||||||
|
product: products[index],
|
||||||
|
count: 0,
|
||||||
|
onIncrement: () {},
|
||||||
|
onDecrement: () {},
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user