area_item_table.dart
4.15 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
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/area.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/widgets/h_empty_view.dart';
class AreaItemTableSim extends StatefulWidget {
final String currentArea; //当前选中区域名称
final Area area;
final ValueChanged selectCallback;
final bool showBadge;
AreaItemTableSim(this.area, this.currentArea, this.selectCallback,
{this.showBadge = true});
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new AreaItemTableSimState();
}
}
class AreaItemTableSimState extends State<AreaItemTableSim> {
@override
Widget build(BuildContext context) {
// TODO: implement build
Area area = widget.area;
bool isSelected = area.name == widget.currentArea;
return GestureDetector(
onTap: () {
widget.selectCallback(widget.area);
},
child:
// Stack(
// overflow: Overflow.visible,
// alignment: Alignment.topLeft,
// children: <Widget>[
Container(
// width: ScreenUtil().setWidth(104 * 2),
// height: ScreenUtil().setWidth(10),
margin: EdgeInsets.only(
right: ScreenUtil().setWidth(15),
top: ScreenUtil().setWidth(20),
),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(14),
// vertical: ScreenUtil().setWidth(4)
),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
color: isSelected
? MyColours.color_199095
: widget.showBadge && area.count != -1 && area.count! <= 0
? Color.fromRGBO(154, 154, 154, 1)
: MyColours.color_ffffff,
border: Border.all(
color: MyColours.color_E0E0E0,
width: ScreenUtil().setWidth(2))),
child: Text(
area.name!,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: isSelected ||
(widget.showBadge && area.count != -1 && area.count! <= 0)
? MyColours.color_ffffff
: MyColours.color_333333,
fontSize: ScreenUtil().setSp(24),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
),
),
// !widget.showBadge
// ? SizedBox()
// : area.count == -1
// ? Container()
// : Positioned(
// right: ScreenUtil().setWidth(12),
// top: ScreenUtil().setWidth(6),
// child: Container(
// padding: EdgeInsets.symmetric(
// vertical: ScreenUtil().setWidth(6),
// horizontal: ScreenUtil().setWidth(4)),
// // width: ScreenUtil().setWidth(78),
// // height: ScreenUtil().setWidth(30),
// alignment: Alignment.center,
// decoration: BoxDecoration(
// color: area.count <= 0
// ? MyColours.color_999999
// : MyColours.color_199095,
// // borderRadius: BorderRadius.only(
// // topLeft: Radius.circular(ScreenUtil().setWidth(10)),
// // topRight: Radius.circular(ScreenUtil().setWidth(15)),
// // bottomRight:
// // Radius.circular(ScreenUtil().setWidth(15)))
// ),
// child: Text(area.count <= 0 ? "满座" : "${area.count}",
// style: TextStyle(
// color: MyColours.color_ffffff,
// fontSize: ScreenUtil().setSp(26),
// decoration: TextDecoration.none,
// fontWeight: FontWeight.normal)),
// ),
// ),
// ],
// )
);
}
}