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: [ SizedBox( height: 10, ), new TextField( maxLines: 3, decoration: InputDecoration(border: OutlineInputBorder()), style: TextStyle(fontSize: 14), onChanged: (value) { result = value; }, ) ], ), actions: [ CupertinoDialogAction( child: Text("取消"), onPressed: () { Navigator.pop(context); }, ), CupertinoDialogAction( child: Text("确定"), onPressed: () { if (!CommonUtils.validationInput(result)) { showToast(ConstantString.notesNull); } else { onPressed(result); Navigator.pop(context); } }, ), ], )); }); } } typedef _CallBack = void Function(String msg);