You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.0 KiB
75 lines
2.0 KiB
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<TransactionModel> transactions;
|
|
|
|
const Transactions({
|
|
super.key,
|
|
required this.transactions,
|
|
});
|
|
@override
|
|
State<Transactions> createState() => _TransactionsState();
|
|
}
|
|
|
|
class _TransactionsState extends State<Transactions> {
|
|
|
|
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,
|
|
),
|
|
],
|
|
);
|
|
},
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
}
|
|
|