|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter_drag_scale/core/drag_scale_widget.dart';
|
|
|
import 'dart:io';
|
|
|
|
|
|
//确认对话框
|
|
|
class CustomDialogFaceReg extends Dialog {
|
|
|
String title;
|
|
|
String username;
|
|
|
String imagePath;
|
|
|
Size imageSize;
|
|
|
|
|
|
CustomDialogFaceReg(
|
|
|
{@required this.username,
|
|
|
@required this.imagePath,
|
|
|
@required this.imageSize,
|
|
|
this.title = ""});
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
Size mediaSize = MediaQuery.of(context).size;
|
|
|
return WillPopScope(
|
|
|
child: Material(
|
|
|
type: MaterialType.transparency,
|
|
|
child: Container(
|
|
|
padding: EdgeInsets.only(top: 45),
|
|
|
alignment: Alignment(0, -1),
|
|
|
color: Colors.black12,
|
|
|
child: Container(
|
|
|
// height: 260,
|
|
|
// width: 300,
|
|
|
height: mediaSize.height * 0.9,
|
|
|
width: mediaSize.width * 0.98,
|
|
|
//color: Colors.white, //Cannot provide both a color and a decoration
|
|
|
decoration: BoxDecoration(
|
|
|
color: Colors.white,
|
|
|
border: Border.all(color: Colors.blue, width: 2.0),
|
|
|
borderRadius: BorderRadius.all(
|
|
|
Radius.circular(5),
|
|
|
),
|
|
|
),
|
|
|
child: Column(
|
|
|
children: <Widget>[
|
|
|
Padding(
|
|
|
padding: EdgeInsets.fromLTRB(10, 10, 10, 0),
|
|
|
child: Stack(
|
|
|
children: <Widget>[
|
|
|
Align(
|
|
|
alignment: Alignment.center,
|
|
|
child: Text(
|
|
|
title,
|
|
|
style: TextStyle(
|
|
|
fontSize: 20.0,
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
Align(
|
|
|
alignment: Alignment.centerRight,
|
|
|
child: InkWell(
|
|
|
child: Icon(Icons.close),
|
|
|
onTap: () {
|
|
|
Navigator.pop(context, false);
|
|
|
},
|
|
|
),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
Divider(),
|
|
|
Container(
|
|
|
padding: EdgeInsets.fromLTRB(20, 5, 20, 10),
|
|
|
width: double.infinity,
|
|
|
height: mediaSize.height * 0.1,
|
|
|
child: SingleChildScrollView(
|
|
|
child: RichText(
|
|
|
text: TextSpan(children: [
|
|
|
TextSpan(
|
|
|
text: '是否确定为用户 ', style: TextStyle(fontSize: 18.0, color: Colors.blue)),
|
|
|
TextSpan(
|
|
|
text: username,
|
|
|
style: TextStyle(
|
|
|
fontSize: 18.0, fontWeight: FontWeight.bold, color: Colors.red)),
|
|
|
TextSpan(
|
|
|
text: ' 注册或更新以下人脸图片?',
|
|
|
style: TextStyle(fontSize: 18.0, color: Colors.blue)),
|
|
|
]),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
//SizedBox(height: 10),
|
|
|
//480*720
|
|
|
Text('宽高:${imageSize.width}x${imageSize.height}', style: TextStyle(fontSize: 18)),
|
|
|
SizedBox(height: 5),
|
|
|
SingleChildScrollView(
|
|
|
//滑动的方向 Axis.vertical为垂直方向滑动,Axis.horizontal 为水平方向
|
|
|
scrollDirection: Axis.vertical,
|
|
|
reverse: false,
|
|
|
padding: EdgeInsets.all(0.0),
|
|
|
//滑动到底部回弹效果
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
child: Container(
|
|
|
alignment: Alignment(0, 0),
|
|
|
height: mediaSize.height * 0.52,
|
|
|
width: mediaSize.width * 0.95,
|
|
|
decoration: BoxDecoration(
|
|
|
border: Border.all(color: Colors.orange, width: 1.0),
|
|
|
borderRadius: BorderRadius.circular(5),
|
|
|
),
|
|
|
//DragScaleContainer 插件只能放大,不能缩小到比原始尺寸小
|
|
|
child: DragScaleContainer(
|
|
|
doubleTapStillScale: true,
|
|
|
child: Image.file(File(imagePath), fit: BoxFit.fitHeight)),
|
|
|
),
|
|
|
),
|
|
|
SizedBox(height: 10),
|
|
|
Row(
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
children: <Widget>[
|
|
|
RaisedButton(
|
|
|
onPressed: () async {
|
|
|
Navigator.pop(context, true); //关闭弹框,返回 true
|
|
|
},
|
|
|
child: Text("确认"),
|
|
|
),
|
|
|
RaisedButton(
|
|
|
child: Text("取消"),
|
|
|
onPressed: () async {
|
|
|
Navigator.pop(context, false); //关闭弹框,返回 false
|
|
|
},
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
onWillPop: () {
|
|
|
// 屏蔽点击返回键的操作
|
|
|
Navigator.pop(context, false);
|
|
|
},
|
|
|
);
|
|
|
}
|
|
|
}
|