Files
kmobile/lib/features/account_opening/screens/fd_screen.dart

244 lines
8.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:kmobile/features/account_opening/screens/interest_rates_screen.dart';
class FdScreen extends StatefulWidget {
const FdScreen({super.key});
@override
State<FdScreen> createState() => _FdScreenState();
}
class _FdScreenState extends State<FdScreen> {
final TextEditingController _debitAccountController = TextEditingController();
final TextEditingController _amountController = TextEditingController();
final TextEditingController _yearsController = TextEditingController();
final TextEditingController _monthsController = TextEditingController();
final TextEditingController _daysController = TextEditingController();
String _rateOfInterest = "N/A";
String _maturityDate = "N/A";
String _maturityAmount = "N/A";
@override
void dispose() {
_debitAccountController.dispose();
_amountController.dispose();
_yearsController.dispose();
_monthsController.dispose();
_daysController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Fixed Deposit (FD)'),
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Explanation Tile
Card(
margin: const EdgeInsets.only(bottom: 20),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Earn more on your savings with a simple, secure Fixed Deposit.',
style: Theme.of(context).textTheme.bodyMedium,
),
],
),
),
),
// Debit Account Number
TextFormField(
controller: _debitAccountController,
decoration: const InputDecoration(
labelText: 'Debit Account Number',
border: OutlineInputBorder(),
),
keyboardType: TextInputType.number,
),
const SizedBox(height: 20),
// Enter Amount
TextFormField(
controller: _amountController,
decoration: const InputDecoration(
labelText: 'Enter Amount',
border: OutlineInputBorder(),
prefixText: ''
),
keyboardType: TextInputType.number,
),
const SizedBox(height: 20),
// Duration and Interest Rates Link
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Duration',
style: Theme.of(context).textTheme.titleLarge,
),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const InterestRatesScreen()),
);
},
child: Text(
'Interest Rates',
style: Theme.of(context).textTheme.titleSmall
),
),
],
),
const SizedBox(height: 10),
// Duration TextBoxes
Row(
children: [
Expanded(
child: TextFormField(
controller: _yearsController,
decoration: const InputDecoration(
labelText: 'Years',
border: OutlineInputBorder(),
),
keyboardType: TextInputType.number,
),
),
const SizedBox(width: 10),
Expanded(
child: TextFormField(
controller: _monthsController,
decoration: const InputDecoration(
labelText: 'Months',
border: OutlineInputBorder(),
),
keyboardType: TextInputType.number,
),
),
const SizedBox(width: 10),
Expanded(
child: TextFormField(
controller: _daysController,
decoration: const InputDecoration(
labelText: 'Days',
border: OutlineInputBorder(),
),
keyboardType: TextInputType.number,
),
),
],
),
const SizedBox(height: 20),
// Rate of Interest and Maturity Date Display
Row(
children: [
Expanded(
child: Card(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Rate of Interest',
style: Theme.of(context).textTheme.bodySmall,
),
const SizedBox(height: 5),
Text(
_rateOfInterest,
style: Theme.of(context).textTheme.headlineSmall,
),
],
),
),
),
),
const SizedBox(width: 10),
Expanded(
child: Card(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Maturity Date',
style: Theme.of(context).textTheme.bodySmall,
),
const SizedBox(height: 5),
Text(
_maturityDate,
style: Theme.of(context).textTheme.headlineSmall,
),
],
),
),
),
),
],
),
const SizedBox(height: 10),
// Maturity Amount Display
Row(
children: [
Expanded(
child: Card(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Maturity Amount',
style: Theme.of(context).textTheme.bodySmall,
),
const SizedBox(height: 5),
Text(
_maturityAmount,
style: Theme.of(context).textTheme.headlineSmall,
),
],
),
),
),
),
],
),
const SizedBox(height: 30),
// Proceed Button
Center(
child: ElevatedButton(
onPressed: () {
// TODO: Implement proceed logic
},
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 15),
),
child: const Text(
'Proceed',
style: TextStyle(fontSize: 18),
),
),
),
],
),
),
);
}
}