Fakultas Ilmu Komputer UI

Commit 7c83fe03 authored by Ferdi Salim Sungkar's avatar Ferdi Salim Sungkar
Browse files

[GREEN]fixing bug and adding remaining time

parents d89be0be fa034f88
Pipeline #83817 passed with stages
in 7 minutes and 18 seconds
......@@ -710,7 +710,7 @@
"languageVersion": "2.7"
}
],
"generated": "2021-06-27T20:00:55.393763Z",
"generated": "2021-06-27T21:42:36.485600Z",
"generator": "pub",
"generatorVersion": "2.12.0"
}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_keyboard_visibility","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility-5.0.0/","dependencies":[]},{"name":"flutter_secure_storage","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.5/","dependencies":[]},{"name":"image_picker","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.7.4/","dependencies":[]},{"name":"path_provider","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/","dependencies":[]}],"android":[{"name":"flutter_keyboard_visibility","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility-5.0.0/","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-2.0.1/","dependencies":[]},{"name":"flutter_secure_storage","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.5/","dependencies":[]},{"name":"image_picker","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.7.4/","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.0/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.0.0/","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.0/","dependencies":[]}],"web":[{"name":"flutter_keyboard_visibility_web","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility_web-2.0.0/","dependencies":[]},{"name":"image_picker_for_web","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_for_web-2.0.0/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_web"]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle","image_picker_for_web"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-06-28 03:00:55.534962","version":"2.0.1"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_keyboard_visibility","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility-5.0.0/","dependencies":[]},{"name":"flutter_secure_storage","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.5/","dependencies":[]},{"name":"image_picker","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.7.4/","dependencies":[]},{"name":"path_provider","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/","dependencies":[]}],"android":[{"name":"flutter_keyboard_visibility","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility-5.0.0/","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-2.0.1/","dependencies":[]},{"name":"flutter_secure_storage","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.5/","dependencies":[]},{"name":"image_picker","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.7.4/","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.0/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.0.0/","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.0/","dependencies":[]}],"web":[{"name":"flutter_keyboard_visibility_web","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keyboard_visibility_web-2.0.0/","dependencies":[]},{"name":"image_picker_for_web","path":"/Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_for_web-2.0.0/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_web"]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle","image_picker_for_web"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-06-28 04:42:36.667531","version":"2.0.1"}
\ No newline at end of file
......@@ -3,7 +3,7 @@
#
# For more info see: https://dart.dev/go/dot-packages-deprecation
#
# Generated by pub on 2021-06-28 03:00:55.365912.
# Generated by pub on 2021-06-28 04:42:36.460181.
_fe_analyzer_shared:file:///Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-14.0.0/lib/
analyzer:file:///Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib/
args:file:///Users/ferdisungkar/flutter/.pub-cache/hosted/pub.dartlang.org/args-2.0.0/lib/
......
import 'package:flutter/cupertino.dart';
import 'package:intl/intl.dart';
import 'package:time_formatter/time_formatter.dart';
......@@ -103,4 +104,20 @@ class Ukm {
String get beautifyTime {
return formatTime(remainingTime);
}
ImageProvider<Object> get ukmBanner {
if (this.bannerImg == "") {
return AssetImage('assets/images/equityWithNoImage.jpg');
} else {
return NetworkImage(this.bannerImg);
}
}
Widget ukmLogo(String logoUrl) {
try {
return Image.network(this.logoUrl);
} catch (e) {
return Image.asset('assets/images/tidak-ada-perjanjian.png');
}
}
}
This diff is collapsed.
......@@ -2,6 +2,7 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:fundex_app/api/api.dart';
import 'package:fundex_app/assets/loading.dart';
import 'package:fundex_app/pages/business/cardsListOnHome.dart';
import 'package:fundex_app/pages/business/prospectus_page.dart';
import 'package:google_fonts/google_fonts.dart';
......@@ -19,14 +20,20 @@ class HomeKYC extends StatefulWidget {
class _HomeKYCState extends State<HomeKYC> {
Future<EquityOfferings> futureEquities;
bool alreadyRegistered = false;
bool userChecked = false;
bool lihatSemuaIsClicked = false;
List<Ukm> ukmList = [];
void initState() {
super.initState();
futureEquities = Api().getEquities();
checkUser();
}
Widget buildUkmCarousel(BuildContext context,
AsyncSnapshot<EquityOfferings> snapshot, int index) {
List<Ukm> ukmList = snapshot.data.getUkmList();
ukmList = snapshot.data.getUkmList();
return new Container(
alignment: Alignment.center,
margin: EdgeInsets.fromLTRB(0.0, 24.0, 0.0, 0.0),
......@@ -54,10 +61,21 @@ class _HomeKYCState extends State<HomeKYC> {
ProspectusPage((ukmList[index].id).toString())));
},
child: Container(
margin: EdgeInsets.fromLTRB(0.0, 16.0, 0.0, 16.0),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 0,
blurRadius: 8,
offset: Offset(0, 0), // changes position of shadow
),
],
),
child: Column(
children: [
Expanded(
flex: 7,
flex: 8,
child: Container(
key: Key('containerForWholeCarousel'),
decoration: BoxDecoration(
......@@ -66,7 +84,7 @@ class _HomeKYCState extends State<HomeKYC> {
topRight: Radius.circular(8.0),
),
image: DecorationImage(
image: NetworkImage(ukmList[index].bannerImg),
image: ukmList[index].ukmBanner,
fit: BoxFit.cover,
),
),
......@@ -83,15 +101,6 @@ class _HomeKYCState extends State<HomeKYC> {
bottomLeft: Radius.circular(8.0),
bottomRight: Radius.circular(8.0),
),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 0,
blurRadius: 8,
offset:
Offset(0, 0), // changes position of shadow
),
],
),
alignment: Alignment.center,
child: Column(
......@@ -106,10 +115,8 @@ class _HomeKYCState extends State<HomeKYC> {
flex: 2,
child: Container(
margin: EdgeInsets.fromLTRB(8, 0, 8, 0),
child: Image.network(
ukmList[index].logoUrl,
key: Key('ukmLogo'),
),
child: ukmList[index]
.ukmLogo(ukmList[index].logoUrl),
),
),
Expanded(
......@@ -368,84 +375,122 @@ class _HomeKYCState extends State<HomeKYC> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
resizeToAvoidBottomInset: false,
appBar: AppBar(
backgroundColor: Colors.white,
title: Image.asset(
'assets/images/fundex.png',
key: Key('logoFundex'),
),
),
body: SafeArea(
child: SingleChildScrollView(
child: Column(
key: Key('wholePageColumn'),
crossAxisAlignment: CrossAxisAlignment.start,
children: [
registeredUser(context),
Container(
alignment: Alignment.center,
key: Key('containerPenawaranAndLihatSemua'),
margin: EdgeInsets.fromLTRB(24.0, 0.0, 24.0, 0.0),
child: Row(
key: Key('rowPenawaranAndLihatSemua'),
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
'Penawaran',
key: Key('stringPenawaran'),
style: GoogleFonts.inter(
color: Color.fromRGBO(0, 0, 0, 1.0),
fontSize: 16.0,
),
),
RichText(
key: Key('stringLihatSemua'),
text: TextSpan(
text: 'Lihat Semua >>',
return userChecked == false || lihatSemuaIsClicked == true
? Loading()
: Scaffold(
backgroundColor: Colors.white,
resizeToAvoidBottomInset: false,
appBar: AppBar(
backgroundColor: Colors.white,
title: Image.asset(
'assets/images/fundex.png',
key: Key('logoFundex'),
),
),
body: SafeArea(
child: SingleChildScrollView(
child: Column(
key: Key('wholePageColumn'),
crossAxisAlignment: CrossAxisAlignment.start,
children: [
getCard(),
Container(
alignment: Alignment.center,
key: Key('containerPenawaranAndLihatSemua'),
margin: EdgeInsets.fromLTRB(24.0, 0.0, 24.0, 0.0),
child: Row(
key: Key('rowPenawaranAndLihatSemua'),
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
'Penawaran',
key: Key('stringPenawaran'),
style: GoogleFonts.inter(
color: Color.fromRGBO(189, 189, 189, 1.0),
fontSize: 12.0,
color: Color.fromRGBO(0, 0, 0, 1.0),
fontSize: 16.0,
),
recognizer: TapGestureRecognizer()
..onTap = () {
Navigator.push(context,
MaterialPageRoute(builder: (context) {
return MaterialApp(home: ExploreBusiness());
}));
})),
]),
),
Container(
alignment: Alignment.center,
margin: EdgeInsets.fromLTRB(0.0, 24.0, 0.0, 0.0),
child: FutureBuilder<EquityOfferings>(
future: futureEquities,
builder: (context, snapshot) {
if (snapshot.hasData) {
return buildUkmCarousel(context, snapshot,
snapshot.data.getUkmList().length);
),
RichText(
key: Key('stringLihatSemua'),
text: TextSpan(
text: 'Lihat Semua >>',
style: GoogleFonts.inter(
color: Color.fromRGBO(189, 189, 189, 1.0),
fontSize: 12.0,
),
recognizer: TapGestureRecognizer()
..onTap = () {
setState(() {
lihatSemuaIsClicked = true;
});
Navigator.push(context,
MaterialPageRoute(
builder: (context) {
return MaterialApp(
home: ExploreBusiness());
}));
})),
]),
),
Container(
alignment: Alignment.center,
margin: EdgeInsets.fromLTRB(0.0, 24.0, 0.0, 0.0),
child: FutureBuilder<EquityOfferings>(
future: futureEquities,
builder: (context, snapshot) {
if (snapshot.hasData) {
return buildUkmCarousel(context, snapshot,
snapshot.data.getUkmList().length);
// SingleChildScrollView(
// scrollDirection: Axis.vertical,
// child: buildUkmCard(context, snapshot));
} else if (snapshot.hasError) {
print('${snapshot.error}');
return Container(child: Text('${snapshot.error}'));
} else {
return Container(
width: 0,
height: 0,
);
}
}),
// SingleChildScrollView(
// scrollDirection: Axis.vertical,
// child: buildUkmCard(context, snapshot));
} else if (snapshot.hasError) {
print('${snapshot.error}');
return Container(
child: Text('${snapshot.error}'));
} else {
return Container(
width: 0,
height: 0,
);
}
}),
),
],
),
),
],
),
),
),
);
),
);
}
Future checkUser() async {
final List<dynamic> getMemberAttribute = await Api().getMemberAttribute();
for (var i = 0; i < getMemberAttribute.length; i++) {
if (getMemberAttribute[i]['attribute_name'] == 'kyc_progress') {
var map = (getMemberAttribute[i] as Map<String, dynamic>);
var val = (map)['attribute_value'];
var str = val.substring(1, val.length - 1);
var lastStep = str.split(",")[4];
var value = lastStep.substring(8);
if (value == "true") {
setState(() {
alreadyRegistered = true;
});
}
}
}
setState(() {
userChecked = true;
});
}
Widget getCard() {
if (alreadyRegistered == true) {
return registeredUser(context);
} else {
return unregisteredUser(context);
}
}
}
This diff is collapsed.
......@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:fundex_app/api/api.dart';
import 'package:fundex_app/assets/colors.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:fundex_app/pages/business/homekycUnregsitered.dart';
import 'package:fundex_app/pages/business/homekyc.dart';
import 'package:fundex_app/pages/kyc/alamat_body.dart';
import 'package:fundex_app/pages/kyc/design.dart';
import 'package:intl/intl.dart';
......@@ -231,7 +231,7 @@ class _BiodataBodyState extends State<BiodataBody> {
),
onPressed: () {
Navigator.push(context, MaterialPageRoute(builder: (context) {
return HomeKYCUnregistered();
return HomeKYC();
}));
},
),
......
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:fundex_app/api/api.dart';
import 'package:fundex_app/main-screen.dart';
import 'package:fundex_app/pages/kyc/design.dart';
import 'package:fundex_app/storage/storage.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:fundex_app/assets/colors.dart';
import '../business/homekycUnregsitered.dart';
class Otp extends StatefulWidget {
@override
_OtpState createState() => _OtpState();
......@@ -338,7 +337,7 @@ class __OtpFormState extends State<_OtpForm> {
await SecureStorage().readSecureData('token'), otpString);
if (statusCode == 200) {
Navigator.push(context, MaterialPageRoute(builder: (context) {
return MaterialApp(home: HomeKYCUnregistered());
return MaterialApp(home: MainScreen());
}));
} else if (statusCode == 400) {
createAlertDialog(context);
......
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fundex_app/pages/business/exploreBusiness.dart';
void main() {
testWidgets('Back Icon navigate into Dashboard when pressed',
(WidgetTester tester) async {
// initialize
final backIcon = find.byKey(Key('backIcon'));
final penawaranString = find.byKey(Key('stringPenawaran'));
// execute
await tester.pumpWidget(MaterialApp(
home: ExploreBusiness(),
));
await tester.tap(backIcon);
await tester.pumpAndSettle();
// check outputs
expect(penawaranString, findsOneWidget);
});
}
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:fundex_app/pages/business/homekyc.dart';
void main() {
Widget createWidgetForTesting({Widget child}) {
return MaterialApp(
home: child,
);
}
testWidgets('Testing appBar', (WidgetTester tester) async {
await tester.pumpWidget(createWidgetForTesting(child: HomeKYC()));
expect(find.byKey(Key('logoFundex')), findsOneWidget);
});
testWidgets('Testing column for whole body', (WidgetTester tester) async {
await tester.pumpWidget(createWidgetForTesting(child: HomeKYC()));
expect(find.byKey(Key('wholePageColumn')), findsOneWidget);
});
testWidgets('Testing card container', (WidgetTester tester) async {
await tester.pumpWidget(createWidgetForTesting(child: HomeKYC()));
expect(find.byKey(Key('cardContainer')), findsOneWidget);
});
testWidgets('Testing status card', (WidgetTester tester) async {
await tester.pumpWidget(createWidgetForTesting(child: HomeKYC()));
expect(find.byKey(Key('statusCard')), findsOneWidget);
});
testWidgets('Testing row for status card', (WidgetTester tester) async {
await tester.pumpWidget(createWidgetForTesting(child: HomeKYC()));
expect(find.byKey(Key('rowStatusCard')), findsOneWidget);
});
testWidgets('Testing image on card', (WidgetTester tester) async {
await tester.pumpWidget(createWidgetForTesting(child: HomeKYC()));
expect(find.byKey(Key('statusLogo')), findsOneWidget);
});
testWidgets('Testing text status on card', (WidgetTester tester) async {
await tester.pumpWidget(createWidgetForTesting(child: HomeKYC()));
expect(find.byKey(Key('stringStatus')), findsOneWidget);
});
testWidgets('Testing container for penawaran and lihat semua',
(WidgetTester tester) async {
await tester.pumpWidget(createWidgetForTesting(child: HomeKYC()));
expect(find.byKey(Key('containerPenawaranAndLihatSemua')), findsOneWidget);
});
testWidgets('Testing row for penawaran and lihat semua string',
(WidgetTester tester) async {
await tester.pumpWidget(createWidgetForTesting(child: HomeKYC()));
expect(find.byKey(Key('rowPenawaranAndLihatSemua')), findsOneWidget);
});
testWidgets('Testing string penawaran', (WidgetTester tester) async {
await tester.pumpWidget(createWidgetForTesting(child: HomeKYC()));
expect(find.byKey(Key('stringPenawaran')), findsOneWidget);
});
testWidgets('Testing string lihat semua', (WidgetTester tester) async {
await tester.pumpWidget(createWidgetForTesting(child: HomeKYC()));
expect(find.byKey(Key('stringLihatSemua')), 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