-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfrosted_glass_effect.dart
208 lines (202 loc) · 6.6 KB
/
frosted_glass_effect.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
199
200
201
202
203
204
205
206
207
208
import 'dart:ui';
import 'package:flutter/material.dart';
class BackDropFilter extends StatelessWidget {
const BackDropFilter({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
backgroundColor: Colors.white12,
title: Text("Flutter Frosted Glass Effect Demo"),
),
body: Container(
height: double.infinity,
width: double.infinity,
color: Colors.black,
child: Stack(
children: [
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 200,
height: 200,
margin: EdgeInsets.only(left: 200),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.pink.shade700,
Colors.orange.shade500,
],
begin: Alignment.topRight,
end: Alignment.bottomLeft,
),
borderRadius: BorderRadius.circular(100),
),
),
Container(
width: 100,
height: 100,
margin: EdgeInsets.only(right: 270),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.pink.shade700,
Colors.orange.shade500,
],
begin: Alignment.topRight,
end: Alignment.bottomLeft,
),
borderRadius: BorderRadius.circular(100),
),
),
],
),
),
FrostedGlassEffectDemo(),
],
),
),
);
}
}
class FrostedGlassEffectDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: Container(
child: Stack(
children: [
BackdropFilter(
filter: ImageFilter.blur(
sigmaX: 7,
sigmaY: 7,
),
child: Container(
height: 220,
width: 360,
),
),
Container(
height: 230,
width: 360,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.25),
),
],
border: Border.all(
color: Colors.white.withOpacity(0.2),
width: 1.0,
),
gradient: LinearGradient(
colors: [
Colors.white.withOpacity(0.5),
Colors.white.withOpacity(0.2),
],
stops: [0.0, 1.0],
),
borderRadius: BorderRadius.circular(20),
),
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
children: [
SizedBox(
height: 10,
),
SizedBox(
width: 270,
child: Text(
"Debit Card",
style: TextStyle(
color: Colors.white.withOpacity(0.6),
fontWeight: FontWeight.bold,
fontSize: 22,
),
),
),
SizedBox(
height: 70,
),
Text(
"7622 4574 3688 3640 ",
style: TextStyle(
fontSize: 23,
color: Colors.white.withOpacity(0.4),
),
),
SizedBox(
width: 275,
child: Row(
children: [
Text(
"6372",
style: TextStyle(
color: Colors.white.withOpacity(0.5),
fontSize: 12,
),
),
SizedBox(
width: 100,
),
Text(
"VALID \n THRU",
style: TextStyle(
fontSize: 6,
color: Colors.white.withOpacity(0.5),
fontWeight: FontWeight.bold,
),
),
Text(
" 09/25",
style: TextStyle(
fontSize: 14,
color: Colors.white.withOpacity(0.5),
),
),
],
),
),
SizedBox(
height: 10,
),
SizedBox(
width: 275,
child: Text(
"FLUTTER DEVS",
style: TextStyle(
color: Colors.white.withOpacity(0.6),
fontWeight: FontWeight.bold,
),
),
),
],
),
),
),
],
),
),
),
);
}
}