Fakultas Ilmu Komputer UI

Commit af299c49 authored by Tsamara Esperanti Erwin's avatar Tsamara Esperanti Erwin
Browse files

[GREEN] Add dialog for goods donation detail info

parent cb495b75
Pipeline #62150 passed with stages
in 8 minutes and 6 seconds
......@@ -117,7 +117,7 @@ class __MyDonationsState extends State<_MyDonations> {
? const Center(
child: CustomCircularIndicator(),
)
: _DonationListItem(
: _CardDonation(
donation: state.donations[index],
);
}));
......@@ -129,6 +129,68 @@ class __MyDonationsState extends State<_MyDonations> {
}
}
class _CardDonation extends StatelessWidget {
const _CardDonation({
Key key,
@required this.donation,
}) : super(key: key);
final Donation donation;
@override
Widget build(BuildContext context) {
if (donation.donationType == 'CSH') {
return _DonationListItem(
donation: donation,
);
} else {
return GestureDetector(
onTap: () {
showDialog(context: context, builder: (BuildContext context) =>
_DonationDetaiDialog(donation: donation,));
},
child: _DonationListItem(
donation: donation,
),
);
}
}
}
class _DonationDetaiDialog extends StatelessWidget {
final Donation donation;
const _DonationDetaiDialog({
Key key,
@required this.donation,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Dialog(
child: Container(
height: 100,
margin: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Wrap(children: [
const Icon(Icons.clear, size: 22.0, key: Key('clear-icon'),),
Text('Detail Donasi - ${donation.donationNumber}',
style: TextStyle(fontSize: 16.0, height: 1.3, fontWeight: FontWeight.bold),)
],),
),
const SizedBox(height: 10.0,),
Text('Barang: ${donation.goodsDescription}'),
Text('Jumlah: ${donation.goodsQuantity}'),
],
),
),
);
}
}
class _DonationListItem extends StatelessWidget {
const _DonationListItem({
Key key,
......@@ -256,3 +318,4 @@ class _DonationListItem extends StatelessWidget {
);
}
}
......@@ -136,37 +136,37 @@ void main() {
(_) async =>
Response<Map<String, dynamic>>(statusCode: 200, data:
{
"count": 1,
"next": "ada",
"previous": null,
"results": [
'count': 1,
'next': 'ada',
'previous': null,
'results': [
{
"id": "5b0a405c-a5a2-415e-9788-2b52c50792b1",
"donation_number": "8DVQQ6",
"program": "b02580b3-d1ab-4bf8-b4c3-87a340ed3319",
"program_code": "5GZW45",
"user": "f26c3bcd-f9d3-469e-b466-57610d9acdcb",
"user_username": "sarah",
"user_full_name": "sarah",
"user_phone_number": "+628123456789",
"program_name": "Program Mengaji Bersama",
"donation_type": "GDS",
"donation_status": "002",
"amount": null,
"readable_donation_status": "Selesai",
"proof_of_bank_transfer": null,
"user_bank_name": null,
"user_bank_account_name": null,
"bank_account_transfer_destination": null,
"transfer_destination_bank_name": null,
"transfer_destination_bank_account_name": null,
"transfer_destination_bank_account_number": null,
"goods_quantity": "1",
"goods_description": "kaos",
"delivery_method": "PCK",
"delivery_address": "rumah",
"created_at": "2020-11-27T09:11:13.019671+07:00",
"updated_at": "2020-12-05T20:29:11.013324+07:00"
'id': '5b0a405c-a5a2-415e-9788-2b52c50792b1',
'donation_number': '8DVQQ6',
'program': 'b02580b3-d1ab-4bf8-b4c3-87a340ed3319',
'program_code': '5GZW45',
'user': 'f26c3bcd-f9d3-469e-b466-57610d9acdcb',
'user_username': 'sarah',
'user_full_name': 'sarah',
'user_phone_number': '+628123456789',
'program_name': 'Program Mengaji Bersama',
'donation_type': 'GDS',
'donation_status': '002',
'amount': null,
'readable_donation_status': 'Selesai',
'proof_of_bank_transfer': null,
'user_bank_name': null,
'user_bank_account_name': null,
'bank_account_transfer_destination': null,
'transfer_destination_bank_name': null,
'transfer_destination_bank_account_name': null,
'transfer_destination_bank_account_number': null,
'goods_quantity': '1',
'goods_description': 'kaos',
'delivery_method': 'PCK',
'delivery_address': 'rumah',
'created_at': '2020-11-27T09:11:13.019671+07:00',
'updated_at': '2020-12-05T20:29:11.013324+07:00'
}
]
}));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment