index.dart 862 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import 'package:flutter/material.dart';
  2. class Utils {
  3. static void showConfirmDialog(BuildContext context,String content, Function confirmCallback) {
  4. showDialog(context: context, builder: (context) {
  5. return new AlertDialog(
  6. title: new Text("提示"),
  7. content: new Text(content),
  8. actions: <Widget>[
  9. new FlatButton(
  10. onPressed: () {
  11. confirmCallback();
  12. Navigator.of(context).pop();
  13. },
  14. child: new Text("确认"),
  15. ),
  16. new FlatButton(
  17. onPressed: () {
  18. Navigator.of(context).pop();
  19. },
  20. child: new Text("取消"),
  21. ),
  22. ],
  23. );
  24. });
  25. }
  26. }
  27. class NetError implements Exception {
  28. String msg;
  29. NetError(this.msg);
  30. @override
  31. String toString() {
  32. return msg;
  33. }
  34. }