my_item.dart
1.96 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
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/widgets/h_empty_view.dart';
class MyItem extends StatefulWidget {
final String title;
final String content;
final VoidCallback callback;
final bool needRadius;
const MyItem(
{Key key,
this.title,
this.content,
this.callback,
this.needRadius = false})
: super(key: key);
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new MyItemState();
}
}
class MyItemState extends State<MyItem> {
@override
Widget build(BuildContext context) {
// TODO: implement build
return GestureDetector(
onTap: widget.callback,
child: Container(
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.circular(
widget.needRadius ? ScreenUtil().setWidth(40) : 0)),
width: double.infinity,
height: ScreenUtil().setWidth(122),
padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
alignment: Alignment.center,
child: Row(
children: <Widget>[
Text(
widget.title,
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: MyColours.color_353535),
),
Spacer(),
Text(
widget.content,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_666666),
),
HEmptyView(20),
widget.needRadius
? Container()
: Image.asset(
"assets/arr_right_gray.png",
width: ScreenUtil().setWidth(14),
height: ScreenUtil().setWidth(22),
)
],
),
),
);
}
}