Fakultas Ilmu Komputer UI

Commit 183cd1a1 authored by Agnes Handoko's avatar Agnes Handoko
Browse files

[REFACTOR] finished filter feature and add switch case

parents 6c05d5b4 0be57530
Pipeline #38635 passed with stages
in 15 minutes and 56 seconds
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
final Color greenPrimary = Color(0xff3A903A); final Color greenPrimary = Color(0xff3A903A);
final Color greenPale = Color(0xff4FBA4F);
final Color redPrimary = Color(0xffC60000); final Color redPrimary = Color(0xffC60000);
final double superSmallSpace = 4.0;
final double smallSpace = 4.0; final double smallSpace = 4.0;
final double regularSpace = 8.0; final double regularSpace = 8.0;
final double regularBiggerSpace = 12.0;
final double doubleSpace = 16.0; final double doubleSpace = 16.0;
final double tripleSpace = 32.0; final double tripleSpace = 32.0;
final double spaceFourty = 45.0;
final double quartetSpace = 64.0; final double quartetSpace = 64.0;
final double spaceFourtyEight = 48.0; final double spaceFourtyEight = 48.0;
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/app.dart'; //import 'package:ppl_disabilitas/app.dart';
import 'package:ppl_disabilitas/page/filter%20&%20fasilitas/filter.dart';
import 'flavor/flavor.dart'; import 'flavor/flavor.dart';
void main() { void main() {
ApiFlavor.flavor = BuildFlavor.production.toString(); ApiFlavor.flavor = BuildFlavor.production.toString();
runApp(BisaGo()); //runApp(BisaGo());
runApp(Filter());
} }
\ No newline at end of file
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/page/filter%20&%20fasilitas/insideFilter.dart';
class Filter extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Filter',
theme: ThemeData(
primarySwatch: Colors.green,
),
//home: new Icon(Icons.filter_list),
home: MyHomePage(title: 'Filter Informasi'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage>
with SingleTickerProviderStateMixin {
AnimationController controller;
Animation<Offset> offset;
// final _controller = new PageController();
// static const _kDuration = const Duration(milliseconds: 300);
// static const _kCurve = Curves.ease;
// final _kArrowColor = Colors.black.withOpacity(0.8);
@override
void initState() {
super.initState();
controller =
AnimationController(vsync: this, duration: Duration(seconds: 1));
offset = Tween<Offset>(begin: Offset.zero, end: Offset(0.0, 1.0))
.animate(controller);
}
bool showUrutan = true;
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
key: Key("tambah informasi"),
title: Text(widget.title),
),
body: Align(
heightFactor: 150,
alignment: Alignment.bottomCenter,
child: SlideTransition(
position: offset,
child: Container(
// margin: EdgeInsets.all(25.0),
child: InsideFilter(),
),
),
),
floatingActionButton: FloatingActionButton(
key: Key("button"),
onPressed: () {
switch (controller.status) {
case AnimationStatus.completed:
controller.reverse();
break;
case AnimationStatus.dismissed:
controller.forward();
break;
default:
}
},
child: Icon(Icons.filter_list),
),
);
}
}
This diff is collapsed.
...@@ -14,7 +14,7 @@ description: Project PPL layanan aplikasi disabilitas ...@@ -14,7 +14,7 @@ description: Project PPL layanan aplikasi disabilitas
version: 1.0.0+1 version: 1.0.0+1
environment: environment:
sdk: ">=2.1.0 <3.0.0" sdk: ">=2.2.0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
......
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:ppl_disabilitas/page/filter & fasilitas/filter.dart';
//import 'package:ppl_disabilitas/page/filter%20&%20fasilitas/insideFilter.dart';
void main() {
testWidgets('find inside filter page', (WidgetTester tester) async {
// Provide the childWidget to the Container.
await tester.pumpWidget(Filter());
// inside filter
expect(find.byType(Container), findsNWidgets(21));
expect(find.byType(Row), findsNWidgets(12));
expect(find.byType(Column), findsNWidgets(2));
expect(find.byType(Text), findsNWidgets(14));
expect(find.byType(Flex), findsNothing);
expect(find.text('jns fasilitas'), findsNothing);
expect(find.text('urutn'), findsNothing);
expect(find.text('hps smw'), findsNothing);
// filter
expect(find.byType(Scaffold), findsOneWidget);
expect(find.byType(Icon), findsNWidgets(2));
});
}
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