adding multilingual support

This commit is contained in:
Azmat-7860
2026-10-03 15:04:48 +05:30
parent 3785ea1e45
commit 0d7785b242
51 changed files with 3007 additions and 250 deletions
+19 -17
View File
@@ -9,6 +9,7 @@ import 'package:base_project/utils/managers/user_manager.dart';
import 'package:provider/provider.dart';
import 'package:base_project/view_model/system_params/system_params_view_model.dart';
import 'package:flutter/material.dart';
import '../../l10n/app_localizations.dart';
class HomeView extends StatefulWidget {
const HomeView({super.key});
@@ -32,54 +33,54 @@ class _HomeViewState extends State<HomeView> with TickerProviderStateMixin {
// Dashboard stats (replace with real API data)
List<Map<String, dynamic>> _dashboardStats = [];
final List<Map<String, dynamic>> _quickActions = [
List<Map<String, dynamic>> _quickActions(BuildContext context) => [
{
'label': 'Profile',
'label': AppLocalizations.of(context)!.profile,
'icon': Icons.person,
'onTap': () {},
'backgroundColor': null, // Use theme default
},
{
'label': 'Settings',
'label': AppLocalizations.of(context)!.settings,
'icon': Icons.settings,
'onTap': () {},
'backgroundColor': null,
},
{
'label': 'Security',
'label': AppLocalizations.of(context)!.security,
'icon': Icons.security,
'onTap': () {},
'backgroundColor': null,
},
{
'label': 'Reports',
'label': AppLocalizations.of(context)!.reports,
'icon': Icons.analytics,
'onTap': () {},
'backgroundColor': null,
},
];
final List<DrawerItem> _drawerItems = [
List<DrawerItem> _drawerItems(BuildContext context) => [
DrawerItem(
icon: Icons.person,
title: 'Profile',
subtitle: 'Manage your account',
title: AppLocalizations.of(context)!.profile,
subtitle: AppLocalizations.of(context)!.manageAccount,
onTap: (context) {
Navigator.pushNamed(context, RouteNames.profileView);
},
),
DrawerItem(
icon: Icons.system_security_update,
title: 'System Parameters',
subtitle: 'Configure system settings',
title: AppLocalizations.of(context)!.systemParameters,
subtitle: AppLocalizations.of(context)!.configureSystemSettings,
onTap: (context) {
Navigator.pushNamed(context, RouteNames.systemParamsView);
},
),
DrawerItem(
icon: Icons.password,
title: 'Change Password',
subtitle: 'Update your password',
title: AppLocalizations.of(context)!.changePassword,
subtitle: AppLocalizations.of(context)!.updateYourPassword,
onTap: (context) {
Navigator.pushNamed(context, RouteNames.changePasswordView);
},
@@ -226,7 +227,7 @@ class _HomeViewState extends State<HomeView> with TickerProviderStateMixin {
return Scaffold(
backgroundColor: colorScheme.background,
appBar: ModernAppBar(
title: 'Dashboard',
title: AppLocalizations.of(context)!.dashboard,
centerTitle: false,
showLogoInTitle: true,
logoImage: _getDashboardLogoImage(colorScheme),
@@ -237,7 +238,7 @@ class _HomeViewState extends State<HomeView> with TickerProviderStateMixin {
Navigator.pushNamed(context, RouteNames.profileView);
},
),
drawer: ModernDrawer(items: _drawerItems),
drawer: ModernDrawer(items: _drawerItems(context)),
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
@@ -339,7 +340,8 @@ class _HomeViewState extends State<HomeView> with TickerProviderStateMixin {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Welcome back, ${userName ?? 'User'}! 👋',
AppLocalizations.of(context)!
.helloUser(userName ?? AppLocalizations.of(context)!.user),
style: theme.textTheme.headlineMedium?.copyWith(
color: colorScheme.onBackground,
fontWeight: FontWeight.w700,
@@ -468,9 +470,9 @@ class _HomeViewState extends State<HomeView> with TickerProviderStateMixin {
mainAxisSpacing: UIConstants.spacing16,
childAspectRatio: 1.0,
),
itemCount: _quickActions.length,
itemCount: _quickActions(context).length,
itemBuilder: (context, index) {
final action = _quickActions[index];
final action = _quickActions(context)[index];
return QuickActionButton(
label: action['label'],
icon: action['icon'],