Fakultas Ilmu Komputer UI

Commit f5b14ab6 authored by Michael Wiryadinata Halim's avatar Michael Wiryadinata Halim
Browse files

[REFACTOR] Run dartfm

parent 97d78b34
Pipeline #52366 passed with stages
in 10 minutes and 20 seconds
......@@ -64,9 +64,8 @@ class ProductBloc extends Bloc<ProductEvent, ProductState> {
@override
Stream<Transition<ProductEvent, ProductState>> transformEvents(
Stream<ProductEvent> events,
TransitionFunction<ProductEvent, ProductState> transitionFn)
{
Stream<ProductEvent> events,
TransitionFunction<ProductEvent, ProductState> transitionFn) {
return super.transformEvents(
events.debounce(
const Duration(milliseconds: 500),
......
......@@ -66,8 +66,7 @@ class SearchProductBloc extends Bloc<SearchProductEvent, SearchProductState> {
@override
Stream<Transition<SearchProductEvent, SearchProductState>> transformEvents(
Stream<SearchProductEvent> events,
TransitionFunction<SearchProductEvent, SearchProductState> transitionFn)
{
TransitionFunction<SearchProductEvent, SearchProductState> transitionFn) {
return super.transformEvents(
events.debounce(
const Duration(milliseconds: 500),
......
......@@ -53,8 +53,7 @@ class SubcategoryBloc extends Bloc<SubcategoryEvent, SubcategoryState> {
@override
Stream<Transition<SubcategoryEvent, SubcategoryState>> transformEvents(
Stream<SubcategoryEvent> events,
TransitionFunction<SubcategoryEvent, SubcategoryState> transitionFn)
{
TransitionFunction<SubcategoryEvent, SubcategoryState> transitionFn) {
return super.transformEvents(
events.debounce(
const Duration(milliseconds: 500),
......
......@@ -54,8 +54,7 @@ class ProgramBloc extends Bloc<ProgramEvent, ProgramState> {
@override
Stream<Transition<ProgramEvent, ProgramState>> transformEvents(
Stream<ProgramEvent> events,
TransitionFunction<ProgramEvent, ProgramState> transitionFn)
{
TransitionFunction<ProgramEvent, ProgramState> transitionFn) {
return super.transformEvents(
events.debounce(
const Duration(milliseconds: 500),
......
......@@ -69,8 +69,7 @@ class SearchProgramBloc extends Bloc<SearchProgramEvent, SearchProgramState> {
@override
Stream<Transition<SearchProgramEvent, SearchProgramState>> transformEvents(
Stream<SearchProgramEvent> events,
TransitionFunction<SearchProgramEvent, SearchProgramState> transitionFn)
{
TransitionFunction<SearchProgramEvent, SearchProgramState> transitionFn) {
return super.transformEvents(
events.debounce(
const Duration(milliseconds: 500),
......
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:home_industry/Component/router.dart';
import 'package:flutter/material.dart';
import 'package:home_industry/Component/blue_button.dart';
import 'package:home_industry/Component/date_time_formatter.dart';
import 'package:home_industry/Component/product_image.dart';
import 'package:home_industry/Component/router.dart';
import 'package:home_industry/Pages/Program/model/program.dart';
import 'package:home_industry/Component/date_time_formatter.dart';
class DetailProgram extends StatelessWidget {
final Program program;
......@@ -54,15 +54,13 @@ class DetailProgram extends StatelessWidget {
children: <Widget>[
_DeskripsiRow(
icon: Icons.calendar_today,
label:
'${formatDate(program.startDateTime)}'
label: '${formatDate(program.startDateTime)}'
' - '
'${formatDate(program.endDateTime)}',
),
_DeskripsiRow(
icon: Icons.query_builder,
label:
'${formatTime(program.startDateTime)}'
label: '${formatTime(program.startDateTime)}'
' - '
'${formatTime(program.endDateTime)}',
),
......@@ -103,15 +101,13 @@ class DetailProgram extends StatelessWidget {
SizedBox(
width: double.infinity,
height: 45,
child:
BlueButton(onPressed: () {
child: BlueButton(
onPressed: () {
Navigator.of(context).pushNamed(
Router.donationPage,
arguments: {
'program': program
}
);
}, label: "DONASI"))
Router.donationPage,
arguments: {'program': program});
},
label: "DONASI"))
],
),
)
......
......@@ -39,7 +39,10 @@ class SummaryError extends SummaryState {
class SummaryCheckoutSuccess extends SummaryState {
final String transactionId;
final PaymentMethod paymentMethod;
const SummaryCheckoutSuccess(this.transactionId, this.paymentMethod, );
const SummaryCheckoutSuccess(
this.transactionId,
this.paymentMethod,
);
@override
List<Object> get props => [transactionId, paymentMethod];
......
......@@ -55,8 +55,7 @@ class MyOrderBloc extends Bloc<MyOrderEvent, MyOrderState> {
@override
Stream<Transition<MyOrderEvent, MyOrderState>> transformEvents(
Stream<MyOrderEvent> events,
TransitionFunction<MyOrderEvent, MyOrderState> transitionFn)
{
TransitionFunction<MyOrderEvent, MyOrderState> transitionFn) {
return super.transformEvents(
events.debounce(
const Duration(milliseconds: 500),
......
......@@ -55,8 +55,8 @@ class DetailOrderBloc extends Bloc<DetailOrderEvent, DetailOrderState> {
Stream<DetailOrderState> _fetchOrderDetail(String idTransaction) async* {
yield const FetchOrderLoading();
try {
final response = await _transactionRepository
.fetchDetailTransaction(idTransaction);
final response =
await _transactionRepository.fetchDetailTransaction(idTransaction);
yield FetchOrderSuccess(response);
} catch (_) {
yield const FetchOrderError();
......
......@@ -455,22 +455,22 @@ void main() {
testWidgets("Test Widget Loaded preorder", (WidgetTester tester) async {
when(cartBloc.state).thenAnswer((_) => CartLoaded([
CartItem(
"test",
1,
Product(
image: null,
categoryName: "catName",
category: "catId",
name: "kue",
id: "1",
description: "aaaa",
price: "200000",
pre_order: true,
stock: null,
subcategory: "subCatId",
subcategoryName: "subCatName"))
], 200000, 1));
CartItem(
"test",
1,
Product(
image: null,
categoryName: "catName",
category: "catId",
name: "kue",
id: "1",
description: "aaaa",
price: "200000",
pre_order: true,
stock: null,
subcategory: "subCatId",
subcategoryName: "subCatName"))
], 200000, 1));
await tester.pumpWidget(testedWidget);
expect(find.text("Keranjang"), findsOneWidget);
expect(find.text("kue"), findsOneWidget);
......
......@@ -94,22 +94,25 @@ void main() {
testWidgets("Category Page loaded preorder", (WidgetTester tester) async {
when(dio.get(urlCategory, queryParameters: queryParam)).thenAnswer(
(_) async => Response<Map<dynamic, dynamic>>(
(_) async => Response<Map<dynamic, dynamic>>(
statusCode: 200, data: listCategory.toJson()));
when(dio.get(urlProduct, queryParameters: queryParamProduct)).thenAnswer(
(_) async => Response<Map<dynamic, dynamic>>(
statusCode: 200, data: ListProduct(count: 1, next: null, previous: null, results: [Product(
image: null,
categoryName: catName,
category: catId,
name: "kue",
id: "1",
description: "aaaa",
price: "200000",
stock: null,
pre_order: true,
subcategory: "idSub",
subcategoryName: "subcat")]).toJson()));
when(dio.get(urlProduct, queryParameters: queryParamProduct))
.thenAnswer((_) async => Response<Map<dynamic, dynamic>>(
statusCode: 200,
data: ListProduct(count: 1, next: null, previous: null, results: [
Product(
image: null,
categoryName: catName,
category: catId,
name: "kue",
id: "1",
description: "aaaa",
price: "200000",
stock: null,
pre_order: true,
subcategory: "idSub",
subcategoryName: "subcat")
]).toJson()));
await tester.pumpWidget(widgetTested);
expect(find.text("Belanja"), findsNWidgets(2));
expect(find.byType(CustomCircularIndicator), findsOneWidget);
......
......@@ -80,7 +80,8 @@ void main() {
expect(find.text("Rp10.000"), findsOneWidget);
});
testWidgets("Test detail loaded cart loaded preorder", (WidgetTester tester) async {
testWidgets("Test detail loaded cart loaded preorder",
(WidgetTester tester) async {
when(cartBloc.state).thenAnswer((_) => CartLoaded([], 10000, 1));
await tester.pumpWidget(widgetTested);
expect(find.text("kue"), findsOneWidget);
......
......@@ -91,20 +91,23 @@ void main() {
});
testWidgets("Load one product preorder", (WidgetTester tester) async {
when(dio.get(urlProduct, queryParameters: queryParamProduct)).thenAnswer(
(_) async => Response<Map<dynamic, dynamic>>(
statusCode: 200, data: ListProduct(count: 1, next: null, previous: null, results: [Product(
image: null,
categoryName: "catName",
category: "catId",
name: "kue",
id: "1",
description: "aaaa",
price: "200000",
stock: null,
pre_order: true,
subcategory: subCatId,
subcategoryName: subCatName)]).toJson()));
when(dio.get(urlProduct, queryParameters: queryParamProduct))
.thenAnswer((_) async => Response<Map<dynamic, dynamic>>(
statusCode: 200,
data: ListProduct(count: 1, next: null, previous: null, results: [
Product(
image: null,
categoryName: "catName",
category: "catId",
name: "kue",
id: "1",
description: "aaaa",
price: "200000",
stock: null,
pre_order: true,
subcategory: subCatId,
subcategoryName: subCatName)
]).toJson()));
await tester.pumpWidget(widgetTested);
expect(find.text(subCatName), findsNWidgets(2));
expect(find.byType(CustomCircularIndicator), findsNWidgets(1));
......
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:home_industry/Component/router.dart';
import 'package:home_industry/Pages/Donation/donation_page.dart';
import 'package:home_industry/Pages/Login/otp_page.dart';
import 'package:home_industry/Pages/Product/category_page.dart';
import 'package:home_industry/Pages/Product/detail_product.dart';
......@@ -11,7 +12,6 @@ import 'package:home_industry/Pages/ProductPayment/product_payment.dart';
import 'package:home_industry/Pages/Profile/edit_profile.dart';
import 'package:home_industry/Pages/Program/detail_program.dart';
import 'package:home_industry/Pages/Program/program_page.dart';
import 'package:home_industry/Pages/Donation/donation_page.dart';
import 'package:home_industry/Pages/Register/register.dart';
import 'package:home_industry/Pages/Summary/summary_page.dart';
......@@ -72,7 +72,8 @@ void main() {
MaterialPageRoute<Programs>(builder: (_) => const Programs())
.runtimeType);
expect(
Router.generateRoute(RouteSettings(name: Router.donationPage)).runtimeType,
Router.generateRoute(RouteSettings(name: Router.donationPage))
.runtimeType,
MaterialPageRoute<Donasi>(builder: (_) => const Donasi(program: null))
.runtimeType);
expect(
......
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