@@ -110,21 +110,39 @@ class _FormBuilderImagePickerState extends State<FormBuilderImagePicker> {
110
110
child: ListView (
111
111
scrollDirection: Axis .horizontal,
112
112
children: field.value.map <Widget >((item) {
113
- return Container (
114
- width: widget.imageWidth,
115
- height: widget.imageHeight,
116
- margin: widget.imageMargin,
117
- child: GestureDetector (
118
- child: item is String
119
- ? Image .network (item, fit: BoxFit .cover)
120
- : Image .file (item, fit: BoxFit .cover),
121
- onLongPress: _readOnly
122
- ? null
123
- : () {
124
- field.didChange (
125
- [...field.value]..remove (item));
126
- },
127
- ),
113
+ return Stack (
114
+ alignment: Alignment .topRight,
115
+ children: < Widget > [
116
+ Container (
117
+ width: widget.imageWidth,
118
+ height: widget.imageHeight,
119
+ margin: widget.imageMargin,
120
+ child: item is String
121
+ ? Image .network (item, fit: BoxFit .cover)
122
+ : Image .file (item, fit: BoxFit .cover),
123
+ ),
124
+ if (! _readOnly)
125
+ InkWell (
126
+ onTap: () {
127
+ field.didChange ([...field.value]..remove (item));
128
+ },
129
+ child: Container (
130
+ margin: EdgeInsets .all (3 ),
131
+ decoration: BoxDecoration (
132
+ color: Colors .grey.withOpacity (.7 ),
133
+ shape: BoxShape .circle,
134
+ ),
135
+ alignment: Alignment .center,
136
+ height: 22 ,
137
+ width: 22 ,
138
+ child: Icon (
139
+ Icons .close,
140
+ size: 18 ,
141
+ color: Colors .white,
142
+ ),
143
+ ),
144
+ ),
145
+ ],
128
146
);
129
147
}).toList ()
130
148
..add (
0 commit comments