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 createState() => _BuildingTransactionsDetailsState(); } class _BuildingTransactionsDetailsState extends State { @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, ), ), ); } }