admin
2021-11-03 0daa197dbaf611eacdf9eeb3763ddcb10038585b
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
import 'dart:async';
import 'dart:io';
import 'dart:ui';
 
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:location/main.dart';
import 'package:location/ui/sos/sos.dart';
import 'package:location/ui/widget/button.dart';
import 'package:location/ui/widget/dialog.dart';
import 'package:location/ui/widget/nav.dart';
import 'package:location/utils/pageutils.dart';
import 'package:location/utils/ui_constant.dart';
 
class SOSContactPage extends StatefulWidget {
  SOSContactPage({Key? key, required this.title}) : super(key: key);
 
  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.
 
  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".
 
  final String title;
 
  @override
  _SOSContactPageState createState() => _SOSContactPageState();
}
 
class _SOSContactPageState extends State<SOSContactPage>
    with SingleTickerProviderStateMixin {
  int selectedIndex = -1;
 
  AnimationController? controller;
  Animation<double>? animation;
 
  @override
  void initState() {
    super.initState();
    controller = new AnimationController(
        duration: const Duration(milliseconds: 300), vsync: this);
    final CurvedAnimation curve =
        CurvedAnimation(parent: controller!, curve: Curves.easeIn);
    animation = Tween(begin: -300.0, end: 0.0).animate(curve)
      ..addListener(() {
        setState(() {});
      });
  }
 
  @override
  void dispose() {
    controller!.dispose();
    super.dispose();
  }
 
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Colors.white,
        body: Stack(children: [
          Container(
            color: Color(0xFFB4E4FF),
            child: Column(
              children: [
                TopNavBar(title: "紧急联系人"),
                Expanded(
                    child: Container(
                  margin: EdgeInsets.all(10),
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(10),
                      color: Colors.white),
                  child: ListView(
                    padding: EdgeInsets.all(0),
                    children: [getListViewItem(0), getListViewItem(1)],
                  ),
                )),
                //---------底部菜单----------
                Container(
                  height: 55,
                  margin: EdgeInsets.only(top: 3, left: 10, right: 10),
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.only(
                          topLeft: Radius.circular(10),
                          topRight: Radius.circular(10)),
                      boxShadow: getViewShadow()),
                  child: Row(
                    children: [
                      Expanded(
                          child: InkWell(
                        onTap: () {
                          //TODO 赋值弹出框
                          if (controller!.status == AnimationStatus.dismissed) {
                            controller!.forward();
                          }
                        },
                        child: Container(
                          child: Flex(
                            mainAxisAlignment: MainAxisAlignment.center,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            direction: Axis.horizontal,
                            children: [
                              Image.asset(
                                "assets/images/common/icon_edit.png",
                                height: 17,
                              ),
                              Container(
                                width: 8,
                              ),
                              const Text(
                                "编辑",
                                style: TextStyle(
                                    color: ColorConstant.theme, fontSize: 15),
                              )
                            ],
                          ),
                        ),
                      )),
                      Container(
                        height: 28,
                        width: 1,
                        color: ColorConstant.theme,
                      ),
                      Expanded(
                          child: InkWell(
                        onTap: () {
                          showGeneralDialog(
                              context: context,
                              pageBuilder: (BuildContext buildContext,
                                  Animation<double> animation,
                                  Animation<double> secondaryAnimation) {
                                return NotifyDialog("温馨提示", "你确认要删除这位紧急联系人吗?",
                                    () {
                                  // Navigator.of(context).pop();
                                }, () {
                                  // Navigator.of(context).pop();
                                });
                              });
                        },
                        child: Container(
                          child: Flex(
                            mainAxisAlignment: MainAxisAlignment.center,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            direction: Axis.horizontal,
                            children: [
                              Image.asset(
                                "assets/images/common/icon_delete.png",
                                height: 17,
                              ),
                              Container(
                                width: 8,
                              ),
                              const Text(
                                "删除",
                                style: TextStyle(
                                    color:ColorConstant.theme, fontSize: 15),
                              )
                            ],
                          ),
                        ),
                      ))
                    ],
                  ),
                )
              ],
            ),
          ),
          Positioned(
              bottom: animation!.value,
              left: 0,
              right: 0,
              child: EmergencyContactEdit("编辑紧急联系人", () {}, () {
                print("点击取消");
                if (controller!.status == AnimationStatus.completed) {
                  controller!.reverse();
                }
              }, () {
                if (controller!.status == AnimationStatus.completed) {
                  controller!.reverse();
                }
              }))
        ]));
  }
 
  Widget getListViewItem(int index) {
    return InkWell(
        onTap: () {
          setState(() {
            selectedIndex = index;
          });
        },
        child: Container(
          height: 77,
          alignment: Alignment.centerLeft,
          padding: const EdgeInsets.fromLTRB(25, 0, 25, 0),
          decoration: BoxDecoration(
            color:
                index == selectedIndex ? const Color(0xFFF0F8FF) : Colors.white,
            borderRadius: BorderRadius.only(
                topLeft: index == 0 ? const Radius.circular(10) : Radius.zero,
                topRight: index == 0 ? const Radius.circular(10) : Radius.zero),
          ),
          child: Row(
            children: [
              Image.asset(
                "assets/images/mine/icon_mine_default_portrait.png",
                height: 50,
              ),
              Container(
                width: 10,
              ),
              Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(
                    "刘洪瑞",
                    style: TextStyle(color: ColorConstant.theme, fontSize: 18),
                  ),
                  Container(
                    height: 5,
                  ),
                  Text("18888888888",
                      style: TextStyle(color: Color(0xFF9DAAB3), fontSize: 15))
                ],
              )
            ],
          ),
        ));
  }
 
  //控件阴影
  List<BoxShadow> getViewShadow() {
    return [
      BoxShadow(
        blurRadius: 6.5,
        spreadRadius: 3,
        color: Color(0x4D0E96FF),
      )
    ];
  }
}