Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
IT Project 2020
Group B
pilar-mobile
Commits
8647d12f
Commit
8647d12f
authored
Dec 29, 2020
by
Tsamara Esperanti Erwin
🦄
Browse files
Bugfixing
parent
0d8f75b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/Pages/DonationHistory/donation_history.dart
View file @
8647d12f
...
...
@@ -117,7 +117,7 @@ class __MyDonationsState extends State<_MyDonations> {
?
const
Center
(
child:
CustomCircularIndicator
(),
)
:
_Donation
ListItem
(
:
_
Card
Donation
(
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 {
);
}
}
lib/Pages/Program/detail_program.dart
View file @
8647d12f
...
...
@@ -70,12 +70,14 @@ class DetailProgram extends StatelessWidget {
_DeskripsiRow
(
icon:
Icons
.
calendar_today
,
label:
'
${formatDate(program.startDateTime)}
'
),
'
${formatDate(program.startDateTime)}
'
',
${formatTime(program.startDateTime)}
WIB -'
),
if
(
program
.
endDateTime
!=
null
)
_DeskripsiRow
(
icon:
Icons
.
schedule
,
label:
'
${formatTime(program.startDateTime)}
'
,
'
${formatDate(program.endDateTime)}
'
',
${formatTime(program.endDateTime)}
WIB'
,
),
if
(
program
.
location
!=
null
&&
program
.
location
!=
''
)
...
...
@@ -411,7 +413,7 @@ class _ButtonDownloadNote extends StatelessWidget {
class
_DeskripsiRow
extends
StatelessWidget
{
const
_DeskripsiRow
({
Key
key
,
@required
this
.
icon
,
this
.
icon
,
@required
this
.
label
,
})
:
super
(
key:
key
);
...
...
@@ -429,6 +431,7 @@ class _DeskripsiRow extends StatelessWidget {
child:
Icon
(
icon
,
color:
Theme
.
of
(
context
)
.
primaryColor
,
size:
18
,
),
),
),
...
...
test/my_donations_test.dart
View file @
8647d12f
...
...
@@ -131,6 +131,56 @@ void main() {
}))
.
called
(
1
);
});
testWidgets
(
'show dialog for goods donation'
,
(
WidgetTester
tester
)
async
{
when
(
dio
.
get
(
_donation
,
queryParameters:
queryParam
))
.
thenAnswer
(
(
_
)
async
=
>
Response
<
Map
<
String
,
dynamic
>>(
statusCode:
200
,
data:
{
'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'
}
]
}));
await
tester
.
pumpWidget
(
widgetTested
);
expect
(
find
.
byType
(
CircularProgressIndicator
),
findsOneWidget
);
await
tester
.
pump
(
Duration
(
seconds:
5
));
await
tester
.
pump
();
expect
(
find
.
text
(
'27 November 2020'
),
findsOneWidget
);
await
tester
.
tap
(
find
.
text
(
'27 November 2020'
));
await
tester
.
pump
(
Duration
(
seconds:
3
));
expect
(
find
.
text
(
'Barang: kaos'
),
findsOneWidget
);
expect
(
find
.
text
(
'Jumlah: 1'
),
findsOneWidget
);
});
testWidgets
(
'refresh load'
,
(
WidgetTester
tester
)
async
{
when
(
dio
.
get
(
_donation
,
queryParameters:
queryParam
))
.
thenAnswer
(
(
_
)
async
=
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment