Update codebase
This commit is contained in:
@@ -8,10 +8,13 @@ import '../build_config.dart';
|
||||
import '../config.dart';
|
||||
import '../design/tokens.dart';
|
||||
import '../design/tripz_colors.dart';
|
||||
import '../di.dart';
|
||||
import '../l10n/l10n.dart';
|
||||
import '../notifications/notification_store.dart';
|
||||
import '../router.dart';
|
||||
import '../session/session_cubit.dart';
|
||||
import '../session/session_state.dart';
|
||||
import '../store_links.dart';
|
||||
import '../tenant/feature_gate.dart';
|
||||
|
||||
/// الدراور — نقطة تطبيق **طبقتَي الميزات** معاً (docs/23 §5 + docs/38 §10):
|
||||
@@ -43,6 +46,14 @@ class AppDrawer extends StatelessWidget {
|
||||
label: l10n.menuProfile,
|
||||
route: Routes.profileEdit,
|
||||
),
|
||||
_Item(
|
||||
icon: Icons.notifications_none_rounded,
|
||||
label: l10n.menuNotifications,
|
||||
route: Routes.notifications,
|
||||
// العدّاد يُقرأ عند بناء الدراور — والدراور يُبنى عند كل
|
||||
// فتح، فلا حاجة لتيّار يراقب مخزناً في الذاكرة.
|
||||
badge: sl<NotificationStore>().unreadCount,
|
||||
),
|
||||
_Item(
|
||||
icon: Icons.route_outlined,
|
||||
label: l10n.menuTrips,
|
||||
@@ -72,28 +83,36 @@ class AppDrawer extends StatelessWidget {
|
||||
route: Routes.support,
|
||||
),
|
||||
// مداخل محليّة بلا نقطة خادم — تُنفَّذ في الجهاز مباشرة.
|
||||
//
|
||||
// الروابط من `StoreLinks` لا من ثابتٍ واحد: هذا البناء
|
||||
// يشارك **رابط نفسه** (سائق يشارك رابط السائق)، ويفتح
|
||||
// متجر منصّته هو.
|
||||
_Action(
|
||||
icon: Icons.share_outlined,
|
||||
label: l10n.menuShare,
|
||||
onTap: () => SharePlus.instance
|
||||
.share(ShareParams(text: l10n.shareMessage(''))),
|
||||
onTap: () => SharePlus.instance.share(
|
||||
ShareParams(
|
||||
text: l10n.shareMessagePlain(StoreLinks.thisApp),
|
||||
),
|
||||
),
|
||||
),
|
||||
_Action(
|
||||
icon: Icons.star_outline_rounded,
|
||||
label: l10n.menuRateApp,
|
||||
onTap: () => _open(BuildConfig.storeUrl),
|
||||
onTap: () => _open(StoreLinks.thisApp),
|
||||
),
|
||||
_Action(
|
||||
icon: Icons.shield_outlined,
|
||||
label: l10n.menuPrivacy,
|
||||
onTap: () => _open(BuildConfig.privacyUrl),
|
||||
),
|
||||
if (!isDriver)
|
||||
_Action(
|
||||
icon: Icons.local_taxi_outlined,
|
||||
label: l10n.menuDriverApp,
|
||||
onTap: () => _open(BuildConfig.driverAppUrl),
|
||||
),
|
||||
_Action(
|
||||
icon: isDriver
|
||||
? Icons.person_outline_rounded
|
||||
: Icons.local_taxi_outlined,
|
||||
label: isDriver ? l10n.menuRiderApp : l10n.menuDriverApp,
|
||||
onTap: () => _open(StoreLinks.otherApp),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -220,17 +239,43 @@ class _Action extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _Item extends StatelessWidget {
|
||||
const _Item({required this.icon, required this.label, required this.route});
|
||||
const _Item({
|
||||
required this.icon,
|
||||
required this.label,
|
||||
required this.route,
|
||||
this.badge = 0,
|
||||
});
|
||||
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final String route;
|
||||
|
||||
/// عدّاد غير المقروء — يُخفى عند الصفر.
|
||||
final int badge;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
leading: Icon(icon),
|
||||
title: Text(label),
|
||||
trailing: badge == 0
|
||||
? null
|
||||
: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: Space.xs,
|
||||
vertical: Space.xxs / 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: context.tripzColors.danger,
|
||||
borderRadius: Radii.field_,
|
||||
),
|
||||
child: Text(
|
||||
'$badge',
|
||||
style: context.texts.labelSmall?.copyWith(
|
||||
color: context.colors.onPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
context.push(route);
|
||||
|
||||
Reference in New Issue
Block a user