Add Beneficiary Animations and Localizations

This commit is contained in:
2025-08-07 23:36:28 +05:30
parent a1365b19d5
commit ae40f61c01
19 changed files with 139 additions and 275 deletions

View File

@@ -1,7 +1,5 @@
import 'dart:developer';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter/material.dart';
import 'theme_state.dart';
import 'package:kmobile/config/theme_type.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -47,14 +45,5 @@ class ThemeCubit extends Cubit<ThemeState> {
print('default macthed');
}
}
// Future<void> toggleDarkMode(bool isDark) async {
// final prefs = await SharedPreferences.getInstance();
// await prefs.setBool('is_dark_mode', isDark);
// emit(state.copyWith(
// themeMode: isDark ? ThemeMode.dark : ThemeMode.light,
// ));
// }
}

View File

@@ -1,32 +1,7 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:kmobile/config/theme_type.dart';
import 'package:kmobile/config/themes.dart';
// class ThemeState {
// final ThemeData lightTheme;
// final ThemeMode themeMode;
// final ThemeType themeType;
// ThemeState({
// required this.lightTheme,
// required this.themeMode,
// required this.themeType,
// });
// ThemeState copyWith({
// ThemeData? lightTheme,
// ThemeMode? themeMode,
// ThemeType? themeType,
// }) {
// return ThemeState(
// lightTheme: lightTheme ?? this.lightTheme,
// themeMode: themeMode ?? this.themeMode,
// themeType: themeType ?? this.themeType,
// );
// }
// bool get isDarkMode => themeMode == ThemeMode.dark;
// }
abstract class ThemeState extends Equatable {
getThemeData();

View File

@@ -64,12 +64,12 @@ bool _isLoading = false; //for validateIFSC()
if (result == null) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Invalid IFSC code')),
SnackBar(content: Text(AppLocalizations.of(context).invalidIfsc)),
);
bankNameController.clear();
branchNameController.clear();
} else {
print("Valid IFSC: ${result.bankName}, ${result.branchName}");
print("${AppLocalizations.of(context).validIfsc}: ${result.bankName}, ${result.branchName}");
bankNameController.text = result.bankName;
branchNameController.text = result.branchName;
}
@@ -118,7 +118,7 @@ void validateAndAddBeneficiary() async {
} catch (e) {
Navigator.pop(context); // Close the spinner
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text("Something went wrong during validation.")),
SnackBar(content: Text(AppLocalizations.of(context).somethingWentWrong)),
);
}
}
@@ -178,10 +178,10 @@ void validateAndAddBeneficiary() async {
isDense: true,
filled: true,
fillColor: Theme.of(context).scaffoldBackgroundColor,
enabledBorder: OutlineInputBorder(
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
focusedBorder: OutlineInputBorder(
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 2,
@@ -213,10 +213,10 @@ void validateAndAddBeneficiary() async {
isDense: true,
filled: true,
fillColor: Theme.of(context).scaffoldBackgroundColor,
enabledBorder: OutlineInputBorder(
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
focusedBorder: OutlineInputBorder(
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 2,
@@ -249,10 +249,10 @@ void validateAndAddBeneficiary() async {
isDense: true,
filled: true,
fillColor: Theme.of(context).dialogBackgroundColor,
enabledBorder: OutlineInputBorder(
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
focusedBorder: OutlineInputBorder(
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 2,
@@ -271,14 +271,14 @@ void validateAndAddBeneficiary() async {
controller: ifscController,
decoration: InputDecoration(
labelText: AppLocalizations.of(context).ifscCode,
border: OutlineInputBorder(),
border: const OutlineInputBorder(),
isDense: true,
filled: true,
fillColor: Theme.of(context).scaffoldBackgroundColor,
enabledBorder: OutlineInputBorder(
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
focusedBorder: OutlineInputBorder(
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 2,
@@ -320,14 +320,14 @@ void validateAndAddBeneficiary() async {
enabled: false, // changed from readOnly to disabled
decoration: InputDecoration(
labelText: AppLocalizations.of(context).bankName,
border: OutlineInputBorder(),
border: const OutlineInputBorder(),
isDense: true,
filled: true,
fillColor: Theme.of(context).dialogBackgroundColor, // disabled color
enabledBorder: OutlineInputBorder(
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
),
focusedBorder: OutlineInputBorder(
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
width: 2,
@@ -343,7 +343,7 @@ void validateAndAddBeneficiary() async {
enabled: false, // changed from readOnly to disabled
decoration: InputDecoration(
labelText: AppLocalizations.of(context).branchName,
border: OutlineInputBorder(),
border: const OutlineInputBorder(),
isDense: true,
filled: true,
fillColor: Theme.of(context).dialogBackgroundColor,

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
import 'package:confetti/confetti.dart';
import 'dart:math';
import '../../../l10n/app_localizations.dart';
class BeneficiaryResultPage extends StatefulWidget {
final bool isSuccess;
@@ -53,8 +54,8 @@ class _BeneficiaryResultPageState extends State<BeneficiaryResultPage> {
const SizedBox(height: 20),
Text(
widget.isSuccess
? 'Beneficiary Added Successfully!'
: 'Beneficiary Addition Failed!',
? AppLocalizations.of(context).beneficiaryAddedSuccess
: AppLocalizations.of(context).beneficiaryAdditionFailed,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,

View File

@@ -482,7 +482,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
MaterialPageRoute(
builder: (context) =>
const FundTransferBeneficiaryScreen()));
}, disable: false),
}, disable: true),
_buildQuickLink(Symbols.server_person,
AppLocalizations.of(context).accountInfo, () {
Navigator.push(

View File

@@ -1,6 +1,5 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:kmobile/features/fund_transfer/screens/transaction_pin_screen.dart';
import 'package:material_symbols_icons/material_symbols_icons.dart';
import '../../../l10n/app_localizations.dart';

View File

@@ -7,7 +7,6 @@ import 'package:kmobile/data/models/transfer.dart';
import 'package:kmobile/di/injection.dart';
import 'package:kmobile/features/fund_transfer/screens/payment_animation.dart';
import 'package:kmobile/features/fund_transfer/screens/tpin_prompt_screen.dart';
import 'package:kmobile/features/fund_transfer/screens/transaction_success_screen.dart';
import 'package:material_symbols_icons/material_symbols_icons.dart';
class TransactionPinScreen extends StatefulWidget {

View File

@@ -2,37 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:kmobile/config/theme_type.dart';
import 'package:kmobile/features/auth/controllers/theme_cubit.dart';
import 'package:kmobile/features/auth/controllers/theme_state.dart';
/*void showColorThemeDialog(BuildContext context) {
showDialog(
context: context,
builder: (_) => AlertDialog(
title: const Text('Select Theme Color'),
content: BlocBuilder<ThemeCubit, ThemeState>(
builder: (context, state) {
return Column(
mainAxisSize: MainAxisSize.min,
children: ThemeType.values.map((type) {
return RadioListTile<ThemeType>(
value: type,
groupValue: state.themeType,
title: Text(type.name.toUpperCase()),
onChanged: (val) {
if (val != null) {
context.read<ThemeCubit>().changeTheme(val);
Navigator.pop(context);
}
},
);
}).toList(),
);
},
),
),
);
}*/
import '../../../l10n/app_localizations.dart';
class ColorThemeDialog extends StatelessWidget {
const ColorThemeDialog({super.key});
@@ -40,11 +10,11 @@ class ColorThemeDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SimpleDialog(
title: const Text('Select Color Theme'),
title: Text(AppLocalizations.of(context).selectThemeColor),
children: [
ListTile(
leading: const CircleAvatar(backgroundColor: Colors.deepPurple),
title: const Text('Violet'),
title: Text(AppLocalizations.of(context).violet),
onTap: () {
context.read<ThemeCubit>().changeTheme(ThemeType.violet);
Navigator.pop(context);
@@ -68,7 +38,7 @@ class ColorThemeDialog extends StatelessWidget {
// ),
ListTile(
leading: const CircleAvatar(backgroundColor: Colors.blue),
title: const Text('Blue'),
title: Text(AppLocalizations.of(context).blue),
onTap: () {
context.read<ThemeCubit>().changeTheme(ThemeType.blue);
Navigator.pop(context);

View File

@@ -3,53 +3,6 @@ import '../../../l10n/app_localizations.dart';
import 'package:kmobile/app.dart';
import 'package:shared_preferences/shared_preferences.dart';
/*class LanguageDialog extends StatelessWidget {
const LanguageDialog({super.key});
String getLocaleName(AppLocalizations localizations, String code) {
final localeCodeMap = {
'en': localizations.english,
'hi': localizations.hindi,
};
return localeCodeMap[code] ?? 'Unknown';
}
@override
Widget build(BuildContext context) {
return Builder(
builder: (context) {
final localizations = AppLocalizations.of(context);
final supportedLocales = [const Locale('en'), const Locale('hi')];
return AlertDialog(
title: Text(localizations.language),
content: Column(
mainAxisSize: MainAxisSize.min,
children: supportedLocales.map((locale) {
return ListTile(
leading: const Icon(Icons.language),
title: Text(getLocaleName(localizations, locale.languageCode)),
onTap: () {
Navigator.pop(context);
KMobile.setLocale(context, locale);
},
);
}).toList(),
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: Text(localizations.cancel),
),
],
);
},
);
}
}
*/
class LanguageDialog extends StatelessWidget {
const LanguageDialog({Key? key}) : super(key: key);

View File

@@ -35,7 +35,7 @@ class PreferenceScreen extends StatelessWidget {
//Color_Theme_Selection
ListTile(
leading: const Icon(Icons.color_lens),
title: const Text('Theme Color'),
title: Text(AppLocalizations.of(context).themeColor),
onTap: () {
showDialog(
context: context,