隐藏删除符号

master
张萌 3 years ago
parent 8359e7ba61
commit 557dc56a92

@ -12,8 +12,7 @@ class AsGridImageView extends StatelessWidget {
final void Function(dynamic value)? onDelete;
final double? iconSize;
const AsGridImageView.fromFile(
{Key? key,
const AsGridImageView.fromFile({Key? key,
required this.files,
this.placeholder,
this.onDelete,
@ -21,8 +20,7 @@ class AsGridImageView extends StatelessWidget {
: nets = null,
super(key: key);
const AsGridImageView.fromNets(
{Key? key,
const AsGridImageView.fromNets({Key? key,
required this.nets,
this.placeholder,
this.onDelete,
@ -43,8 +41,10 @@ class AsGridImageView extends StatelessWidget {
shrinkWrap: true,
children: files == null
? nets!
.map((e) => GestureDetector(
onTap: () => PhotoViewer.fromNet(
.map((e) =>
GestureDetector(
onTap: () =>
PhotoViewer.fromNet(
context,
tag: e,
net: e,
@ -56,14 +56,12 @@ class AsGridImageView extends StatelessWidget {
child: FadeInImage.assetNetwork(
placeholder: placeholder ?? '', image: e),
),
Positioned(
if(onDelete != null) Positioned(
top: size / 2,
right: size / 2,
child: GestureDetector(
onTap: () {
if (onDelete == null) {
onDelete!(e);
}
},
child: Icon(
CupertinoIcons.xmark_circle_fill,
@ -75,15 +73,14 @@ class AsGridImageView extends StatelessWidget {
))
.toList()
: files!
.map((e) => Stack(children: [
Positioned(
.map((e) =>
Stack(children: [
if(onDelete != null) Positioned(
top: 0,
right: 0,
child: GestureDetector(
onTap: () {
if (onDelete != null) {
onDelete!(e);
}
},
child: Icon(
CupertinoIcons.xmark_circle_fill,
@ -91,7 +88,8 @@ class AsGridImageView extends StatelessWidget {
),
)),
GestureDetector(
onTap: () => PhotoViewer.fromFile(context,
onTap: () =>
PhotoViewer.fromFile(context,
tag: e.path, file: e),
child: Hero(tag: e.path, child: Image.file(e)))
]))

Loading…
Cancel
Save