import 'package:flutter/material.dart'; Future showGenericDialog(dynamic object, BuildContext parentContext) { return showGeneralDialog( barrierColor: Colors.black.withOpacity(0.5), transitionDuration: const Duration(milliseconds: 220), transitionBuilder: (BuildContext context, Animation animation, Animation secondaryAnimation, Widget child) { Animation custom = Tween( begin: const Offset(0.0, 1.0), end: const Offset(0.0, 0.0)) .animate(animation); return SlideTransition( position: custom, child: Dialog.fullscreen(child: object)); }, barrierDismissible: true, barrierLabel: '', context: parentContext, pageBuilder: (context, animation1, animation2) { return Container(); }); } Future showCrudDialog(String title, String content, BuildContext context, dynamic daoCall, dynamic object) { return showAdaptiveDialog( context: context, builder: (BuildContext context) => AlertDialog( title: Text(title), content: Text(content), actions: [ TextButton( onPressed: () => { Navigator.pop(context, 'Cancel'), }, child: const Text('Cancel'), ), TextButton( onPressed: () => {daoCall(object), Navigator.pop(context, 'OK')}, child: const Text('OK'), ), ], ), ); } Future showRemovalDialog(String title, String content, BuildContext context, dynamic dao, dynamic object) { return showCrudDialog(title, content, context, dao.remove, object); } Future showUpdateDialog(String title, String content, BuildContext context, dynamic dao, dynamic object) { return showCrudDialog(title, content, context, dao.replace, object); }