CloseTaskDialog.dart 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import 'package:deus_app/common/utils/CommonUtils.dart';
  2. import 'package:deus_app/common/utils/ConstantString.dart';
  3. import 'package:deus_app/common/utils/ToastUtils.dart';
  4. import 'package:flutter/cupertino.dart';
  5. import 'package:flutter/material.dart';
  6. class CloseTaskDialog {
  7. static void showCupertinoAlertDialog(
  8. BuildContext context, _CallBack onPressed) {
  9. String result = '';
  10. showDialog(
  11. context: context,
  12. barrierDismissible:false,
  13. builder: (BuildContext context) {
  14. return Theme(
  15. data: ThemeData(
  16. dialogBackgroundColor: Colors.white,
  17. dialogTheme: DialogTheme(backgroundColor: Colors.white)),
  18. child: CupertinoAlertDialog(
  19. title: Text(ConstantString.close_task),
  20. content: Column(
  21. children: <Widget>[
  22. SizedBox(
  23. height: 10,
  24. ),
  25. new TextField(
  26. maxLines: 3,
  27. decoration: InputDecoration(border: OutlineInputBorder()),
  28. style: TextStyle(fontSize: 14),
  29. onChanged: (value) {
  30. result = value;
  31. },
  32. )
  33. ],
  34. ),
  35. actions: <Widget>[
  36. CupertinoDialogAction(
  37. child: Text("取消"),
  38. onPressed: () {
  39. Navigator.pop(context);
  40. },
  41. ),
  42. CupertinoDialogAction(
  43. child: Text("确定"),
  44. onPressed: () {
  45. if (!CommonUtils.validationInput(result)) {
  46. showToast(ConstantString.notesNull);
  47. } else {
  48. onPressed(result);
  49. Navigator.pop(context);
  50. }
  51. },
  52. ),
  53. ],
  54. ));
  55. });
  56. }
  57. }
  58. typedef _CallBack = void Function(String msg);