Compare commits
6 Commits
services
...
Acc_no_dro
Author | SHA1 | Date | |
---|---|---|---|
0c1d6fc718 | |||
1ad1cd07cc | |||
c0e892341b | |||
83ad2b2e52 | |||
7832a9372f | |||
3f71a32c04 |
BIN
assets/fonts/Sriracha-Regular.ttf
Normal file
BIN
assets/fonts/Sriracha-Regular.ttf
Normal file
Binary file not shown.
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:
|
12
lib/app.dart
12
lib/app.dart
@@ -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',
|
||||||
@@ -59,7 +53,7 @@ class KMobile extends StatelessWidget {
|
|||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
// Handle different authentication states
|
// Handle different authentication states
|
||||||
if (state is AuthInitial || state is AuthLoading) {
|
if (state is AuthInitial || state is AuthLoading) {
|
||||||
return const _SplashScreen();
|
return const SplashScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state is ShowBiometricPermission){
|
if(state is ShowBiometricPermission){
|
||||||
@@ -79,8 +73,8 @@ class KMobile extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Simple splash screens component
|
// Simple splash screens component
|
||||||
class _SplashScreen extends StatelessWidget {
|
class SplashScreen extends StatelessWidget {
|
||||||
const _SplashScreen();
|
const SplashScreen();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@@ -31,6 +31,8 @@ class AppRoutes {
|
|||||||
// Route generator
|
// Route generator
|
||||||
static Route<dynamic> generateRoute(RouteSettings settings) {
|
static Route<dynamic> generateRoute(RouteSettings settings) {
|
||||||
switch (settings.name) {
|
switch (settings.name) {
|
||||||
|
case splash:
|
||||||
|
return MaterialPageRoute(builder: (_) => const SplashScreen());
|
||||||
case login:
|
case login:
|
||||||
return MaterialPageRoute(builder: (_) => const LoginScreen());
|
return MaterialPageRoute(builder: (_) => const LoginScreen());
|
||||||
|
|
||||||
|
@@ -46,7 +46,6 @@ class AuthRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<User?> getCurrentUser() async {
|
Future<User?> getCurrentUser() async {
|
||||||
final userJson = await _secureStorage.read(_userKey);
|
final userJson = await _secureStorage.read(_userKey);
|
||||||
if (userJson != null) {
|
if (userJson != null) {
|
||||||
|
@@ -35,7 +35,7 @@ class _AccountInfoScreen extends State<AccountInfoScreen>{
|
|||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
children: const [
|
children: const [
|
||||||
InfoRow(title: 'Account Number', value: '700127638009871'),
|
InfoRow(title: 'Account Number', value: '700127638009871'),
|
||||||
InfoRow(title: 'Nominee Customer No', value: '700127638009871'),
|
// InfoRow(title: 'Nominee Customer No', value: '700127638009871'),
|
||||||
InfoRow(title: 'SMS Service', value: 'Active'),
|
InfoRow(title: 'SMS Service', value: 'Active'),
|
||||||
InfoRow(title: 'Missed Call Service', value: 'Active'),
|
InfoRow(title: 'Missed Call Service', value: 'Active'),
|
||||||
InfoRow(title: 'Customer Number', value: '9000875272000212'),
|
InfoRow(title: 'Customer Number', value: '9000875272000212'),
|
||||||
|
@@ -8,33 +8,96 @@ class AccountStatementScreen extends StatefulWidget {
|
|||||||
State<AccountStatementScreen> createState() => _AccountStatementScreen();
|
State<AccountStatementScreen> createState() => _AccountStatementScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
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": "Mobile recharge", "amount": "-₹299.00", "type": "Dr", "time": "21-02-2024 13:09:30"},
|
"desc": "Transfer From ICICI Bank subsidy",
|
||||||
{"desc": "NEFT received from Jaya Saha", "amount": "+₹987.80", "type": "Cr", "time": "21-02-2024 13:09:30"},
|
"amount": "+₹133.98",
|
||||||
{"desc": "Transfer From ICICI Bank subsidy", "amount": "+₹100.00", "type": "Cr", "time": "21-02-2024 13:09:30"},
|
"type": "Cr",
|
||||||
{"desc": "Transfer From ICICI Bank subsidy", "amount": "-₹100.00", "type": "Dr", "time": "21-02-2024 13:09:30"},
|
"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"},
|
},
|
||||||
{"desc": "Transfer From ICICI Bank subsidy", "amount": "+₹100.00", "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": "NEFT received from Jaya Saha",
|
||||||
|
"amount": "+₹987.80",
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Transfer From ICICI Bank subsidy",
|
||||||
|
"amount": "-₹100.00",
|
||||||
|
"type": "Dr",
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc": "Transfer From ICICI Bank subsidy",
|
||||||
|
"amount": "+₹100.00",
|
||||||
|
"type": "Cr",
|
||||||
|
"time": "21-02-2024 13:09:30"
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
Future<void> _selectDateRange(BuildContext context) async {
|
Future<void> _selectFromDate(BuildContext context) async {
|
||||||
final DateTime now = DateTime.now();
|
final DateTime now = DateTime.now();
|
||||||
|
|
||||||
final DateTimeRange? picked = await showDateRangePicker(
|
final DateTime? picked = await showDatePicker(
|
||||||
context: context,
|
context: context,
|
||||||
firstDate: DateTime(2023),
|
initialDate: fromDate ?? now,
|
||||||
lastDate: now, // disables future dates
|
firstDate: DateTime(2020), // or your app's start limit
|
||||||
initialDateRange: selectedDateRange ??
|
lastDate: now, // No future date
|
||||||
DateTimeRange(start: now.subtract(const Duration(days: 7)), end: now),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (picked != null) {
|
if (picked != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedDateRange = picked;
|
fromDate = picked;
|
||||||
|
toDate = null; // reset toDate when fromDate changes
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _selectToDate(BuildContext context) async {
|
||||||
|
if (fromDate == null) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||||
|
content: Text('Please select From Date first'),
|
||||||
|
));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final DateTime now = DateTime.now();
|
||||||
|
|
||||||
|
final DateTime lastAllowedDate = fromDate!.add(const Duration(days: 31));
|
||||||
|
final DateTime maxToDate = lastAllowedDate.isBefore(now) ? lastAllowedDate : now;
|
||||||
|
|
||||||
|
final DateTime? picked = await showDatePicker(
|
||||||
|
context: context,
|
||||||
|
initialDate: toDate ?? fromDate!,
|
||||||
|
firstDate: fromDate!, // 🔒 can't be before fromDate
|
||||||
|
lastDate: maxToDate, // 🔒 not more than 1 month or future
|
||||||
|
);
|
||||||
|
|
||||||
|
if (picked != null) {
|
||||||
|
setState(() {
|
||||||
|
toDate = picked;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,36 +118,74 @@ class _AccountStatementScreen extends State<AccountStatementScreen>{
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: IconButton(icon: const Icon(Symbols.arrow_back_ios_new),
|
leading: IconButton(
|
||||||
|
icon: const Icon(Symbols.arrow_back_ios_new),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},),
|
},
|
||||||
title: const Text('Account Statement', style: TextStyle(color: Colors.black,
|
),
|
||||||
fontWeight: FontWeight.w500),),
|
title: const Text(
|
||||||
|
'Account Statement',
|
||||||
|
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
actions: const [
|
actions: const [
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(right: 10.0),
|
padding: EdgeInsets.only(right: 10.0),
|
||||||
child: CircleAvatar(
|
child: CircleAvatar(
|
||||||
backgroundImage: AssetImage('assets/images/avatar.jpg'), // Replace with your image
|
backgroundImage: AssetImage('assets/images/avatar.jpg'),
|
||||||
|
// Replace with your image
|
||||||
radius: 20,
|
radius: 20,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
const Text('Filters', style: TextStyle(fontSize: 17),),
|
const Text(
|
||||||
const SizedBox(height: 15,),
|
'Filters',
|
||||||
|
style: TextStyle(fontSize: 17),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: _buildDateRangeSelector()),
|
Expanded(child: GestureDetector(
|
||||||
|
onTap: () => _selectFromDate(context),
|
||||||
|
child: buildDateBox("From Date", fromDate),
|
||||||
|
),),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Expanded(child: _buildFilterBox("100-500")),
|
Expanded(child: GestureDetector(
|
||||||
|
onTap: () => _selectToDate(context),
|
||||||
|
child: buildDateBox("To Date", toDate),
|
||||||
|
),),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: _buildFilterBox(""),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 8,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 75,
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
|
),
|
||||||
|
child: const Text(
|
||||||
|
'Go',
|
||||||
|
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
|
||||||
|
)),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 35),
|
const SizedBox(height: 35),
|
||||||
@@ -100,32 +201,26 @@ class _AccountStatementScreen extends State<AccountStatementScreen>{
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildDateRangeSelector() {
|
Widget buildDateBox(String label, DateTime? date) {
|
||||||
String label = "Select Date";
|
return Container(
|
||||||
if (selectedDateRange != null) {
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||||
final from = _formatDate(selectedDateRange!.start);
|
decoration: BoxDecoration(
|
||||||
final to = _formatDate(selectedDateRange!.end);
|
border: Border.all(color: Colors.grey),
|
||||||
label = "$from - $to";
|
borderRadius: BorderRadius.circular(6),
|
||||||
}
|
),
|
||||||
|
child: Row(
|
||||||
return GestureDetector(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
onTap: () => _selectDateRange(context),
|
children: [
|
||||||
child: Container(
|
Text(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
|
date != null ? _formatDate(date) : label,
|
||||||
decoration: BoxDecoration(
|
style: TextStyle(fontSize: 16,
|
||||||
border: Border.all(color: Colors.grey),
|
color: date != null ? Colors.black: Colors.grey),
|
||||||
borderRadius: BorderRadius.circular(8),
|
),
|
||||||
),
|
const Icon(Icons.arrow_drop_down),
|
||||||
child: Row(
|
],
|
||||||
children: [
|
|
||||||
Expanded(child: Text(label, style: const TextStyle(fontSize: 16))),
|
|
||||||
const Icon(Icons.calendar_today),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -169,7 +264,9 @@ class _AccountStatementScreen extends State<AccountStatementScreen>{
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: Text(txn['desc']!, style: const TextStyle(fontSize: 16))),
|
Expanded(
|
||||||
|
child:
|
||||||
|
Text(txn['desc']!, style: const TextStyle(fontSize: 16))),
|
||||||
Text(
|
Text(
|
||||||
"${txn['amount']} ${txn['type']}",
|
"${txn['amount']} ${txn['type']}",
|
||||||
style: TextStyle(color: amountColor, fontWeight: FontWeight.bold),
|
style: TextStyle(color: amountColor, fontWeight: FontWeight.bold),
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:kmobile/features/auth/controllers/auth_cubit.dart';
|
import 'package:kmobile/features/auth/controllers/auth_cubit.dart';
|
||||||
|
import 'package:kmobile/security/secure_storage.dart';
|
||||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
|
|
||||||
import '../../../app.dart';
|
import '../../../app.dart';
|
||||||
|
|
||||||
class MPinScreen extends StatefulWidget {
|
class MPinScreen extends StatefulWidget {
|
||||||
@@ -64,15 +64,20 @@ class MPinScreenState extends State<MPinScreen> {
|
|||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
if (key == '<') {
|
if (key == '<') {
|
||||||
deleteDigit();
|
deleteDigit();
|
||||||
} else if (key == 'Enter') {
|
} else if (key == 'Enter') {
|
||||||
if (mPin.length == 4) {
|
if (mPin.length == 4) {
|
||||||
Navigator.push(
|
// String storedMpin = await SecureStorage().read("mpin");
|
||||||
context,
|
// if(!mounted) return;
|
||||||
MaterialPageRoute(builder: (context) => const NavigationScaffold()),
|
// if(storedMpin == mPin.join()) {
|
||||||
);
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const NavigationScaffold()),
|
||||||
|
);
|
||||||
|
// }
|
||||||
} else {
|
} else {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
const SnackBar(content: Text("Please enter 4 digits")),
|
const SnackBar(content: Text("Please enter 4 digits")),
|
||||||
|
144
lib/features/auth/screens/mpin_setup.dart
Normal file
144
lib/features/auth/screens/mpin_setup.dart
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:kmobile/features/auth/controllers/auth_cubit.dart';
|
||||||
|
import 'package:kmobile/features/auth/screens/mpin_setup_confirm.dart';
|
||||||
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
|
|
||||||
|
class MPinSetupScreen extends StatefulWidget {
|
||||||
|
const MPinSetupScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
MPinSetupScreenState createState() => MPinSetupScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class MPinSetupScreenState extends State<MPinSetupScreen> {
|
||||||
|
List<String> mPin = [];
|
||||||
|
|
||||||
|
void addDigit(String digit) {
|
||||||
|
if (mPin.length < 4) {
|
||||||
|
setState(() {
|
||||||
|
mPin.add(digit);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void deleteDigit() {
|
||||||
|
if (mPin.isNotEmpty) {
|
||||||
|
setState(() {
|
||||||
|
mPin.removeLast();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildMPinDots() {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: List.generate(4, (index) {
|
||||||
|
return Container(
|
||||||
|
margin: const EdgeInsets.all(8),
|
||||||
|
width: 15,
|
||||||
|
height: 15,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: index < mPin.length ? Colors.black : Colors.grey[400],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildNumberPad() {
|
||||||
|
List<List<String>> keys = [
|
||||||
|
['1', '2', '3'],
|
||||||
|
['4', '5', '6'],
|
||||||
|
['7', '8', '9'],
|
||||||
|
['Enter', '0', '<']
|
||||||
|
];
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: keys.map((row) {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: row.map((key) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
if (key == '<') {
|
||||||
|
deleteDigit();
|
||||||
|
} else if (key == 'Enter') {
|
||||||
|
if (mPin.length == 4) {
|
||||||
|
Navigator.of(context).push(
|
||||||
|
MaterialPageRoute(builder: (context) => MPinSetupConfirmScreen(mPin: mPin,)),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text("Please enter 4 digits")),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else if (key.isNotEmpty) {
|
||||||
|
addDigit(key);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: 70,
|
||||||
|
height: 70,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.grey[200],
|
||||||
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: key == 'Enter' ? const Icon(Symbols.check) : Text(
|
||||||
|
key == '<' ? '⌫' : key,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: key == 'Enter' ?
|
||||||
|
FontWeight.normal : FontWeight.normal,
|
||||||
|
color: key == 'Enter' ? Colors.blue : Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final cubit = context.read<AuthCubit>();
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
body: SafeArea(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const Spacer(),
|
||||||
|
// Logo
|
||||||
|
const FlutterLogo(size: 100),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
const Text(
|
||||||
|
"Enter your mPIN",
|
||||||
|
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
buildMPinDots(),
|
||||||
|
const Spacer(),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
TextButton(onPressed: () {
|
||||||
|
cubit.authenticateBiometric();
|
||||||
|
}, child: const Text("Try another way")),
|
||||||
|
TextButton(onPressed: () {}, child: const Text("Register?")),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
buildNumberPad(),
|
||||||
|
const Spacer(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
154
lib/features/auth/screens/mpin_setup_confirm.dart
Normal file
154
lib/features/auth/screens/mpin_setup_confirm.dart
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:kmobile/features/auth/controllers/auth_cubit.dart';
|
||||||
|
import 'package:kmobile/security/secure_storage.dart';
|
||||||
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
import '../../../app.dart';
|
||||||
|
|
||||||
|
class MPinSetupConfirmScreen extends StatefulWidget {
|
||||||
|
final List<String> mPin;
|
||||||
|
const MPinSetupConfirmScreen({super.key, required this.mPin});
|
||||||
|
|
||||||
|
@override
|
||||||
|
MPinSetupConfirmScreenState createState() => MPinSetupConfirmScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class MPinSetupConfirmScreenState extends State<MPinSetupConfirmScreen> {
|
||||||
|
List<String> mPin = [];
|
||||||
|
|
||||||
|
void addDigit(String digit) {
|
||||||
|
if (mPin.length < 4) {
|
||||||
|
setState(() {
|
||||||
|
mPin.add(digit);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void deleteDigit() {
|
||||||
|
if (mPin.isNotEmpty) {
|
||||||
|
setState(() {
|
||||||
|
mPin.removeLast();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildMPinDots() {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: List.generate(4, (index) {
|
||||||
|
return Container(
|
||||||
|
margin: const EdgeInsets.all(8),
|
||||||
|
width: 15,
|
||||||
|
height: 15,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: index < mPin.length ? Colors.black : Colors.grey[400],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildNumberPad() {
|
||||||
|
List<List<String>> keys = [
|
||||||
|
['1', '2', '3'],
|
||||||
|
['4', '5', '6'],
|
||||||
|
['7', '8', '9'],
|
||||||
|
['Enter', '0', '<']
|
||||||
|
];
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: keys.map((row) {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: row.map((key) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () async {
|
||||||
|
if (key == '<') {
|
||||||
|
deleteDigit();
|
||||||
|
} else if (key == 'Enter') {
|
||||||
|
if (mPin.length == 4 && mPin.join() == widget.mPin.join()) {
|
||||||
|
|
||||||
|
await SecureStorage().write("mpin", mPin.join());
|
||||||
|
await SharedPreferences.getInstance()
|
||||||
|
.then((prefs) => prefs.setBool('mpin_set', true));
|
||||||
|
if(!mounted) return;
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) => const NavigationScaffold()),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(content: Text("Please enter 4 digits")),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else if (key.isNotEmpty) {
|
||||||
|
addDigit(key);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: 70,
|
||||||
|
height: 70,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.grey[200],
|
||||||
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: key == 'Enter' ? const Icon(Symbols.check) : Text(
|
||||||
|
key == '<' ? '⌫' : key,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: key == 'Enter' ?
|
||||||
|
FontWeight.normal : FontWeight.normal,
|
||||||
|
color: key == 'Enter' ? Colors.blue : Colors.black,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final cubit = context.read<AuthCubit>();
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
body: SafeArea(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const Spacer(),
|
||||||
|
// Logo
|
||||||
|
const FlutterLogo(size: 100),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
const Text(
|
||||||
|
"Enter your mPIN",
|
||||||
|
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
buildMPinDots(),
|
||||||
|
const Spacer(),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
TextButton(onPressed: () {
|
||||||
|
cubit.authenticateBiometric();
|
||||||
|
}, child: const Text("Try another way")),
|
||||||
|
TextButton(onPressed: () {}, child: const Text("Register?")),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
buildNumberPad(),
|
||||||
|
const Spacer(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -12,6 +12,7 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen>{
|
|||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
final TextEditingController accountNumberController = TextEditingController();
|
final TextEditingController accountNumberController = TextEditingController();
|
||||||
|
final TextEditingController confirmAccountNumberController = TextEditingController();
|
||||||
final TextEditingController nameController = TextEditingController();
|
final TextEditingController nameController = TextEditingController();
|
||||||
final TextEditingController bankNameController = TextEditingController();
|
final TextEditingController bankNameController = TextEditingController();
|
||||||
final TextEditingController branchNameController = TextEditingController();
|
final TextEditingController branchNameController = TextEditingController();
|
||||||
@@ -109,6 +110,7 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen>{
|
|||||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
obscureText: true,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
textInputAction: TextInputAction.next,
|
textInputAction: TextInputAction.next,
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
@@ -119,6 +121,36 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen>{
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
|
// Confirm Account Number
|
||||||
|
TextFormField(
|
||||||
|
controller: confirmAccountNumberController,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Confirm Account Number',
|
||||||
|
// prefixIcon: Icon(Icons.person),
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
isDense: true,
|
||||||
|
filled: true,
|
||||||
|
fillColor: Colors.white,
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.black),
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Re-enter account number';
|
||||||
|
}
|
||||||
|
if (value != accountNumberController.text) {
|
||||||
|
return 'Account numbers do not match';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: nameController,
|
controller: nameController,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
|
@@ -9,6 +9,7 @@ import 'package:kmobile/features/fund_transfer/screens/fund_transfer_beneficiary
|
|||||||
import 'package:kmobile/features/quick_pay/screens/quick_pay_screen.dart';
|
import 'package:kmobile/features/quick_pay/screens/quick_pay_screen.dart';
|
||||||
import 'package:kmobile/src/preferences/preference.dart';
|
import 'package:kmobile/src/preferences/preference.dart';
|
||||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
|
||||||
class DashboardScreen extends StatefulWidget {
|
class DashboardScreen extends StatefulWidget {
|
||||||
const DashboardScreen({super.key});
|
const DashboardScreen({super.key});
|
||||||
@@ -20,20 +21,55 @@ class DashboardScreen extends StatefulWidget {
|
|||||||
class _DashboardScreenState extends State<DashboardScreen> {
|
class _DashboardScreenState extends State<DashboardScreen> {
|
||||||
// Mock data for transactions
|
// Mock data for transactions
|
||||||
final List<Map<String, String>> transactions = [
|
final List<Map<String, String>> transactions = [
|
||||||
{'name': 'Raj Kumar', 'amount': '₹1,000', 'date': '09 March, 2025 16:04', 'type': 'in'},
|
{
|
||||||
{'name': 'Sunita Joshi', 'amount': '₹1,45,000', 'date': '07 March, 2025 16:04', 'type': 'out'},
|
'name': 'Raj Kumar',
|
||||||
{'name': 'Manoj Singh', 'amount': '₹2,400', 'date': '07 March, 2025 16:04', 'type': 'in'},
|
'amount': '₹1,000',
|
||||||
{'name': 'Raj Kumar', 'amount': '₹11,500', 'date': '09 March, 2025 16:04', 'type': 'in'},
|
'date': '09 March, 2025 16:04',
|
||||||
|
'type': 'in'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'Sunita Joshi',
|
||||||
|
'amount': '₹1,45,000',
|
||||||
|
'date': '07 March, 2025 16:04',
|
||||||
|
'type': 'out'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'Manoj Singh',
|
||||||
|
'amount': '₹2,400',
|
||||||
|
'date': '07 March, 2025 16:04',
|
||||||
|
'type': 'in'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'Raj Kumar',
|
||||||
|
'amount': '₹11,500',
|
||||||
|
'date': '09 March, 2025 16:04',
|
||||||
|
'type': 'in'
|
||||||
|
},
|
||||||
{'name': 'Manoj Singh', 'amount': '₹1,000', 'date': '', 'type': 'in'},
|
{'name': 'Manoj Singh', 'amount': '₹1,000', 'date': '', 'type': 'in'},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
List<String> accountNumbers = [
|
||||||
|
'0300015678903456',
|
||||||
|
'0300015678903678',
|
||||||
|
'0300015678903325',
|
||||||
|
];
|
||||||
|
|
||||||
|
String selectedAccount = '0300015678903456';
|
||||||
|
bool isVisible = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: const Color(0xfff5f9fc),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
backgroundColor: const Color(0xfff5f9fc),
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
title: const Text('kMobile', style: TextStyle(color: Colors.blueAccent,
|
title: Text(
|
||||||
fontWeight: FontWeight.w500),),
|
'kMobile',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
actions: [
|
actions: [
|
||||||
// IconButton(
|
// IconButton(
|
||||||
// icon: const Icon(Icons.notifications_outlined),
|
// icon: const Icon(Icons.notifications_outlined),
|
||||||
@@ -45,12 +81,15 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
padding: const EdgeInsets.only(right: 10.0),
|
padding: const EdgeInsets.only(right: 10.0),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
borderRadius: BorderRadius.circular(20),
|
borderRadius: BorderRadius.circular(20),
|
||||||
onTap: (){
|
onTap: () {
|
||||||
Navigator.push(context, MaterialPageRoute(
|
Navigator.push(
|
||||||
builder: (context) => const Preference()));
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const Preference()));
|
||||||
},
|
},
|
||||||
child: const CircleAvatar(
|
child: const CircleAvatar(
|
||||||
backgroundImage: AssetImage('assets/images/avatar.jpg'), // Replace with your image
|
backgroundImage: AssetImage('assets/images/avatar.jpg'),
|
||||||
|
// Replace with your image
|
||||||
radius: 20,
|
radius: 20,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -64,45 +103,91 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: Text(
|
||||||
|
"Hi Trina Bakshi",
|
||||||
|
style: GoogleFonts.sriracha().copyWith(fontSize: 20),
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
|
||||||
// Account Info Card
|
// Account Info Card
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(24),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.blue[700],
|
color: Theme.of(context).primaryColor,
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
),
|
),
|
||||||
child: const Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text("Account Number: ", style:
|
const Text("Account Number: ",
|
||||||
TextStyle(color: Colors.white, fontSize: 12)),
|
style:
|
||||||
Text("03000156789462302", style:
|
TextStyle(color: Colors.white, fontSize: 12)),
|
||||||
TextStyle(color: Colors.white, fontSize: 14)),
|
DropdownButton<String>(
|
||||||
Padding(
|
value: selectedAccount,
|
||||||
padding: EdgeInsets.only(left: 5.0),
|
dropdownColor: Theme.of(context).primaryColor,
|
||||||
child: Icon(Symbols.keyboard_arrow_down, color: Colors.white),
|
underline: const SizedBox(),
|
||||||
|
icon: const Icon(Icons.keyboard_arrow_down),
|
||||||
|
iconEnabledColor: Colors.white,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white, fontSize: 14),
|
||||||
|
items: accountNumbers.map((String acc) {
|
||||||
|
return DropdownMenuItem<String>(
|
||||||
|
value: acc,
|
||||||
|
child: Text(acc,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white, fontSize: 14)),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
onChanged: (String? newValue) {
|
||||||
|
setState(() {
|
||||||
|
selectedAccount = newValue!;
|
||||||
|
});
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text("₹ *****", style: TextStyle(color: Colors.white,
|
const Text("₹ ",
|
||||||
fontSize: 24, fontWeight: FontWeight.w700)),
|
style: const TextStyle(
|
||||||
Icon(Symbols.visibility_lock, color: Colors.white),
|
color: Colors.white,
|
||||||
|
fontSize: 40,
|
||||||
|
fontWeight: FontWeight.w700)),
|
||||||
|
Text(isVisible ? "1,23,456" : "*****",
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 30,
|
||||||
|
fontWeight: FontWeight.w700)),
|
||||||
|
const Spacer(),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
isVisible = !isVisible;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Icon(
|
||||||
|
isVisible
|
||||||
|
? Symbols.visibility_lock
|
||||||
|
: Symbols.visibility,
|
||||||
|
color: Colors.white)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 18),
|
const SizedBox(height: 18),
|
||||||
const Text('Quick Links', style: TextStyle(fontSize: 15),),
|
const Text(
|
||||||
|
'Quick Links',
|
||||||
|
style: TextStyle(fontSize: 15),
|
||||||
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
|
||||||
// Quick Links
|
// Quick Links
|
||||||
@@ -112,44 +197,58 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
children: [
|
children: [
|
||||||
_buildQuickLink(Symbols.id_card, "Customer \n Info", () {
|
_buildQuickLink(Symbols.id_card, "Customer \n Info", () {
|
||||||
Navigator.push(context, MaterialPageRoute(
|
Navigator.push(
|
||||||
builder: (context) => const CustomerInfoScreen()));
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const CustomerInfoScreen()));
|
||||||
}),
|
}),
|
||||||
_buildQuickLink(Symbols.currency_rupee, "Quick \n Pay",
|
_buildQuickLink(Symbols.currency_rupee, "Quick \n Pay", () {
|
||||||
() {
|
Navigator.push(
|
||||||
Navigator.push(context, MaterialPageRoute(
|
context,
|
||||||
builder: (context) => const QuickPayScreen()));
|
MaterialPageRoute(
|
||||||
}),
|
builder: (context) => const QuickPayScreen()));
|
||||||
_buildQuickLink(Symbols.send_money, "Fund \n Transfer",
|
}),
|
||||||
() {
|
_buildQuickLink(Symbols.send_money, "Fund \n Transfer", () {
|
||||||
Navigator.push(context, MaterialPageRoute(
|
Navigator.push(
|
||||||
builder: (context) => const FundTransferBeneficiaryScreen()));
|
context,
|
||||||
}),
|
MaterialPageRoute(
|
||||||
_buildQuickLink(Symbols.server_person, "Account \n Info",
|
builder: (context) =>
|
||||||
(){
|
const FundTransferBeneficiaryScreen()));
|
||||||
Navigator.push(context, MaterialPageRoute(
|
}),
|
||||||
|
_buildQuickLink(Symbols.server_person, "Account \n Info", () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
builder: (context) => const AccountInfoScreen()));
|
builder: (context) => const AccountInfoScreen()));
|
||||||
}),
|
}),
|
||||||
_buildQuickLink(Symbols.receipt_long, "Account \n History",
|
_buildQuickLink(Symbols.receipt_long, "Account \n Statement",
|
||||||
() {
|
() {
|
||||||
Navigator.push(context, MaterialPageRoute(
|
Navigator.push(
|
||||||
builder: (context) => const AccountStatementScreen()));
|
context,
|
||||||
}),
|
MaterialPageRoute(
|
||||||
_buildQuickLink(Symbols.checkbook, "Handle \n Cheque",
|
builder: (context) =>
|
||||||
() {
|
const AccountStatementScreen()));
|
||||||
Navigator.push(context, MaterialPageRoute(
|
}),
|
||||||
builder: (context) => const ChequeManagementScreen()));
|
// _buildQuickLink(Symbols.checkbook, "Handle \n Cheque", () {
|
||||||
}),
|
// Navigator.push(
|
||||||
_buildQuickLink(Icons.group, "Manage \n Beneficiary",
|
// context,
|
||||||
() {
|
// MaterialPageRoute(
|
||||||
Navigator.push(context, MaterialPageRoute(
|
// builder: (context) =>
|
||||||
builder: (context) => const ManageBeneficiariesScreen()));
|
// const ChequeManagementScreen()));
|
||||||
}),
|
// }),
|
||||||
_buildQuickLink(Symbols.support_agent, "Contact \n Us",
|
_buildQuickLink(Icons.group, "Manage \n Beneficiary", () {
|
||||||
() {
|
Navigator.push(
|
||||||
Navigator.push(context, MaterialPageRoute(
|
context,
|
||||||
builder: (context) => const EnquiryScreen()));
|
MaterialPageRoute(
|
||||||
}),
|
builder: (context) =>
|
||||||
|
const ManageBeneficiariesScreen()));
|
||||||
|
}),
|
||||||
|
_buildQuickLink(Symbols.support_agent, "Contact \n Us", () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const EnquiryScreen()));
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
@@ -157,16 +256,20 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
// Recent Transactions
|
// Recent Transactions
|
||||||
const Align(
|
const Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Text("Recent Transactions", style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
|
child: Text("Recent Transactions",
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
|
||||||
),
|
),
|
||||||
...transactions.map((tx) => ListTile(
|
...transactions.map((tx) => ListTile(
|
||||||
leading: Icon(tx['type'] == 'in' ? Symbols.call_received : Symbols.call_made, color: tx['type'] == 'in' ? Colors.green : Colors.red),
|
leading: Icon(
|
||||||
title: Text(tx['name']!),
|
tx['type'] == 'in'
|
||||||
subtitle: Text(tx['date']!),
|
? Symbols.call_received
|
||||||
trailing: Text(tx['amount']!),
|
: Symbols.call_made,
|
||||||
)),
|
color: tx['type'] == 'in' ? Colors.green : Colors.red),
|
||||||
|
title: Text(tx['name']!),
|
||||||
|
subtitle: Text(tx['date']!),
|
||||||
|
trailing: Text(tx['amount']!),
|
||||||
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -180,9 +283,11 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Icon(icon, size: 30, color: Colors.blue[700]),
|
Icon(icon, size: 30, color: Theme.of(context).primaryColor),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text(label, textAlign: TextAlign.center, style: const TextStyle(fontSize: 12)),
|
Text(label,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(fontSize: 12)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@@ -98,6 +98,17 @@ class _FundTransferScreen extends State<FundTransferScreen> {
|
|||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
|
const Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text('Debit from:'),
|
||||||
|
Text(
|
||||||
|
'0300015678903456',
|
||||||
|
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
const Text('Enter Amount', style: TextStyle(fontSize: 20)),
|
const Text('Enter Amount', style: TextStyle(fontSize: 20)),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Container(
|
Container(
|
||||||
|
@@ -5,7 +5,7 @@ import 'package:path_provider/path_provider.dart';
|
|||||||
import 'package:screenshot/screenshot.dart';
|
import 'package:screenshot/screenshot.dart';
|
||||||
import 'package:social_share/social_share.dart';
|
import 'package:social_share/social_share.dart';
|
||||||
|
|
||||||
import '../../dashboard/screens/dashboard_screen.dart';
|
import '../../../app.dart';
|
||||||
|
|
||||||
class TransactionSuccessScreen extends StatefulWidget {
|
class TransactionSuccessScreen extends StatefulWidget {
|
||||||
const TransactionSuccessScreen({super.key});
|
const TransactionSuccessScreen({super.key});
|
||||||
@@ -116,7 +116,7 @@ class _TransactionSuccessScreen extends State<TransactionSuccessScreen> {
|
|||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => const DashboardScreen()));
|
builder: (context) => const NavigationScaffold()));
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
shape: const StadiumBorder(),
|
shape: const StadiumBorder(),
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
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';
|
||||||
|
|
||||||
|
import '../../fund_transfer/screens/transaction_pin_screen.dart';
|
||||||
|
|
||||||
class QuickPayOutsideBankScreen extends StatefulWidget {
|
class QuickPayOutsideBankScreen extends StatefulWidget {
|
||||||
const QuickPayOutsideBankScreen({super.key});
|
const QuickPayOutsideBankScreen({super.key});
|
||||||
|
|
||||||
@@ -14,6 +17,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
|
|
||||||
// Controllers
|
// Controllers
|
||||||
final accountNumberController = TextEditingController();
|
final accountNumberController = TextEditingController();
|
||||||
|
final confirmAccountNumberController = TextEditingController();
|
||||||
final nameController = TextEditingController();
|
final nameController = TextEditingController();
|
||||||
final bankNameController = TextEditingController();
|
final bankNameController = TextEditingController();
|
||||||
final branchNameController = TextEditingController();
|
final branchNameController = TextEditingController();
|
||||||
@@ -29,6 +33,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
// Dispose controllers
|
// Dispose controllers
|
||||||
accountNumberController.dispose();
|
accountNumberController.dispose();
|
||||||
|
confirmAccountNumberController.dispose();
|
||||||
nameController.dispose();
|
nameController.dispose();
|
||||||
bankNameController.dispose();
|
bankNameController.dispose();
|
||||||
branchNameController.dispose();
|
branchNameController.dispose();
|
||||||
@@ -49,7 +54,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
title: const Text(
|
title: const Text(
|
||||||
'Quick Pay - Other Bank',
|
'Quick Pay - Outside Bank',
|
||||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
@@ -70,7 +75,17 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 10),
|
||||||
|
const Row(
|
||||||
|
children: [
|
||||||
|
Text('Debit from:'),
|
||||||
|
Text(
|
||||||
|
'0300015678903456',
|
||||||
|
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: 'Account Number',
|
labelText: 'Account Number',
|
||||||
@@ -87,6 +102,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
),
|
),
|
||||||
controller: accountNumberController,
|
controller: accountNumberController,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
|
obscureText: true,
|
||||||
textInputAction: TextInputAction.next,
|
textInputAction: TextInputAction.next,
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value == null || value.isEmpty) {
|
if (value == null || value.isEmpty) {
|
||||||
@@ -97,6 +113,35 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
TextFormField(
|
||||||
|
controller: confirmAccountNumberController,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Confirm Account Number',
|
||||||
|
// prefixIcon: Icon(Icons.person),
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
isDense: true,
|
||||||
|
filled: true,
|
||||||
|
fillColor: Colors.white,
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.black),
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Re-enter account number';
|
||||||
|
}
|
||||||
|
if (value != accountNumberController.text) {
|
||||||
|
return 'Account numbers do not match';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
@@ -296,32 +341,40 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
Expanded(child: buildTransactionModeSelector()),
|
Expanded(child: buildTransactionModeSelector()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
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];
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text('Paying via $selectedMode...')),
|
SnackBar(
|
||||||
|
content: Text('Paying via $selectedMode...')),
|
||||||
);
|
);
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
const TransactionPinScreen()));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: const Text('Pay'),
|
)),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -347,7 +400,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
color: isSelected ? Colors.blue[200] : Colors.white,
|
color: isSelected ? Colors.blue[200] : Colors.white,
|
||||||
borderRadius: BorderRadius.circular(5),
|
borderRadius: BorderRadius.circular(5),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: isSelected? Colors.blue : Colors.grey,
|
color: isSelected ? Colors.blue : Colors.grey,
|
||||||
width: isSelected ? 0 : 1.2,
|
width: isSelected ? 0 : 1.2,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
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';
|
||||||
|
|
||||||
|
import '../../fund_transfer/screens/transaction_pin_screen.dart';
|
||||||
|
|
||||||
class QuickPayWithinBankScreen extends StatefulWidget {
|
class QuickPayWithinBankScreen extends StatefulWidget {
|
||||||
const QuickPayWithinBankScreen({super.key});
|
const QuickPayWithinBankScreen({super.key});
|
||||||
|
|
||||||
@@ -12,6 +15,7 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
|||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
final TextEditingController accountNumberController = TextEditingController();
|
final TextEditingController accountNumberController = TextEditingController();
|
||||||
|
final TextEditingController confirmAccountNumberController = TextEditingController();
|
||||||
final TextEditingController nameController = TextEditingController();
|
final TextEditingController nameController = TextEditingController();
|
||||||
final TextEditingController amountController = TextEditingController();
|
final TextEditingController amountController = TextEditingController();
|
||||||
|
|
||||||
@@ -47,7 +51,17 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
|||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 10),
|
||||||
|
const Row(
|
||||||
|
children: [
|
||||||
|
Text('Debit from:'),
|
||||||
|
Text(
|
||||||
|
'0300015678903456',
|
||||||
|
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: 'Account Number',
|
labelText: 'Account Number',
|
||||||
@@ -64,6 +78,7 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
|||||||
),
|
),
|
||||||
controller: accountNumberController,
|
controller: accountNumberController,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
|
obscureText: true,
|
||||||
textInputAction: TextInputAction.next,
|
textInputAction: TextInputAction.next,
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value == null || value.isEmpty) {
|
if (value == null || value.isEmpty) {
|
||||||
@@ -84,6 +99,35 @@ class _QuickPayWithinBankScreen extends State<QuickPayWithinBankScreen> {
|
|||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
|
TextFormField(
|
||||||
|
controller: confirmAccountNumberController,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Confirm Account Number',
|
||||||
|
// prefixIcon: Icon(Icons.person),
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
isDense: true,
|
||||||
|
filled: true,
|
||||||
|
fillColor: Colors.white,
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.black),
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Re-enter account number';
|
||||||
|
}
|
||||||
|
if (value != accountNumberController.text) {
|
||||||
|
return 'Account numbers do not match';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: 'Name',
|
labelText: 'Name',
|
||||||
@@ -149,27 +193,32 @@ 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...')),
|
||||||
|
);
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const TransactionPinScreen()));
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@@ -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,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
26
pubspec.lock
26
pubspec.lock
@@ -65,6 +65,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.19.1"
|
version: "1.19.1"
|
||||||
|
crypto:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: crypto
|
||||||
|
sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.6"
|
||||||
cupertino_icons:
|
cupertino_icons:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -211,6 +219,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
|
||||||
@@ -237,6 +253,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.3"
|
version: "2.1.3"
|
||||||
|
google_fonts:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: google_fonts
|
||||||
|
sha256: b1ac0fe2832c9cc95e5e88b57d627c5e68c223b9657f4b96e1487aa9098c7b82
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.2.1"
|
||||||
http:
|
http:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -470,7 +494,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,9 @@ 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
|
||||||
|
google_fonts: ^6.2.1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -100,6 +103,12 @@ flutter:
|
|||||||
- asset: assets/fonts/Rubik-Regular.ttf
|
- asset: assets/fonts/Rubik-Regular.ttf
|
||||||
- asset: assets/fonts/Rubik-Bold.ttf
|
- asset: assets/fonts/Rubik-Bold.ttf
|
||||||
weight: 700
|
weight: 700
|
||||||
|
|
||||||
|
- family: Sriracha
|
||||||
|
fonts:
|
||||||
|
- asset: assets/fonts/Sriracha-Regular.ttf
|
||||||
|
|
||||||
|
|
||||||
# style: italic
|
# style: italic
|
||||||
# - family: Trajan Pro
|
# - family: Trajan Pro
|
||||||
# fonts:
|
# fonts:
|
||||||
|
Reference in New Issue
Block a user