Fakultas Ilmu Komputer UI

Commit 25467abe authored by Tsamara Esperanti Erwin's avatar Tsamara Esperanti Erwin
Browse files

[CHORES] Fix merge conflict

parents 6fdce381 823f4db1
Pipeline #60400 passed with stages
in 26 minutes and 6 seconds
......@@ -5,6 +5,12 @@ String formatDate(DateTime dateTime) {
return dateTime != null ? formatter.format(dateTime.toLocal()) : '';
}
String formatDatePlusOne(DateTime dateTime) {
var addOneDay = dateTime.add(Duration(days: 1));
final formatter = DateFormat(DateFormat.YEAR_MONTH_DAY);
return dateTime != null ? formatter.format(addOneDay.toLocal()) : '';
}
String formatTime(DateTime dateTime) {
final formatter = DateFormat(DateFormat.HOUR24_MINUTE);
return dateTime != null ? formatter.format(dateTime.toLocal()) : '';
......
......@@ -51,9 +51,6 @@ class _ChooseDonation extends StatefulWidget {
}
class __ChooseDonationState extends State<_ChooseDonation> {
// final Program program;
// __ChooseDonationState(this.program);
bool uangValue = false;
bool barangValue = false;
......
......@@ -140,150 +140,146 @@ class _DonasiBarangFormState extends State<DonasiBarangForm> {
TextEditingController goodsDescriptionController = TextEditingController();
TextEditingController goodsQuantityController = TextEditingController();
TextEditingController addressController = TextEditingController();
FocusScopeNode focusScopeNode;
@override
Widget build(BuildContext context) {
return Form(
key: _formKey,
child: FocusScope(
node: focusScopeNode,
child: Column(
children: [
Row(
children: [
Text('Jenis Barang', style: Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 18),),
const SizedBox(width: 20),
Container(
width: 187,
height: 50,
child: TextFormField(
controller: goodsDescriptionController,
validator: (value) {
return value.isEmpty ? 'Mohon isi jenis barang' : null;
},
decoration: _inputDecoration(),
)),
],
),
const SizedBox(height: 20,),
Row(
children: [
Text('Jumlah', style: Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 18),),
const SizedBox(width: 70),
Container(
width: 187,
height: 50,
color: Colors.white,
child: TextFormField(
controller: goodsQuantityController,
validator: (value) {
return value.isEmpty ? 'Mohon isi jumlah barang' : null;
},
keyboardType: TextInputType.number,
decoration: _inputDecoration(),
))
],
),
const SizedBox(height: 10,),
Row(
children: [
Expanded(
child: Divider(
color: Colors.grey),
),
const SizedBox(width: 10,),
const Icon(Icons.add_circle, color: Color.fromRGBO(60, 141, 188, 1),)
],
),
Row(
children: [
Radio(
value: 'PCK',
groupValue: methodOfDelivery,
onChanged: (val) {
setState(() {
methodOfDelivery = val;
deliveryWidget = Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Alamat', style: Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 18),),
const SizedBox(width: 70),
Container(
width: 187,
height: 80,
color: Colors.white,
child: TextFormField(
controller: addressController,
keyboardType: TextInputType.multiline,
validator: (value) {
if (value.isEmpty) {
return 'Mohon isi alamat';
}
return null;
},
maxLines: 5,
decoration: _inputDecoration()
))
],
);
});
},
),
Text(
'Dijemput',
style: Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 18),
),
Radio(
value: 'DLV',
groupValue: methodOfDelivery,
onChanged: (val) {
setState(() {
addressController.text = null;
methodOfDelivery = val;
deliveryWidget = Container(height: 80);
});
},
),
Text(
'Diantar ke Al-Jabbar',
style: Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 18),
),
],
),
const SizedBox(height: 10,),
deliveryWidget,
const SizedBox(height: 15,),
GestureDetector(
onTap: (){
if (_formKey.currentState.validate()) {
_formKey.currentState.save();
widget.tap(
quantity: goodsQuantityController.text,
description: goodsDescriptionController.text,
address: addressController.text,
methodOfDelivery: methodOfDelivery
);
}
},
child: Align(
alignment: Alignment.bottomCenter,
child: Container(
width: 330,
margin: const EdgeInsets.only(bottom: 10),
height: 45,
decoration: BoxDecoration(
color: const Color.fromRGBO(60, 141, 188, 1),
borderRadius: BorderRadius.circular(50)
),
child: Center(child: Text('DONASI SEKARANG',
style: Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 18, color: Colors.white, fontWeight: FontWeight.bold, letterSpacing: 1.2),)),
child: Column(
children: [
Row(
children: [
Text('Jenis Barang', style: Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 18),),
const SizedBox(width: 20),
Container(
width: 187,
height: 50,
child: TextFormField(
controller: goodsDescriptionController,
validator: (value) {
return value.isEmpty ? 'Mohon isi jenis barang' : null;
},
decoration: _inputDecoration(),
)),
],
),
const SizedBox(height: 20,),
Row(
children: [
Text('Jumlah', style: Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 18),),
const SizedBox(width: 70),
Container(
width: 187,
height: 50,
color: Colors.white,
child: TextFormField(
controller: goodsQuantityController,
validator: (value) {
return value.isEmpty ? 'Mohon isi jumlah barang' : null;
},
keyboardType: TextInputType.number,
decoration: _inputDecoration(),
))
],
),
const SizedBox(height: 10,),
Row(
children: [
Expanded(
child: Divider(
color: Colors.grey),
),
const SizedBox(width: 10,),
const Icon(Icons.add_circle, color: Color.fromRGBO(60, 141, 188, 1),)
],
),
Row(
children: [
Radio(
value: 'PCK',
groupValue: methodOfDelivery,
onChanged: (val) {
setState(() {
methodOfDelivery = val;
deliveryWidget = Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Alamat', style: Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 18),),
const SizedBox(width: 70),
Container(
width: 187,
height: 80,
color: Colors.white,
child: TextFormField(
controller: addressController,
keyboardType: TextInputType.multiline,
validator: (value) {
if (value.isEmpty) {
return 'Mohon isi alamat';
}
return null;
},
maxLines: 5,
decoration: _inputDecoration()
))
],
);
});
},
),
Text(
'Dijemput',
style: Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 18),
),
Radio(
value: 'DLV',
groupValue: methodOfDelivery,
onChanged: (val) {
setState(() {
addressController.text = null;
methodOfDelivery = val;
deliveryWidget = Container(height: 80);
});
},
),
Text(
'Diantar ke Al-Jabbar',
style: Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 18),
),
],
),
const SizedBox(height: 10,),
deliveryWidget,
const SizedBox(height: 15,),
GestureDetector(
onTap: (){
if (_formKey.currentState.validate()) {
_formKey.currentState.save();
widget.tap(
quantity: goodsQuantityController.text,
description: goodsDescriptionController.text,
address: addressController.text,
methodOfDelivery: methodOfDelivery
);
}
},
child: Align(
alignment: Alignment.bottomCenter,
child: Container(
width: 330,
margin: const EdgeInsets.only(bottom: 10),
height: 45,
decoration: BoxDecoration(
color: const Color.fromRGBO(60, 141, 188, 1),
borderRadius: BorderRadius.circular(50)
),
child: Center(child: Text('DONASI SEKARANG',
style: Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 18, color: Colors.white, fontWeight: FontWeight.bold, letterSpacing: 1.2),)),
),
)
],
),
),
),
)
],
)
);
}
}
......
......@@ -260,7 +260,9 @@ class __BodyState extends State<_Body> {
);
} else if (state is FetchOrderSuccess && (state.transaction.transactionStatus ==
StatusTransaction.waitProof || state.transaction.transactionStatus ==
StatusTransaction.canceled)) {
StatusTransaction.canceled ||
state.transaction.transactionStatus ==
StatusTransaction.waitSellerConfirmation)) {
return Provider<Transaction>.value(
value: state.transaction,
child: RefreshIndicator(
......@@ -294,8 +296,6 @@ class __BodyState extends State<_Body> {
else if (state is FetchOrderSuccess && (
state.transaction.transactionStatus ==
StatusTransaction.inProcess ||
state.transaction.transactionStatus ==
StatusTransaction.waitSellerConfirmation ||
state.transaction.transactionStatus ==
StatusTransaction.beingShipped ||
state.transaction.transactionStatus ==
......@@ -412,7 +412,7 @@ class _ShipmentInfo extends StatelessWidget {
padding: const EdgeInsets.only(top: 10, left: 10),
child: Consumer<Transaction>(
builder: (_, transaction, __) => Text(
'Barang akan dikirim pada hari Sabtu, ${formatDate(transaction.batchEndDate)}',
'Barang akan dikirim pada hari Sabtu, ${formatDatePlusOne(transaction.batchEndDate)}',
maxLines: 5,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 12, color: Color.fromRGBO(60, 141, 188, 1)),
......
......@@ -104,7 +104,6 @@ void main() {
expect(find.text('GTXWP3PJ'), findsOneWidget);
expect(find.text('Rp155.040'), findsOneWidget);
expect(find.text('Ubah bukti pembayaran'), findsOneWidget);
expect(find.text('Barang akan dikirim pada hari Sabtu, 17 Oktober 2020'), findsOneWidget);
});
testWidgets('loaded 001', (WidgetTester tester) async {
......@@ -175,7 +174,7 @@ void main() {
expect(find.text('GTXWP3PJ'), findsOneWidget);
expect(find.text('Rp155.040'), findsOneWidget);
expect(find.text('Barang diterima'), findsOneWidget);
expect(find.text('Barang akan dikirim pada hari Sabtu, 17 Oktober 2020'), findsOneWidget);
expect(find.text('Barang akan dikirim pada hari Sabtu, 18 Oktober 2020'), findsOneWidget);
await tester.tap(find.text('Barang diterima'));
await tester.pumpAndSettle();
expect(find.text('Barang sudah diterima?'), findsOneWidget);
......@@ -192,7 +191,7 @@ void main() {
expect(find.text('GTXWP3PJ'), findsOneWidget);
expect(find.text('Rp155.040'), findsOneWidget);
expect(find.text('Barang diterima'), findsOneWidget);
expect(find.text('Barang akan dikirim pada hari Sabtu, 17 Oktober 2020'), findsOneWidget);
expect(find.text('Barang akan dikirim pada hari Sabtu, 18 Oktober 2020'), findsOneWidget);
await tester.tap(find.text('Barang diterima'));
await tester.pumpAndSettle();
expect(find.text('Barang sudah diterima?'), findsOneWidget);
......
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