1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import 'package:flutter/material.dart';
- class HelpersViewModel {
- static Future<void> dialog(
- int buttons,
- Widget widget,
- String content,
- BuildContext context,
- String textBtn1,
- String textBtn2,
- Function callback,
- Function callback2
- ) async {
- return showDialog<void>(
- context: context,
- builder: (BuildContext context) {
- return AlertDialog(
- title: widget,
- content: Text(content),
- actions: <Widget>[
- 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();
- },
- ),
- ],
- );
- },
- );
- }
- }
|