import 'package:flutter/material.dart'; class HelpersViewModel { static Future dialog( int buttons, Widget widget, String content, BuildContext context, String textBtn1, String textBtn2, Function callback, Function callback2 ) async { return showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: widget, content: Text(content), actions: [ TextButton( child: Text(textBtn1, style: TextStyle(color: Colors.black)), onPressed: () { Navigator.of(context).pop(); callback(); }, ), if(buttons == 2) TextButton( child: Text(textBtn2, style: TextStyle(color: Colors.black)), onPressed: () { Navigator.of(context).pop(); callback2(); }, ), ], ); }, ); } }