1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import 'package:flutter/material.dart';
- class TipsDialog {
- static show(BuildContext context, String title, tips) async {
- await showDialog<Null>(
- context: context,
- barrierDismissible: false,
- builder: (BuildContext context) {
- return AlertDialog(
- title: Text(title),
- content: SingleChildScrollView(
- child: ListBody(
- children: <Widget>[Text(tips)],
- ),
- ),
- actions: <Widget>[
- TextButton(
- child: Text('确定'),
- onPressed: () {
- Navigator.of(context).pop();
- },
- ),
- ],
- );
- },
- );
- }
- static wait(BuildContext context, String title, tips) async {
- await showDialog<Null>(
- context: context,
- barrierDismissible: false,
- builder: (BuildContext context) {
- return AlertDialog(
- title: Text(title),
- content: SingleChildScrollView(
- child: ListBody(
- children: <Widget>[Text(tips)],
- ),
- ),
- );
- },
- );
- }
- static showByChoose(
- BuildContext context, String title, tips, yes, no, Function f) async {
- await showDialog<Null>(
- context: context,
- barrierDismissible: false,
- builder: (BuildContext context) {
- return AlertDialog(
- title: Text(title),
- content: SingleChildScrollView(
- child: ListBody(
- children: <Widget>[Text(tips)],
- ),
- ),
- actions: <Widget>[
- TextButton(
- child: Text(no),
- onPressed: () {
- f(false);
- },
- ),
- TextButton(
- child: Text(yes),
- onPressed: () {
- f(true);
- },
- ),
- ],
- );
- },
- );
- }
- }
|