إصلاح توافق فلاتر مع Theme الجديد
This commit is contained in:
@@ -126,47 +126,51 @@ class _ErrorListPageState extends State<ErrorListPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF0F4F8),
|
||||
appBar: _buildAppBar(),
|
||||
backgroundColor: cs.surface,
|
||||
appBar: _buildAppBar(cs),
|
||||
body: Column(
|
||||
children: [
|
||||
_SearchBar(
|
||||
controller: _phoneCtrl,
|
||||
onSearch: _searchByPhone,
|
||||
onClear: _clearSearch,
|
||||
cs: cs,
|
||||
),
|
||||
Expanded(
|
||||
child: _buildBody(),
|
||||
child: _buildBody(cs),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
PreferredSizeWidget _buildAppBar() {
|
||||
PreferredSizeWidget _buildAppBar(ColorScheme cs) {
|
||||
return AppBar(
|
||||
elevation: 0,
|
||||
backgroundColor: const Color(0xFF0F172A),
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: cs.surfaceContainerHighest,
|
||||
foregroundColor: cs.onSurface,
|
||||
centerTitle: true,
|
||||
title: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.1),
|
||||
color: cs.onSurface.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: Colors.white.withOpacity(0.2)),
|
||||
border: Border.all(color: cs.onSurface.withValues(alpha: 0.2)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.error_outline, color: Colors.red, size: 22),
|
||||
Icon(Icons.error_outline, color: cs.error, size: 22),
|
||||
const SizedBox(width: 8),
|
||||
const Text(
|
||||
Text(
|
||||
"سجل الأخطاء",
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: cs.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -175,11 +179,11 @@ class _ErrorListPageState extends State<ErrorListPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBody() {
|
||||
Widget _buildBody(ColorScheme cs) {
|
||||
if (_loading) {
|
||||
return const Center(
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(Color(0xFF0F172A)),
|
||||
valueColor: AlwaysStoppedAnimation<Color>(cs.primary),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -189,13 +193,13 @@ class _ErrorListPageState extends State<ErrorListPage> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.error_outline, size: 64, color: Colors.red.shade300),
|
||||
Icon(Icons.error_outline, size: 64, color: cs.error),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
_errorMsg!,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.red.shade700,
|
||||
color: cs.error,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
@@ -209,15 +213,15 @@ class _ErrorListPageState extends State<ErrorListPage> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
const Icon(
|
||||
Icons.check_circle_outline,
|
||||
size: 64,
|
||||
color: Colors.green.shade300,
|
||||
color: Color(0xFF10B981),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
Text(
|
||||
'لا توجد سجلات أخطاء',
|
||||
style: TextStyle(fontSize: 16, color: Colors.grey),
|
||||
style: TextStyle(fontSize: 16, color: cs.onSurfaceVariant),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -232,12 +236,12 @@ class _ErrorListPageState extends State<ErrorListPage> {
|
||||
await _fetchLast20();
|
||||
}
|
||||
},
|
||||
color: const Color(0xFF0F172A),
|
||||
color: cs.primary,
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
|
||||
itemCount: _items.length,
|
||||
itemBuilder: (context, index) {
|
||||
return _ErrorTile(_items[index], index);
|
||||
return _ErrorTile(_items[index], index, cs);
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -254,11 +258,13 @@ class _SearchBar extends StatefulWidget {
|
||||
final TextEditingController controller;
|
||||
final VoidCallback onSearch;
|
||||
final VoidCallback onClear;
|
||||
final ColorScheme cs;
|
||||
|
||||
const _SearchBar({
|
||||
required this.controller,
|
||||
required this.onSearch,
|
||||
required this.onClear,
|
||||
required this.cs,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -270,18 +276,16 @@ class _SearchBarState extends State<_SearchBar> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cs = widget.cs;
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.white, Colors.grey.shade50],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
color: cs.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.08),
|
||||
color: Colors.black.withValues(alpha: 0.08),
|
||||
blurRadius: 16,
|
||||
spreadRadius: 2,
|
||||
)
|
||||
@@ -303,15 +307,13 @@ class _SearchBarState extends State<_SearchBar> {
|
||||
keyboardType: TextInputType.phone,
|
||||
textDirection: TextDirection.rtl,
|
||||
onSubmitted: (_) => widget.onSearch(),
|
||||
style: const TextStyle(fontSize: 15),
|
||||
style: TextStyle(fontSize: 15, color: cs.onSurface),
|
||||
decoration: InputDecoration(
|
||||
hintText: 'بحث برقم الهاتف',
|
||||
hintStyle: TextStyle(color: Colors.grey.shade400),
|
||||
hintStyle: TextStyle(color: cs.onSurfaceVariant),
|
||||
prefixIcon: Icon(
|
||||
Icons.search,
|
||||
color: _isFocused
|
||||
? const Color(0xFF0F172A)
|
||||
: Colors.grey.shade400,
|
||||
color: _isFocused ? cs.primary : cs.onSurfaceVariant,
|
||||
),
|
||||
suffixIcon: widget.controller.text.isNotEmpty
|
||||
? InkWell(
|
||||
@@ -320,28 +322,28 @@ class _SearchBarState extends State<_SearchBar> {
|
||||
setState(() {});
|
||||
},
|
||||
child: Icon(Icons.close,
|
||||
color: Colors.grey.shade400, size: 20),
|
||||
color: cs.onSurfaceVariant, size: 20),
|
||||
)
|
||||
: null,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide:
|
||||
BorderSide(color: Colors.grey.shade300, width: 1),
|
||||
BorderSide(color: cs.outline, width: 1),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide:
|
||||
BorderSide(color: Colors.grey.shade300, width: 1),
|
||||
BorderSide(color: cs.outline, width: 1),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: const BorderSide(
|
||||
color: Color(0xFF0F172A),
|
||||
borderSide: BorderSide(
|
||||
color: cs.primary,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
fillColor: cs.surfaceContainerHighest,
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 12),
|
||||
),
|
||||
onChanged: (_) => setState(() {}),
|
||||
@@ -352,8 +354,8 @@ class _SearchBarState extends State<_SearchBar> {
|
||||
ElevatedButton(
|
||||
onPressed: widget.onSearch,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF0F172A),
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: cs.primary,
|
||||
foregroundColor: cs.onPrimary,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
@@ -372,9 +374,9 @@ class _SearchBarState extends State<_SearchBar> {
|
||||
OutlinedButton(
|
||||
onPressed: widget.onClear,
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: const Color(0xFF0F172A),
|
||||
side: const BorderSide(
|
||||
color: Color(0xFF0F172A),
|
||||
foregroundColor: cs.primary,
|
||||
side: BorderSide(
|
||||
color: cs.primary,
|
||||
width: 1.5,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
@@ -395,12 +397,12 @@ class _SearchBarState extends State<_SearchBar> {
|
||||
class _ErrorTile extends StatelessWidget {
|
||||
final ErrorLog item;
|
||||
final int index;
|
||||
final ColorScheme cs;
|
||||
|
||||
const _ErrorTile(this.item, this.index);
|
||||
const _ErrorTile(this.item, this.index, this.cs);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// تحديد الألوان والأيقونات بناءً على نوع المستخدم
|
||||
final isDriver = item.userType.toLowerCase().contains('driver') ||
|
||||
item.userType.toLowerCase().contains('سائق');
|
||||
|
||||
@@ -410,22 +412,18 @@ class _ErrorTile extends StatelessWidget {
|
||||
final userTypeLabel = isDriver ? "سائق" : "راكب";
|
||||
|
||||
final userTypeBgColor = isDriver
|
||||
? const Color(0xFF10B981).withOpacity(0.1)
|
||||
: const Color(0xFFF59E0B).withOpacity(0.1);
|
||||
? const Color(0xFF10B981).withValues(alpha: 0.1)
|
||||
: const Color(0xFFF59E0B).withValues(alpha: 0.1);
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.white, Colors.grey.shade50],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
color: cs.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: Colors.grey.shade200, width: 1),
|
||||
border: Border.all(color: cs.outline, width: 1),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.06),
|
||||
color: Colors.black.withValues(alpha: 0.06),
|
||||
blurRadius: 12,
|
||||
spreadRadius: 1,
|
||||
)
|
||||
@@ -435,7 +433,6 @@ class _ErrorTile extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Stack(
|
||||
children: [
|
||||
// خط علوي ملون
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: 0,
|
||||
@@ -446,7 +443,7 @@ class _ErrorTile extends StatelessWidget {
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
const Color(0xFFEF4444),
|
||||
Colors.red.shade400,
|
||||
cs.error,
|
||||
],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
@@ -459,7 +456,6 @@ class _ErrorTile extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
// الصف الأول: رقم الخطأ ونوع المستخدم
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@@ -493,7 +489,7 @@ class _ErrorTile extends StatelessWidget {
|
||||
'#${item.id}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.grey.shade500,
|
||||
color: cs.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
@@ -501,14 +497,13 @@ class _ErrorTile extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// عنوان الخطأ (قابل للنسخ)
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red.shade50,
|
||||
color: cs.error.withValues(alpha: 0.08),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: Colors.red.shade200,
|
||||
color: cs.error.withValues(alpha: 0.3),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
@@ -516,7 +511,7 @@ class _ErrorTile extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(Icons.warning_amber_rounded,
|
||||
size: 18, color: Colors.red.shade600),
|
||||
size: 18, color: cs.error),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: SelectableText(
|
||||
@@ -524,7 +519,7 @@ class _ErrorTile extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.red.shade900,
|
||||
color: cs.error,
|
||||
height: 1.4,
|
||||
),
|
||||
),
|
||||
@@ -534,15 +529,14 @@ class _ErrorTile extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// التفاصيل (إن وجدت)
|
||||
if (item.details.isNotEmpty) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade50,
|
||||
color: cs.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: Colors.grey.shade200,
|
||||
color: cs.outline,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
@@ -550,14 +544,14 @@ class _ErrorTile extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(Icons.info_outline,
|
||||
size: 16, color: Colors.grey.shade600),
|
||||
size: 16, color: cs.onSurfaceVariant),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: SelectableText(
|
||||
item.details,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.grey.shade700,
|
||||
color: cs.onSurfaceVariant,
|
||||
height: 1.4,
|
||||
),
|
||||
),
|
||||
@@ -568,7 +562,6 @@ class _ErrorTile extends StatelessWidget {
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
|
||||
// معلومات تقنية
|
||||
Wrap(
|
||||
spacing: 6,
|
||||
runSpacing: 6,
|
||||
@@ -578,25 +571,29 @@ class _ErrorTile extends StatelessWidget {
|
||||
icon: Icons.phone,
|
||||
label: 'الهاتف',
|
||||
value: item.phone,
|
||||
color: Colors.blue,
|
||||
color: cs.primary,
|
||||
cs: cs,
|
||||
),
|
||||
_buildInfoBadge(
|
||||
icon: Icons.person_outline,
|
||||
label: 'المعرف',
|
||||
value: item.userId,
|
||||
color: Colors.purple,
|
||||
cs: cs,
|
||||
),
|
||||
_buildInfoBadge(
|
||||
icon: Icons.devices,
|
||||
label: 'Path',
|
||||
value: item.device,
|
||||
color: Colors.orange,
|
||||
cs: cs,
|
||||
),
|
||||
_buildInfoBadge(
|
||||
icon: Icons.schedule,
|
||||
label: 'التاريخ',
|
||||
value: item.createdAt,
|
||||
color: Colors.teal,
|
||||
cs: cs,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -614,13 +611,14 @@ class _ErrorTile extends StatelessWidget {
|
||||
required String label,
|
||||
required String value,
|
||||
required Color color,
|
||||
required ColorScheme cs,
|
||||
}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.08),
|
||||
color: color.withValues(alpha: 0.08),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: color.withOpacity(0.3), width: 1),
|
||||
border: Border.all(color: color.withValues(alpha: 0.3), width: 1),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -635,7 +633,7 @@ class _ErrorTile extends StatelessWidget {
|
||||
text: "$label: ",
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: color.withOpacity(0.7),
|
||||
color: color.withValues(alpha: 0.7),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user