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_bottom.dart';
import 'package:aves/widgets/fullscreen/overlay_top.dart'; import 'package:aves/widgets/fullscreen/overlay_top.dart';
import 'package:aves/widgets/fullscreen/video.dart'; import 'package:aves/widgets/fullscreen/video.dart';
import 'package:flushbar/flushbar.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -38,6 +39,35 @@ class FullscreenPage extends StatelessWidget {
entries: entries, entries: entries,
initialUri: initialUri, 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final entry = entries[_currentHorizontalPage]; final entry = entries[_currentHorizontalPage];
return WillPopScope( return Stack(
onWillPop: () {
Screen.keepOn(false);
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
return Future.value(true);
},
child: Scaffold(
backgroundColor: Colors.black,
body: Stack(
children: [ children: [
PageView( PageView(
scrollDirection: Axis.vertical, 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; if (newName == null || newName.isEmpty) return;
final success = await entry.rename(newName); final success = await entry.rename(newName);
final snackBar = SnackBar(content: Text(success ? 'Done!' : 'Failed')); Flushbar(
Scaffold.of(context).showSnackBar(snackBar); 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) { onActionSelected(ImageEntry entry, FullscreenAction action) {

View file

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

View file

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