xuiGetGalleria function

List<Widget> xuiGetGalleria({
  1. required BuildContext context,
  2. required List imagesFileList,
  3. dynamic onTapImage()?,
  4. required void onDelete(
    1. dynamic
    ),
  5. required dynamic onPressedEdit(
    1. dynamic i
    ),
})

Implementation

List<Widget> xuiGetGalleria({required BuildContext context, required List<dynamic> imagesFileList, dynamic Function()? onTapImage, required void Function(dynamic) onDelete, required Function(dynamic i) onPressedEdit}) {
  var retval = <Widget>[];
  if (imagesFileList.isNotEmpty) {
    for (var i in imagesFileList) {
      retval.add(XContainerForImage(
          widthContainer: 120,
          heightContainer: 140,
          visibleBTN: true,
          image: i.imageContent!,
          onTapImage: onTapImage,
          onPressedDelete: () {
            return showDialog(
                context: context,
                builder: (BuildContext context) {
                  return AlertDialog(
                      title: const Center(
                          child: const Text(
                        'Sei sicuro di voler cancellare la foto? Una volta cancellata non sarà più recuperabile!!!',
                        style: const TextStyle(fontSize: 18, color: Colors.white),
                      )),
                      content: Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
                        Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[
                          Expanded(
                              child: TextButton(
                                  child: const Text('Si', style: TextStyle(fontSize: 18, color: Colors.greenAccent)),
                                  onPressed: () {
                                    Navigator.pop(context, true);
                                    onDelete(i);
                                  })),
                          Expanded(
                              child: TextButton(
                                  child: const Text('No', style: TextStyle(fontSize: 18, color: Colors.redAccent)),
                                  onPressed: () {
                                    Navigator.pop(context, null);
                                  })),
                        ])
                      ]));
                });
          },
          onPressedEdit: () {
            onPressedEdit(i);
          }));
    }
  } else {
    retval.add(Container());
  }
  return retval;
}