Fakultas Ilmu Komputer UI

Commit 1ce093fb authored by Michael Wiryadinata Halim's avatar Michael Wiryadinata Halim
Browse files

Merge branch 'staging' into 'master'

Sprint 5

See merge request ppl-fasilkom-ui/2020/ppl-c/diskominfo-depok-tpu-online/post-rpl-mobile!78
parents a3c1b29b e3fd695a
......@@ -5,7 +5,7 @@ WORKDIR /sdk
ENV ANDROID_COMPILE_SDK=29 \
ANDROID_BUILD_TOOLS=29.0.3 \
ANDROID_SDK_TOOLS=4333796 \
FLUTTER_VERSION="https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.12.13+hotfix.9-stable.tar.xz" \
FLUTTER_VERSION="https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_1.17.1-stable.tar.xz" \
ANDROID_HOME=/sdk/android-sdk-linux \
PATH="$PATH:/sdk/android-sdk-linux/platform-tools" \
PATH="/sdk/flutter/bin:$PATH" \
......
Fix layout
\ No newline at end of file
Final release
\ No newline at end of file
Copyright 2011 The Montserrat Project Authors (https://github.com/JulietaUla/Montserrat)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
import 'package:animations/animations.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:home_industry/Component/cart_icon.dart';
import 'package:home_industry/Component/router.dart';
import 'package:home_industry/Pages/DonationHistory/donation_history.dart';
import 'package:home_industry/Pages/Home/home_page.dart';
import 'package:home_industry/Pages/Profile/bloc/bloc.dart';
import 'package:home_industry/Pages/Profile/profile.dart';
import 'package:home_industry/Pages/Transactions/my_orders.dart';
import 'package:home_industry/State/ChangeBottomNavigatonBar/bloc.dart';
import 'modal_bottom_admin_info.dart';
class BottomNavigation extends StatefulWidget {
const BottomNavigation({Key key}) : super(key: key);
......@@ -38,16 +44,39 @@ class _BottomNavigationState extends State<BottomNavigation> {
List<Widget> _dynamicAction(BuildContext context) {
if (_selectedIndex == 3) {
return <Widget>[
BlocBuilder<ProfileBloc, ProfileState>(builder: (context, state) {
if (state is ProfileLoaded) {
return IconButton(
icon: Icon(
Icons.edit,
),
onPressed: () {
Navigator.of(context).pushNamed(Router.editProfilePage);
});
}
return const SizedBox.shrink();
})
];
}
return <Widget>[
const CartIcon(),
if (_selectedIndex == 0)
IconButton(
icon: Icon(
Icons.edit,
),
icon: Icon(Icons.info_outline),
onPressed: () {
Navigator.of(context).pushNamed(Router.editProfilePage);
showModalInfoAdmin(context);
})
];
}
return const <Widget>[CartIcon()];
];
}
void showModalInfoAdmin(BuildContext context) {
showModalBottomSheet(
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(25))),
builder: (BuildContext context) {
return const AdminInfo();
});
}
Widget _dynamicAppBar(BuildContext context) {
......@@ -70,10 +99,30 @@ class _BottomNavigationState extends State<BottomNavigation> {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: _dynamicAppBar(context),
body: Center(
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 220),
child: _widgetOptions.elementAt(_selectedIndex)),
body: BlocListener<ChangeBottomNavigationBarBloc,
ChangeBottomNavigationBarState>(
listener: (context, state) {
if (state is ChangedToMyTransaction) {
setState(() {
_selectedIndex = 2;
});
} else if (state is ChangedToMyDonations) {
setState(() {
_selectedIndex = 1;
});
}
},
child: PageTransitionSwitcher(
transitionBuilder: (Widget child, Animation<double> animation,
Animation<double> secondaryAnimation) {
return FadeThroughTransition(
animation: animation,
secondaryAnimation: secondaryAnimation,
child: child,
);
},
child: _widgetOptions.elementAt(_selectedIndex),
),
),
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
......
......@@ -18,7 +18,7 @@ class HomeIndustryLogo extends StatelessWidget {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5), color: Colors.black),
child: Text(
'Home Industry',
'Industri Pilar',
style: TextStyle(color: Colors.white, fontSize: fontSize),
),
);
......
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:home_industry/Component/border_blue_button.dart';
import 'package:home_industry/State/AdminInfo/repositories/admin_info_repository.dart';
import 'package:home_industry/State/Auth/repositories/depedencies_repositories.dart';
import 'package:url_launcher/url_launcher.dart';
import 'custom_circular.dart';
class AdminInfo extends StatefulWidget {
const AdminInfo({Key key, this.subject}) : super(key: key);
final String subject;
@override
_AdminInfoState createState() => _AdminInfoState();
}
class _AdminInfoState extends State<AdminInfo> {
AdminInfoRepository _adminInfo;
Future<String> email;
@override
void initState() {
_adminInfo = AdminInfoRepository(
RepositoryProvider.of<DependenciesRepositories>(context).dio);
email = _adminInfo.fetchContact();
super.initState();
}
@override
Widget build(BuildContext context) {
return FractionallySizedBox(
heightFactor: 0.4,
child: Column(
children: <Widget>[
Center(
child: Icon(Icons.arrow_drop_down),
),
Expanded(
child: FutureBuilder<String>(
future: email,
builder:
(BuildContext context, AsyncSnapshot<String> snapshot) {
if (snapshot.hasError) {
return const Center(
child: Text('Maaf ada kesalahan!'),
);
} else if (snapshot.hasData) {
final url = 'mailto:${snapshot.data}'
'${widget.subject != null ? "?subject="
"${widget.subject}" : ""}';
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Text(
snapshot.data,
style: Theme.of(context).textTheme.headline6,
),
IconButton(
icon: Icon(
Icons.content_copy,
color: Colors.black54,
),
onPressed: () {
Clipboard.setData(
ClipboardData(text: snapshot.data));
}),
],
),
FutureBuilder<bool>(
future: canLaunch(url),
builder: (BuildContext context,
AsyncSnapshot<bool> snapshot) {
if (snapshot.hasData && snapshot.data) {
return BorderBlueButton(
onPressed: () async {
await launch(url);
Navigator.of(context).pop();
},
label: 'Kirim email');
} else if (snapshot.hasError ||
(snapshot.hasData && !snapshot.data)) {
return const SizedBox(
height: 0,
width: 0,
);
}
return const Center(
child: CustomCircularIndicator(),
);
},
)
],
);
}
return const Center(
child: CustomCircularIndicator(),
);
}))
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:home_industry/Pages/ProductPayment/model/account.dart';
import 'package:home_industry/Pages/ProductPayment/repositories/rekening_repository.dart';
import 'package:home_industry/State/Auth/repositories/depedencies_repositories.dart';
import 'custom_circular.dart';
class Rekening extends StatefulWidget {
const Rekening({Key key}) : super(key: key);
@override
_RekeningState createState() => _RekeningState();
}
class _RekeningState extends State<Rekening> {
Future<Account> _futureAccount;
@override
void initState() {
final _accountRepository = AccountRepository(
RepositoryProvider.of<DependenciesRepositories>(context).dio);
_futureAccount = _accountRepository.fetchAccountDetail();
super.initState();
}
@override
Widget build(BuildContext context) {
return FutureBuilder<Account>(
future: _futureAccount,
builder: (BuildContext context, AsyncSnapshot<Account> snapshot) {
if (snapshot.hasError) {
return const Center(
child: Text('Maaf sedang ada error pada aplikasi'),
);
} else if (snapshot.hasData) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const Text(
'Nomor Rekening',
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Text(
'${snapshot.data.bankName}: ',
style: const TextStyle(fontSize: 18),
),
Text(snapshot.data.accountNumber,
style: Theme.of(context)
.textTheme
.headline6
.copyWith(fontSize: 18)),
],
),
Text(snapshot.data.accountOwner,
style: Theme.of(context)
.textTheme
.headline6
.copyWith(fontSize: 18)),
],
)
],
);
}
return const Center(child: CustomCircularIndicator());
});
}
}
......@@ -28,6 +28,7 @@ import 'package:home_industry/Pages/Transactions/detail_bloc/bloc.dart';
import 'package:home_industry/Pages/Transactions/my_detail_order.dart';
import 'package:home_industry/Pages/Transactions/repositories/transaction_repository.dart';
import 'package:home_industry/State/Auth/repositories/depedencies_repositories.dart';
import 'package:home_industry/State/ChangeBottomNavigatonBar/bloc.dart';
class Router {
static const registerPage = '/register';
......@@ -82,7 +83,9 @@ class Router {
RepositoryProvider.of<DependenciesRepositories>(context)
.dio;
return PaymentBloc(
TransactionRepository(dio), PaymentRepository(dio))
TransactionRepository(dio),
PaymentRepository(dio),
BlocProvider.of<ChangeBottomNavigationBarBloc>(context))
..add(FetchPayment(args['transaction']));
},
child: const ProductPaymentView(),
......@@ -95,7 +98,8 @@ class Router {
RepositoryProvider.of<DependenciesRepositories>(context)
.dio),
BlocProvider.of<CartBloc>(context),
BlocProvider.of<ProfileBloc>(context))
BlocProvider.of<ProfileBloc>(context),
BlocProvider.of<ChangeBottomNavigationBarBloc>(context))
..add(const FetchSummary()),
child: const SummaryView()));
......@@ -151,13 +155,14 @@ class Router {
case donationPage:
final Map<String, dynamic> args = settings.arguments;
return MaterialPageRoute<Donasi>(
return MaterialPageRoute(
builder: (context) => Donasi(
program: args['program'],
));
case donationReUpload:
final Map<String, dynamic> args = settings.arguments;
return MaterialPageRoute<Donasi>(
return MaterialPageRoute<DonationReUpload>(
builder: (context) => DonationReUpload(
donation: args['donation'],
));
......
......@@ -4,31 +4,32 @@ import 'package:google_fonts/google_fonts.dart';
class AppTheme {
static ThemeData custom(ThemeData base) {
return base.copyWith(
appBarTheme: base.appBarTheme.copyWith(
color: Colors.white,
iconTheme: IconThemeData(color: Colors.black87),
elevation: 0.5,
textTheme: GoogleFonts.montserratTextTheme(base.textTheme)),
textTheme: GoogleFonts.montserratTextTheme(base.textTheme).apply(
bodyColor: Colors.black,
displayColor: Colors.black,
appBarTheme: base.appBarTheme.copyWith(
color: Colors.white,
iconTheme: IconThemeData(color: Colors.black87),
elevation: 0.5,
textTheme: GoogleFonts.montserratTextTheme(base.textTheme)),
textTheme: GoogleFonts.montserratTextTheme(base.textTheme).apply(
bodyColor: Colors.black,
displayColor: Colors.black,
),
primaryColor: const Color(0xff3C8DBC),
iconTheme: IconThemeData(color: Colors.grey),
scaffoldBackgroundColor: Colors.white,
backgroundColor: Colors.white,
inputDecorationTheme: const InputDecorationTheme(
contentPadding: EdgeInsets.symmetric(horizontal: 2),
labelStyle: TextStyle(color: Color(0xff4E7890)),
fillColor: Color(0xffF1F1F1),
filled: true,
border: OutlineInputBorder(),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xff4E7890)),
),
primaryColor: const Color(0xff3C8DBC),
iconTheme: IconThemeData(color: Colors.grey),
scaffoldBackgroundColor: Colors.white,
backgroundColor: Colors.white,
inputDecorationTheme: const InputDecorationTheme(
contentPadding: EdgeInsets.symmetric(horizontal: 2),
labelStyle: TextStyle(color: Color(0xff4E7890)),
fillColor: Color(0xffF1F1F1),
filled: true,
border: OutlineInputBorder(),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xff4E7890)),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xff4E7890), width: 2.4),
),
));
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xff4E7890), width: 2.4),
),
),
);
}
}
import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:home_industry/Pages/Bank/repositories/bank_repository.dart';
import 'package:stream_transform/stream_transform.dart';
import './bloc.dart';
class BankBloc extends Bloc<BankBlocEvent, BankBlocState> {
final BankRepository _bankRepository;
BankBloc(this._bankRepository);
@override
BankBlocState get initialState => const InitialBankBlocState();
bool _hasReachedMax(BankBlocState state) =>
state is ListBankLoaded && state.hasReachedMax;
@override
Stream<BankBlocState> mapEventToState(
BankBlocEvent event,
) async* {
final currentState = state;
if ((event is FetchBank) && !_hasReachedMax(currentState)) {
try {
final banks = await _bankRepository.fetchBanks(currentState.page + 1);
if (currentState is InitialBankBlocState) {
yield ListBankLoaded(
page: currentState.page + 1,
listBank: banks.results,
hasReachedMax: banks.next == null);
return;
}
if (currentState is ListBankLoaded) {
yield ListBankLoaded(
page: currentState.page + 1,
hasReachedMax: banks.next == null,
listBank: [...currentState.listBank, ...banks.results]);
return;
}
} catch (_) {
yield const ListBankError();
}
}
}
@override
Stream<Transition<BankBlocEvent, BankBlocState>> transformEvents(
Stream<BankBlocEvent> events,
TransitionFunction<BankBlocEvent, BankBlocState> transitionFn) {
return super.transformEvents(
events.debounce(
const Duration(milliseconds: 500),
),
transitionFn,
);
}
}
import 'package:equatable/equatable.dart';
abstract class BankBlocEvent extends Equatable {
const BankBlocEvent();
}
class FetchBank extends BankBlocEvent {
@override
List<Object> get props => [];
const FetchBank();
}
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:home_industry/Pages/Bank/model/bank.dart';
abstract class BankBlocState extends Equatable {
const BankBlocState(this.page);
final int page;
}
class InitialBankBlocState extends BankBlocState {
const InitialBankBlocState() : super(0);
@override
List<Object> get props => [page];
}
class ListBankLoaded extends BankBlocState {
final List<Bank> listBank;
final bool hasReachedMax;
const ListBankLoaded(
{@required this.listBank, @required this.hasReachedMax, @required page})
: super(page);
@override
List<Object> get props => [listBank, hasReachedMax, page];
}
class ListBankError extends BankBlocState {
const ListBankError() : super(0);
@override
List<Object> get props => [page];
}
export 'bank_bloc_bloc.dart';