You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
2.4 KiB
83 lines
2.4 KiB
part of ansu_ui;
|
|
|
|
class CameraView extends StatefulWidget {
|
|
final File file;
|
|
final String title;
|
|
CameraView({Key key, this.file, this.title}) : super(key: key);
|
|
|
|
@override
|
|
_CameraViewState createState() => _CameraViewState();
|
|
}
|
|
|
|
class _CameraViewState extends State<CameraView> {
|
|
_buildButton({String title, Color color = kTextColor, onPressed}) {
|
|
return MaterialButton(
|
|
child: title.text.bold.size(18).copyWith(color: color),
|
|
onPressed: onPressed,
|
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
height: 48.w,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ASScaffold(
|
|
title: widget.title,
|
|
body: BackdropFilter(
|
|
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
|
|
child: Container(
|
|
alignment: Alignment.center,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
toPhotoViewer(context, tag: widget.title, file: widget.file);
|
|
},
|
|
child: Hero(
|
|
child: Image.file(
|
|
widget.file,
|
|
fit: BoxFit.cover,
|
|
),
|
|
tag: widget.title,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
bottomNavigationBar: Material(
|
|
color: kForegroundColor,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: <Widget>[
|
|
_buildButton(
|
|
title: '重拍',
|
|
onPressed: () async {
|
|
File file = await camFile();
|
|
if (file == null)
|
|
Navigator.pop(context);
|
|
else
|
|
Navigator.pushReplacement(context, PageRouteBuilder(
|
|
pageBuilder: (context, animation, secondAnimation) {
|
|
return FadeTransition(
|
|
opacity: animation,
|
|
child: CameraView(file: file, title: widget.title),
|
|
);
|
|
},
|
|
));
|
|
},
|
|
),
|
|
_buildButton(
|
|
title: '删除',
|
|
color: kDangerColor,
|
|
onPressed: () => Navigator.pop(context),
|
|
),
|
|
_buildButton(
|
|
title: '确认',
|
|
onPressed: () => Navigator.pop(context, widget.file),
|
|
),
|
|
].sepWidget(separate: ASDivider()),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|