| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- import 'package:deus_app/common/utils/CommonUtils.dart';
- import 'package:deus_app/common/utils/ConstantString.dart';
- import 'package:deus_app/common/utils/ToastUtils.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- class CloseTaskDialog {
- static void showCupertinoAlertDialog(
- BuildContext context, _CallBack onPressed) {
- String result = '';
- showDialog(
- context: context,
- barrierDismissible:false,
- builder: (BuildContext context) {
- return Theme(
- data: ThemeData(
- dialogBackgroundColor: Colors.white,
- dialogTheme: DialogTheme(backgroundColor: Colors.white)),
- child: CupertinoAlertDialog(
- title: Text(ConstantString.close_task),
- content: Column(
- children: <Widget>[
- SizedBox(
- height: 10,
- ),
- new TextField(
- maxLines: 3,
- decoration: InputDecoration(border: OutlineInputBorder()),
- style: TextStyle(fontSize: 14),
- onChanged: (value) {
- result = value;
- },
- )
- ],
- ),
- actions: <Widget>[
- CupertinoDialogAction(
- child: Text("取消"),
- onPressed: () {
- Navigator.pop(context);
- },
- ),
- CupertinoDialogAction(
- child: Text("确定"),
- onPressed: () {
- if (!CommonUtils.validationInput(result)) {
- showToast(ConstantString.notesNull);
- } else {
- onPressed(result);
- Navigator.pop(context);
- }
- },
- ),
- ],
- ));
- });
- }
- static void showAlertDialog(
- BuildContext context, _Back onPressed,String text) {
- showDialog(
- context: context,
- barrierDismissible:false,
- builder: (BuildContext context) {
- return Theme(
- data: ThemeData(
- dialogBackgroundColor: Colors.white,
- dialogTheme: DialogTheme(backgroundColor: Colors.white)),
- child: CupertinoAlertDialog(
- title: Text('提示'),
- content: Column(
- children: <Widget>[
- SizedBox(
- height: 10,
- ),
- Container(
- padding: EdgeInsets.all(10),
- child: Text(text),
- )
- ],
- ),
- actions: <Widget>[
- CupertinoDialogAction(
- child: Text("取消"),
- onPressed: () {
- Navigator.pop(context);
- },
- ),
- CupertinoDialogAction(
- child: Text("确定"),
- onPressed: () {
- onPressed();
- Navigator.pop(context);
- },
- ),
- ],
- ));
- });
- }
- }
- typedef _CallBack = void Function(String msg);
- typedef _Back = void Function();
|