2021-07-11 06:48:50 +02:00
|
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
import 'package:nc_photos/widget/my_app.dart';
|
|
|
|
|
|
|
|
mixin PageVisibilityMixin<T extends StatefulWidget> on State<T>, RouteAware {
|
|
|
|
@override
|
|
|
|
didChangeDependencies() {
|
|
|
|
super.didChangeDependencies();
|
2021-07-23 22:05:57 +02:00
|
|
|
MyApp.routeObserver.subscribe(this, ModalRoute.of(context)!);
|
2021-07-11 06:48:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
dispose() {
|
|
|
|
MyApp.routeObserver.unsubscribe(this);
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
didPush() {
|
|
|
|
_isVisible = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
didPushNext() {
|
|
|
|
_isVisible = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
didPop() {
|
|
|
|
_isVisible = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
didPopNext() {
|
|
|
|
_isVisible = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isPageVisible() => _isVisible;
|
|
|
|
|
|
|
|
var _isVisible = true;
|
|
|
|
}
|