forked from md-siam/widget_of_the_day
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcard.dart
198 lines (196 loc) · 7.01 KB
/
card.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
import 'package:flutter/material.dart';
import 'color_filters.dart';
class MyCard extends StatelessWidget {
const MyCard({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.deepPurple[100],
appBar: AppBar(title: const Text('Card')),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: ListView(
children: [
Card(
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text(
'If life were predictable it would cease to be life, and be without flovor.',
style: TextStyle(fontSize: 24),
),
SizedBox(height: 12),
Text(
'- Eleanor Roosevelt',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
const SizedBox(height: 10),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text(
'Rounded card',
style:
TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
SizedBox(height: 12),
Text(
'This card is rounded',
style: TextStyle(fontSize: 20),
)
],
),
),
),
const SizedBox(height: 10),
Card(
shadowColor: Colors.red,
elevation: 8,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24),
),
child: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [Colors.redAccent, Colors.red],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text(
'Colored card',
style: TextStyle(
fontSize: 20,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 12),
Text(
'This card is rounded and has a gradient',
style: TextStyle(fontSize: 20, color: Colors.white),
),
],
),
),
),
),
const SizedBox(height: 10),
Card(
elevation: 8,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
child: Stack(
alignment: Alignment.center,
children: [
Ink.image(
image: const NetworkImage(
'https://images.unsplash.com/photo-1514888286974-6c03e2ca1dba?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1327&q=80',
),
colorFilter: ColorFilters.greyscale,
child: InkWell(
onTap: () {},
),
height: 240,
fit: BoxFit.cover,
),
const Text(
'Card With Splash',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
],
),
),
const SizedBox(height: 10),
Card(
elevation: 10,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
child: Column(
children: [
Stack(
children: [
Ink.image(
image: const NetworkImage(
'https://images.unsplash.com/photo-1514888286974-6c03e2ca1dba?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1327&q=80',
),
child: InkWell(
onTap: () {},
),
height: 240,
fit: BoxFit.cover,
),
const Positioned(
bottom: 16,
right: 16,
left: 16,
child: Text(
'Card With Splash',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
],
),
Padding(
padding: const EdgeInsets.all(16.0).copyWith(bottom: 0),
child: const Text(
'The cat is the only domesticated species in the family Felidae and is often referred to as the domestic cat to distinguish it from the wild members of the family',
style: TextStyle(fontSize: 16),
),
),
ButtonBar(
alignment: MainAxisAlignment.start,
children: [
TextButton(
onPressed: () {},
child: const Text('Buy Cat'),
),
TextButton(
onPressed: () {},
child: const Text('Buy Cat Food'),
),
],
),
],
),
),
const SizedBox(height: 10),
],
),
),
);
}
}