merged with dev and access_bugs and solved conflicts

This commit is contained in:
Abdullah Alassaf
2024-08-28 14:50:47 +03:00
30 changed files with 1326 additions and 1207 deletions

View File

@ -7,6 +7,7 @@ Future<void> showCustomDialog({
required String message,
String? title,
String? iconPath,
Widget? widget,
double? dialogHeight,
double? iconHeight,
double? iconWidth,
@ -54,6 +55,8 @@ Future<void> showCustomDialog({
textAlign: TextAlign.center,
),
),
if(widget!=null)
Expanded(child:widget)
],
),
),

View File

@ -14,7 +14,6 @@ class DynamicTable extends StatefulWidget {
final void Function(bool?)? selectAll;
final void Function(int, bool, dynamic)? onRowSelected;
final List<String>? initialSelectedIds;
const DynamicTable({
super.key,
required this.headers,
@ -66,14 +65,11 @@ class _DynamicTableState extends State<DynamicTable> {
child: Column(
children: [
Container(
decoration: widget.headerDecoration ??
BoxDecoration(color: Colors.grey[200]),
decoration: widget.headerDecoration ?? BoxDecoration(color: Colors.grey[200]),
child: Row(
children: [
if (widget.withCheckBox) _buildSelectAllCheckbox(),
...widget.headers
.map((header) => _buildTableHeaderCell(header))
.toList(),
...widget.headers.map((header) => _buildTableHeaderCell(header)).toList(),
],
),
),
@ -97,8 +93,7 @@ class _DynamicTableState extends State<DynamicTable> {
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(
color: ColorsManager.grayColor),
.copyWith(color: ColorsManager.grayColor),
)
],
),
@ -118,12 +113,10 @@ class _DynamicTableState extends State<DynamicTable> {
return Row(
children: [
if (widget.withCheckBox)
_buildRowCheckbox(
index, widget.size.height * 0.10),
_buildRowCheckbox(index, widget.size.height * 0.10),
...row
.map((cell) => _buildTableCell(
cell.toString(),
widget.size.height * 0.10))
.map((cell) =>
_buildTableCell(cell.toString(), widget.size.height * 0.10))
.toList(),
],
);
@ -211,6 +204,27 @@ class _DynamicTableState extends State<DynamicTable> {
batteryLevel = double.tryParse(content.replaceAll('%', '').trim());
}
Color? statusColor;
switch (content) {
case 'Effective':
statusColor = ColorsManager.textGreen;
break;
case 'Expired':
statusColor = ColorsManager.red;
break;
case 'To be effective':
statusColor = ColorsManager.yaGreen;
break;
case 'Online':
statusColor = ColorsManager.green;
break;
case 'Offline':
statusColor = ColorsManager.red;
break;
default:
statusColor = Colors.black; // Default color
}
return Expanded(
child: Container(
height: size,
@ -227,16 +241,11 @@ class _DynamicTableState extends State<DynamicTable> {
child: Text(
content,
style: TextStyle(
color: batteryLevel != null && batteryLevel < 20
? ColorsManager.red // Red color for low battery
: content == 'Online'
? ColorsManager.green // Green color for Online
: content == 'Offline'
? ColorsManager.red // Red color for Offline
: Colors.black,
fontSize: 12,
fontWeight: FontWeight.w400,
),
color: batteryLevel != null && batteryLevel < 20
? ColorsManager.red
: statusColor, // Use the passed color or default to black
fontSize: 10,
fontWeight: FontWeight.w400),
),
),
);

View File

@ -36,10 +36,7 @@ class DateTimeWebWidget 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(
title,
@ -55,8 +52,7 @@ class DateTimeWebWidget extends StatelessWidget {
),
Container(
height: size.height * 0.055,
padding:
const EdgeInsets.only(top: 10, bottom: 10, right: 30, left: 10),
padding: const EdgeInsets.only(top: 10, bottom: 10, right: 30, left: 10),
decoration: containerDecoration,
child: FittedBox(
child: Column(
@ -69,13 +65,10 @@ class DateTimeWebWidget extends StatelessWidget {
child: FittedBox(
child: Text(
firstString,
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(
color: ColorsManager.grayColor,
fontSize: 12,
fontWeight: FontWeight.w400),
style: Theme.of(context).textTheme.bodySmall!.copyWith(
color: ColorsManager.grayColor,
fontSize: 12,
fontWeight: FontWeight.w400),
),
)),
const SizedBox(
@ -90,13 +83,10 @@ class DateTimeWebWidget extends StatelessWidget {
child: FittedBox(
child: Text(
secondString,
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(
color: ColorsManager.grayColor,
fontSize: 12,
fontWeight: FontWeight.w400),
style: Theme.of(context).textTheme.bodySmall!.copyWith(
color: ColorsManager.grayColor,
fontSize: 12,
fontWeight: FontWeight.w400),
),
)),
const SizedBox(