161 lines
5.3 KiB
Dart
161 lines
5.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:package_info_plus/package_info_plus.dart';
|
|
import 'package:uae_stat/domain/use_cases/language.dart';
|
|
import 'package:uae_stat/infrastructure/services/img_asset_paths/logo_asset_path.dart';
|
|
import 'package:uae_stat/l10n/app_localizations.dart';
|
|
|
|
class UaeStatsDrawer extends StatelessWidget {
|
|
const UaeStatsDrawer({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Drawer(
|
|
backgroundColor: Colors.white,
|
|
child: SafeArea(
|
|
child: Column(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(20, 20, 20, 12),
|
|
child: Row(
|
|
children: [
|
|
Image.asset(
|
|
LogoAssetPath.fcsc,
|
|
height: 42,
|
|
),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: Text(
|
|
context.translate('UAE Stats', 'إحصائيات الإمارات'),
|
|
style: TextStyle(
|
|
fontFamily: context.translate('Roboto', 'NotoKufi'),
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w700,
|
|
color: const Color(0xFF0F172A),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const Divider(height: 1),
|
|
Expanded(
|
|
child: ListView(
|
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
|
children: [
|
|
_DrawerTile(
|
|
icon: Icons.home_rounded,
|
|
title: context.translate('Home', 'الرئيسية'),
|
|
onTap: () => _go(context, '/home'),
|
|
),
|
|
_DrawerTile(
|
|
icon: Icons.notifications_none_rounded,
|
|
title: AppLocalizations.of(context)!.notification,
|
|
onTap: () => _go(context, '/notification'),
|
|
),
|
|
_DrawerTile(
|
|
icon: Icons.message_outlined,
|
|
title: AppLocalizations.of(context)!.feedback_title,
|
|
onTap: () => _go(context, '/feedback'),
|
|
),
|
|
_DrawerTile(
|
|
icon: Icons.bookmarks_outlined,
|
|
title: AppLocalizations.of(context)!.bookmark_title,
|
|
onTap: () => _go(context, '/bookmark'),
|
|
),
|
|
_DrawerTile(
|
|
icon: Icons.leaderboard_outlined,
|
|
title: AppLocalizations.of(context)!.nav_competitiveness,
|
|
onTap: () => _go(context, '/competitiveness'),
|
|
),
|
|
_DrawerTile(
|
|
icon: Icons.public_outlined,
|
|
title: AppLocalizations.of(context)!.country_profile,
|
|
onTap: () => _go(context, '/countryprofile'),
|
|
),
|
|
_DrawerTile(
|
|
icon: Icons.menu_book_outlined,
|
|
title: AppLocalizations.of(context)!.guide_title,
|
|
onTap: () => _go(context, '/user-guide'),
|
|
),
|
|
_DrawerTile(
|
|
icon: Icons.quiz_outlined,
|
|
title: context.translate('FAQs', 'الأسئلة الشائعة'),
|
|
onTap: () => _go(context, '/faq'),
|
|
),
|
|
_DrawerTile(
|
|
icon: Icons.mail_outline_rounded,
|
|
title: context.translate('Contact Us', 'اتصل بنا'),
|
|
onTap: () => _go(context, '/contact'),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const Divider(height: 1),
|
|
const Padding(
|
|
padding: EdgeInsets.fromLTRB(16, 12, 16, 16),
|
|
child: _DrawerVersion(),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
void _go(BuildContext context, String route) {
|
|
Navigator.of(context).pop();
|
|
context.go(route);
|
|
}
|
|
}
|
|
|
|
class _DrawerTile extends StatelessWidget {
|
|
const _DrawerTile({
|
|
required this.icon,
|
|
required this.title,
|
|
required this.onTap,
|
|
});
|
|
|
|
final IconData icon;
|
|
final String title;
|
|
final VoidCallback onTap;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ListTile(
|
|
leading: Icon(icon, color: const Color(0xFF4B5563)),
|
|
title: Text(
|
|
title,
|
|
style: TextStyle(
|
|
fontFamily: context.translate('Roboto', 'NotoKufi'),
|
|
fontSize: 14,
|
|
color: const Color(0xFF0F172A),
|
|
),
|
|
),
|
|
onTap: onTap,
|
|
);
|
|
}
|
|
}
|
|
|
|
class _DrawerVersion extends StatelessWidget {
|
|
const _DrawerVersion();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return FutureBuilder<PackageInfo>(
|
|
future: PackageInfo.fromPlatform(),
|
|
builder: (context, snapshot) {
|
|
final version = snapshot.data?.version;
|
|
return Text(
|
|
version == null ? 'Version' : 'Version $version',
|
|
style: TextStyle(
|
|
fontFamily: context.translate('Roboto', 'NotoKufi'),
|
|
fontSize: 12,
|
|
color: const Color(0xFF9CA3AF),
|
|
),
|
|
textAlign: TextAlign.center,
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|