code reformatting and adding const everywhere

This commit is contained in:
asif
2025-08-12 11:47:10 +05:30
parent 8ae26e2f18
commit 82951b7919
6 changed files with 107 additions and 84 deletions

View File

@@ -14,7 +14,7 @@ class AppThemes {
default:
return ThemeData(primarySwatch: Colors.deepPurple);
}
}
}
static ThemeData getDarkTheme(ThemeType type) {
switch (type) {
@@ -29,4 +29,5 @@ class AppThemes {
return ThemeData.dark().copyWith(primaryColor: Colors.deepPurple);
}
}
}
}

View File

@@ -64,7 +64,8 @@ class _BlockCardScreen extends State<BlockCardScreen> {
),
title: Text(
AppLocalizations.of(context).blockCard,
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
style:
const TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
),
centerTitle: false,
actions: [
@@ -94,14 +95,14 @@ class _BlockCardScreen extends State<BlockCardScreen> {
controller: _cardController,
decoration: InputDecoration(
labelText: AppLocalizations.of(context).cardNumber,
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),
),
),
@@ -119,14 +120,14 @@ class _BlockCardScreen extends State<BlockCardScreen> {
controller: _cvvController,
decoration: InputDecoration(
labelText: AppLocalizations.of(context).cvv,
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),
),
),
@@ -146,15 +147,15 @@ class _BlockCardScreen extends State<BlockCardScreen> {
onTap: _pickExpiryDate,
decoration: InputDecoration(
labelText: AppLocalizations.of(context).expiryDate,
suffixIcon: Icon(Icons.calendar_today),
border: OutlineInputBorder(),
suffixIcon: const Icon(Icons.calendar_today),
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),
),
),
@@ -170,15 +171,15 @@ class _BlockCardScreen extends State<BlockCardScreen> {
controller: _phoneController,
decoration: InputDecoration(
labelText: AppLocalizations.of(context).phone,
prefixIcon: Icon(Icons.phone),
border: OutlineInputBorder(),
prefixIcon: const Icon(Icons.phone),
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),
),
),
@@ -199,7 +200,8 @@ class _BlockCardScreen extends State<BlockCardScreen> {
shape: const StadiumBorder(),
padding: const EdgeInsets.symmetric(vertical: 16),
backgroundColor: Theme.of(context).primaryColor,
foregroundColor: Theme.of(context).scaffoldBackgroundColor,
foregroundColor:
Theme.of(context).scaffoldBackgroundColor,
),
child: Text(AppLocalizations.of(context).block),
),

View File

@@ -62,7 +62,8 @@ import 'app_localizations_hi.dart';
/// be consistent with the languages listed in the AppLocalizations.supportedLocales
/// property.
abstract class AppLocalizations {
AppLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString());
AppLocalizations(String locale)
: localeName = intl.Intl.canonicalizedLocale(locale.toString());
final String localeName;
@@ -70,7 +71,8 @@ abstract class AppLocalizations {
return Localizations.of<AppLocalizations>(context, AppLocalizations)!;
}
static const LocalizationsDelegate<AppLocalizations> delegate = _AppLocalizationsDelegate();
static const LocalizationsDelegate<AppLocalizations> delegate =
_AppLocalizationsDelegate();
/// A list of this localizations delegate along with the default localizations
/// delegates.
@@ -82,7 +84,8 @@ abstract class AppLocalizations {
/// Additional delegates can be added by appending to this list in
/// MaterialApp. This list does not have to be used at all if a custom list
/// of delegates is preferred or required.
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates =
<LocalizationsDelegate<dynamic>>[
delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
@@ -1416,7 +1419,8 @@ abstract class AppLocalizations {
String get themeMode;
}
class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
class _AppLocalizationsDelegate
extends LocalizationsDelegate<AppLocalizations> {
const _AppLocalizationsDelegate();
@override
@@ -1425,25 +1429,25 @@ class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations>
}
@override
bool isSupported(Locale locale) => <String>['en', 'hi'].contains(locale.languageCode);
bool isSupported(Locale locale) =>
<String>['en', 'hi'].contains(locale.languageCode);
@override
bool shouldReload(_AppLocalizationsDelegate old) => false;
}
AppLocalizations lookupAppLocalizations(Locale locale) {
// Lookup logic when only language code is specified.
switch (locale.languageCode) {
case 'en': return AppLocalizationsEn();
case 'hi': return AppLocalizationsHi();
case 'en':
return AppLocalizationsEn();
case 'hi':
return AppLocalizationsHi();
}
throw FlutterError(
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
'an issue with the localizations generation tool. Please file an issue '
'on GitHub with a reproducible sample app and the gen-l10n configuration '
'that was used.'
);
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
'an issue with the localizations generation tool. Please file an issue '
'on GitHub with a reproducible sample app and the gen-l10n configuration '
'that was used.');
}

View File

@@ -1,3 +1,5 @@
// ignore: unused_import
import 'package:intl/intl.dart' as intl;
import 'app_localizations.dart';
// ignore_for_file: type=lint
@@ -486,7 +488,8 @@ class AppLocalizationsEn extends AppLocalizations {
String get otpVerification => 'OTP Verification';
@override
String get otpSentMessage => 'Enter the 4-digit OTP sent to your mobile number';
String get otpSentMessage =>
'Enter the 4-digit OTP sent to your mobile number';
@override
String get verifyOtp => 'Verify OTP';
@@ -504,13 +507,15 @@ class AppLocalizationsEn extends AppLocalizations {
String get tpinRequired => 'TPIN Required';
@override
String get tpinRequiredMessage => 'You need to set your TPIN to continue with secure transactions';
String get tpinRequiredMessage =>
'You need to set your TPIN to continue with secure transactions';
@override
String get setTpinTitle => 'Set TPIN';
@override
String get tpinInfo => 'Your TPIN is a 6-digit code used to authorize transactions. Keep it safe and do not share it with anyone.';
String get tpinInfo =>
'Your TPIN is a 6-digit code used to authorize transactions. Keep it safe and do not share it with anyone.';
@override
String get tpinFailed => 'Failed to set TPIN. Please try again.';
@@ -564,7 +569,8 @@ class AppLocalizationsEn extends AppLocalizations {
String get enableFingerprintLogin => 'Enable Fingerprint Login?';
@override
String get enableFingerprintMessage => 'Would you like to enable fingerprint authentication for faster login?';
String get enableFingerprintMessage =>
'Would you like to enable fingerprint authentication for faster login?';
@override
String get no => 'No';
@@ -585,7 +591,8 @@ class AppLocalizationsEn extends AppLocalizations {
String get loading => 'Loading......';
@override
String get enableFingerprintQuick => 'Enable fingerprint authentication for quick login?';
String get enableFingerprintQuick =>
'Enable fingerprint authentication for quick login?';
@override
String get kccb => 'KCCB';

View File

@@ -1,3 +1,5 @@
// ignore: unused_import
import 'package:intl/intl.dart' as intl;
import 'app_localizations.dart';
// ignore_for_file: type=lint
@@ -52,7 +54,8 @@ class AppLocalizationsHi extends AppLocalizations {
String get enableBiometric => 'बायोमेट्रिक प्रमाणीकरण सक्षम करें';
@override
String get useBiometricPrompt => 'तेज़ लॉगिन के लिए फिंगरप्रिंट/फेस आईडी का उपयोग करें?';
String get useBiometricPrompt =>
'तेज़ लॉगिन के लिए फिंगरप्रिंट/फेस आईडी का उपयोग करें?';
@override
String get later => 'बाद में';
@@ -486,7 +489,8 @@ class AppLocalizationsHi extends AppLocalizations {
String get otpVerification => 'ओटीपी सत्यापन';
@override
String get otpSentMessage => 'अपने मोबाइल नंबर पर भेजा गया 4-अंकों का ओटीपी दर्ज करें';
String get otpSentMessage =>
'अपने मोबाइल नंबर पर भेजा गया 4-अंकों का ओटीपी दर्ज करें';
@override
String get verifyOtp => 'ओटीपी सत्यापित करें';
@@ -504,13 +508,15 @@ class AppLocalizationsHi extends AppLocalizations {
String get tpinRequired => 'टी-पिन आवश्यक है';
@override
String get tpinRequiredMessage => 'सुरक्षित लेनदेन के लिए टी-पिन सेट करना आवश्यक है';
String get tpinRequiredMessage =>
'सुरक्षित लेनदेन के लिए टी-पिन सेट करना आवश्यक है';
@override
String get setTpinTitle => 'टी-पिन सेट करें';
@override
String get tpinInfo => 'आपका टी-पिन 6 अंकों का कोड है जिसका उपयोग लेन-देन को प्रमाणित करने के लिए किया जाता है। इसे सुरक्षित रखें और किसी से साझा न करें।';
String get tpinInfo =>
'आपका टी-पिन 6 अंकों का कोड है जिसका उपयोग लेन-देन को प्रमाणित करने के लिए किया जाता है। इसे सुरक्षित रखें और किसी से साझा न करें।';
@override
String get tpinFailed => 'टी-पिन सेट करने में विफल। कृपया पुनः प्रयास करें।';
@@ -564,7 +570,8 @@ class AppLocalizationsHi extends AppLocalizations {
String get enableFingerprintLogin => 'फिंगरप्रिंट लॉगिन सक्षम करें?';
@override
String get enableFingerprintMessage => 'क्या आप तेज लॉगिन के लिए फिंगरप्रिंट प्रमाणीकरण सक्षम करना चाहेंगे?';
String get enableFingerprintMessage =>
'क्या आप तेज लॉगिन के लिए फिंगरप्रिंट प्रमाणीकरण सक्षम करना चाहेंगे?';
@override
String get no => 'नहीं';
@@ -573,7 +580,8 @@ class AppLocalizationsHi extends AppLocalizations {
String get yes => 'हाँ';
@override
String get authenticateToEnable => 'फिंगरप्रिंट लॉगिन सक्षम करने के लिए प्रमाणीकरण करें';
String get authenticateToEnable =>
'फिंगरप्रिंट लॉगिन सक्षम करने के लिए प्रमाणीकरण करें';
@override
String get exitApp => 'ऐप बंद करें';
@@ -585,7 +593,8 @@ class AppLocalizationsHi extends AppLocalizations {
String get loading => 'लोड हो रहा है......';
@override
String get enableFingerprintQuick => 'तेज़ लॉगिन के लिए फिंगरप्रिंट प्रमाणीकरण सक्षम करें?';
String get enableFingerprintQuick =>
'तेज़ लॉगिन के लिए फिंगरप्रिंट प्रमाणीकरण सक्षम करें?';
@override
String get kccb => 'केसीसीबी';