1
1
import 'package:flutter/material.dart' ;
2
2
import 'package:flutter/services.dart' ;
3
3
import 'action_sheet.dart' ;
4
+ import 'weui_icon.dart' ;
4
5
5
6
class Cells extends StatelessWidget {
6
7
Cells ({@required this .children, Key key}) : super (key: key);
@@ -164,14 +165,18 @@ class CellInput extends StatelessWidget {
164
165
}
165
166
166
167
class Cell extends StatefulWidget {
167
- Cell ({this .title = "" , Key key, this .secondaryText = "" , this .banner, this .access = false , this .onPressed, this .radio, this .checkBox}) : super (key: key);
168
+ Cell ({this .title = "" , Key key, this .secondaryText = "" , this .banner, this .access = false , this .onPressed, this .radio, this .checkBox, this .checked = false })
169
+ : super (key: key);
168
170
final String title;
169
171
final String secondaryText;
170
172
final Widget banner;
171
173
final bool access;
172
174
final VoidCallback onPressed;
173
175
final bool radio;
174
176
final bool checkBox;
177
+ final bool checked;
178
+
179
+ ///只在checkBox == true || radio == true时有效
175
180
@override
176
181
State <StatefulWidget > createState () => _Cell ();
177
182
}
@@ -194,22 +199,39 @@ class _Cell extends State<Cell> {
194
199
if (widget.onPressed != null ) widget.onPressed ();
195
200
}
196
201
202
+ _onTapCancel () {
203
+ setState (() {
204
+ bg = Color (0xFFFFFFFF );
205
+ });
206
+ }
207
+
197
208
@override
198
209
Widget build (BuildContext context) {
199
210
return GestureDetector (
200
211
onTapDown: this ._onTapDown,
201
212
onTapUp: this ._onTapUp,
213
+ onTapCancel: this ._onTapCancel,
202
214
child: Container (
203
215
padding: const EdgeInsets .symmetric (vertical: 10 , horizontal: 15 ),
204
216
color: bg,
205
217
child: Row (
206
218
crossAxisAlignment: CrossAxisAlignment .center,
207
219
children: < Widget > [
208
220
Offstage (
209
- child: Icon (
210
- Icons .check_circle,
211
- color: Color (0xFF1AAD19 ),
212
- size: 20 ,
221
+ child: Container (
222
+ margin: const EdgeInsets .only (right: 5 ),
223
+ child: WeuiIcon (
224
+ type: WeuiIconType .success,
225
+ color: widget.checked == true ? Color (0xFF1AAD19 ) : Color (0xFFFFFFFF ),
226
+ size: 20 ,
227
+ ),
228
+ decoration: BoxDecoration (
229
+ borderRadius: BorderRadius .all (Radius .circular (10 )),
230
+ border: Border .all (
231
+ width: 1 ,
232
+ color: Color (0xCCCCCCCC ),
233
+ ),
234
+ ),
213
235
),
214
236
offstage: widget.checkBox != true ,
215
237
),
@@ -242,7 +264,7 @@ class _Cell extends State<Cell> {
242
264
Offstage (
243
265
child: Icon (
244
266
Icons .check,
245
- color: Color (0xFF1AAD19 ),
267
+ color: widget.checked == true ? Color (0xFF1AAD19 ) : Color ( 0xFFFFFFFF ),
246
268
size: 20 ,
247
269
),
248
270
offstage: widget.radio != true ,
0 commit comments