adding multilingual support
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
|
||||
class EditSystemParams extends StatelessWidget {
|
||||
const EditSystemParams({super.key});
|
||||
@@ -13,9 +14,9 @@ class EditSystemParams extends StatelessWidget {
|
||||
},
|
||||
icon: Icon(Icons.adaptive.arrow_back),
|
||||
),
|
||||
title: const Text("Edit System Parameters"),
|
||||
title: Text(AppLocalizations.of(context)!.editSystemParameters),
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:base_project/shared/widgets/theme_preview.dart';
|
||||
import 'package:base_project/utils/managers/user_manager.dart';
|
||||
import 'package:base_project/view_model/system_params/system_params_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:base_project/core/providers/dynamic_theme_provider.dart';
|
||||
|
||||
@@ -235,7 +236,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
return Scaffold(
|
||||
backgroundColor: colorScheme.background,
|
||||
appBar: ModernAppBar(
|
||||
title: 'System Parameters',
|
||||
title: AppLocalizations.of(context)!.systemParameters,
|
||||
userAvatar: null,
|
||||
userName: userName,
|
||||
onProfilePressed: () {},
|
||||
@@ -409,7 +410,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'System Configuration',
|
||||
AppLocalizations.of(context)!.sysConfigTitle,
|
||||
style: theme.textTheme.headlineMedium?.copyWith(
|
||||
color: colorScheme.onBackground,
|
||||
fontWeight: FontWeight.w700,
|
||||
@@ -417,7 +418,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
),
|
||||
const SizedBox(height: UIConstants.spacing8),
|
||||
Text(
|
||||
'Configure system-wide parameters and settings',
|
||||
AppLocalizations.of(context)!.sysConfigSubtitle,
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
@@ -691,7 +692,8 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
),
|
||||
const SizedBox(width: UIConstants.spacing8),
|
||||
Text(
|
||||
'Generating dynamic theme...',
|
||||
AppLocalizations.of(context)!
|
||||
.generatingTheme,
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
fontSize: 12,
|
||||
@@ -720,7 +722,8 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
),
|
||||
const SizedBox(width: UIConstants.spacing8),
|
||||
Text(
|
||||
'Dynamic theme applied! Colors extracted from logo.',
|
||||
AppLocalizations.of(context)!
|
||||
.themeApplied,
|
||||
style: TextStyle(
|
||||
color: Colors.green,
|
||||
fontSize: 12,
|
||||
@@ -742,7 +745,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ModernButton(
|
||||
text: 'Upload Logo',
|
||||
text: AppLocalizations.of(context)!.uploadLogo,
|
||||
type: ModernButtonType.primary,
|
||||
size: ModernButtonSize.medium,
|
||||
icon: Icon(Icons.upload),
|
||||
@@ -757,7 +760,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ModernButton(
|
||||
text: 'Clear Logo',
|
||||
text: AppLocalizations.of(context)!.clearLogo,
|
||||
type: ModernButtonType.outline,
|
||||
size: ModernButtonSize.medium,
|
||||
icon: Icon(Icons.delete_outline),
|
||||
@@ -788,7 +791,8 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
const SizedBox(width: UIConstants.spacing8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Theme is applied immediately! Click "Upload Logo" to save the logo permanently to the database. The dynamic theme will work even if upload fails.',
|
||||
AppLocalizations.of(context)!
|
||||
.themeImmediateNote,
|
||||
style: TextStyle(
|
||||
color: AppColorScheme.info,
|
||||
fontSize: 12,
|
||||
@@ -806,7 +810,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ModernButton(
|
||||
text: 'Upload New Logo',
|
||||
text: AppLocalizations.of(context)!.uploadNewLogo,
|
||||
type: ModernButtonType.primary,
|
||||
size: ModernButtonSize.medium,
|
||||
icon: Icon(Icons.upload),
|
||||
@@ -821,7 +825,8 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ModernButton(
|
||||
text: 'Remove Logo',
|
||||
text:
|
||||
AppLocalizations.of(context)!.removeLogo,
|
||||
type: ModernButtonType.danger,
|
||||
size: ModernButtonSize.medium,
|
||||
icon: Icon(Icons.delete_outline),
|
||||
@@ -852,7 +857,8 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
const SizedBox(width: UIConstants.spacing8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Company logo is already uploaded and saved in the system. You can upload a new one or remove the existing logo.',
|
||||
AppLocalizations.of(context)!
|
||||
.logoAlreadyUploaded,
|
||||
style: TextStyle(
|
||||
color: AppColorScheme.success,
|
||||
fontSize: 12,
|
||||
@@ -913,7 +919,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Enable Manual Override',
|
||||
AppLocalizations.of(context)!.manualOverride,
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
color: cs.onSurface,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -938,7 +944,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
),
|
||||
const SizedBox(height: UIConstants.spacing12),
|
||||
_buildColorRow(
|
||||
label: 'Primary',
|
||||
label: AppLocalizations.of(context)!.colorPrimary,
|
||||
color: effectivePrimary,
|
||||
onPick: () async {
|
||||
final picked = await _pickColor(context, effectivePrimary);
|
||||
@@ -949,7 +955,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
),
|
||||
const SizedBox(height: UIConstants.spacing12),
|
||||
_buildColorRow(
|
||||
label: 'Secondary',
|
||||
label: AppLocalizations.of(context)!.colorSecondary,
|
||||
color: effectiveSecondary,
|
||||
onPick: () async {
|
||||
final picked =
|
||||
@@ -961,7 +967,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
),
|
||||
const SizedBox(height: UIConstants.spacing12),
|
||||
_buildColorRow(
|
||||
label: 'Tertiary',
|
||||
label: AppLocalizations.of(context)!.colorTertiary,
|
||||
color: effectiveTertiary,
|
||||
onPick: () async {
|
||||
final picked = await _pickColor(context, effectiveTertiary);
|
||||
@@ -975,7 +981,8 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
children: [
|
||||
Expanded(
|
||||
child: ModernButton(
|
||||
text: 'Reset to Logo Colors',
|
||||
text: AppLocalizations.of(context)!
|
||||
.resetLogoColors,
|
||||
type: ModernButtonType.outline,
|
||||
size: ModernButtonSize.medium,
|
||||
icon: Icon(Icons.refresh),
|
||||
@@ -987,7 +994,8 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
const SizedBox(width: UIConstants.spacing12),
|
||||
Expanded(
|
||||
child: ModernButton(
|
||||
text: 'Reset to Default',
|
||||
text: AppLocalizations.of(context)!
|
||||
.resetDefault,
|
||||
type: ModernButtonType.danger,
|
||||
size: ModernButtonSize.medium,
|
||||
icon: Icon(Icons.settings_backup_restore),
|
||||
@@ -1041,7 +1049,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
),
|
||||
),
|
||||
ModernButton(
|
||||
text: 'Edit',
|
||||
text: AppLocalizations.of(context)!.edit,
|
||||
type: ModernButtonType.text,
|
||||
size: ModernButtonSize.small,
|
||||
onPressed: () async {
|
||||
@@ -1073,7 +1081,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Pick a color'),
|
||||
title: Text(AppLocalizations.of(context)!.pickColor),
|
||||
content: SizedBox(
|
||||
width: 320,
|
||||
child: GridView.builder(
|
||||
@@ -1105,7 +1113,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('Cancel'),
|
||||
child: Text(AppLocalizations.of(context)!.cancel),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -1156,7 +1164,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'User Registration',
|
||||
AppLocalizations.of(context)!.userRegistration,
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
color: colorScheme.onSurface,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -1164,7 +1172,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
),
|
||||
const SizedBox(height: UIConstants.spacing4),
|
||||
Text(
|
||||
'Allow new users to register accounts',
|
||||
AppLocalizations.of(context)!.allowUserRegistration,
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
@@ -1194,7 +1202,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: ModernButton(
|
||||
text: 'Save Configuration',
|
||||
text: AppLocalizations.of(context)!.saveConfiguration,
|
||||
type: ModernButtonType.primary,
|
||||
size: ModernButtonSize.large,
|
||||
icon: Icon(Icons.save),
|
||||
@@ -1266,16 +1274,18 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
_buildDrawerItem(
|
||||
context, theme, colorScheme, Icons.home, 'Home', () {
|
||||
context, theme, colorScheme, Icons.home,
|
||||
AppLocalizations.of(context)!.drawerHome, () {
|
||||
Navigator.of(context).pushReplacementNamed('/');
|
||||
}),
|
||||
_buildDrawerItem(context, theme, colorScheme, Icons.settings,
|
||||
'System Parameters', () {
|
||||
AppLocalizations.of(context)!.systemParameters, () {
|
||||
Navigator.of(context)
|
||||
.pushReplacementNamed('/system_parameters');
|
||||
}, isSelected: true),
|
||||
_buildDrawerItem(
|
||||
context, theme, colorScheme, Icons.people, 'Users', () {
|
||||
context, theme, colorScheme, Icons.people,
|
||||
AppLocalizations.of(context)!.drawerUsers, () {
|
||||
Navigator.of(context).pushReplacementNamed('/users');
|
||||
}),
|
||||
_buildDrawerItem(
|
||||
@@ -1283,41 +1293,49 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
Navigator.of(context).pushReplacementNamed('/roles');
|
||||
}),
|
||||
_buildDrawerItem(
|
||||
context, theme, colorScheme, Icons.business, 'Departments',
|
||||
context, theme, colorScheme, Icons.business,
|
||||
AppLocalizations.of(context)!.drawerDepartments,
|
||||
() {
|
||||
Navigator.of(context).pushReplacementNamed('/departments');
|
||||
}),
|
||||
_buildDrawerItem(
|
||||
context, theme, colorScheme, Icons.work, 'Positions', () {
|
||||
context, theme, colorScheme, Icons.work,
|
||||
AppLocalizations.of(context)!.drawerPositions, () {
|
||||
Navigator.of(context).pushReplacementNamed('/positions');
|
||||
}),
|
||||
_buildDrawerItem(context, theme, colorScheme,
|
||||
Icons.monetization_on, 'Charges', () {
|
||||
Icons.monetization_on,
|
||||
AppLocalizations.of(context)!.drawerCharges, () {
|
||||
Navigator.of(context).pushReplacementNamed('/charges');
|
||||
}),
|
||||
_buildDrawerItem(
|
||||
context, theme, colorScheme, Icons.calendar_today, 'Weeks',
|
||||
context, theme, colorScheme, Icons.calendar_today,
|
||||
AppLocalizations.of(context)!.drawerWeeks,
|
||||
() {
|
||||
Navigator.of(context).pushReplacementNamed('/weeks');
|
||||
}),
|
||||
_buildDrawerItem(
|
||||
context, theme, colorScheme, Icons.schedule, 'Shifts', () {
|
||||
context, theme, colorScheme, Icons.schedule,
|
||||
AppLocalizations.of(context)!.drawerShifts, () {
|
||||
Navigator.of(context).pushReplacementNamed('/shifts');
|
||||
}),
|
||||
_buildDrawerItem(
|
||||
context, theme, colorScheme, Icons.payment, 'Billing', () {
|
||||
context, theme, colorScheme, Icons.payment,
|
||||
AppLocalizations.of(context)!.drawerBilling, () {
|
||||
Navigator.of(context).pushReplacementNamed('/billing');
|
||||
}),
|
||||
_buildDrawerItem(context, theme, colorScheme, Icons.swap_horiz,
|
||||
'EDI Settings', () {
|
||||
AppLocalizations.of(context)!.drawerEdi, () {
|
||||
Navigator.of(context).pushReplacementNamed('/edi_settings');
|
||||
}),
|
||||
_buildDrawerItem(context, theme, colorScheme,
|
||||
Icons.business_center, 'Company', () {
|
||||
Icons.business_center,
|
||||
AppLocalizations.of(context)!.drawerCompany, () {
|
||||
Navigator.of(context).pushReplacementNamed('/company');
|
||||
}),
|
||||
_buildDrawerItem(
|
||||
context, theme, colorScheme, Icons.image, 'Logo', () {
|
||||
context, theme, colorScheme, Icons.image,
|
||||
AppLocalizations.of(context)!.drawerLogo, () {
|
||||
Navigator.of(context).pushReplacementNamed('/logo');
|
||||
}),
|
||||
],
|
||||
@@ -1328,7 +1346,7 @@ class _SystemParametersViewState extends State<SystemParametersView>
|
||||
Container(
|
||||
padding: const EdgeInsets.all(UIConstants.spacing24),
|
||||
child: ModernButton(
|
||||
text: 'Logout',
|
||||
text: AppLocalizations.of(context)!.logoutAction,
|
||||
type: ModernButtonType.danger,
|
||||
size: ModernButtonSize.medium,
|
||||
icon: Icon(Icons.logout),
|
||||
|
||||
Reference in New Issue
Block a user