| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import 'package:flutter/material.dart';
- class TipsDialog {
- static Future<void> show(
- BuildContext context,
- String title,
- String tips,
- ) {
- return showDialog<void>(
- context: context,
- barrierDismissible: false,
- builder: (context) {
- return AlertDialog(
- title: Text(title),
- content: SingleChildScrollView(
- child: ListBody(children: [Text(tips)]),
- ),
- actions: [
- TextButton(
- child: const Text('确定'),
- onPressed: () => Navigator.of(context).pop(),
- ),
- ],
- );
- },
- );
- }
- static Future<bool?> showByChoose(
- BuildContext context,
- String title,
- String tips,
- String yes,
- String no,
- ) {
- return showDialog<bool>(
- context: context,
- barrierDismissible: false,
- builder: (context) {
- return AlertDialog(
- title: Text(title),
- content: SingleChildScrollView(
- child: ListBody(children: [Text(tips)]),
- ),
- actions: [
- TextButton(
- child: Text(no),
- onPressed: () => Navigator.of(context).pop(false),
- ),
- TextButton(
- child: Text(yes),
- onPressed: () => Navigator.of(context).pop(true),
- ),
- ],
- );
- },
- );
- }
- }
|