Refactor UI components across various screens to use SVG avatars, enhance biometric authentication check, and improve code readability with consistent formatting.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:kmobile/features/card/screens/card_pin_set_screen.dart';
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
@@ -7,10 +8,11 @@ class CardPinChangeDetailsScreen extends StatefulWidget {
|
||||
const CardPinChangeDetailsScreen({super.key});
|
||||
|
||||
@override
|
||||
State<CardPinChangeDetailsScreen> createState() => _CardPinChangeDetailsScreen();
|
||||
State<CardPinChangeDetailsScreen> createState() =>
|
||||
_CardPinChangeDetailsScreen();
|
||||
}
|
||||
|
||||
class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen>{
|
||||
class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
final _cardController = TextEditingController();
|
||||
final _cvvController = TextEditingController();
|
||||
@@ -43,24 +45,33 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen>{
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: IconButton(icon: const Icon(Symbols.arrow_back_ios_new),
|
||||
leading: IconButton(
|
||||
icon: const Icon(Symbols.arrow_back_ios_new),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},),
|
||||
title: const Text('Card Details', style: TextStyle(color: Colors.black,
|
||||
fontWeight: FontWeight.w500),),
|
||||
},
|
||||
),
|
||||
title: const Text(
|
||||
'Card Details',
|
||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
|
||||
),
|
||||
centerTitle: false,
|
||||
actions: const [
|
||||
actions: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 10.0),
|
||||
padding: const EdgeInsets.only(right: 10.0),
|
||||
child: CircleAvatar(
|
||||
backgroundImage: AssetImage('assets/images/avatar.jpg'), // Replace with your image
|
||||
backgroundColor: Colors.grey[200],
|
||||
radius: 20,
|
||||
child: SvgPicture.asset(
|
||||
'assets/images/avatar_male.svg',
|
||||
width: 40,
|
||||
height: 40,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Form(
|
||||
@@ -85,8 +96,9 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen>{
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
textInputAction: TextInputAction.next,
|
||||
validator: (value) =>
|
||||
value != null && value.length == 16 ? null : 'Enter valid card number',
|
||||
validator: (value) => value != null && value.length == 16
|
||||
? null
|
||||
: 'Enter valid card number',
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Row(
|
||||
@@ -110,8 +122,9 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen>{
|
||||
keyboardType: TextInputType.number,
|
||||
textInputAction: TextInputAction.next,
|
||||
obscureText: true,
|
||||
validator: (value) =>
|
||||
value != null && value.length == 3 ? null : 'CVV must be 3 digits',
|
||||
validator: (value) => value != null && value.length == 3
|
||||
? null
|
||||
: 'CVV must be 3 digits',
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
@@ -134,8 +147,9 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen>{
|
||||
borderSide: BorderSide(color: Colors.black, width: 2),
|
||||
),
|
||||
),
|
||||
validator: (value) =>
|
||||
value != null && value.isNotEmpty ? null : 'Select expiry date',
|
||||
validator: (value) => value != null && value.isNotEmpty
|
||||
? null
|
||||
: 'Select expiry date',
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -159,8 +173,9 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen>{
|
||||
),
|
||||
textInputAction: TextInputAction.done,
|
||||
keyboardType: TextInputType.phone,
|
||||
validator: (value) =>
|
||||
value != null && value.length >= 10 ? null : 'Enter valid phone number',
|
||||
validator: (value) => value != null && value.length >= 10
|
||||
? null
|
||||
: 'Enter valid phone number',
|
||||
),
|
||||
const SizedBox(height: 45),
|
||||
Align(
|
||||
@@ -185,5 +200,4 @@ class _CardPinChangeDetailsScreen extends State<CardPinChangeDetailsScreen>{
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user