Fakultas Ilmu Komputer UI

kegiatan.dart 6.31 KB
Newer Older
1
import 'package:bisaGo/config/styles.dart';
2
import 'package:bisaGo/model/lokasi.dart';
3
4
import 'package:bisaGo/model/kegiatan.dart';
import 'package:bisaGo/page/filter_fasilitas/postingan/detail_post_kegiatan.dart';
5
import 'package:carousel_slider/carousel_slider.dart';
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import 'package:flutter/material.dart';
// import 'package:bisaGo/component/image_holder.dart';

class Kegiatan extends StatefulWidget {
  final Lokasi lokasi;
  final KegiatanModel kegiatan;

  const Kegiatan({@required this.kegiatan, @required this.lokasi, Key key})
      : super(key: key);
  @override
  _KegiatanState createState() => _KegiatanState();
}

class _KegiatanState extends State<Kegiatan> {

  @override
  Widget build(BuildContext context) {
    return InkWell(
jovi_013's avatar
jovi_013 committed
24
        key: Key(widget.kegiatan.namaKegiatan),
25
26
27
28
29
30
        onTap: () {
          Navigator.of(context).pushReplacement(MaterialPageRoute(
              builder: (BuildContext context) => DetailPostKegiatanPage(
                lokasi: widget.lokasi,
                kegiatan: KegiatanModel(
                  id: widget.kegiatan.id,
jovi_013's avatar
jovi_013 committed
31
                  placeId: widget.kegiatan.placeId,
32
33
34
35
36
                  creator: widget.kegiatan.creator,
                  namaKegiatan: widget.kegiatan.namaKegiatan,
                  penyelenggara: widget.kegiatan.penyelenggara,
                  narahubung: widget.kegiatan.narahubung,
                  deskripsi: widget.kegiatan.deskripsi,
37
38
39
                  timeStart: widget.kegiatan.timeStart,
                  timeEnd: widget.kegiatan.timeEnd,
                  image: widget.kegiatan.image,
40
41
42
43
                ),
              )
          ));
        },
44
45
46
47
48
49
        child: Container(
          margin: const EdgeInsets.only(bottom: regularSpace),
          padding: const EdgeInsets.all(doubleSpace),
          decoration: BoxDecoration(
            boxShadow: regularShadow,
            border: Border.all(width: 2, color: greenPrimary.withOpacity(0.4)),
jovi_013's avatar
jovi_013 committed
50
            borderRadius: const BorderRadius.all(Radius.circular(10)),
51
52
53
54
55
56
57
58
59
60
61
62
            color: Colors.white,
          ),
          child: Stack(
            children: <Widget>[
              Column(
                children: <Widget>[
                  Container(
                    margin: const EdgeInsets.only(bottom: regularSpace),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: <Widget>[
                        Text(
jovi_013's avatar
jovi_013 committed
63
                          widget.kegiatan.namaKegiatan,
64
65
66
67
68
69
70
71
72
73
74
75
76
                          style: const TextStyle(
                            fontSize: 16,
                            fontWeight: FontWeight.w800,
                            color: Colors.black,
                            fontFamily: 'Muli',
                          ),
                        ),
                      ],
                    ),
                  ),
                  Container(
                    margin: const EdgeInsets.only(bottom: regularSpace),
                    child: SizedBox(
77
                      width: MediaQuery.of(context).size.width,
78
                      height: 160,
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
                      child: CarouselSlider(
                        options: CarouselOptions(
                          aspectRatio: 1.0,
                          enlargeCenterPage: true,
                          enableInfiniteScroll: false,
                          initialPage: 0,
                          autoPlay: true,
                        ),
                        items: widget.kegiatan.image.map((item) => Container(
                          child: Container(
                            child: ClipRRect(
                              borderRadius: BorderRadius.all(Radius.circular(20)),
                              child: Stack(
                                children: <Widget>[
                                  Image.network(item, fit: BoxFit.cover, width: 1000.0),
                                  Positioned(
                                    bottom: 0.0,
                                    left: 0.0,
                                    right: 0.0,
                                    child: Container(
                                      decoration: BoxDecoration(
                                        gradient: LinearGradient(
                                          colors: [
                                            Color.fromARGB(200, 0, 0, 0),
                                            Color.fromARGB(0, 0, 0, 0)
                                          ],
                                          begin: Alignment.bottomCenter,
                                          end: Alignment.topCenter,
                                        ),
                                      ),
                                      padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
                                      child: Text(
                                        '#${widget.kegiatan.image.indexOf(item)+1}',
                                        style: TextStyle(
                                          color: Colors.white,
                                          fontSize: 20.0,
                                          fontWeight: FontWeight.bold,
                                        ),
                                      ),
                                    ),
                                  ),
                                ],
                              )
                            ),
                          ),
                        )).toList(),
                      ),
126
127
128
129
130
131
132
133
                    )
                  ),
                  Row(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    mainAxisAlignment: MainAxisAlignment.end,
                    children: <Widget>[
                      Flexible(
                        child: Text(
jovi_013's avatar
jovi_013 committed
134
                          'ditambahkan oleh ${widget.kegiatan.creator}',
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
                          softWrap: true,
                          style: const TextStyle(
                            fontSize: 12,
                            color: Colors.black,
                            fontFamily: 'Muli',
                            fontStyle: FontStyle.italic,
                          ),
                        ),
                      ),
                    ],
                  ),
                ],
              ),
            ],
          ),
        ));
151
152
  }  
}