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