table_manage_item.dart
4.95 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
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/models/table.dart' as t;
import 'package:one_key/widgets/v_empty_view.dart';
class ManageTableItem extends StatefulWidget {
final t.Table table;
final bool canMulSelected; //是否多选
final ValueChanged<t.Table> onSelected;
final int height; //高度
ManageTableItem(
this.table, {
this.onSelected,
this.canMulSelected = false,
this.height = 185,
});
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new ManageTableItemState();
}
}
class ManageTableItemState extends State<ManageTableItem> {
@override
Widget build(BuildContext context) {
t.Table table = widget.table;
return GestureDetector(
onTap: () {
widget.onSelected(table);
},
child: Stack(
children: <Widget>[
Container(
decoration: BoxDecoration(
color: table.selected
? MyColours.color_199095
: MyColours.color_ffffff,
border: Border.all(
width: ScreenUtil().setWidth(2),
color: MyColours.color_438E93),
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(10)))),
child: Stack(
// alignment: Alignment.center,
children: <Widget>[
Container(
child: Column(
// mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
VEmptyView(10),
Container(
// color: Colors.red,
height: ScreenUtil().setWidth(48),
alignment: Alignment.center,
child: Text(
table.name,
maxLines: 1,
style: TextStyle(
color: table.selected
? MyColours.color_ffffff
: MyColours.color_438E93,
fontSize: ScreenUtil().setSp(32),
decoration: TextDecoration.none,
fontWeight: FontWeight.bold),
overflow: TextOverflow.ellipsis,
)),
table.tableNum != '' && table.tableNum != null
? Container(
// color: Colors.red,
alignment: Alignment.center,
height: ScreenUtil().setWidth(48),
child: Text(
table.tableNum,
style: TextStyle(
color: table.selected
? MyColours.color_ffffff
: MyColours.color_000000,
fontSize: ScreenUtil().setSp(14),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
overflow: TextOverflow.ellipsis,
),
)
: SizedBox()
],
),
),
Positioned(
left: 0,
top: 0,
child: table.tidStr == null
? Container()
: Container(
width: ScreenUtil().setWidth(44),
height: ScreenUtil().setWidth(22),
alignment: Alignment.center,
decoration: BoxDecoration(
color: table.selected
? MyColours.color_199095
: MyColours.color_999999,
borderRadius: BorderRadius.only(
topLeft:
Radius.circular(ScreenUtil().setWidth(8)),
)),
child: Text(table.tidStr,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(14),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal)),
),
),
],
),
),
],
),
);
}
}