grant_page.dart
7.06 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
205
206
207
208
209
210
211
212
213
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/screen_util.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/system_app_bar.dart';
/**
* 发放消费金
*/
class GrantPage extends StatefulWidget {
const GrantPage({super.key});
@override
State<GrantPage> createState() => _GrantPageState();
}
class _GrantPageState extends State<GrantPage> {
ScrollController controller = ScrollController();
List ladderSelectFree = [];
@override
void initState() {
super.initState();
ladderSelectFree.add('1');
WidgetsBinding.instance.addPostFrameCallback((_) {
// _getConsumeConfig();
});
}
///发放阶梯
Widget _ladderWidget() {
return ListView.builder(
controller: controller,
shrinkWrap: true,
itemCount: ladderSelectFree.length,
itemBuilder: (context, index) {
dynamic data = ladderSelectFree[index];
return Container(
padding: EdgeInsets.only(
left: w(16),
// top: w(12),
bottom: w(12),
),
child: Column(
children: [
Container(
height: w(48),
padding: EdgeInsets.only(right: w(16)),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: MyColours.color_E7E7E7, width: w(0.5)))),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'发放(${index + 1})',
style: TextStyle(
color: MyColours.color_515151, fontSize: font(14)),
),
InkWell(
onTap: () {
//删除媒体
ladderSelectFree.remove(data);
setState(() {});
},
child: Padding(
padding: EdgeInsets.only(top: w(8), bottom: w(8)),
child: Text(
'删除',
style: TextStyle(
color: MyColours.color_438E93,
fontSize: font(12)),
),
))
],
),
),
_ladderPriceWidget(TextEditingController(), FocusNode(),
width: 50),
],
),
);
});
}
//阶梯返还金额widget
Widget _ladderPriceWidget(
TextEditingController controllerGive, FocusNode focusNodeGive,
{num width = 40}) {
return Container(
height: w(40),
margin: EdgeInsets.only(left: w(width)),
padding: EdgeInsets.only(top: w(8), bottom: w(8)),
decoration: BoxDecoration(
border: Border(
bottom:
BorderSide(color: MyColours.color_E7E7E7, width: w(0.5)))),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'发放消费金',
style: TextStyle(color: MyColours.color_515151, fontSize: font(14)),
),
HEmptyView(10),
Container(
width: w(54),
height: w(26),
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(color: MyColours.color_999999, width: w(1))),
child: TextField(
controller: controllerGive,
textAlign: TextAlign.center,
textAlignVertical: TextAlignVertical.center,
maxLines: 1,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp("[0-9.]")),
], // 限制输入为数字,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(20),
),
focusNode: focusNodeGive,
decoration: InputDecoration(
isCollapsed: true,
border: OutlineInputBorder(borderSide: BorderSide.none),
hintText: '请输入数字',
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(20),
),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
focusedBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
),
onChanged: (value) {},
onEditingComplete: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
keyboardType: TextInputType.numberWithOptions()),
),
HEmptyView(10),
Text(
'元',
style: TextStyle(color: MyColours.color_515151, fontSize: font(14)),
),
HEmptyView(10),
Spacer(),
RoundButton(
text: '查看二维码',
width: w(86),
height: w(24),
fontSize: 28,
gradientStart: MyColours.color_438E93,
gradientEnd: MyColours.color_438E93,
textColor: MyColours.color_ffffff,
isBold: false,
radius: 5,
onPressed: () {
//跳转到二维码展示页面
NavigatorUtil.goGrantWechatPage(context);
},
),
HEmptyView(32),
],
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar('发放消费金'),
body: Column(
children: [
_ladderWidget(),
InkWell(
onTap: () {
// LadderData data = LadderData();
ladderSelectFree.add('1');
setState(() {});
},
child: Container(
height: w(30),
margin: EdgeInsets.only(left: w(60), right: w(16)),
alignment: Alignment.centerLeft,
child: Text(
'+增加阶梯',
style: TextStyle(
color: MyColours.color_438E93, fontSize: font(12)),
),
)),
],
),
);
}
}