adding multilingual support
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
import '../../../core/providers/dynamic_theme_provider.dart';
|
||||
import '../../../core/constants/ui_constants.dart';
|
||||
import '../../../shared/widgets/app_bar/modern_app_bar.dart';
|
||||
@@ -408,7 +409,7 @@ class _EntityDetailsState extends State<EntityDetails>
|
||||
children: [
|
||||
Expanded(
|
||||
child: ModernButton(
|
||||
text: 'Edit',
|
||||
text: AppLocalizations.of(context)!.edit,
|
||||
type: ModernButtonType.secondary,
|
||||
size: ModernButtonSize.large,
|
||||
onPressed: () => widget.onEdit(widget.entity),
|
||||
@@ -418,7 +419,7 @@ class _EntityDetailsState extends State<EntityDetails>
|
||||
const SizedBox(width: UIConstants.spacing16),
|
||||
Expanded(
|
||||
child: ModernButton(
|
||||
text: 'Delete',
|
||||
text: AppLocalizations.of(context)!.delete,
|
||||
type: ModernButtonType.danger,
|
||||
size: ModernButtonSize.large,
|
||||
onPressed: () => _showDeleteDialog(colorScheme),
|
||||
|
||||
@@ -386,6 +386,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
import '../../../core/providers/dynamic_theme_provider.dart';
|
||||
import '../fields/base_field.dart';
|
||||
import '../fields/dependent_dropdown_field.dart';
|
||||
@@ -562,7 +563,9 @@ class _EntityFormState extends State<EntityForm> {
|
||||
final pass = passwordByGroup[gid] ?? '';
|
||||
if (confirm.isNotEmpty && confirm != pass) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Passwords do not match')),
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!
|
||||
.passwordsDoNotMatch)),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../../core/providers/dynamic_theme_provider.dart';
|
||||
import '../../../core/constants/ui_constants.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
import '../../../shared/widgets/app_bar/modern_app_bar.dart';
|
||||
import 'entity_card.dart';
|
||||
|
||||
@@ -106,7 +107,7 @@ class _EntityListState extends State<EntityList> with TickerProviderStateMixin {
|
||||
TextButton(
|
||||
onPressed: widget.onInsertAction,
|
||||
child: Text(
|
||||
widget.insertActionLabel ?? 'Unknown',
|
||||
widget.insertActionLabel ?? AppLocalizations.of(context)!.unknown,
|
||||
style: TextStyle(
|
||||
color: colorScheme.primary,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -117,7 +118,7 @@ class _EntityListState extends State<EntityList> with TickerProviderStateMixin {
|
||||
IconButton(
|
||||
onPressed: widget.onAddNew,
|
||||
icon: Icon(Icons.add_rounded, color: colorScheme.primary),
|
||||
tooltip: 'Add New',
|
||||
tooltip: AppLocalizations.of(context)!.addNew,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -175,7 +176,8 @@ class _EntityListState extends State<EntityList> with TickerProviderStateMixin {
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Search ${widget.title.toLowerCase()}...',
|
||||
hintText: AppLocalizations.of(context)!
|
||||
.searchEntity(widget.title.toLowerCase()),
|
||||
hintStyle: TextStyle(
|
||||
color: colorScheme.onSurface.withOpacity(0.6),
|
||||
fontSize: 16,
|
||||
@@ -214,7 +216,7 @@ class _EntityListState extends State<EntityList> with TickerProviderStateMixin {
|
||||
color: colorScheme.onSurface.withOpacity(0.8),
|
||||
size: 22,
|
||||
),
|
||||
tooltip: 'Refresh',
|
||||
tooltip: AppLocalizations.of(context)!.refresh,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -245,7 +247,7 @@ class _EntityListState extends State<EntityList> with TickerProviderStateMixin {
|
||||
CircularProgressIndicator(color: colorScheme.primary, strokeWidth: 3),
|
||||
const SizedBox(height: UIConstants.spacing16),
|
||||
Text(
|
||||
'Loading ${widget.title.toLowerCase()}...',
|
||||
AppLocalizations.of(context)!.loadingEntity(widget.title.toLowerCase()),
|
||||
style: TextStyle(
|
||||
color: colorScheme.onSurface.withOpacity(0.7),
|
||||
fontSize: 16,
|
||||
@@ -277,7 +279,7 @@ class _EntityListState extends State<EntityList> with TickerProviderStateMixin {
|
||||
),
|
||||
const SizedBox(height: UIConstants.spacing16),
|
||||
Text(
|
||||
'Error Loading Data',
|
||||
AppLocalizations.of(context)!.errorLoadingData,
|
||||
style: TextStyle(
|
||||
color: colorScheme.onSurface,
|
||||
fontSize: 18,
|
||||
@@ -286,7 +288,7 @@ class _EntityListState extends State<EntityList> with TickerProviderStateMixin {
|
||||
),
|
||||
const SizedBox(height: UIConstants.spacing8),
|
||||
Text(
|
||||
widget.errorMessage ?? 'Something went wrong',
|
||||
widget.errorMessage ?? AppLocalizations.of(context)!.somethingWentWrong,
|
||||
style: TextStyle(
|
||||
color: colorScheme.onSurface.withOpacity(0.7),
|
||||
fontSize: 14,
|
||||
@@ -299,7 +301,7 @@ class _EntityListState extends State<EntityList> with TickerProviderStateMixin {
|
||||
onPressed: widget.onRefresh,
|
||||
icon: Icon(Icons.refresh_rounded, color: colorScheme.onPrimary),
|
||||
label: Text(
|
||||
'Retry',
|
||||
AppLocalizations.of(context)!.retry,
|
||||
style: TextStyle(
|
||||
color: colorScheme.onPrimary,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -344,7 +346,7 @@ class _EntityListState extends State<EntityList> with TickerProviderStateMixin {
|
||||
),
|
||||
const SizedBox(height: UIConstants.spacing16),
|
||||
Text(
|
||||
'No ${widget.title.toLowerCase()} found',
|
||||
AppLocalizations.of(context)!.noEntityFound(widget.title.toLowerCase()),
|
||||
style: TextStyle(
|
||||
color: colorScheme.onSurface,
|
||||
fontSize: 18,
|
||||
@@ -354,8 +356,9 @@ class _EntityListState extends State<EntityList> with TickerProviderStateMixin {
|
||||
const SizedBox(height: UIConstants.spacing8),
|
||||
Text(
|
||||
widget.searchQuery.isNotEmpty
|
||||
? 'Try adjusting your search terms'
|
||||
: 'Start by adding your first ${widget.title.toLowerCase()}',
|
||||
? AppLocalizations.of(context)!.adjustSearchTerms
|
||||
: AppLocalizations.of(context)!
|
||||
.startByAdding(widget.title.toLowerCase()),
|
||||
style: TextStyle(
|
||||
color: colorScheme.onSurface.withOpacity(0.7),
|
||||
fontSize: 14,
|
||||
@@ -369,7 +372,7 @@ class _EntityListState extends State<EntityList> with TickerProviderStateMixin {
|
||||
onPressed: widget.onAddNew,
|
||||
icon: Icon(Icons.add_rounded, color: colorScheme.onPrimary),
|
||||
label: Text(
|
||||
'Add ${widget.title}',
|
||||
AppLocalizations.of(context)!.addEntity(widget.title),
|
||||
style: TextStyle(
|
||||
color: colorScheme.onPrimary,
|
||||
fontWeight: FontWeight.w600,
|
||||
|
||||
Reference in New Issue
Block a user