onlongPress method

dynamic onlongPress(
  1. dynamic context,
  2. List<Media> medialist,
  3. dynamic index
)

Implementation

onlongPress(context, List<Media> medialist, index) {
  showModalBottomSheet<void>(
      shape: const RoundedRectangleBorder(
        borderRadius: BorderRadius.vertical(
          top: Radius.circular(10),
        ),
      ),
      context: context,
      builder: (BuildContext context) {
        return SafeArea(
          child: Wrap(
            children: [
              Column(
                children: [
                  Padding(
                    padding: const EdgeInsets.symmetric(vertical: 10),
                    child: Container(
                      decoration: BoxDecoration(
                        color: Colors.grey[900],
                        borderRadius: const BorderRadius.all(
                          Radius.circular(30),
                        ),
                      ),
                      width: ARMOYU.screenWidth / 4,
                      height: 5,
                    ),
                  ),
                  InkWell(
                    onTap: () async {
                      Navigator.pop(context);

                      MediaDeleteResponse response = await service
                          .mediaServices
                          .delete(mediaID: medialist[index].mediaID);

                      medialist.removeAt(index);
                      updateMediaList();
                      if (!response.result.status) {
                        log(response.result.description.toString());
                        ARMOYUWidget.toastNotification(
                          response.result.description.toString(),
                        );
                        return;
                      }
                    },
                    child: const ListTile(
                      leading: Icon(
                        Icons.delete,
                        color: Colors.red,
                      ),
                      title: Text(
                        "Medyayı Sil",
                        style: TextStyle(
                          color: Colors.red,
                        ),
                      ),
                    ),
                  ),
                  const SizedBox(height: 10),
                ],
              ),
            ],
          ),
        );
      });
}