fullscreen: fixed scaffold and snackbar

This commit is contained in:
Thibault Deckers 2019-08-15 14:21:29 +09:00
parent c78241e204
commit a3ac7d8f22
3 changed files with 91 additions and 84 deletions

View file

@ -7,6 +7,7 @@ import 'package:aves/widgets/fullscreen/info/info_page.dart';
import 'package:aves/widgets/fullscreen/overlay_bottom.dart';
import 'package:aves/widgets/fullscreen/overlay_top.dart';
import 'package:aves/widgets/fullscreen/video.dart';
import 'package:flushbar/flushbar.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
@ -38,6 +39,35 @@ class FullscreenPage extends StatelessWidget {
entries: entries,
initialUri: initialUri,
),
resizeToAvoidBottomInset: false,
// Hero(
// tag: uri,
// child: Stack(
// children: [
// Center(
// child: widget.thumbnail == null
// ? CircularProgressIndicator()
// : Image.memory(
// widget.thumbnail,
// width: requestWidth,
// height: requestHeight,
// fit: BoxFit.contain,
// ),
// ),
// Center(
// child: FadeInImage(
// placeholder: MemoryImage(kTransparentImage),
// image: FileImage(File(path)),
// fadeOutDuration: Duration(milliseconds: 1),
// fadeInDuration: Duration(milliseconds: 200),
// width: requestWidth,
// height: requestHeight,
// fit: BoxFit.contain,
// ),
// ),
// ],
// ),
// ),
),
);
}
@ -110,15 +140,7 @@ class FullscreenBodyState extends State<FullscreenBody> with SingleTickerProvide
@override
Widget build(BuildContext context) {
final entry = entries[_currentHorizontalPage];
return WillPopScope(
onWillPop: () {
Screen.keepOn(false);
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
return Future.value(true);
},
child: Scaffold(
backgroundColor: Colors.black,
body: Stack(
return Stack(
children: [
PageView(
scrollDirection: Axis.vertical,
@ -165,37 +187,6 @@ class FullscreenBodyState extends State<FullscreenBody> with SingleTickerProvide
)
]
],
),
resizeToAvoidBottomInset: false,
// Hero(
// tag: uri,
// child: Stack(
// children: [
// Center(
// child: widget.thumbnail == null
// ? CircularProgressIndicator()
// : Image.memory(
// widget.thumbnail,
// width: requestWidth,
// height: requestHeight,
// fit: BoxFit.contain,
// ),
// ),
// Center(
// child: FadeInImage(
// placeholder: MemoryImage(kTransparentImage),
// image: FileImage(File(path)),
// fadeOutDuration: Duration(milliseconds: 1),
// fadeInDuration: Duration(milliseconds: 200),
// width: requestWidth,
// height: requestHeight,
// fit: BoxFit.contain,
// ),
// ),
// ],
// ),
// ),
),
);
}
@ -247,8 +238,16 @@ class FullscreenBodyState extends State<FullscreenBody> with SingleTickerProvide
});
if (newName == null || newName.isEmpty) return;
final success = await entry.rename(newName);
final snackBar = SnackBar(content: Text(success ? 'Done!' : 'Failed'));
Scaffold.of(context).showSnackBar(snackBar);
Flushbar(
message: success ? 'Done!' : 'Failed',
margin: EdgeInsets.all(8),
borderRadius: 8,
borderColor: Colors.white30,
borderWidth: 0.5,
duration: Duration(seconds: 2),
flushbarPosition: FlushbarPosition.TOP,
animationDuration: Duration(milliseconds: 600),
)..show(context);
}
onActionSelected(ImageEntry entry, FullscreenAction action) {

View file

@ -43,6 +43,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
flushbar:
dependency: "direct main"
description:
name: flushbar
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
flutter:
dependency: "direct main"
description: flutter

View file

@ -21,6 +21,7 @@ dependencies:
sdk: flutter
chewie:
collection:
flushbar:
flutter_sticky_header:
geocoder:
google_maps_flutter: