import 'package:flutter/material.dart'; import 'package:bookatanker/common/settings.dart'; import 'package:bookatanker/supplier/paymnets/transaction_model.dart'; class Transactions extends StatefulWidget { final List transactions; const Transactions({ super.key, required this.transactions, }); @override State createState() => _TransactionsState(); } class _TransactionsState extends State { Widget _transactionItem( String supplier, String dateTime, String amount, Color color) { return ListTile( contentPadding: EdgeInsets.zero, title: Text(supplier, style: const TextStyle(fontWeight: FontWeight.w600)), subtitle: Text(dateTime), trailing: Text( amount, style: TextStyle(color: color, fontWeight: FontWeight.w600), ), ); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0XFFFFFFFF), appBar: AppSettings.supplierAppBarWithoutActions( 'Transactions', context), body: Padding( padding: const EdgeInsets.fromLTRB(16, 0, 16, 0), child: widget.transactions.isEmpty ? Center( child: Text( 'No Data Available', style: fontTextStyle( 12, const Color(0XFF000000), FontWeight.w500), ), ) : ListView.builder( itemCount: widget.transactions.length, itemBuilder: (context, index) { final txn = widget.transactions[index]; return Column( children: [ _transactionItem( txn.name, txn.dateTime, txn.amount, txn.color, ), if (index != widget.transactions.length - 1) const Divider( thickness: 1, color: Color(0xFFE0E0E0), height: 1, ), ], ); }, ), ), ); } }