move icon to the center and change subspace title name

This commit is contained in:
mohammad
2025-05-21 10:16:12 +03:00
parent a15b5439f0
commit 06b320a75d
2 changed files with 53 additions and 33 deletions

View File

@ -63,7 +63,8 @@ class _DynamicTableState extends State<DynamicTable> {
} }
} }
bool _compareListOfLists(List<List<dynamic>> oldList, List<List<dynamic>> newList) { bool _compareListOfLists(
List<List<dynamic>> oldList, List<List<dynamic>> newList) {
// Check if the old and new lists are the same // Check if the old and new lists are the same
if (oldList.length != newList.length) return false; if (oldList.length != newList.length) return false;
@ -132,46 +133,60 @@ class _DynamicTableState extends State<DynamicTable> {
children: [ children: [
if (widget.withCheckBox) _buildSelectAllCheckbox(), if (widget.withCheckBox) _buildSelectAllCheckbox(),
...List.generate(widget.headers.length, (index) { ...List.generate(widget.headers.length, (index) {
return _buildTableHeaderCell(widget.headers[index], index); return _buildTableHeaderCell(
widget.headers[index], index);
}) })
//...widget.headers.map((header) => _buildTableHeaderCell(header)), //...widget.headers.map((header) => _buildTableHeaderCell(header)),
], ],
), ),
), ),
widget.isEmpty widget.isEmpty
? Column( ? SizedBox(
mainAxisAlignment: MainAxisAlignment.center, height: widget.size.height * 0.5,
children: [ width: widget.size.width,
Row( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, children: [
children: [ Row(
Column( crossAxisAlignment: CrossAxisAlignment.center,
children: [ mainAxisAlignment: MainAxisAlignment.center,
SvgPicture.asset(Assets.emptyTable), children: [
const SizedBox( Column(
height: 15, children: [
), SvgPicture.asset(Assets.emptyTable),
Text( const SizedBox(
widget.tableName == 'AccessManagement' ? 'No Password ' : 'No Devices', height: 15,
style: Theme.of(context) ),
.textTheme Text(
.bodySmall! widget.tableName == 'AccessManagement'
.copyWith(color: ColorsManager.grayColor), ? 'No Password '
) : 'No Devices',
], style: Theme.of(context)
), .textTheme
], .bodySmall!
), .copyWith(
], color:
ColorsManager.grayColor),
)
],
),
],
),
],
),
) )
: Column( : Column(
children: List.generate(widget.data.length, (index) { children:
List.generate(widget.data.length, (index) {
final row = widget.data[index]; final row = widget.data[index];
return Row( return Row(
children: [ children: [
if (widget.withCheckBox) _buildRowCheckbox(index, widget.size.height * 0.08), if (widget.withCheckBox)
...row.map((cell) => _buildTableCell(cell.toString(), widget.size.height * 0.08)), _buildRowCheckbox(
index, widget.size.height * 0.08),
...row.map((cell) => _buildTableCell(
cell.toString(),
widget.size.height * 0.08)),
], ],
); );
}), }),
@ -196,7 +211,9 @@ class _DynamicTableState extends State<DynamicTable> {
), ),
child: Checkbox( child: Checkbox(
value: _selectAll, value: _selectAll,
onChanged: widget.withSelectAll && widget.data.isNotEmpty ? _toggleSelectAll : null, onChanged: widget.withSelectAll && widget.data.isNotEmpty
? _toggleSelectAll
: null,
), ),
); );
} }
@ -238,7 +255,9 @@ class _DynamicTableState extends State<DynamicTable> {
constraints: const BoxConstraints.expand(height: 40), constraints: const BoxConstraints.expand(height: 40),
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: index == widget.headers.length - 1 ? 12 : 8.0, vertical: 4), padding: EdgeInsets.symmetric(
horizontal: index == widget.headers.length - 1 ? 12 : 8.0,
vertical: 4),
child: Text( child: Text(
title, title,
style: context.textTheme.titleSmall!.copyWith( style: context.textTheme.titleSmall!.copyWith(

View File

@ -97,7 +97,8 @@ class DeviceControlDialog extends StatelessWidget with RouteControlsBasedCode {
children: [ children: [
_buildInfoRow('Space Name:', _buildInfoRow('Space Name:',
device.spaces?.firstOrNull?.spaceName ?? 'N/A'), device.spaces?.firstOrNull?.spaceName ?? 'N/A'),
_buildInfoRow('Room:', device.subspace?.subspaceName ?? 'N/A'), _buildInfoRow(
'Sub space:', device.subspace?.subspaceName ?? 'N/A'),
], ],
), ),
TableRow( TableRow(