-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmain.dart
149 lines (141 loc) · 5.07 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
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
import 'package:example/movie.dart';
import 'package:flutter/material.dart';
import 'package:flutter_stack_card/flutter_stack_card.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Stack Card',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Stack Card'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
List<Movie> _movieData = Movie().movieData;
var width, height;
@override
Widget build(BuildContext context) {
height = MediaQuery.of(context).size.height;
width = MediaQuery.of(context).size.width;
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Padding(
padding: const EdgeInsets.only(top: 16.0),
child: StackCard.builder(
displayIndicator: true,
displayIndicatorBuilder:
IdicatorBuilder(displayIndicatorActiveColor: Colors.blue),
itemCount: _movieData.length,
onSwap: (index) {
print("Page change to $index");
},
itemBuilder: (context, index) {
Movie movie = _movieData[index];
return _itemBuilder(movie);
},
),
),
);
}
Widget _itemBuilder(Movie movie) {
return Container(
child: Stack(children: <Widget>[
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(12)),
color: Colors.white),
),
SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
height: height * .3,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(12)),
image: DecorationImage(
image: ExactAssetImage(movie.image),
fit: BoxFit.cover)),
),
Container(
height: height * .45,
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Container(
width: 150,
child: Text(
movie.title,
style: TextStyle(
color: Colors.blueGrey, fontSize: 24),
textAlign: TextAlign.left,
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
SizedBox(height: 4),
Text(
movie.display,
style:
TextStyle(fontSize: 14, color: Colors.grey),
textAlign: TextAlign.right,
),
SizedBox(height: 12),
Text(
"IMDB: ${movie.imdb.toString()}",
style: TextStyle(
fontSize: 14, fontWeight: FontWeight.bold),
textAlign: TextAlign.right,
)
],
),
],
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: Text(movie.gendres,
style: TextStyle(fontWeight: FontWeight.bold)),
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(bottom: 16, top: 8),
child: Text(movie.desc,
style: TextStyle(color: Colors.grey)),
),
),
Center(
child: IconButton(
icon: Icon(Icons.drag_handle, color: Colors.grey),
onPressed: () {}),
)
],
),
),
),
],
),
),
]),
);
}
}