Fakultas Ilmu Komputer UI

dashboard.dart 6.27 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

class Dashboard extends StatefulWidget {
  @override
  DashboardState createState() => DashboardState();
}

class DashboardState extends State<Dashboard> {
  Completer<GoogleMapController> _controller = Completer();

  @override
  void initState() {
    super.initState();
  }

  double zoomVal = 5.0;
19
  //https://flutter.dev/docs/cookbook/design/drawer
20
21
  @override
  Widget build(BuildContext context) {
22
    return Scaffold(
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
      drawer: Theme(
        data: Theme.of(context).copyWith(
          canvasColor: Color.fromRGBO(58, 144, 58, 1),
          //This will change the drawer background to blue.
          //other styles
        ),
        child: Drawer(
          // Add a ListView to the drawer. This ensures the user can scroll
          // through the options in the drawer if there isn't enough vertical
          // space to fit everything.
          child: ListView(
            // Important: Remove any padding from the ListView.
            padding: EdgeInsets.zero,
            children: <Widget>[
              Container(
                height: 130,
                child: DrawerHeader(
                  decoration: BoxDecoration(
                    color: Color.fromRGBO(58, 144, 58, 1),
                  ),
                  child: Row(
                    children: <Widget>[
                      FloatingActionButton(
                        backgroundColor: Colors.white,
                        elevation: 0,
                        onPressed: () => {},
                      ),
                      Padding(
                        padding: EdgeInsets.all(16.0),
                        child: Text(
                          'Nama Orang',
                          style: TextStyle(
                            fontSize: 20,
                            color: Colors.white,
                            fontFamily: 'Muli',
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
64
              ),
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
              Container(
                child: ListTile(
                  title: Text(
                    'Beranda',
                    style: TextStyle(
                      fontSize: 20,
                      color: Colors.white,
                      fontFamily: 'Muli',
                    ),
                  ),
                  onTap: () {
                    // Update the state of the app
                    // ...
                    // Then close the drawer
                    Navigator.pop(context);
                  },
                ),
                decoration: new BoxDecoration(
                  border: new Border(
                    top: new BorderSide(color: Colors.white),
                    bottom: new BorderSide(color: Colors.white),
                  ),
                ),
              ),
              Container(
                child: ListTile(
                  title: Text(
                    'Riwayat Pencarian',
                    style: TextStyle(
                      fontSize: 20,
                      color: Colors.white,
                      fontFamily: 'Muli',
                    ),
                  ),
                  onTap: () {
                    // Update the state of the app
                    // ...
                    // Then close the drawer
                    Navigator.pop(context);
                  },
                ),
                decoration: new BoxDecoration(
                  border: new Border(
                    bottom: new BorderSide(color: Colors.white),
                  ),
                ),
              ),
              Container(
                child: ListTile(
                  title: Text(
                    'Tentang Aplikasi',
                    style: TextStyle(
                      fontSize: 20,
                      color: Colors.white,
                      fontFamily: 'Muli',
                    ),
                  ),
                  onTap: () {
                    // Update the state of the app
                    // ...
                    // Then close the drawer
                    Navigator.pop(context);
                  },
                ),
                decoration: new BoxDecoration(
                  border: new Border(
                    bottom: new BorderSide(color: Colors.white),
                  ),
                ),
              ),
              Container(
                child: ListTile(
                  title: Text(
                    'Logout',
                    style: TextStyle(
                      fontSize: 20,
                      color: Colors.white,
                      fontFamily: 'Muli',
                    ),
                  ),
                  onTap: () {
                    // Update the state of the app
                    // ...
                    // Then close the drawer
                    Navigator.pop(context);
                  },
                ),
                decoration: new BoxDecoration(
                  border: new Border(
                    bottom: new BorderSide(color: Colors.white),
                  ),
                ),
              ),
            ],
          ),
160
        ),
161
162
163
164
165
166
167
168
169
170
      ),
      appBar: AppBar(
        elevation: 15,
        centerTitle: true,
        backgroundColor: Color.fromRGBO(58, 144, 58, 1),
        title: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            Text(
171
              "bisaGo",
172
173
174
175
              style: TextStyle(
                  fontSize: 25,
                  fontFamily: 'Comfortaa',
                  fontWeight: FontWeight.w800),
176
            ),
177
          ],
178
        ),
179
      ),
180
181
182
      body: Stack(children: <Widget>[
        _buildGoogleMap(context),
      ]),
183
184
185
186
187
    );
  }

  Widget _buildGoogleMap(BuildContext context) {
    return Container(
188
189
      height: MediaQuery.of(context).size.height,
      width: MediaQuery.of(context).size.width,
190
191
      child: GoogleMap(
        mapType: MapType.normal,
192
193
        initialCameraPosition:
            CameraPosition(target: LatLng(40.712776, -74.005974), zoom: 12),
194
195
196
197
198
199
        onMapCreated: (GoogleMapController controller) {
          _controller.complete(controller);
        },
      ),
    );
  }
200
}