category_item.dart
7.29 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
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:Parlando/category/models/category_item_entity.dart';
import 'package:Parlando/poem/poem_router.dart';
import 'package:Parlando/res/gaps.dart';
import 'package:Parlando/res/resources.dart';
import 'package:Parlando/routers/fluro_navigator.dart';
import 'package:Parlando/extension/int_extension.dart';
class CategoryItem extends StatelessWidget {
const CategoryItem({
Key? key,
required this.item,
required this.index,
required this.selectIndex,
}) : super(key: key);
final CategoryItemEntity item;
final int index;
final int selectIndex;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
NavigatorUtils.push(context, '${PoemRouter.poemDetailPage}?id=100');
},
child: item.bgImage != null && item.bgImage != ""
? Container(
margin: EdgeInsets.symmetric(vertical: 5.px, horizontal: 10.px),
width: double.infinity,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(item.bgImage!),
fit: BoxFit.fill,
),
border: Border.all(
color: Colors.grey,
width: 0.5,
), //
),
child: Padding(
padding: EdgeInsets.all(10.px),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
//交叉轴的布局方式,对于column来说就是水平方向的布局方式
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(item.flag ?? "此地"),
// Icon(
// Icons.query_builder_outlined,
// size: 15.0,
// ),
Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Icon(
Icons.room_outlined,
size: 15.px,
),
Text(
item.timeLunar ?? "北京 海淀 万泉庄",
maxLines: 3,
),
],
),
Text(
item.period ?? "冬",
style: const TextStyle(
fontSize: 30,
fontFamily: "ZhiMangXing",
),
),
],
),
Gaps.vGap16,
Text(
item.poem ?? "前不见古人,后不见来者。\n念天地之悠悠,独怆然而涕下。\n",
style: TextStyle(
fontSize: 22.px,
fontFamily: "ZCOOLXiaoWei",
),
),
Gaps.vGap5,
Container(
width: double.infinity,
alignment: Alignment.centerRight,
child: Text(
item.author ?? "[唐] 陈子昂《登幽州台歌》",
maxLines: 1,
),
),
],
),
),
)
: Container(
margin: EdgeInsets.symmetric(vertical: 5.px, horizontal: 10.px),
width: double.infinity,
decoration: BoxDecoration(
color: Colors.grey.shade200.withOpacity(0.1),
border: Border.all(
color: Colors.grey,
width: 0.5,
), // 边色与边宽度
),
child: ClipRect(
child: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: 10.0,
sigmaY: 10.0,
),
child: Container(
decoration: BoxDecoration(
color: Colors.grey.shade200.withOpacity(0.1),
),
child: Padding(
padding: EdgeInsets.all(10.px),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
//交叉轴的布局方式,对于column来说就是水平方向的布局方式
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(item.flag ?? "此地"),
// Icon(
// Icons.query_builder_outlined,
// size: 15.0,
// ),
Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Icon(
Icons.room_outlined,
size: 15.px,
),
Text(
item.timeLunar ?? "北京 海淀 万泉庄",
maxLines: 3,
),
],
),
Text(
item.period ?? "冬",
style: const TextStyle(
fontSize: 30,
fontFamily: "ZhiMangXing",
),
),
],
),
Gaps.vGap16,
Text(
item.poem ?? "前不见古人,后不见来者。\n念天地之悠悠,独怆然而涕下。\n",
style: TextStyle(
fontSize: 22.px,
fontFamily: "ZCOOLXiaoWei",
),
),
Gaps.vGap5,
Container(
width: double.infinity,
alignment: Alignment.centerRight,
child: Text(
item.author ?? "[唐] 陈子昂《登幽州台歌》",
maxLines: 1,
),
),
],
),
),
),
),
),
),
);
}
}