formatted all files.

This commit is contained in:
Faris Armoush
2025-06-12 15:33:32 +03:00
parent 29959f567e
commit 04250ebc98
474 changed files with 5425 additions and 4338 deletions
+47 -49
View File
@@ -108,66 +108,64 @@ class _DynamicTableState extends State<AccessDeviceTable> {
child: Row(
children: [
if (widget.withCheckBox) _buildSelectAllCheckbox(),
...widget.headers
.map((header) => _buildTableHeaderCell(header)),
...widget.headers.map(_buildTableHeaderCell),
],
),
),
widget.isEmpty
? Expanded(
child: Column(
if (widget.isEmpty)
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
Column(
children: [
Column(
children: [
SvgPicture.asset(Assets.emptyTable),
const SizedBox(
height: 15,
),
Text(
// no password
widget.tableName == 'AccessManagement'
? 'No Password '
: 'No Devices',
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(
color: ColorsManager.grayColor),
)
],
SvgPicture.asset(Assets.emptyTable),
const SizedBox(
height: 15,
),
Text(
// no password
widget.tableName == 'AccessManagement'
? 'No Password '
: 'No Devices',
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(color: ColorsManager.grayColor),
)
],
),
],
),
)
: Expanded(
child: Container(
color: Colors.white,
child: ListView.builder(
shrinkWrap: true,
itemCount: widget.data.length,
itemBuilder: (context, index) {
final row = widget.data[index];
return Row(
children: [
if (widget.withCheckBox)
_buildRowCheckbox(
index, widget.size.height * 0.10),
...row.map((cell) => _buildTableCell(
cell.toString(),
widget.size.height * 0.10)),
],
);
},
),
),
],
),
)
else
Expanded(
child: ColoredBox(
color: Colors.white,
child: ListView.builder(
shrinkWrap: true,
itemCount: widget.data.length,
itemBuilder: (context, index) {
final row = widget.data[index];
return Row(
children: [
if (widget.withCheckBox)
_buildRowCheckbox(
index, widget.size.height * 0.10),
...row.map((cell) => _buildTableCell(
cell.toString(), widget.size.height * 0.10)),
],
);
},
),
),
),
],
),
),
@@ -245,7 +243,7 @@ class _DynamicTableState extends State<AccessDeviceTable> {
}
Widget _buildTableCell(String content, double size) {
bool isBatteryLevel = content.endsWith('%');
final isBatteryLevel = content.endsWith('%');
double? batteryLevel;
if (isBatteryLevel) {
+9 -5
View File
@@ -22,17 +22,21 @@ class CancelButton extends StatelessWidget {
return ElevatedButton(
onPressed: onPressed,
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all(ColorsManager.boxColor), // White background
foregroundColor: WidgetStateProperty.all(Colors.black), // Black text color
backgroundColor:
WidgetStateProperty.all(ColorsManager.boxColor), // White background
foregroundColor:
WidgetStateProperty.all(Colors.black), // Black text color
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(borderRadius ?? 10),
side: const BorderSide(color: ColorsManager.boxColor), // Black border
side:
const BorderSide(color: ColorsManager.boxColor), // Black border
),
),
fixedSize: WidgetStateProperty.all(Size(width ?? 50, height ?? 40)), // Set button height
fixedSize: WidgetStateProperty.all(
Size(width ?? 50, height ?? 40)), // Set button height
),
child: Text(label), // Dynamic label
);
}
}
}
+1 -1
View File
@@ -64,7 +64,7 @@ class DefaultButton extends StatelessWidget {
(Set<WidgetState> states) {
return enabled
? backgroundColor ?? ColorsManager.primaryColor
: Colors.black.withOpacity(0.2);
: Colors.black.withValues(alpha: 0.2);
}),
shape: WidgetStateProperty.all(
RoundedRectangleBorder(
+2 -2
View File
@@ -34,7 +34,7 @@ class CurtainToggle extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ClipOval(
child: Container(
child: ColoredBox(
color: ColorsManager.whiteColors,
child: SvgPicture.asset(
Assets.curtainIcon,
@@ -52,7 +52,7 @@ class CurtainToggle extends StatelessWidget {
width: 35,
child: CupertinoSwitch(
value: value,
activeColor: ColorsManager.dialogBlueTitle,
activeTrackColor: ColorsManager.dialogBlueTitle,
onChanged: onChanged,
),
),
+9 -3
View File
@@ -12,7 +12,7 @@ Future<void> showCustomDialog({
double? iconWidth,
VoidCallback? onOkPressed,
bool barrierDismissible = false,
List<Widget>? actions,
List<Widget>? actions,
}) {
return showDialog(
context: context,
@@ -40,14 +40,20 @@ Future<void> showCustomDialog({
style: Theme.of(context)
.textTheme
.headlineLarge!
.copyWith(fontSize: 20, fontWeight: FontWeight.w400, color: Colors.black),
.copyWith(
fontSize: 20,
fontWeight: FontWeight.w400,
color: Colors.black),
),
),
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Text(
message,
style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.black),
style: Theme.of(context)
.textTheme
.bodyMedium!
.copyWith(color: Colors.black),
textAlign: TextAlign.center,
),
),
+11 -12
View File
@@ -20,8 +20,8 @@ class DynamicTable extends StatefulWidget {
final void Function(int, bool, dynamic)? onRowSelected;
final List<String>? initialSelectedIds;
final int uuidIndex;
final Function(dynamic selectedRows)? onSelectionChanged;
final Function(int rowIndex)? onSettingsPressed;
final void Function(dynamic selectedRows)? onSelectionChanged;
final void Function(int rowIndex)? onSettingsPressed;
const DynamicTable({
super.key,
required this.headers,
@@ -79,10 +79,10 @@ class _DynamicTableState extends State<DynamicTable> {
// Check if the old and new lists are the same
if (oldList.length != newList.length) return false;
for (int i = 0; i < oldList.length; i++) {
for (var i = 0; i < oldList.length; i++) {
if (oldList[i].length != newList[i].length) return false;
for (int j = 0; j < oldList[i].length; j++) {
for (var j = 0; j < oldList[i].length; j++) {
if (oldList[i][j] != newList[i][j]) return false;
}
}
@@ -162,7 +162,7 @@ class _DynamicTableState extends State<DynamicTable> {
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
controller: _horizontalBodyScrollController,
child: Container(
child: ColoredBox(
color: ColorsManager.whiteColors,
child: SizedBox(
width: widget.size.width,
@@ -184,7 +184,7 @@ class _DynamicTableState extends State<DynamicTable> {
rowIndex: rowIndex,
columnIndex: entry.key,
);
}).toList(),
}),
],
);
}),
@@ -304,13 +304,13 @@ class _DynamicTableState extends State<DynamicTable> {
required int rowIndex,
required int columnIndex,
}) {
bool isBatteryLevel = content.endsWith('%');
final isBatteryLevel = content.endsWith('%');
double? batteryLevel;
if (isBatteryLevel) {
batteryLevel = double.tryParse(content.replaceAll('%', '').trim());
}
bool isSettingsColumn = widget.headers[columnIndex] == 'Settings';
final isSettingsColumn = widget.headers[columnIndex] == 'Settings';
if (isSettingsColumn) {
return buildSettingsIcon(
@@ -404,7 +404,7 @@ class _DynamicTableState extends State<DynamicTable> {
borderRadius: BorderRadius.circular(height / 2),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.17),
color: Colors.black.withValues(alpha: 0.17),
blurRadius: 14,
offset: const Offset(0, 4),
),
@@ -416,11 +416,10 @@ class _DynamicTableState extends State<DynamicTable> {
padding: const EdgeInsets.all(8.0),
child: Center(
child: SvgPicture.asset(
Assets.settings, // ضع المسار الصحيح هنا
Assets.settings,
width: 40,
height: 22,
color: ColorsManager
.primaryColor, // نفس لون الأيقونة في الصورة
color: ColorsManager.primaryColor,
),
),
),
+2 -2
View File
@@ -36,7 +36,7 @@ class FilterWidget extends StatelessWidget {
color: ColorsManager.boxColor,
border: Border.all(
color: isSelected
? ColorsManager.blueColor.withOpacity(0.8)
? ColorsManager.blueColor.withValues(alpha: 0.8)
: Colors.transparent,
width: 2.0,
),
@@ -48,7 +48,7 @@ class FilterWidget extends StatelessWidget {
tabs[index],
style: TextStyle(
color: isSelected
? ColorsManager.blueColor.withOpacity(0.8)
? ColorsManager.blueColor.withValues(alpha: 0.8)
: Colors.black,
),
),
+6 -6
View File
@@ -1,5 +1,3 @@
import 'package:flutter/material.dart';
class HourPickerDialog extends StatefulWidget {
@@ -18,7 +16,7 @@ class _HourPickerDialogState extends State<HourPickerDialog> {
void initState() {
super.initState();
// Initialize the selectedHour with the initial time passed to the dialog
selectedHour = widget.initialTime.hour.toString().padLeft(2, '0') + ':00';
selectedHour = '${widget.initialTime.hour.toString().padLeft(2, '0')}:00';
}
@override
@@ -28,7 +26,7 @@ class _HourPickerDialogState extends State<HourPickerDialog> {
content: DropdownButton<String>(
value: selectedHour, // Show the currently selected hour
items: List.generate(24, (index) {
String hour = index.toString().padLeft(2, '0');
final hour = index.toString().padLeft(2, '0');
return DropdownMenuItem<String>(
value: '$hour:00',
child: Text('$hour:00'),
@@ -37,14 +35,16 @@ class _HourPickerDialogState extends State<HourPickerDialog> {
onChanged: (String? newValue) {
if (newValue != null) {
setState(() {
selectedHour = newValue; // Update the selected hour without closing the dialog
selectedHour =
newValue; // Update the selected hour without closing the dialog
});
}
},
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(null), // Close the dialog without selection
onPressed: () => Navigator.of(context)
.pop(null), // Close the dialog without selection
child: const Text('Cancel'),
),
TextButton(
+2 -1
View File
@@ -9,7 +9,8 @@ class InfoDialog extends StatelessWidget {
final Size? size;
final List<Widget>? actions;
InfoDialog({
const InfoDialog({
super.key,
required this.title,
required this.content,
this.actions,