Swipe_Button_on_quick_pay
This commit is contained in:
parent
47fcb0e287
commit
3f71a32c04
3
devtools_options.yaml
Normal file
3
devtools_options.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
description: This file stores settings for Dart & Flutter DevTools.
|
||||||
|
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
|
||||||
|
extensions:
|
@ -2,12 +2,8 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:kmobile/features/customer_info/screens/customer_info_screen.dart';
|
import 'package:kmobile/features/customer_info/screens/customer_info_screen.dart';
|
||||||
import 'package:kmobile/security/secure_storage.dart';
|
|
||||||
import 'package:kmobile/src/preferences/preferences_cubit.dart';
|
|
||||||
import 'api/services/auth_service.dart';
|
|
||||||
import 'config/themes.dart';
|
import 'config/themes.dart';
|
||||||
import 'config/routes.dart';
|
import 'config/routes.dart';
|
||||||
import 'data/repositories/auth_repository.dart';
|
|
||||||
import 'di/injection.dart';
|
import 'di/injection.dart';
|
||||||
import 'features/auth/controllers/auth_cubit.dart';
|
import 'features/auth/controllers/auth_cubit.dart';
|
||||||
import 'features/auth/controllers/auth_state.dart';
|
import 'features/auth/controllers/auth_state.dart';
|
||||||
@ -36,8 +32,6 @@ class KMobile extends StatelessWidget {
|
|||||||
create: (_) => getIt<AuthCubit>(),
|
create: (_) => getIt<AuthCubit>(),
|
||||||
),
|
),
|
||||||
// Add other Bloc/Cubit providers here
|
// Add other Bloc/Cubit providers here
|
||||||
BlocProvider<PreferencesCubit>(
|
|
||||||
create: (_) => PreferencesCubit()),
|
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
title: 'Banking App',
|
title: 'Banking App',
|
||||||
|
@ -9,8 +9,9 @@ class AccountStatementScreen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _AccountStatementScreen extends State<AccountStatementScreen>{
|
class _AccountStatementScreen extends State<AccountStatementScreen>{
|
||||||
DateTimeRange? selectedDateRange;
|
DateTime? fromDate;
|
||||||
final _amountRangeController = TextEditingController(text: "100-500");
|
DateTime? toDate;
|
||||||
|
final _amountRangeController = TextEditingController(text: "");
|
||||||
final transactions = [
|
final transactions = [
|
||||||
{"desc": "Transfer From ICICI Bank subsidy", "amount": "+₹133.98", "type": "Cr", "time": "21-02-2024 13:09:30"},
|
{"desc": "Transfer From ICICI Bank subsidy", "amount": "+₹133.98", "type": "Cr", "time": "21-02-2024 13:09:30"},
|
||||||
{"desc": "Mobile recharge", "amount": "-₹299.00", "type": "Dr", "time": "21-02-2024 13:09:30"},
|
{"desc": "Mobile recharge", "amount": "-₹299.00", "type": "Dr", "time": "21-02-2024 13:09:30"},
|
||||||
@ -21,20 +22,32 @@ class _AccountStatementScreen extends State<AccountStatementScreen>{
|
|||||||
{"desc": "Transfer From ICICI Bank subsidy", "amount": "+₹100.00", "type": "Cr", "time": "21-02-2024 13:09:30"},
|
{"desc": "Transfer From ICICI Bank subsidy", "amount": "+₹100.00", "type": "Cr", "time": "21-02-2024 13:09:30"},
|
||||||
];
|
];
|
||||||
|
|
||||||
Future<void> _selectDateRange(BuildContext context) async {
|
void _selectDate({required bool isFromDate}) async {
|
||||||
final DateTime now = DateTime.now();
|
final DateTime initial = isFromDate ? fromDate ?? DateTime.now() : toDate ?? fromDate ?? DateTime.now();
|
||||||
|
|
||||||
final DateTimeRange? picked = await showDateRangePicker(
|
final DateTime? picked = await showDatePicker(
|
||||||
context: context,
|
context: context,
|
||||||
|
initialDate: initial,
|
||||||
firstDate: DateTime(2023),
|
firstDate: DateTime(2023),
|
||||||
lastDate: now, // disables future dates
|
lastDate: DateTime(2030),
|
||||||
initialDateRange: selectedDateRange ??
|
|
||||||
DateTimeRange(start: now.subtract(const Duration(days: 7)), end: now),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (picked != null) {
|
if (picked != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedDateRange = picked;
|
if (isFromDate) {
|
||||||
|
fromDate = picked;
|
||||||
|
if (toDate != null && toDate!.isBefore(fromDate!)) {
|
||||||
|
toDate = null; // reset invalid toDate
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (fromDate != null && picked.isBefore(fromDate!)) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||||
|
content: Text("To Date cannot be before From Date"),
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
toDate = picked;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,11 +95,13 @@ class _AccountStatementScreen extends State<AccountStatementScreen>{
|
|||||||
const SizedBox(height: 15,),
|
const SizedBox(height: 15,),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: _buildDateRangeSelector()),
|
Expanded(child: _buildFromDateSelector()),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Expanded(child: _buildFilterBox("100-500")),
|
Expanded(child: _buildToDateSelector()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
_buildFilterBox(""),
|
||||||
const SizedBox(height: 35),
|
const SizedBox(height: 35),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
@ -104,16 +119,9 @@ class _AccountStatementScreen extends State<AccountStatementScreen>{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildDateRangeSelector() {
|
Widget _buildFromDateSelector() {
|
||||||
String label = "Select Date";
|
|
||||||
if (selectedDateRange != null) {
|
|
||||||
final from = _formatDate(selectedDateRange!.start);
|
|
||||||
final to = _formatDate(selectedDateRange!.end);
|
|
||||||
label = "$from - $to";
|
|
||||||
}
|
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => _selectDateRange(context),
|
onTap: () => _selectDate(isFromDate: true),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -122,8 +130,37 @@ class _AccountStatementScreen extends State<AccountStatementScreen>{
|
|||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: Text(label, style: const TextStyle(fontSize: 16))),
|
Expanded(
|
||||||
const Icon(Icons.calendar_today),
|
child: Text(
|
||||||
|
fromDate != null ? _formatDate(fromDate!) : "From Date",
|
||||||
|
style: const TextStyle(fontSize: 16),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Icon(Icons.arrow_drop_down),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildToDateSelector() {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () => _selectDate(isFromDate: false),
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.grey),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
toDate != null ? _formatDate(toDate!) : "To Date",
|
||||||
|
style: const TextStyle(fontSize: 16),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Icon(Icons.arrow_drop_down),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_swipe_button/flutter_swipe_button.dart';
|
||||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
|
|
||||||
class QuickPayOutsideBankScreen extends StatefulWidget {
|
class QuickPayOutsideBankScreen extends StatefulWidget {
|
||||||
@ -300,16 +301,20 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
const SizedBox(height: 45),
|
const SizedBox(height: 45),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: SizedBox(
|
child: SwipeButton.expand(
|
||||||
width: 250,
|
thumb: const Icon(
|
||||||
child: ElevatedButton(
|
Icons.arrow_forward,
|
||||||
style: ElevatedButton.styleFrom(
|
color: Colors.white,
|
||||||
shape: const StadiumBorder(),
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
|
||||||
backgroundColor: Colors.blue[900],
|
|
||||||
foregroundColor: Colors.white,
|
|
||||||
),
|
),
|
||||||
onPressed: () {
|
activeThumbColor: Colors.blue[900],
|
||||||
|
activeTrackColor: Colors.blue.shade100,
|
||||||
|
borderRadius: BorderRadius.circular(30),
|
||||||
|
height: 56,
|
||||||
|
child: const Text(
|
||||||
|
"Swipe to Pay",
|
||||||
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
onSwipe: () {
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
// Perform payment logic
|
// Perform payment logic
|
||||||
final selectedMode = transactionModes[selectedTransactionIndex];
|
final selectedMode = transactionModes[selectedTransactionIndex];
|
||||||
@ -318,9 +323,8 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: const Text('Pay'),
|
)
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_swipe_button/flutter_swipe_button.dart';
|
||||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
|
|
||||||
class QuickPayWithinBankScreen extends StatefulWidget {
|
class QuickPayWithinBankScreen extends StatefulWidget {
|
||||||
@ -149,27 +150,28 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
|||||||
const SizedBox(height: 45),
|
const SizedBox(height: 45),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: SizedBox(
|
child: SwipeButton.expand(
|
||||||
width: 250,
|
thumb: const Icon(
|
||||||
height: 50,
|
Icons.arrow_forward,
|
||||||
child: ElevatedButton(
|
color: Colors.white,
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
shape: const StadiumBorder(),
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
|
||||||
backgroundColor: Colors.blue[900],
|
|
||||||
foregroundColor: Colors.white,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
if (_formKey.currentState!.validate()) {
|
|
||||||
// Perform payment logic
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
const SnackBar(
|
|
||||||
content: Text('Processing Payment...')),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: const Text('Pay'),
|
|
||||||
),
|
),
|
||||||
|
activeThumbColor: Colors.blue[900],
|
||||||
|
activeTrackColor: Colors.blue.shade100,
|
||||||
|
borderRadius: BorderRadius.circular(30),
|
||||||
|
height: 56,
|
||||||
|
child: const Text(
|
||||||
|
"Swipe to Pay",
|
||||||
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
onSwipe: () {
|
||||||
|
if (_formKey.currentState!.validate()) {
|
||||||
|
// Perform payment logic
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(
|
||||||
|
content: Text('Processing Payment...')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:kmobile/src/preferences/preferences_provider.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
import 'di/injection.dart';
|
import 'di/injection.dart';
|
||||||
import 'app.dart';
|
import 'app.dart';
|
||||||
|
|
||||||
@ -15,5 +17,7 @@ void main() async {
|
|||||||
// Initialize dependencies
|
// Initialize dependencies
|
||||||
await setupDependencies();
|
await setupDependencies();
|
||||||
|
|
||||||
runApp(const KMobile());
|
runApp(MultiProvider(providers: [
|
||||||
|
ChangeNotifierProvider(create: (_) => PreferencesProvider()),
|
||||||
|
], child: const KMobile()));
|
||||||
}
|
}
|
||||||
|
@ -1,72 +1,73 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:kmobile/src/preferences/color_dialog.dart';
|
import 'package:kmobile/src/preferences/color_dialog.dart';
|
||||||
import 'package:kmobile/src/preferences/language_dialog.dart';
|
import 'package:kmobile/src/preferences/language_dialog.dart';
|
||||||
|
import 'package:kmobile/src/preferences/preferences_provider.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:kmobile/src/preferences/preferences_cubit.dart';
|
|
||||||
import 'package:kmobile/src/preferences/preferences_state.dart';
|
|
||||||
|
|
||||||
class Preference extends StatelessWidget {
|
class Preference extends StatelessWidget {
|
||||||
const Preference({super.key});
|
const Preference({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<PreferencesCubit, PreferencesState>(
|
PreferencesProvider preferencesProvider =
|
||||||
builder: (context, state) {
|
Provider.of<PreferencesProvider>(context);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Theme.of(context).colorScheme.background,
|
backgroundColor: Theme.of(context).colorScheme.background,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(AppLocalizations.of(context)!.preferences),
|
title: Text(AppLocalizations.of(context)!.preferences),
|
||||||
|
),
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
ListTile(
|
||||||
|
title: Text(AppLocalizations.of(context)!.dark_theme),
|
||||||
|
trailing: Switch(
|
||||||
|
value: preferencesProvider.themeMode == ThemeMode.dark,
|
||||||
|
onChanged: (value) {
|
||||||
|
preferencesProvider.themeMode =
|
||||||
|
value ? ThemeMode.dark : ThemeMode.light;
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
body: ListView(
|
const Divider(height: 0),
|
||||||
children: [
|
ListTile(
|
||||||
ListTile(
|
title: Text(AppLocalizations.of(context)!.color_theme),
|
||||||
title: Text(AppLocalizations.of(context)!.dark_theme),
|
onTap: () => _changeCurrentTheme(context),
|
||||||
trailing: Switch(
|
|
||||||
value: state.themeMode == ThemeMode.dark,
|
|
||||||
onChanged: (value) {
|
|
||||||
context.read<PreferencesCubit>().setThemeMode(
|
|
||||||
value ? ThemeMode.dark : ThemeMode.light,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Divider(height: 0),
|
|
||||||
ListTile(
|
|
||||||
title: Text(AppLocalizations.of(context)!.color_theme),
|
|
||||||
onTap: () => _changeCurrentTheme(context),
|
|
||||||
),
|
|
||||||
const Divider(height: 0),
|
|
||||||
ListTile(
|
|
||||||
title: Text(AppLocalizations.of(context)!.language),
|
|
||||||
onTap: () => _changeCurrentLocale(context),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
const Divider(height: 0),
|
||||||
},
|
ListTile(
|
||||||
|
title: Text(AppLocalizations.of(context)!.language),
|
||||||
|
onTap: () => _changeCurrentLocale(context),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _changeCurrentTheme(BuildContext context) async {
|
Future<void> _changeCurrentTheme(BuildContext context) async {
|
||||||
final selectedColorScheme = await showDialog<Map<ThemeMode, ColorScheme>>(
|
Map<ThemeMode, ColorScheme> selectedColorScheme = await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => const ColorDialog(),
|
builder: (BuildContext context) {
|
||||||
|
return const ColorDialog();
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
if (context.mounted) {
|
||||||
if (context.mounted && selectedColorScheme != null) {
|
PreferencesProvider provider =
|
||||||
context.read<PreferencesCubit>().setColorScheme(selectedColorScheme);
|
Provider.of<PreferencesProvider>(context, listen: false);
|
||||||
|
provider.colorScheme = selectedColorScheme;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _changeCurrentLocale(BuildContext context) async {
|
Future<void> _changeCurrentLocale(BuildContext context) async {
|
||||||
final selectedLocale = await showDialog<Locale>(
|
Locale selectedLocale = await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => const LanguageDialog(),
|
builder: (BuildContext context) {
|
||||||
|
return const LanguageDialog();
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
if (context.mounted) {
|
||||||
if (context.mounted && selectedLocale != null) {
|
PreferencesProvider provider =
|
||||||
context.read<PreferencesCubit>().setLocale(selectedLocale);
|
Provider.of<PreferencesProvider>(context, listen: false);
|
||||||
|
provider.locale = selectedLocale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
import 'preferences_state.dart';
|
|
||||||
import 'package:kmobile/utils/theme/color/color_scheme.dart';
|
|
||||||
|
|
||||||
class PreferencesCubit extends Cubit<PreferencesState> {
|
|
||||||
PreferencesCubit()
|
|
||||||
: super(PreferencesState(
|
|
||||||
themeMode: ThemeMode.light,
|
|
||||||
colorScheme: KMobileColorScheme.everforest,
|
|
||||||
locale: const Locale.fromSubtags(languageCode: 'en'),
|
|
||||||
));
|
|
||||||
|
|
||||||
void setThemeMode(ThemeMode mode) {
|
|
||||||
emit(state.copyWith(themeMode: mode));
|
|
||||||
}
|
|
||||||
|
|
||||||
void setColorScheme(Map<ThemeMode, ColorScheme> colorScheme) {
|
|
||||||
emit(state.copyWith(colorScheme: colorScheme));
|
|
||||||
}
|
|
||||||
|
|
||||||
void setLocale(Locale locale) {
|
|
||||||
emit(state.copyWith(locale: locale));
|
|
||||||
}
|
|
||||||
}
|
|
25
lib/src/preferences/preferences_provider.dart
Normal file
25
lib/src/preferences/preferences_provider.dart
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:kmobile/utils/theme/color/color_scheme.dart';
|
||||||
|
|
||||||
|
class PreferencesProvider with ChangeNotifier {
|
||||||
|
ThemeMode _themeMode = ThemeMode.light;
|
||||||
|
ThemeMode get themeMode => _themeMode;
|
||||||
|
set themeMode(ThemeMode currentMode) {
|
||||||
|
_themeMode = currentMode;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<ThemeMode, ColorScheme> _colorScheme = KMobileColorScheme.everforest;
|
||||||
|
Map<ThemeMode, ColorScheme> get colorScheme => _colorScheme;
|
||||||
|
set colorScheme(Map<ThemeMode, ColorScheme> currentColorScheme) {
|
||||||
|
_colorScheme = currentColorScheme;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Locale _locale = const Locale.fromSubtags(languageCode: 'en');
|
||||||
|
Locale get locale => _locale;
|
||||||
|
set locale(Locale currentLocale) {
|
||||||
|
_locale = currentLocale;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
@ -1,25 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class PreferencesState {
|
|
||||||
final ThemeMode themeMode;
|
|
||||||
final Map<ThemeMode, ColorScheme> colorScheme;
|
|
||||||
final Locale locale;
|
|
||||||
|
|
||||||
PreferencesState({
|
|
||||||
required this.themeMode,
|
|
||||||
required this.colorScheme,
|
|
||||||
required this.locale,
|
|
||||||
});
|
|
||||||
|
|
||||||
PreferencesState copyWith({
|
|
||||||
ThemeMode? themeMode,
|
|
||||||
Map<ThemeMode, ColorScheme>? colorScheme,
|
|
||||||
Locale? locale,
|
|
||||||
}) {
|
|
||||||
return PreferencesState(
|
|
||||||
themeMode: themeMode ?? this.themeMode,
|
|
||||||
colorScheme: colorScheme ?? this.colorScheme,
|
|
||||||
locale: locale ?? this.locale,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
10
pubspec.lock
10
pubspec.lock
@ -211,6 +211,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0"
|
version: "2.1.0"
|
||||||
|
flutter_swipe_button:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_swipe_button
|
||||||
|
sha256: "67df9f1121ad10429b900a723366403441634ebb2c064fd4babb7de274366a36"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.3"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -470,7 +478,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.8"
|
version: "2.1.8"
|
||||||
provider:
|
provider:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: provider
|
name: provider
|
||||||
sha256: "4abbd070a04e9ddc287673bf5a030c7ca8b685ff70218720abab8b092f53dd84"
|
sha256: "4abbd070a04e9ddc287673bf5a030c7ca8b685ff70218720abab8b092f53dd84"
|
||||||
|
@ -52,6 +52,8 @@ dependencies:
|
|||||||
social_share: ^2.3.1
|
social_share: ^2.3.1
|
||||||
screenshot: ^3.0.0
|
screenshot: ^3.0.0
|
||||||
path_provider: ^2.1.5
|
path_provider: ^2.1.5
|
||||||
|
flutter_swipe_button: ^2.1.3
|
||||||
|
provider: ^6.1.5
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user