Fakultas Ilmu Komputer UI

fasilitas.dart 45.4 KB
Newer Older
1
2
3
4
5
6
7
import 'package:flutter/material.dart';
import 'package:ppl_disabilitas/bloc/KomentarBloc.dart';
import 'package:ppl_disabilitas/component/ImageHolder.dart';
import 'package:ppl_disabilitas/component/bisago_appbar.dart';
import 'package:ppl_disabilitas/component/bisago_drawer.dart';
import 'package:ppl_disabilitas/config/styles.dart';
import 'package:ppl_disabilitas/network/data/network_model.dart';
Usman Sidiq's avatar
Usman Sidiq committed
8
import 'package:ppl_disabilitas/page/addInformasi/addInfromasi.dart';
9
import 'package:ppl_disabilitas/page/filter_fasilitas/komentar.dart';
10
import 'package:ppl_disabilitas/model/komentar.dart';
Usman Sidiq's avatar
Usman Sidiq committed
11
12
import 'package:ppl_disabilitas/page/login/login.dart';
import 'package:shared_preferences/shared_preferences.dart';
13

14

15
16
17
18
19
class Fasilitas extends StatefulWidget {
  final String nama;
  final String alamat;
  final String url;
  final String telpon;
20
21
  final int id;
  Fasilitas({this.nama, this.alamat, this.url, this.telpon, this.id});
22
23
24
25
26
  @override
  _FasilitasState createState() => _FasilitasState();
}

class _FasilitasState extends State<Fasilitas> {
27
28
29
30
31
32
33
  var kursiRodaVal = true;
  var liftVal = true;
  var toiletDisabilitasVal = true;
  var tempatIbadahVal = true;
  var bidangMiringVal = true;
  var parkirUmumVal = true;
  var parkirDisabilitasVal = true;
34
35
36
37
38
39
  var guidingBlockVal = true;
  var temanDisabilitasVal = true;
  var juruIsyaratVal = true;
  var tongkatVal = true;
  var kursiDisabilitasVal = true;
  var runningTextVal = true;
40
  var sortKomentar = -1;
Fakhira Devina's avatar
Fakhira Devina committed
41
  var showUrutan = true;
42
43
  var komentarStream;
  List<KomentarModel> allKomentarFromApi;
44
45
46
47
  KomentarBloc _bloc;

  @override
  void initState() {
48
    allKomentarFromApi = [];
49
50
51
    _bloc = KomentarBloc(widget.nama);
    super.initState();
  }
Fakhira Devina's avatar
Fakhira Devina committed
52

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      drawer: BisaGoDrawer(),
      body: SingleChildScrollView(
        child: Column(children: <Widget>[
          SizedBox(height: 160, child: ImageHolder(url: widget.url)),
          Container(
            padding: EdgeInsets.all(doubleSpace),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text(
                  widget.nama,
                  style: TextStyle(
                    fontSize: 25,
                    fontWeight: FontWeight.w800,
                    color: Colors.black,
                    fontFamily: 'Muli',
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(
                      top: regularSpace,
                      bottom: regularSpace,
                      left: smallSpace),
                  child: Row(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      Icon(Icons.place, color: Colors.black, size: 20),
                      Flexible(
Fakhira Devina's avatar
Fakhira Devina committed
85
                        key: Key('Alamat'),
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
                        child: Text(
                          widget.alamat,
                          softWrap: true,
                          textAlign: TextAlign.left,
                          style: TextStyle(
                            fontSize: 15,
                            color: Colors.black,
                            fontFamily: 'Muli',
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Icon(
                      Icons.local_phone,
                      color: Colors.black,
                      size: 20,
                    ),
                    Flexible(
                      child: Text(
110
                        widget.telpon,
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
                        softWrap: true,
                        textAlign: TextAlign.left,
                        style: TextStyle(
                          fontSize: 15,
                          color: Colors.black,
                          fontFamily: 'Muli',
                        ),
                      ),
                    ),
                  ],
                ),
                Container(
                  margin: EdgeInsets.only(
                      top: doubleSpace, bottom: doubleSpace, left: smallSpace),
                  decoration: BoxDecoration(boxShadow: regularShadow),
                  child: SizedBox(
                    width: double.infinity,
                    child: FlatButton(
Fakhira Devina's avatar
Fakhira Devina committed
129
                      key: Key('Tambah Informasi'),
130
131
132
133
134
135
136
137
138
139
                      color: Colors.green[700],
                      textColor: Colors.white,
                      disabledColor: Colors.grey,
                      disabledTextColor: Colors.black,
                      padding: EdgeInsets.all(8),
                      shape: RoundedRectangleBorder(
                          borderRadius: regularBorderRadius,
                          side: BorderSide(color: Colors.transparent)),
                      splashColor: Colors.lightGreen,
                      onPressed: () {
Usman Sidiq's avatar
Usman Sidiq committed
140
                        checkLoginStatus();
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
                      },
                      child: Text(
                        "Tambah Informasi",
                        style: TextStyle(fontSize: 20),
                      ),
                    ),
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(bottom: doubleSpace),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: <Widget>[
                      Text(
                        'Fasilitas',
                        style: TextStyle(
                          fontSize: 25,
                          fontWeight: FontWeight.w800,
                          color: Colors.black,
                          fontFamily: 'Muli',
                        ),
                      ),
                      Container(
                        decoration: BoxDecoration(boxShadow: regularShadow),
                        child: FlatButton(
Fakhira Devina's avatar
Fakhira Devina committed
166
                          key: Key('FilterButton'),
167
168
169
170
171
172
173
174
175
                          color: Colors.green[700],
                          textColor: Colors.white,
                          disabledColor: Colors.grey,
                          disabledTextColor: Colors.black,
                          padding: EdgeInsets.all(8),
                          shape: RoundedRectangleBorder(
                              borderRadius: regularBorderRadius,
                              side: BorderSide(color: Colors.transparent)),
                          splashColor: Colors.lightGreen,
176
177
178
179
180
                          onPressed: () => showModalBottomSheet(
                              context: context,
                              builder: (context) => InsideFilter(),
                              backgroundColor: Colors.transparent,
                              isScrollControlled: true),
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
                          child: Row(
                            children: <Widget>[
                              Icon(Icons.filter_list,
                                  color: Colors.white, size: 20),
                              Text(
                                "Filter Informasi",
                                style: TextStyle(fontSize: 13),
                              ),
                            ],
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
                StreamBuilder(
Fakhira Devina's avatar
Fakhira Devina committed
197
                    stream: _bloc.komentarListStream,
198
199
200
201
202
203
204
205
206
207
208
209
                    builder: (context, snapshot) {
                      if (snapshot.hasData) {
                        switch (snapshot.data.status) {
                          case Status.LOADING:
                            return Center(
                              child: CircularProgressIndicator(
                                valueColor:
                                    AlwaysStoppedAnimation<Color>(greenPrimary),
                              ),
                            );
                            break;
                          case Status.COMPLETED:
210
                            allKomentarFromApi = snapshot.data.data.allKomentar;
Fakhira Devina's avatar
Fakhira Devina committed
211
                            return Column(
212
                                children: allKomentarFromApi
213
                                    .map<Widget>((k) => Komentar(
Fakhira Devina's avatar
Fakhira Devina committed
214
215
216
                                          komentar: k,
                                        ))
                                    .toList());
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
                            break;
                          case Status.ERROR:
                            return Center(
                              child: Text(snapshot.data.data.toString()),
                            );
                            break;
                        }
                      }
                      return Container();
                    }),
              ],
            ),
          ),
        ]),
      ),
232
      appBar: BisaGoAppBar(
233
234
235
236
        key: Key('Scaffold Text Field'),
      ),
    );
  }
Fakhira Devina's avatar
Fakhira Devina committed
237

Fakhira Devina's avatar
Fakhira Devina committed
238
239
  InsideFilter() {
    return StatefulBuilder(
240
      builder: (BuildContext context, StateSetter setStateModal) => Container(
Fakhira Devina's avatar
Fakhira Devina committed
241
242
243
        height: MediaQuery.of(context).size.height / 2,
        decoration: BoxDecoration(
          boxShadow: regularShadow,
244
245
          borderRadius: BorderRadius.only(
              topLeft: Radius.circular(10), topRight: Radius.circular(10)),
Fakhira Devina's avatar
Fakhira Devina committed
246
247
          color: Colors.white,
        ),
248
249
250
251
252
253
254
255
256
257
258
259
260
261
        child: Column(
          children: <Widget>[
            Container(
              padding: EdgeInsets.all(regularBiggerSpace),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  Row(
                    children: <Widget>[
                      Icon(Icons.filter_list),
                      Container(
                        margin: EdgeInsets.only(left: regularSpace),
                        child: Text(
                          'Filter Pencarian',
Fakhira Devina's avatar
Fakhira Devina committed
262
263
264
                          style: TextStyle(
                              color: Colors.black,
                              fontWeight: FontWeight.w800,
265
                              fontSize: 20.0),
Fakhira Devina's avatar
Fakhira Devina committed
266
                        ),
267
268
269
270
271
272
273
274
275
276
277
                      ),
                    ],
                  ),
                  InkWell(
                    onTap: () => Navigator.pop(context),
                    child: Text(
                      'BATAL',
                      style: TextStyle(
                          color: Colors.black,
                          fontWeight: FontWeight.w800,
                          fontSize: 17),
Fakhira Devina's avatar
Fakhira Devina committed
278
                    ),
279
280
                  ),
                ],
Fakhira Devina's avatar
Fakhira Devina committed
281
              ),
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
            ),
            Container(
              decoration: BoxDecoration(
                  border:
                      Border(top: BorderSide(color: greenPrimary, width: 1.5))),
            ),
            Expanded(
              child: Row(
                children: <Widget>[
                  Expanded(
                    flex: 1,
                    child: Container(
                      decoration: BoxDecoration(
                        color: Colors.white,
                      ),
                      child: ListView(
                        children: <Widget>[
                          InkWell(
Fakhira Devina's avatar
Fakhira Devina committed
300
301

                      key: Key('Urutan'),
302
                              child: Container(
Fakhira Devina's avatar
Fakhira Devina committed
303
                                decoration: BoxDecoration(
304
305
306
307
308
309
310
311
312
313
314
315
316
                                  color: greenPale,
                                ),
                                padding: EdgeInsets.only(
                                    left: regularSpace,
                                    right: regularSpace,
                                    top: doubleSpace,
                                    bottom: doubleSpace),
                                child: Text(
                                  'Urutan',
                                  style: TextStyle(
                                    fontSize: 18,
                                    color: Colors.white,
                                    fontFamily: 'Muli',
Fakhira Devina's avatar
Fakhira Devina committed
317
                                  ),
318
319
320
321
322
323
324
325
326
327
328
329
330
331
                                ),
                              ),
                              splashColor: Colors.green[400],
                              highlightColor: Colors.green[400],
                              onTap: () => setStateModal(() {
                                    showUrutan = true;
                                  })),
                          Container(
                            decoration: BoxDecoration(
                                border: Border(
                              top: BorderSide(color: greenPrimary, width: 1.5),
                            )),
                          ),
                          InkWell(
Fakhira Devina's avatar
Fakhira Devina committed
332
                            key: Key('Jenis Fasilitas'),
333
                              child: Container(
Fakhira Devina's avatar
Fakhira Devina committed
334
                                decoration: BoxDecoration(
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
                                  color: greenPale,
                                ),
                                padding: EdgeInsets.only(
                                    left: regularSpace,
                                    right: regularSpace,
                                    top: doubleSpace,
                                    bottom: doubleSpace),
                                child: Text(
                                  'Jenis Fasilitas',
                                  style: TextStyle(
                                    fontSize: 18,
                                    color: Colors.white,
                                    fontFamily: 'Muli',
                                  ),
                                ),
Fakhira Devina's avatar
Fakhira Devina committed
350
                              ),
351
352
353
354
355
356
357
358
359
360
                              splashColor: Colors.green[400],
                              highlightColor: Colors.green[400],
                              onTap: () => setStateModal(() {
                                    showUrutan = false;
                                  })),
                          Container(
                            decoration: BoxDecoration(
                                border: Border(
                                    top: BorderSide(
                                        color: greenPrimary, width: 1.5))),
Fakhira Devina's avatar
Fakhira Devina committed
361
                          ),
362
363
364
365
366
367
368
369
370
371
372
                        ],
                      ),
                    ),
                  ),
                  Expanded(
                    flex: 3,
                    child: Container(
                      decoration: BoxDecoration(
                        color: Colors.white,
                        border: Border(
                          left: BorderSide(color: greenPrimary, width: 1.5),
Fakhira Devina's avatar
Fakhira Devina committed
373
374
                        ),
                      ),
375
376
377
378
379
380
381
                      child: Stack(
                        children: <Widget>[
                          Opacity(
                            opacity: showUrutan ? 1 : 0,
                            child: ListView(
                              children: <Widget>[
                                Row(
Fakhira Devina's avatar
Fakhira Devina committed
382
                                  key: Key('Komentar Terbaru'),
383
                                  crossAxisAlignment: CrossAxisAlignment.center,
Fakhira Devina's avatar
Fakhira Devina committed
384
                                  children: <Widget>[
385
386
387
388
                                    Theme(
                                      data: Theme.of(context).copyWith(
                                        unselectedWidgetColor: greenPrimary,
                                      ),
389
390
391
                                      child: Radio(
                                        value: 0,
                                        groupValue: sortKomentar,
392
                                        activeColor: greenPale,
393
                                        onChanged: (sort) {
394
                                            _bloc.sortKomentarList(
395
396
                                                sort, allKomentarFromApi);

397
                                          setStateModal(() {
398
                                            sortKomentar = sort;
399
400
401
                                          });
                                        },
                                      ),
Fakhira Devina's avatar
Fakhira Devina committed
402
                                    ),
403
404
405
406
                                    Text(
                                      "Komentar Terbaru",
                                      style: TextStyle(
                                          color: Colors.black, fontSize: 18),
Fakhira Devina's avatar
Fakhira Devina committed
407
                                    ),
408
409
410
                                  ],
                                ),
                                Row(
Fakhira Devina's avatar
Fakhira Devina committed
411
                                  key: Key('Komentar Terpopuler'),
412
413
414
415
416
                                  crossAxisAlignment: CrossAxisAlignment.center,
                                  children: <Widget>[
                                    Theme(
                                      data: Theme.of(context).copyWith(
                                        unselectedWidgetColor: greenPrimary,
Fakhira Devina's avatar
Fakhira Devina committed
417
                                      ),
418
419
420
                                      child: Radio(
                                        value: 1,
                                        groupValue: sortKomentar,
421
                                        activeColor: greenPale,
422
423
424
425
                                        onChanged: (sort) {
                                          _bloc.sortKomentarList(
                                              sort, allKomentarFromApi);

426
                                          setStateModal(() {
427
                                            sortKomentar = sort;
428
429
430
431
432
433
434
435
                                          });
                                        },
                                      ),
                                    ),
                                    Text(
                                      "Komentar Terpopuler",
                                      style: TextStyle(
                                          color: Colors.black, fontSize: 18),
Fakhira Devina's avatar
Fakhira Devina committed
436
437
438
                                    ),
                                  ],
                                ),
439
                                Container(
Fakhira Devina's avatar
Fakhira Devina committed
440
                                  key: Key('Komentar dengan Rating Tertinggi'),
441
442
443
444
445
446
447
                                  child: Row(
                                    crossAxisAlignment:
                                        CrossAxisAlignment.center,
                                    children: <Widget>[
                                      Theme(
                                        data: Theme.of(context).copyWith(
                                          unselectedWidgetColor: greenPrimary,
Fakhira Devina's avatar
Fakhira Devina committed
448
                                        ),
449
450
451
                                        child: Radio(
                                          value: 2,
                                          groupValue: sortKomentar,
452
                                          activeColor: greenPale,
453
454
455
456
                                          onChanged: (sort) {
                                            _bloc.sortKomentarList(
                                                sort, allKomentarFromApi);

457
                                            setStateModal(() {
458
                                              sortKomentar = sort;
459
460
461
462
463
464
465
                                            });
                                          },
                                        ),
                                      ),
                                      Flexible(
                                        child: Text(
                                          "Komentar dengan Rating Tertinggi",
Fakhira Devina's avatar
Fakhira Devina committed
466
467
468
469
                                          style: TextStyle(
                                              color: Colors.black,
                                              fontSize: 18),
                                        ),
470
471
472
473
474
475
476
477
478
479
480
481
482
483
                                      ),
                                    ],
                                  ),
                                ),
                              ],
                            ),
                          ),
                          IgnorePointer(
                            ignoring: showUrutan,
                            child: Opacity(
                              opacity: showUrutan ? 0 : 1,
                              child: ListView(
                                children: <Widget>[
                                  Row(
Fakhira Devina's avatar
Fakhira Devina committed
484
                                    key: Key('Kursi Roda'),
485
486
487
488
489
490
                                    crossAxisAlignment:
                                        CrossAxisAlignment.center,
                                    children: <Widget>[
                                      Theme(
                                        data: Theme.of(context).copyWith(
                                          unselectedWidgetColor: greenPrimary,
Fakhira Devina's avatar
Fakhira Devina committed
491
                                        ),
492
493
494
495
496
497
498
499
500
501
502
                                        child: Checkbox(
                                          checkColor: greenPrimary,
                                          activeColor: greenPale,
                                          value: kursiRodaVal,
                                          onChanged: (bool value) {
                                            _bloc.filterKomentarList('KR',
                                                value, allKomentarFromApi);
                                            setStateModal(() {
                                              kursiRodaVal = value;
                                            });
                                          },
Fakhira Devina's avatar
Fakhira Devina committed
503
                                        ),
504
505
506
507
508
509
510
511
512
                                      ),
                                      Text(
                                        "Kursi Roda",
                                        style: TextStyle(
                                            color: Colors.black, fontSize: 18),
                                      ),
                                    ],
                                  ),
                                  Row(
Fakhira Devina's avatar
Fakhira Devina committed
513
                                    key: Key('Lift'),
514
515
516
517
518
519
                                    crossAxisAlignment:
                                        CrossAxisAlignment.center,
                                    children: <Widget>[
                                      Theme(
                                        data: Theme.of(context).copyWith(
                                          unselectedWidgetColor: greenPrimary,
Fakhira Devina's avatar
Fakhira Devina committed
520
                                        ),
521
522
523
524
525
526
527
528
529
530
531
                                        child: Checkbox(
                                          checkColor: greenPrimary,
                                          activeColor: greenPale,
                                          value: liftVal,
                                          onChanged: (bool value) {
                                            _bloc.filterKomentarList('LF',
                                                value, allKomentarFromApi);
                                            setStateModal(() {
                                              liftVal = value;
                                            });
                                          },
Fakhira Devina's avatar
Fakhira Devina committed
532
                                        ),
533
534
535
536
537
538
539
540
541
                                      ),
                                      Text(
                                        "Lift",
                                        style: TextStyle(
                                            color: Colors.black, fontSize: 18),
                                      ),
                                    ],
                                  ),
                                  Row(
Fakhira Devina's avatar
Fakhira Devina committed
542
                                    key: Key('Toilet Disabilitas'),
543
544
545
546
547
548
                                    crossAxisAlignment:
                                        CrossAxisAlignment.center,
                                    children: <Widget>[
                                      Theme(
                                        data: Theme.of(context).copyWith(
                                          unselectedWidgetColor: greenPrimary,
Fakhira Devina's avatar
Fakhira Devina committed
549
                                        ),
550
551
552
553
554
555
556
557
558
559
560
                                        child: Checkbox(
                                          checkColor: greenPrimary,
                                          activeColor: greenPale,
                                          value: toiletDisabilitasVal,
                                          onChanged: (bool value) {
                                            _bloc.filterKomentarList('TD',
                                                value, allKomentarFromApi);
                                            setStateModal(() {
                                              toiletDisabilitasVal = value;
                                            });
                                          },
Fakhira Devina's avatar
Fakhira Devina committed
561
                                        ),
562
563
564
565
566
567
568
569
570
                                      ),
                                      Text(
                                        "Toilet Disabilitas",
                                        style: TextStyle(
                                            color: Colors.black, fontSize: 18),
                                      ),
                                    ],
                                  ),
                                  Row(
Fakhira Devina's avatar
Fakhira Devina committed
571
                                    key: Key('Tempat Ibadah'),
572
573
574
575
576
577
                                    crossAxisAlignment:
                                        CrossAxisAlignment.center,
                                    children: <Widget>[
                                      Theme(
                                        data: Theme.of(context).copyWith(
                                          unselectedWidgetColor: greenPrimary,
Fakhira Devina's avatar
Fakhira Devina committed
578
                                        ),
579
580
581
582
583
584
585
586
587
588
589
                                        child: Checkbox(
                                          checkColor: greenPrimary,
                                          activeColor: greenPale,
                                          value: tempatIbadahVal,
                                          onChanged: (bool value) {
                                            _bloc.filterKomentarList('MM',
                                                value, allKomentarFromApi);
                                            setStateModal(() {
                                              tempatIbadahVal = value;
                                            });
                                          },
Fakhira Devina's avatar
Fakhira Devina committed
590
                                        ),
591
592
593
594
595
596
597
598
                                      ),
                                      Text(
                                        "Tempat Ibadah",
                                        style: TextStyle(
                                            color: Colors.black, fontSize: 18),
                                      ),
                                    ],
                                  ),
599
                                  Row(
Fakhira Devina's avatar
Fakhira Devina committed
600
                                    key: Key('Guiding Block'),
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
                                    crossAxisAlignment:
                                    CrossAxisAlignment.center,
                                    children: <Widget>[
                                      Theme(
                                        data: Theme.of(context).copyWith(
                                          unselectedWidgetColor: greenPrimary,
                                        ),
                                        child: Checkbox(
                                          checkColor: greenPrimary,
                                          activeColor: greenPale,
                                          value: guidingBlockVal,
                                          onChanged: (bool value) {
                                            _bloc.filterKomentarList('GB',
                                                value, allKomentarFromApi);
                                            setStateModal(() {
                                              guidingBlockVal = value;
                                            });
                                          },
                                        ),
                                      ),
                                      Text(
                                        "Guiding Block",
                                        style: TextStyle(
                                            color: Colors.black, fontSize: 18),
                                      ),
                                    ],
                                  ),
628
                                  Row(
Fakhira Devina's avatar
Fakhira Devina committed
629
                                    key: Key('Bidang Miring (Ramp)'),
630
631
632
633
634
635
                                    crossAxisAlignment:
                                        CrossAxisAlignment.center,
                                    children: <Widget>[
                                      Theme(
                                        data: Theme.of(context).copyWith(
                                          unselectedWidgetColor: greenPrimary,
Fakhira Devina's avatar
Fakhira Devina committed
636
                                        ),
637
638
639
640
641
642
643
644
645
646
647
                                        child: Checkbox(
                                          checkColor: greenPrimary,
                                          activeColor: greenPale,
                                          value: bidangMiringVal,
                                          onChanged: (bool value) {
                                            _bloc.filterKomentarList('BM',
                                                value, allKomentarFromApi);
                                            setStateModal(() {
                                              bidangMiringVal = value;
                                            });
                                          },
Fakhira Devina's avatar
Fakhira Devina committed
648
                                        ),
649
650
651
652
653
654
655
656
                                      ),
                                      Text(
                                        "Bidang Miring (Ramp)",
                                        style: TextStyle(
                                            color: Colors.black, fontSize: 18),
                                      ),
                                    ],
                                  ),
657
                                  Row(
Fakhira Devina's avatar
Fakhira Devina committed
658
                                    key: Key('Teman Disabilitas'),
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
                                    crossAxisAlignment:
                                    CrossAxisAlignment.center,
                                    children: <Widget>[
                                      Theme(
                                        data: Theme.of(context).copyWith(
                                          unselectedWidgetColor: greenPrimary,
                                        ),
                                        child: Checkbox(
                                          checkColor: greenPrimary,
                                          activeColor: greenPale,
                                          value: temanDisabilitasVal,
                                          onChanged: (bool value) {
                                            _bloc.filterKomentarList('CP',
                                                value, allKomentarFromApi);
                                            setStateModal(() {
                                              temanDisabilitasVal = value;
                                            });
                                          },
                                        ),
                                      ),
                                      Text(
                                        "Teman Disabilitas",
                                        style: TextStyle(
                                            color: Colors.black, fontSize: 18),
                                      ),
                                    ],
                                  ),
                                  Row(
Fakhira Devina's avatar
Fakhira Devina committed
687
                                    key: Key('Juru Bahasa Isyarat'),
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
                                    crossAxisAlignment:
                                    CrossAxisAlignment.center,
                                    children: <Widget>[
                                      Theme(
                                        data: Theme.of(context).copyWith(
                                          unselectedWidgetColor: greenPrimary,
                                        ),
                                        child: Checkbox(
                                          checkColor: greenPrimary,
                                          activeColor: greenPale,
                                          value: juruIsyaratVal,
                                          onChanged: (bool value) {
                                            _bloc.filterKomentarList('JI',
                                                value, allKomentarFromApi);
                                            setStateModal(() {
                                              juruIsyaratVal = value;
                                            });
                                          },
                                        ),
                                      ),
                                      Text(
                                        "Juru Bahasa Isyarat",
                                        style: TextStyle(
                                            color: Colors.black, fontSize: 18),
                                      ),
                                    ],
                                  ),Row(
Fakhira Devina's avatar
Fakhira Devina committed
715
                                    key: Key("Tongkat Disabilitas Netra"),
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
                                    crossAxisAlignment:
                                    CrossAxisAlignment.center,
                                    children: <Widget>[
                                      Theme(
                                        data: Theme.of(context).copyWith(
                                          unselectedWidgetColor: greenPrimary,
                                        ),
                                        child: Checkbox(
                                          checkColor: greenPrimary,
                                          activeColor: greenPale,
                                          value: tongkatVal,
                                          onChanged: (bool value) {
                                            _bloc.filterKomentarList('TN',
                                                value, allKomentarFromApi);
                                            setStateModal(() {
                                              tongkatVal = value;
                                            });
                                          },
                                        ),
                                      ),
                                      Text(
                                        "Tongkat Disabilitas Netra",
                                        style: TextStyle(
                                            color: Colors.black, fontSize: 18),
                                      ),
                                    ],
                                  ),
                                  Row(
Fakhira Devina's avatar
Fakhira Devina committed
744
                                    key: Key("Kursi Umum Disabilitas"),
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
                                    crossAxisAlignment:
                                    CrossAxisAlignment.center,
                                    children: <Widget>[
                                      Theme(
                                        data: Theme.of(context).copyWith(
                                          unselectedWidgetColor: greenPrimary,
                                        ),
                                        child: Checkbox(
                                          checkColor: greenPrimary,
                                          activeColor: greenPale,
                                          value: kursiDisabilitasVal,
                                          onChanged: (bool value) {
                                            _bloc.filterKomentarList('KD',
                                                value, allKomentarFromApi);
                                            setStateModal(() {
                                              kursiDisabilitasVal = value;
                                            });
                                          },
                                        ),
                                      ),
                                      Text(
                                        "Kursi Umum Disabilitas",
                                        style: TextStyle(
                                            color: Colors.black, fontSize: 18),
                                      ),
                                    ],
                                  ),
772
                                  Row(
Fakhira Devina's avatar
Fakhira Devina committed
773
                                    key: Key("Parkir Umum"),
774
775
776
777
778
779
                                    crossAxisAlignment:
                                        CrossAxisAlignment.center,
                                    children: <Widget>[
                                      Theme(
                                        data: Theme.of(context).copyWith(
                                          unselectedWidgetColor: greenPrimary,
Fakhira Devina's avatar
Fakhira Devina committed
780
                                        ),
781
782
783
784
785
786
787
788
789
790
791
                                        child: Checkbox(
                                          checkColor: greenPrimary,
                                          activeColor: greenPale,
                                          value: parkirUmumVal,
                                          onChanged: (bool value) {
                                            _bloc.filterKomentarList('TB',
                                                value, allKomentarFromApi);
                                            setStateModal(() {
                                              parkirUmumVal = value;
                                            });
                                          },
Fakhira Devina's avatar
Fakhira Devina committed
792
                                        ),
793
794
795
796
797
798
799
800
                                      ),
                                      Text(
                                        "Parkir Umum",
                                        style: TextStyle(
                                            color: Colors.black, fontSize: 18),
                                      ),
                                    ],
                                  ),
801
                                  Row(
Fakhira Devina's avatar
Fakhira Devina committed
802
                                    key: Key('Running Text'),
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
                                    crossAxisAlignment:
                                    CrossAxisAlignment.center,
                                    children: <Widget>[
                                      Theme(
                                        data: Theme.of(context).copyWith(
                                          unselectedWidgetColor: greenPrimary,
                                        ),
                                        child: Checkbox(
                                          checkColor: greenPrimary,
                                          activeColor: greenPale,
                                          value: runningTextVal,
                                          onChanged: (bool value) {
                                            _bloc.filterKomentarList('RT',
                                                value, allKomentarFromApi);
                                            setStateModal(() {
                                              runningTextVal = value;
                                            });
                                          },
                                        ),
                                      ),
                                      Text(
Fakhira Devina's avatar
Fakhira Devina committed
824
                                        "Running Text",
825
826
827
828
829
                                        style: TextStyle(
                                            color: Colors.black, fontSize: 18),
                                      ),
                                    ],
                                  ),
830
                                  Row(
Fakhira Devina's avatar
Fakhira Devina committed
831
                                    key: Key('Parkir Disabilitas'),
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
                                    crossAxisAlignment:
                                        CrossAxisAlignment.center,
                                    children: <Widget>[
                                      Theme(
                                        data: Theme.of(context).copyWith(
                                          unselectedWidgetColor: greenPrimary,
                                        ),
                                        child: Checkbox(
                                          checkColor: greenPrimary,
                                          activeColor: greenPale,
                                          value: parkirDisabilitasVal,
                                          onChanged: (bool value) {
                                            _bloc.filterKomentarList('PK',
                                                value, allKomentarFromApi);
                                            setStateModal(() {
                                              parkirDisabilitasVal = value;
                                            });
                                          },
                                        ),
                                      ),
                                      Text(
                                        "Parkir Disabilitas",
                                        style: TextStyle(
                                            color: Colors.black, fontSize: 18),
                                      ),
                                      //Container(height: 1.0,),
                                    ],
                                  ),
                                ],
Fakhira Devina's avatar
Fakhira Devina committed
861
                              ),
862
                            ),
Fakhira Devina's avatar
Fakhira Devina committed
863
                          ),
864
                        ],
Fakhira Devina's avatar
Fakhira Devina committed
865
                      ),
866
                    ),
Fakhira Devina's avatar
Fakhira Devina committed
867
                  ),
868
                ],
Fakhira Devina's avatar
Fakhira Devina committed
869
              ),
870
871
872
873
874
875
876
877
878
879
880
881
882
            ),
            Column(
              children: <Widget>[
                Container(
                  decoration: BoxDecoration(
                      border: Border(
                    top: BorderSide(color: greenPrimary, width: 1.5),
                  )),
                ),
                Container(
                  margin:
                      EdgeInsets.only(left: doubleSpace, right: doubleSpace),
                  child: Row(
883
884
                    mainAxisSize: MainAxisSize.max,
                    mainAxisAlignment: MainAxisAlignment.center,
885
886
887
888
889
                    children: <Widget>[
                      Container(
                        margin: EdgeInsets.only(
                            top: regularSpace, bottom: regularSpace),
                        decoration: BoxDecoration(boxShadow: regularShadow),
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
                        child: FlatButton(
                          color: redPrimary,
                          textColor: Colors.white,
                          padding: EdgeInsets.only(
                              top: regularBiggerSpace,
                              bottom: regularBiggerSpace,
                              left: doubleSpace,
                              right: doubleSpace),
                          shape: RoundedRectangleBorder(
                              borderRadius: regularBorderRadius,
                              side: BorderSide(color: Colors.transparent)),
                          splashColor: greenPrimary,
                          onPressed: () {
                            setStateModal(() {
                              kursiRodaVal = true;
                              liftVal = true;
                              toiletDisabilitasVal = true;
                              tempatIbadahVal = true;
                              bidangMiringVal = true;
                              parkirUmumVal = true;
                              parkirDisabilitasVal = true;
                              guidingBlockVal = true;
                              temanDisabilitasVal = true;
                              juruIsyaratVal = true;
                              tongkatVal = true;
                              kursiDisabilitasVal = true;
                              runningTextVal = true;
917
                              sortKomentar = -1;
918
919
920
921
922
923
924
                            });
                            _bloc.resetKomentarList();
                          },
                          child: Text(
                            "Hapus Semua",
                            style: TextStyle(
                                fontSize: 20, fontWeight: FontWeight.w400),
Fakhira Devina's avatar
Fakhira Devina committed
925
926
                          ),
                        ),
927
                      ),
928

929
                    ],
Fakhira Devina's avatar
Fakhira Devina committed
930
                  ),
931
932
933
934
                ),
              ],
            ),
          ],
Fakhira Devina's avatar
Fakhira Devina committed
935
936
937
938
        ),
      ),
    );
  }
939

940
941
  @override
  void dispose() {
942
943
944
945
946
947
948
949
950
951
952
953
954
    kursiRodaVal = true;
    liftVal = true;
    toiletDisabilitasVal = true;
    tempatIbadahVal = true;
    bidangMiringVal = true;
    parkirUmumVal = true;
    parkirDisabilitasVal = true;
    guidingBlockVal = true;
    temanDisabilitasVal = true;
    juruIsyaratVal = true;
    tongkatVal = true;
    kursiDisabilitasVal = true;
    runningTextVal = true;
955
    sortKomentar = -1;
956
    super.dispose();
957
  }
Usman Sidiq's avatar
Usman Sidiq committed
958
959
960
961
962
963
964
965
966
967

  checkLoginStatus() async {
    SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
    if(sharedPreferences.getString("token") == null) {
      await Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (BuildContext context) => Login()), (Route<dynamic> route) => false);
    }
    else {
      await Navigator.of(context).push(MaterialPageRoute(
          builder: (BuildContext context) => AddInformasi(
            nama: widget.nama,
Fakhira Devina's avatar
Fakhira Devina committed
968
          ))).then((value) => _bloc.fetchKomentarList(widget.nama));
Usman Sidiq's avatar
Usman Sidiq committed
969
970
971
972
    }
  }


973
}