|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 709 B |
|
After Width: | Height: | Size: 865 B |
|
After Width: | Height: | Size: 465 B |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 349 B |
|
After Width: | Height: | Size: 817 B |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 912 B |
@ -0,0 +1,216 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class AddCreditTransactionPage extends StatefulWidget {
|
||||
const AddCreditTransactionPage({super.key});
|
||||
|
||||
@override
|
||||
State<AddCreditTransactionPage> createState() =>
|
||||
_AddCreditTransactionPageState();
|
||||
}
|
||||
|
||||
class _AddCreditTransactionPageState extends State<AddCreditTransactionPage> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
String? _transactionType;
|
||||
String? _creditAccount;
|
||||
String? _paymentMode;
|
||||
String? _paymentStatus;
|
||||
DateTime? _selectedDate;
|
||||
|
||||
final TextEditingController _amountController =
|
||||
TextEditingController(text: "₹500");
|
||||
final TextEditingController _transactionIdController =
|
||||
TextEditingController(text: "₹500");
|
||||
final TextEditingController _detailsController = TextEditingController();
|
||||
|
||||
Future<void> _pickDate() async {
|
||||
DateTime now = DateTime.now();
|
||||
final picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: now,
|
||||
firstDate: DateTime(2020),
|
||||
lastDate: DateTime(2100),
|
||||
);
|
||||
if (picked != null) {
|
||||
setState(() {
|
||||
_selectedDate = picked;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
backgroundColor: Colors.white,
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.black),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
title: const Text(
|
||||
"Add Credit Transaction",
|
||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w600),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: const Text(
|
||||
"HELP",
|
||||
style: TextStyle(color: Colors.blue),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildDropdown(
|
||||
label: "Transaction Type *",
|
||||
value: _transactionType,
|
||||
items: ["Credit", "Debit"],
|
||||
onChanged: (val) => setState(() => _transactionType = val),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildDropdown(
|
||||
label: "Credit Account Name *",
|
||||
value: _creditAccount,
|
||||
items: ["Credit Account", "Other Account"],
|
||||
onChanged: (val) => setState(() => _creditAccount = val),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildTextField(
|
||||
controller: _amountController,
|
||||
label: "Amount (in ₹) *",
|
||||
keyboardType: TextInputType.number,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildDropdown(
|
||||
label: "Payment Mode *",
|
||||
value: _paymentMode,
|
||||
items: ["Cash", "UPI", "Bank Transfer"],
|
||||
onChanged: (val) => setState(() => _paymentMode = val),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: _pickDate,
|
||||
child: AbsorbPointer(
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
labelText: "Date *",
|
||||
hintText: "DD-MM-YYYY",
|
||||
suffixIcon: const Icon(Icons.calendar_today),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
controller: TextEditingController(
|
||||
text: _selectedDate == null
|
||||
? ""
|
||||
: DateFormat("dd-MM-yyyy")
|
||||
.format(_selectedDate!),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildTextField(
|
||||
controller: _transactionIdController,
|
||||
label: "Transaction ID *",
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildDropdown(
|
||||
label: "Payment Status *",
|
||||
value: _paymentStatus,
|
||||
items: ["Pending", "Completed", "Failed"],
|
||||
onChanged: (val) => setState(() => _paymentStatus = val),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildTextField(
|
||||
controller: _detailsController,
|
||||
label: "Additional Details",
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
// Handle save
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text("Transaction Saved")),
|
||||
);
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.blue,
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
minimumSize: const Size(double.infinity, 50),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
child: const Text("Save Transaction"),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDropdown({
|
||||
required String label,
|
||||
required String? value,
|
||||
required List<String> items,
|
||||
required Function(String?) onChanged,
|
||||
}) {
|
||||
return DropdownButtonFormField<String>(
|
||||
value: value,
|
||||
isExpanded: true,
|
||||
decoration: InputDecoration(
|
||||
labelText: label,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
items: items
|
||||
.map((e) => DropdownMenuItem(
|
||||
value: e,
|
||||
child: Text(e),
|
||||
))
|
||||
.toList(),
|
||||
onChanged: onChanged,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTextField({
|
||||
required TextEditingController controller,
|
||||
required String label,
|
||||
TextInputType keyboardType = TextInputType.text,
|
||||
}) {
|
||||
return TextFormField(
|
||||
controller: controller,
|
||||
keyboardType: keyboardType,
|
||||
decoration: InputDecoration(
|
||||
labelText: label,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,151 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AddTransactionScreen extends StatefulWidget {
|
||||
@override
|
||||
_AddTransactionScreenState createState() => _AddTransactionScreenState();
|
||||
}
|
||||
|
||||
class _AddTransactionScreenState extends State<AddTransactionScreen> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
String? transactionType;
|
||||
String? accountName;
|
||||
String? paymentMode;
|
||||
String? paymentStatus;
|
||||
|
||||
TextEditingController amountController = TextEditingController(text: "₹500");
|
||||
TextEditingController transactionIdController = TextEditingController(text: "₹500");
|
||||
TextEditingController dateController = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
leading: Icon(Icons.arrow_back, color: Colors.black),
|
||||
title: Text(
|
||||
"Add Transaction",
|
||||
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w600),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: Text("HELP", style: TextStyle(color: Colors.purple)),
|
||||
)
|
||||
],
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
buildDropdown("Transaction Type *", ["Credit", "Debit"], transactionType, (val) {
|
||||
setState(() => transactionType = val);
|
||||
}),
|
||||
SizedBox(height: 16),
|
||||
buildDropdown("Account Name *", ["Name1", "Name2"], accountName, (val) {
|
||||
setState(() => accountName = val);
|
||||
}),
|
||||
SizedBox(height: 16),
|
||||
buildTextField("Amount (in ₹) *", amountController),
|
||||
SizedBox(height: 16),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: buildDropdown("Payment Mode *", ["Cash", "Card", "UPI"], paymentMode, (val) {
|
||||
setState(() => paymentMode = val);
|
||||
}),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: buildDatePicker(),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
buildTextField("Transaction ID *", transactionIdController),
|
||||
SizedBox(height: 16),
|
||||
buildDropdown("Payment Status *", ["Pending", "Completed", "Failed"], paymentStatus, (val) {
|
||||
setState(() => paymentStatus = val);
|
||||
}),
|
||||
SizedBox(height: 24),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Color(0xFF8270DB),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
padding: EdgeInsets.symmetric(vertical: 14),
|
||||
),
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
// Handle save
|
||||
}
|
||||
},
|
||||
child: Text("Save", style: TextStyle(color: Colors.white, fontSize: 16)),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildDropdown(String label, List<String> items, String? value, Function(String?) onChanged) {
|
||||
return DropdownButtonFormField<String>(
|
||||
decoration: InputDecoration(
|
||||
labelText: label,
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)),
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 12, vertical: 12),
|
||||
),
|
||||
value: value,
|
||||
items: items.map((e) => DropdownMenuItem(value: e, child: Text(e))).toList(),
|
||||
onChanged: onChanged,
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildTextField(String label, TextEditingController controller) {
|
||||
return TextFormField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(
|
||||
labelText: label,
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)),
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 12, vertical: 12),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildDatePicker() {
|
||||
return TextFormField(
|
||||
controller: dateController,
|
||||
readOnly: true,
|
||||
decoration: InputDecoration(
|
||||
labelText: "Date *",
|
||||
suffixIcon: Icon(Icons.calendar_today),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)),
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 12, vertical: 12),
|
||||
),
|
||||
onTap: () async {
|
||||
DateTime? picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
);
|
||||
if (picked != null) {
|
||||
setState(() {
|
||||
dateController.text = "${picked.day}-${picked.month}-${picked.year}";
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,296 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:supplier_new/financials/add_transaction_for_credit_account.dart';
|
||||
|
||||
class BuildingTransactionsDetails extends StatefulWidget {
|
||||
const BuildingTransactionsDetails({super.key});
|
||||
|
||||
@override
|
||||
State<BuildingTransactionsDetails> createState() => _BuildingTransactionsDetailsState();
|
||||
}
|
||||
|
||||
class _BuildingTransactionsDetailsState extends State<BuildingTransactionsDetails> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
floatingActionButton: SizedBox(
|
||||
width: 52, // default is 56
|
||||
height: 52, // make it bigger
|
||||
child: FloatingActionButton(
|
||||
shape: const CircleBorder(), // ensures perfect round shape
|
||||
backgroundColor: Colors.black,
|
||||
onPressed: (){
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => AddCreditTransactionPage(),
|
||||
),
|
||||
);
|
||||
|
||||
},
|
||||
child:Image.asset(
|
||||
"images/plus.png", // your custom image
|
||||
width: 20,
|
||||
height: 20,
|
||||
color: Colors.white, // optional: apply tint
|
||||
),
|
||||
),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
// Header
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
"Green Valley Apartments",
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
"Gachibowli",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey.shade600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: const Text(
|
||||
"HELP",
|
||||
style: TextStyle(color: Colors.blue),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Statement button
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
OutlinedButton.icon(
|
||||
style: OutlinedButton.styleFrom(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
onPressed: () {},
|
||||
icon: const Icon(Icons.download),
|
||||
label: const Text("Statement"),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Orders and balances
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade100,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// Total orders
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text(
|
||||
"Total Orders",
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: const [
|
||||
Text(
|
||||
"45",
|
||||
style: TextStyle(
|
||||
fontSize: 22, fontWeight: FontWeight.bold),
|
||||
),
|
||||
Text(
|
||||
"12 complete",
|
||||
style:
|
||||
TextStyle(fontSize: 13, color: Colors.grey),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// Balances
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: const [
|
||||
Text("Receivable Balance"),
|
||||
SizedBox(height: 4),
|
||||
Text(
|
||||
"₹24,000",
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.red),
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
Text(
|
||||
"40.61% of total credit",
|
||||
style: TextStyle(
|
||||
fontSize: 12, color: Colors.grey),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: const [
|
||||
Text("Advance Balance"),
|
||||
SizedBox(height: 4),
|
||||
Text(
|
||||
"₹24,000",
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.green),
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
Text(
|
||||
"60.41% of total credit",
|
||||
style: TextStyle(
|
||||
fontSize: 12, color: Colors.grey),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Buttons
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.blue,
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
child: const Text("Add Transaction"),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: OutlinedButton(
|
||||
onPressed: () {},
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
child: const Text("Request Top up"),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// History label
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
"HISTORY",
|
||||
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 15),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// History list
|
||||
Expanded(
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
children: [
|
||||
_historyItem(
|
||||
"Transaction Description", "21 August", "+ ₹2,580", true),
|
||||
_historyItem(
|
||||
"Transaction Description", "19 August", "- ₹748", false),
|
||||
_historyItem(
|
||||
"Transaction Description", "16 August", "- ₹10,000", false),
|
||||
_historyItem(
|
||||
"Transaction Description", "12 August", "- ₹500", false),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _historyItem(
|
||||
String title, String date, String amount, bool isCredit) {
|
||||
return ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: Colors.blue.shade100,
|
||||
child: const Icon(Icons.swap_horiz, color: Colors.blue),
|
||||
),
|
||||
title: Text(title),
|
||||
subtitle: Text(date),
|
||||
trailing: Text(
|
||||
amount,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isCredit ? Colors.green : Colors.red,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,143 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:dropdown_button2/dropdown_button2.dart';
|
||||
|
||||
class CreateCreditAccountScreen extends StatefulWidget {
|
||||
@override
|
||||
_CreateCreditAccountScreenState createState() => _CreateCreditAccountScreenState();
|
||||
}
|
||||
class _CreateCreditAccountScreenState extends State<CreateCreditAccountScreen> {
|
||||
String? selectedCustomer;
|
||||
String paymentTerm = 'Net 30';
|
||||
final creditLimitController = TextEditingController(text: '₹500');
|
||||
final openingBalanceController = TextEditingController(text: '₹500');
|
||||
final List<Map<String, String>> customers = [
|
||||
{'name': 'Ramakrishna', 'date': '20 August'},
|
||||
{'name': 'Mallesham Water Supplies', 'date': '21 August'},
|
||||
{'name': 'My Home Bhooja', 'date': '21 August'},
|
||||
];
|
||||
final List<String> paymentTerms = ['Net 15', 'Net 30', 'Net 45'];
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Create Credit Account'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {},
|
||||
child: Text('HELP', style: TextStyle(color: Colors.blue)),
|
||||
)
|
||||
],
|
||||
backgroundColor: Colors.white,
|
||||
foregroundColor: Colors.black,
|
||||
elevation: 1,
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: ListView(
|
||||
children: [
|
||||
Text('SELECT CUSTOMER', style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 10),
|
||||
...customers.map((customer) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
selectedCustomer = customer['name'];
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(bottom: 10),
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: selectedCustomer == customer['name'] ? Colors.black : Colors.grey.shade300,
|
||||
width: 1.5,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
CircleAvatar(child: Icon(Icons.person)),
|
||||
const SizedBox(width: 10),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(customer['name']!, style: TextStyle(fontSize: 16)),
|
||||
Text(customer['date']!, style: TextStyle(color: Colors.grey)),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
const SizedBox(height: 20),
|
||||
Text('ENTER DETAILS', style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 10),
|
||||
TextField(
|
||||
controller: creditLimitController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Credit Limit (in ₹) *',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
DropdownButtonFormField2<String>(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Payment Terms *',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
value: paymentTerm,
|
||||
items: paymentTerms.map((term) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: term,
|
||||
child: Text(term),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
paymentTerm = value!;
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
TextField(
|
||||
controller: openingBalanceController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Opening Balance (in ₹) *',
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.info_outline, color: Colors.orange, size: 18),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Creating an Account will send the customer a notification about the details and a request to add balance to start the water delivery plan.',
|
||||
style: TextStyle(color: Colors.black87, fontSize: 13),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
// Add your submission logic here
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Color(0xFF9375E8),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
|
||||
minimumSize: Size(double.infinity, 50),
|
||||
),
|
||||
child: Text('Create Account'),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||