showDialog.dart 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. // ignore: must_be_immutable
  4. class LoadingDialog extends Dialog {
  5. String text;
  6. final childCallback;
  7. LoadingDialog({
  8. Key key,
  9. @required this.text,
  10. @required this.childCallback
  11. }): super(key: key);
  12. @override
  13. Widget build(BuildContext context) {
  14. return new Material( //创建透明层
  15. type: MaterialType.transparency, //透明类型
  16. child: new Center( //保证控件居中效果
  17. child: Container(
  18. width: ScreenUtil.getInstance().setWidth(554),
  19. height: ScreenUtil.getInstance().setHeight(345),
  20. decoration: BoxDecoration(
  21. color: Colors.white,
  22. borderRadius: BorderRadius.all(Radius.circular(8))
  23. ),
  24. child: new Container(
  25. child: new Column(
  26. children: < Widget > [
  27. Container(
  28. height: ScreenUtil.getInstance().setHeight(255),
  29. decoration: BoxDecoration(
  30. border: Border(bottom: BorderSide(width: 1, color: Color.fromRGBO(151, 151, 151, 0.27)))
  31. ),
  32. child: Center(
  33. child: Text(text, style: TextStyle(
  34. fontSize: ScreenUtil.getInstance().setSp(32)
  35. ), )
  36. ),
  37. ),
  38. Expanded(
  39. flex: 1,
  40. child: Container(
  41. child: Row(
  42. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  43. children: < Widget > [
  44. Expanded(
  45. flex: 1,
  46. child: InkWell(
  47. child: Container(
  48. decoration: BoxDecoration(
  49. border: Border(right: BorderSide(width: 1, color: Color.fromRGBO(151, 151, 151, 0.27))),
  50. ),
  51. child: Center(
  52. child: Text('取消',
  53. style: TextStyle(
  54. fontSize: ScreenUtil.getInstance().setSp(32),
  55. color: Color.fromRGBO(64, 98, 254, 1)
  56. ), ),
  57. )
  58. ),
  59. onTap: () {
  60. Navigator.pop(context);
  61. },
  62. )
  63. ),
  64. Expanded(
  65. flex: 1,
  66. child: InkWell(
  67. child: Container(
  68. decoration: BoxDecoration(
  69. border: Border(right: BorderSide(width: 1, color: Color.fromRGBO(151, 151, 151, 0.27))),
  70. ),
  71. child: Center(
  72. child: Text('确定',
  73. style: TextStyle(
  74. fontSize: ScreenUtil.getInstance().setSp(32),
  75. color: Color.fromRGBO(64, 98, 254, 1)
  76. ), ),
  77. )
  78. ),
  79. onTap: (){
  80. childCallback(true);
  81. Navigator.pop(context);
  82. },
  83. )
  84. ),
  85. ],
  86. ),
  87. )
  88. )
  89. ],
  90. ),
  91. ),
  92. ),
  93. ),
  94. );
  95. }
  96. }