Fakultas Ilmu Komputer UI

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

[REFACTOR] Remove bugs and issues

parent 8845811c
Pipeline #62342 passed with stages
in 7 minutes and 19 seconds
......@@ -48,8 +48,9 @@ class _CustomTextInputFormState extends State<CustomTextInputForm> {
return TextFormField(
initialValue: widget.initialValue,
decoration:
customInputDecorationForm(context, widget.label, widget.prefixText, widget.prefixIcon),
obscureText: widget.isPassword == true ? _obscureText : false,
customInputDecorationForm(context,
widget.label, widget.prefixText, widget.prefixIcon),
obscureText: widget.isPassword && _obscureText,
onFieldSubmitted: widget.onSubmit,
onSaved: widget.onSave,
maxLength: widget.maxLength,
......
......@@ -103,7 +103,6 @@ class _ListItemBank extends StatelessWidget {
margin: const EdgeInsets.symmetric(vertical: 5),
child: Material(
type: MaterialType.card,
shadowColor: Colors.black,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(4.0))),
elevation: 1,
......
......@@ -36,7 +36,6 @@ class CartView extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(
flex: 3,
......@@ -184,7 +183,6 @@ class _CartDescription extends StatelessWidget {
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(
'${cartItem.product.name}',
......@@ -218,7 +216,7 @@ class _CartDescription extends StatelessWidget {
color: Theme.of(context).primaryColor,
shape: BoxShape.circle,
),
margin: EdgeInsets.symmetric(vertical: 3.0),
margin: const EdgeInsets.symmetric(vertical: 3.0),
child: const Icon(Icons.delete_forever,
color: Colors.white,),
),
......@@ -245,7 +243,9 @@ class _CartDescription extends StatelessWidget {
key: ValueKey<int>(cartItem.quantity),
text: TextSpan(
text: 'Jumlah: ',
style: const TextStyle(color: Colors.black, fontSize: 15),
style:
const TextStyle(color: Colors.black,
fontSize: 15),
children: <TextSpan>[
TextSpan(
text: '${cartItem.quantity}',
......@@ -261,7 +261,8 @@ class _CartDescription extends StatelessWidget {
child: PriceTextFormatter(
key: ValueKey<int>(cartItem.quantity),
price:
'${double.parse(cartItem.product.price) * cartItem.quantity}',
'${double.parse(cartItem.product.price)
* cartItem.quantity}',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w800,
......@@ -397,7 +398,7 @@ class _ModalCartItem extends StatelessWidget {
decoration: ShapeDecoration(
color: Theme.of(context)
.primaryColor,
shape: CircleBorder(),
shape: const CircleBorder(),
),
child: IconButton(
icon: const Icon(Icons.remove),
......@@ -421,7 +422,7 @@ class _ModalCartItem extends StatelessWidget {
decoration: ShapeDecoration(
color: Theme.of(context)
.primaryColor,
shape: CircleBorder(),
shape: const CircleBorder(),
),
child: IconButton(
icon: const Icon(Icons.add),
......
......@@ -10,7 +10,9 @@ import 'goods_donation_state.dart';
class GoodsDonationBloc extends Bloc<GoodsDonationEvent, GoodsDonationState> {
final DonationRepository _donationRepository;
GoodsDonationBloc(this._donationRepository, this._changeBottomNavigationBarBloc);
GoodsDonationBloc(
this._donationRepository,
this._changeBottomNavigationBarBloc);
final ChangeBottomNavigationBarBloc _changeBottomNavigationBarBloc;
@override
......
......@@ -9,7 +9,9 @@ import 'money_donation_state.dart';
class MoneyDonationBloc extends Bloc<DonationEvent, MoneyDonationState> {
final DonationRepository _donationRepository;
MoneyDonationBloc(this._donationRepository, this._changeBottomNavigationBarBloc);
MoneyDonationBloc(
this._donationRepository,
this._changeBottomNavigationBarBloc);
final ChangeBottomNavigationBarBloc _changeBottomNavigationBarBloc;
@override
......
......@@ -112,8 +112,10 @@ class __ChooseDonationState extends State<_ChooseDonation> {
child: Center(
child: Text(
'OK',
style: Theme.of(context).textTheme.bodyText1.copyWith(
fontSize: 18, color: const Color.fromRGBO(60, 141, 188, 1)),
style: Theme.of(context).
textTheme.bodyText1.copyWith(
fontSize: 18, color:
const Color.fromRGBO(60, 141, 188, 1)),
),
)),
],
......
......@@ -119,7 +119,6 @@ class _DonasiBarangState extends State<DonasiBarang> {
child: Form(
key: _formKey,
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
..._getGoodsForm(),
Row(
......@@ -156,11 +155,13 @@ class _DonasiBarangState extends State<DonasiBarang> {
),
const SizedBox(width: 70),
Container(
width: MediaQuery.of(context).size.width / 2,
width: MediaQuery.
of(context).size.width / 2,
height: 80,
color: Colors.white,
child: Padding(
padding: const EdgeInsets.only(top: 8.0),
padding: const
EdgeInsets.only(top: 8.0),
child: TextFormField(
controller: addressController,
keyboardType:
......@@ -331,14 +332,18 @@ class GoodsForm extends StatefulWidget {
}
class _GoodsFormState extends State<GoodsForm> {
final TextEditingController _goodsDescriptionController = TextEditingController();
final TextEditingController _goodsQuantityController = TextEditingController();
final TextEditingController
_goodsDescriptionController = TextEditingController();
final TextEditingController
_goodsQuantityController = TextEditingController();
@override
Widget build(BuildContext context) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
_goodsDescriptionController.text = _DonasiBarangState.goodsDescList[widget.index] ?? '';
_goodsQuantityController.text = _DonasiBarangState.goodsQtyList[widget.index] ?? '';
_goodsDescriptionController.text =
_DonasiBarangState.goodsDescList[widget.index] ?? '';
_goodsQuantityController.text =
_DonasiBarangState.goodsQtyList[widget.index] ?? '';
});
return Column(
......@@ -369,7 +374,8 @@ class _GoodsFormState extends State<GoodsForm> {
height: 50,
child: TextFormField(
key: const Key('goods-desc'),
onChanged: (v) => _DonasiBarangState.goodsDescList[widget.index] = v,
onChanged: (v) =>
_DonasiBarangState.goodsDescList[widget.index] = v,
controller: _goodsDescriptionController,
validator: (value) {
return value.isEmpty
......@@ -410,7 +416,8 @@ class _GoodsFormState extends State<GoodsForm> {
color: Colors.white,
child: TextFormField(
key: const Key('goods-qty'),
onChanged: (v) => _DonasiBarangState.goodsQtyList[widget.index] = v,
onChanged: (v) =>
_DonasiBarangState.goodsQtyList[widget.index] = v,
controller: _goodsQuantityController,
validator: (value) {
return value.isEmpty
......
......@@ -24,9 +24,15 @@ class DonationRepository {
await _dio.post(url, data: formData);
}
Future<void> createGoodsDonation(String program, String quantity, String description, String address, String methodOfDelivery) async {
Future<void> createGoodsDonation(
String program, String quantity,
String description, String address,
String methodOfDelivery) async {
String deliveryAddress;
methodOfDelivery == 'DLV' ? deliveryAddress = null : deliveryAddress = address;
methodOfDelivery == 'DLV' ?
deliveryAddress = null : deliveryAddress = address;
final formData = FormData.fromMap({
'program': program,
'donation_type': 'GDS',
......
......@@ -178,7 +178,10 @@ class _DonationDetaiDialog extends StatelessWidget {
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),)
style: const
TextStyle(fontSize: 16.0,
height: 1.3,
fontWeight: FontWeight.bold),)
],),
),
const SizedBox(height: 10.0,),
......@@ -210,11 +213,9 @@ class _DonationListItem extends StatelessWidget {
Expanded(
flex: 15,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
......@@ -283,7 +284,6 @@ class _DonationListItem extends StatelessWidget {
flex: 11,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
donation.donationStatus.readable,
......@@ -295,7 +295,8 @@ class _DonationListItem extends StatelessWidget {
fontWeight: FontWeight.w600,
fontSize: 15),
),
if (donation.donationType == 'CSH' && (donation.donationStatus ==
if (donation.donationType == 'CSH' &&
(donation.donationStatus ==
StatusDonation.waitAdminConfirmation ||
donation.donationStatus == StatusDonation.waitProofAgain))
FlatButton(
......
......@@ -83,7 +83,6 @@ class _DonationReUploadState extends State<DonationReUpload> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
height: 40,
......
......@@ -15,7 +15,6 @@ class Home extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: const <Widget>[
HomeProfilePlaceholder(),
HomePlaceHolder(
......@@ -71,11 +70,10 @@ class HomeProfile extends StatelessWidget {
padding: const EdgeInsets.only(bottom: 12),
width: double.maxFinite,
decoration: BoxDecoration(
border: Border.all(color: Colors.black, width: 1.2),
border: Border.all(width: 1.2),
borderRadius: BorderRadius.circular(10),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
const Text('SELAMAT DATANG',
......@@ -128,7 +126,7 @@ class HomePlaceHolder extends StatelessWidget {
image:
DecorationImage(image: AssetImage(image), fit: BoxFit.cover),
color: Colors.white,
border: Border.all(color: Colors.black, width: 1.2),
border: Border.all(width: 1.2),
borderRadius: BorderRadius.circular(10),
),
),
......
......@@ -57,17 +57,16 @@ class OTPPage extends StatelessWidget {
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const Text('Mohon masukkan OTP yang dikirim ke nomor anda',
softWrap: true),
const Divider(
height: 20,
thickness: null,
),
Theme(
data: Theme.of(context)
.copyWith(inputDecorationTheme: const InputDecorationTheme()),
.copyWith(inputDecorationTheme:
const InputDecorationTheme()),
child: PinPut(
onSubmit: (String pin) {
_otpSubmitted(pin, context);
......
......@@ -12,7 +12,8 @@ abstract class SearchProductState extends Equatable {
}
class InitialSearchProductState extends SearchProductState {
const InitialSearchProductState({hasReachedMax}) : super(0, '', hasReachedMax: true);
const InitialSearchProductState({hasReachedMax}) :
super(0, '', hasReachedMax: true);
@override
List<Object> get props => [page, searchQuery];
......
......@@ -118,8 +118,8 @@ class ProductGrid extends StatelessWidget {
borderRadius: BorderRadius.circular(8),
color: Colors.white,
boxShadow: [
BoxShadow(
offset: const Offset(2, 0),
const BoxShadow(
offset: Offset(2, 0),
color: Colors.black38,
blurRadius: 10,
spreadRadius: 0.5),
......@@ -170,7 +170,7 @@ class ProductGrid extends StatelessWidget {
BlocProvider.of<CartBloc>(context)
.add(AddCartItem(1, _product.id));
},
icon: Icon(
icon: const Icon(
Icons.add_shopping_cart,
),
alignment: Alignment.bottomCenter,
......
......@@ -113,7 +113,7 @@ class _ProductDescription extends StatelessWidget {
BlocProvider.of<CartBloc>(context)
.add(AddCartItem(1, product.id));
},
icon: Icon(Icons.add_shopping_cart),
icon: const Icon(Icons.add_shopping_cart),
label: Text(product.stock == 0 ? 'Habis' : 'Tambah'),
color: Theme.of(context).primaryColor,
textColor: const Color(0xff003636),
......
......@@ -75,7 +75,7 @@ class _SliverAppBarProductState extends State<SliverAppBarProduct> {
shape: const CircleBorder(),
),
child: IconButton(
icon: Icon(Icons.arrow_back),
icon: const Icon(Icons.arrow_back),
onPressed: () {
Navigator.of(context).pop();
},
......@@ -83,7 +83,7 @@ class _SliverAppBarProductState extends State<SliverAppBarProduct> {
),
),
secondChild: IconButton(
icon: Icon(Icons.arrow_back),
icon: const Icon(Icons.arrow_back),
onPressed: () {
Navigator.of(context).pop();
},
......@@ -92,9 +92,7 @@ class _SliverAppBarProductState extends State<SliverAppBarProduct> {
isFirst ? CrossFadeState.showFirst : CrossFadeState.showSecond,
),
),
floating: false,
pinned: true,
snap: false,
backgroundColor: Colors.white,
title: AnimatedCrossFade(
duration: duration,
......@@ -109,7 +107,7 @@ class _SliverAppBarProductState extends State<SliverAppBarProduct> {
'${widget.label}',
maxLines: 2,
textAlign: TextAlign.center,
style: TextStyle(color: Colors.black),
style: const TextStyle(color: Colors.black),
),
),
secondChild: Container(
......@@ -119,7 +117,7 @@ class _SliverAppBarProductState extends State<SliverAppBarProduct> {
'${widget.label}',
maxLines: 2,
textAlign: TextAlign.center,
style: TextStyle(color: Colors.black),
style: const TextStyle(color: Colors.black),
),
),
crossFadeState:
......
......@@ -124,10 +124,12 @@ class _BodyDetailProduct extends StatelessWidget {
ShapeDecoration(
color: Theme.of(context)
.primaryColor,
shape: CircleBorder(),
shape: const CircleBorder(),
),
child: IconButton(
icon: const Icon(Icons.remove),
icon:
const Icon
(Icons.remove),
onPressed: () {
context
.read<CounterItem>()
......@@ -148,7 +150,7 @@ class _BodyDetailProduct extends StatelessWidget {
decoration: ShapeDecoration(
color: Theme.of(context)
.primaryColor,
shape: CircleBorder(),
shape: const CircleBorder(),
),
child: IconButton(
icon: const Icon(Icons.add),
......
......@@ -519,7 +519,8 @@ class _ItemOrdered extends StatelessWidget {
),
trailing: PriceTextFormatter(
price:
'${transactionItem.quantity * double.parse(transactionItem.productPrice)}',
'${transactionItem.quantity
* double.parse(transactionItem.productPrice)}',
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
......
......@@ -60,11 +60,13 @@ class ProgramBloc extends Bloc<ProgramEvent, ProgramState> {
} catch (e) {
yield ListProgramsError(error: e.toString());
}
} else if ((event is FetchProgramByStatus) && !_hasReachedMaxSorted(currentState)) {
} else if ((event is FetchProgramByStatus)
&& !_hasReachedMaxSorted(currentState)) {
try {
final programs =
await programRepository.fetchProgram(page: currentState.page + 1);
if (currentState is ListProgramsLoaded || currentState is InitialListProgramState) {
if (currentState is ListProgramsLoaded ||
currentState is InitialListProgramState) {
final sort = sortPrograms(programs.results);
yield ListProgramsSortedLoaded(
programs: sort,
......
......@@ -10,20 +10,27 @@ import 'package:home_industry/Pages/Program/repositories/program_repository.dart
part 'progress_program_event.dart';
part 'progress_program_state.dart';
class ProgressProgramBloc extends Bloc<ProgressProgramEvent, ProgressProgramState> {
class ProgressProgramBloc
extends Bloc<ProgressProgramEvent,
ProgressProgramState> {
final Program program;
final ProgramRepository progressProgramRepository;
ProgressProgramBloc({@required this.progressProgramRepository, @required this.program})
ProgressProgramBloc({
@required this.progressProgramRepository,
@required this.program})
: assert(progressProgramRepository != null);
@override
ProgressProgramState get initialState => const ProgressProgramInitial();
@override
Stream<ProgressProgramState> mapEventToState(ProgressProgramEvent event) async* {
Stream<ProgressProgramState>
mapEventToState(ProgressProgramEvent event)
async* {
if (event is FetchProgressProgram) {
try {
final progressProgram = await progressProgramRepository.fetchProgressProgram(program.id);
final progressProgram = await
progressProgramRepository.fetchProgressProgram(program.id);
yield ProgressProgramLoaded(progressProgram);
} on DioError catch (_) {
yield ProgressProgramError(error: _.response.toString());
......
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