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),
|
)
|
];
|
}
|
}
|