premium_card.dart
7.91 KB
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
import 'package:doublefeel_flutter/app/modules/home/controllers/today_controller.dart';
import 'package:doublefeel_flutter/core/theme/app_theme.dart';
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class PremiumCard extends StatelessWidget {
const PremiumCard(
this.controller, {
super.key,
});
final TodayController controller;
static const _accent = Color(0xFFFF773C);
static const _proYellow = Color(0xFFFFDF51);
@override
Widget build(BuildContext context) {
return Container(
height: 165,
margin: const EdgeInsets.only(bottom: 12),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
gradient: const LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Color(0xFFFFE8AE), Color(0xFFFFFAED), Colors.white],
stops: [0, 0.5, 1],
),
boxShadow: const [
BoxShadow(
color: Color(0x1A7E7E7E),
offset: Offset(0, 4),
blurRadius: 12,
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(16),
child: Stack(
children: [
Positioned(
top: 7,
right: 12,
child: Image.asset(
'assets/images/today/ic_gift_box.png',
width: 90,
height: 98,
fit: BoxFit.contain,
),
),
Column(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 20, 104, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'年度会员优惠',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: context.colors.textPrimary,
height: 1.2,
),
),
const SizedBox(height: 4),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
const Text(
'20%',
style: TextStyle(
fontSize: 32,
fontWeight: FontWeight.w700,
color: _accent,
height: 1,
),
),
const SizedBox(width: 4),
const Padding(
padding: EdgeInsets.only(bottom: 4),
child: Text(
'优惠',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: _accent,
height: 1.2,
),
),
),
],
),
const Spacer(),
Obx(() => controller.yearlyProductAppleInfo.value !=
null &&
controller.yearlyProduct.value != null
? Row(
children: [
Text(
'现价',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: context.colors.textPrimary,
),
),
const SizedBox(width: 6),
Text(
controller.displayPrice(),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: context.colors.textPrimary,
),
),
const SizedBox(width: 8),
Text(
'原价${controller.originDisplayPrice()}',
style: TextStyle(
fontSize: 12,
color: context.colors.textTertiary,
decoration: TextDecoration.lineThrough,
decorationColor:
context.colors.textTertiary,
),
),
],
)
: SizedBox()),
const SizedBox(height: 12),
],
),
),
),
const Divider(
height: 1,
thickness: 1,
color: Color(0xFFF3F3F3),
indent: 20,
endIndent: 20,
),
Padding(
padding: const EdgeInsets.fromLTRB(20, 10, 16, 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () => controller.toPremiumPage(),
behavior: HitTestBehavior.opaque,
child: Text(
context.l10n.allPlans,
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: _accent,
),
),
),
GestureDetector(
onTap: () => controller.toPremiumDiscoutPage(),
child: Container(
height: 28,
padding: const EdgeInsets.only(left: 12, right: 8),
decoration: BoxDecoration(
color: _proYellow,
borderRadius: BorderRadius.circular(23),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
context.l10n.redeemOffer,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: context.colors.textPrimary,
),
),
const SizedBox(width: 2),
Image.asset(
'assets/images/today/premium_chevron.png',
width: 12,
height: 12,
),
],
),
),
),
],
),
),
],
),
],
),
),
);
}
}