Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions brightcleanproject/lib/core/enums/laundry_type.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// import 'package:flutter/material.dart';

enum LaundryType {
clothes('ملابس', 'Clothes'),
carsBikes('سيارات ودراجات', 'Cars & Bikes'),
carpets('سجاد', 'Carpets'),
ac('مكيفات', 'AC'),
tanks('خزانات', 'Tanks'),
solarPanels('ألواح شمسية', 'Solar Panels');

final String title;
final String englishTitle;

const LaundryType(this.title, this.englishTitle);
}
15 changes: 15 additions & 0 deletions brightcleanproject/lib/core/enums/order_status.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:flutter/material.dart';
import 'package:brightcleanprojet/core/theme/app_colors.dart';

enum OrderStatus {
received('تم الاستلام', 'Received', AppColors.primary),
inProgress('قيد التنفيذ', 'In Progress', AppColors.tertiary),
ready('جاهز للتسليم', 'Ready', AppColors.success),
delivered('تم التسليم', 'Delivered', AppColors.secondary);

final String title;
final String englishTitle;
final Color color;

const OrderStatus(this.title, this.englishTitle, this.color);
}
17 changes: 17 additions & 0 deletions brightcleanproject/lib/core/localization/language_controller.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';

class LanguageController {
static final LanguageController _instance = LanguageController._internal();
factory LanguageController() => _instance;
LanguageController._internal();

final ValueNotifier<Locale> locale = ValueNotifier(const Locale('ar'));

bool get isArabic => locale.value.languageCode == 'ar';

void toggleLanguage() {
locale.value = locale.value.languageCode == 'ar'
? const Locale('en')
: const Locale('ar');
}
}
Comment on lines +3 to +17
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Confirm the notifier is bound to MaterialApp and that persistence exists.
rg -nP -C3 'LanguageController\(\)\.locale|MaterialApp|locale\s*:\s*'
rg -nP 'SharedPreferences|shared_preferences' -C2

Repository: Klvvr1/BrightClean

Length of output: 903


🏁 Script executed:

#!/bin/bash
# Find all usages of toggleLanguage
rg -n 'toggleLanguage' -B2 -A2

# Check if locale is bound anywhere to LanguageController
rg -n 'LanguageController\(\)\.locale|locale:\s*LanguageController' -B2 -A2

# Check if there are any locale-related listeners
rg -n 'ValueListenableBuilder.*locale|locale.*ValueListenableBuilder' -B1 -A1

Repository: Klvvr1/BrightClean

Length of output: 1118


🏁 Script executed:

#!/bin/bash
# Check the agent_dashboard_screen.dart around that toggle to understand the intent
cat -n brightcleanproject/lib/features/agent/presentation/agent_dashboard_screen.dart | sed -n '395,415p'

# Check the full MaterialApp configuration in main.dart
cat -n brightcleanproject/lib/main.dart | sed -n '12,35p'

# Search for any locale binding in the codebase
rg -n "MaterialApp.*locale|locale.*LanguageController|MaterialApp\.router.*locale" -A5
</parameter>

Repository: Klvvr1/BrightClean

Length of output: 1740


🏁 Script executed:

#!/bin/bash
# Check if there's any other place where locale might be bound or overridden
rg -n "locale\s*:" brightcleanproject/lib/main.dart -A1 -B1

# Check what supportedLocales contains
rg -n "supportedLocales" brightcleanproject/lib/main.dart -A5 -B1

# Verify if the LanguageController is even used for locale in MaterialApp anywhere
rg -n "LanguageController" brightcleanproject/lib/main.dart
</parameter>

Repository: Klvvr1/BrightClean

Length of output: 445


Wire LanguageController.locale to MaterialApp.locale and add 'en' to supportedLocales.

The toggleLanguage() method in LanguageController is called from the Settings tab (agent_dashboard_screen.dart:404), but it has no effect on the app. In main.dart, MaterialApp.locale is hardcoded to const Locale('ar', 'AE') and is never bound to LanguageController.locale. Additionally, supportedLocales only includes Locale('ar', 'AE'), so even if wired, switching to 'en' would fail.

To fix:

  1. Add Locale('en') to supportedLocales
  2. Bind MaterialApp.locale to LanguageController().locale (use ValueListenableBuilder if stateful, or ListenableBuilder if available)
  3. Consider persisting the selection via SharedPreferences
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@brightcleanproject/lib/core/localization/language_controller.dart` around
lines 3 - 17, MaterialApp's locale is hardcoded so
LanguageController.toggleLanguage() has no effect; update main.dart to stop
using the hardcoded const Locale('ar','AE') and instead bind MaterialApp.locale
to LanguageController().locale using a ValueListenableBuilder (or equivalent
ListenableBuilder) so the app rebuilds when locale changes, add Locale('en')
(and a matching country code if desired) to supportedLocales so English is
allowed, and optionally persist the selected locale from LanguageController
(e.g., via SharedPreferences) so the choice survives restarts; key symbols to
change: LanguageController.locale, LanguageController.toggleLanguage,
MaterialApp.locale and supportedLocales.

10 changes: 9 additions & 1 deletion brightcleanproject/lib/core/routing/app_router.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:go_router/go_router.dart';
import 'package:brightcleanprojet/core/enums/order_status.dart';
import '../../features/auth/presentation/splash_screen.dart';
import '../../features/auth/presentation/login_screen.dart';
import '../../features/auth/presentation/role_selection_screen.dart';
Expand Down Expand Up @@ -65,7 +66,14 @@ class AppRouter {
path: '/agent_order_management/:id',
builder: (context, state) {
final id = state.pathParameters['id'] ?? 'unknown';
return AgentOrderManagementScreen(orderId: id);
final extra = state.extra as Map<String, dynamic>?;
final initialStatus = extra?['status'] as OrderStatus? ?? OrderStatus.received;
final isReadOnly = extra?['isReadOnly'] as bool? ?? false;
return AgentOrderManagementScreen(
orderId: id,
initialStatus: initialStatus,
isReadOnly: isReadOnly
);
},
),
GoRoute(
Expand Down
13 changes: 6 additions & 7 deletions brightcleanproject/lib/core/theme/app_colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ class AppColors {
static const Color secondary = Color(0xFF1C4D8D);
static const Color tertiary = Color(0xFF4988C4);
static const Color lightBlue = Color(0xFFBDE8F5);

static const Color background = Color(0xFFF5F7FA);
static const Color textMain = Color(0xFF333333);
static const Color textLight = Color(0xFF888888);
static const Color background = Color(0xFFF8FAFC);
static const Color success = Color(0xFF10B981);
static const Color error = Color(0xFFEF4444);
static const Color warning = Color(0xFFF59E0B);
static const Color textMain = Color(0xFF1E293B);
static const Color textLight = Color(0xFF64748B);
static const Color white = Colors.white;
static const Color error = Color(0xFFD32F2F);
static const Color success = Color(0xFF388E3C);
static const Color warning = Color(0xFFF57C00);
}

Large diffs are not rendered by default.

Loading