fullscreen: make sure feedback is dismissed before popping to collection

This commit is contained in:
Thibault Deckers 2020-06-13 10:09:04 +09:00
parent 6abd3f800a
commit f8deacd8b6
2 changed files with 8 additions and 3 deletions

View file

@ -4,8 +4,12 @@ import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
mixin FeedbackMixin { mixin FeedbackMixin {
Flushbar _flushbar;
Future<void> dismissFeedback() => _flushbar?.dismiss();
void showFeedback(BuildContext context, String message) { void showFeedback(BuildContext context, String message) {
Flushbar( _flushbar = Flushbar(
message: message, message: message,
margin: const EdgeInsets.all(8), margin: const EdgeInsets.all(8),
borderRadius: 8, borderRadius: 8,
@ -14,6 +18,6 @@ mixin FeedbackMixin {
duration: Durations.opToastDisplay * timeDilation, duration: Durations.opToastDisplay * timeDilation,
flushbarPosition: FlushbarPosition.TOP, flushbarPosition: FlushbarPosition.TOP,
animationDuration: Durations.opToastAnimation, animationDuration: Durations.opToastAnimation,
).show(context); )..show(context);
} }
} }

View file

@ -289,9 +289,10 @@ class FullscreenBodyState extends State<FullscreenBody> with SingleTickerProvide
); );
} }
void _onVerticalPageChanged(int page) { Future<void> _onVerticalPageChanged(int page) async {
_currentVerticalPage.value = page; _currentVerticalPage.value = page;
if (page == transitionPage) { if (page == transitionPage) {
await _actionDelegate.dismissFeedback();
_onLeave(); _onLeave();
Navigator.pop(context); Navigator.pop(context);
} }