admin
2021-10-29 a97a225f2ea2cde0c0acf99a7d262f4a8d1d55f3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import 'dart:ui';
 
import 'package:flutter/material.dart';
 
class NotifyDialog extends Dialog {
  final String title;
  final String content;
  final GestureTapCallback onCancel;
  final GestureTapCallback onSure;
 
  NotifyDialog(this.title, this.content, this.onCancel, this.onSure);
 
  @override
  Widget build(BuildContext context) {
    double width = MediaQuery.of(context).size.width;
    double dialogWidth = width * 4 / 5;
    print("屏幕宽:$width");
    //关闭弹框
    // Navigator.pop(context);
    return Material(
        type: MaterialType.transparency,
        child: Align(
            alignment: Alignment.center,
            child: Container(
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.all(Radius.circular(15)),
                  color: Colors.white),
              alignment: Alignment.topCenter,
              height: 240,
              width: dialogWidth,
              child: Flex(
                mainAxisAlignment: MainAxisAlignment.start,
                direction: Axis.vertical,
                children: [
                  Container(
                      alignment: Alignment.center,
                      height: 60,
                      child: Text(
                        title,
                        style: TextStyle(fontSize: 18, color: Colors.white),
                      ),
                      decoration: BoxDecoration(
                        color: Color(0xFF1CC7FF),
                        borderRadius: BorderRadius.only(
                            topLeft: Radius.circular(15),
                            topRight: Radius.circular(15)),
                      )),
                  Expanded(
                      child: Container(
                    alignment: Alignment.center,
                    padding: EdgeInsets.fromLTRB(15, 5, 15, 5),
                    child: Text(
                      content,
                      style: TextStyle(color: Color(0xFF7E7E7E), fontSize: 16),
                    ),
                  )),
                  Flex(
                    direction: Axis.horizontal,
                    children: [
                      Expanded(
                          child: InkWell(
                        onTap: () {
                          Navigator.pop(context);
                          onCancel();
                        },
                        child: Container(
                          margin: EdgeInsets.fromLTRB(15, 0, 6, 15),
                          alignment: Alignment.center,
                          height: 44,
                          decoration: BoxDecoration(
                              border: Border.all(color: Color(0xFF0E96FF)),
                              borderRadius: BorderRadius.circular(10)),
                          child: Text(
                            "取消",
                            style: TextStyle(
                                color: Color(0xFF0E96FF), fontSize: 18),
                          ),
                        ),
                      )),
                      Expanded(
                          child: InkWell(
                        onTap: () {
                          Navigator.pop(context);
                          onSure();
                        },
                        child: Container(
                          margin: EdgeInsets.fromLTRB(6, 0, 15, 15),
                          alignment: Alignment.center,
                          height: 44,
                          decoration: BoxDecoration(
                              color: Color(0xFF0E96FF),
                              borderRadius: BorderRadius.circular(10)),
                          child: Text(
                            "同意",
                            style: TextStyle(color: Colors.white, fontSize: 18),
                          ),
                        ),
                      ))
                    ],
                  )
                ],
              ),
            )));
  }
}