Fakultas Ilmu Komputer UI

filter.dart 2.75 KB
Newer Older
1
import 'package:flutter/foundation.dart';
2
import 'package:flutter/material.dart';
Fakhira Devina's avatar
Fakhira Devina committed
3
import 'package:ppl_disabilitas/page/filter_fasilitas/insideFilter.dart';
4
5
6
7
8

class Filter extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
9
    return MaterialApp(
10
      title: 'Filter',
11
      theme: ThemeData(
12
13
        primarySwatch: Colors.green,
      ),
14
      //home: new Icon(Icons.filter_list),
15
      home: MyHomePage(title: 'Filter Informasi'),
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
    );
  }
}

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
35
  _MyHomePageState createState() => _MyHomePageState();
36
37
}

38
39
class _MyHomePageState extends State<MyHomePage>
    with SingleTickerProviderStateMixin {
40
41
42
  AnimationController controller;
  Animation<Offset> offset;

43
44
45
46
//  final _controller = new PageController();
//  static const _kDuration = const Duration(milliseconds: 300);
//  static const _kCurve = Curves.ease;
//  final _kArrowColor = Colors.black.withOpacity(0.8);
47
48
49
50
51
52
53
54
55
56
57

  @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);
  }
58

59
60
61
  bool showUrutan = true;

  GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
62
63
64

  @override
  Widget build(BuildContext context) {
65
    return Scaffold(
66
      key: _scaffoldKey,
67
      appBar: AppBar(
68
        key: Key("tambah informasi"),
69
70
71
72
73
74
75
76
77
78
79
80
        title: Text(widget.title),
      ),
      body: Align(
        heightFactor: 150,
        alignment: Alignment.bottomCenter,
        child: SlideTransition(
          position: offset,
          child: Container(
//            margin: EdgeInsets.all(25.0),
            child: InsideFilter(),
          ),
        ),
81
      ),
82
      floatingActionButton: FloatingActionButton(
83
84
        key: Key("button"),
        onPressed: () {
85
86
87
88
89
90
91
92
93
          switch (controller.status) {
            case AnimationStatus.completed:
              controller.reverse();
              break;
            case AnimationStatus.dismissed:
              controller.forward();
              break;
            default:
          }
94
        },
95
        child: Icon(Icons.filter_list),
96
      ),
97
98
    );
  }
99
}