mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
[infra_ui][overlay] Impl route and pannel
This commit is contained in:
parent
06ac3bc29e
commit
a231c96aee
@ -1,7 +1,15 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
final GlobalKey<OverlayManagerState> _key = GlobalKey<OverlayManagerState>();
|
||||||
|
TransitionBuilder overlayManagerBuilder() {
|
||||||
|
return (context, child) {
|
||||||
|
return OverlayManager(key: _key, child: child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class OverlayManager extends StatefulWidget {
|
class OverlayManager extends StatefulWidget {
|
||||||
const OverlayManager({Key? key}) : super(key: key);
|
const OverlayManager({Key? key, required this.child}) : super(key: key);
|
||||||
|
final Widget? child;
|
||||||
|
|
||||||
static OverlayManagerState of(
|
static OverlayManagerState of(
|
||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
@ -50,22 +58,3 @@ class OverlayManagerState extends State<OverlayManager> {
|
|||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO: Impl show method
|
|
||||||
// void show(BuildContext context) {
|
|
||||||
// assert(_overlayRoute == null, 'Can\'t push single overlay twice.');
|
|
||||||
// final NavigatorState navigator = Navigator.of(context);
|
|
||||||
// final RenderBox renderBox = context.findRenderObject()! as RenderBox;
|
|
||||||
|
|
||||||
// _overlayRoute = OverlayPannelRoute(
|
|
||||||
// anchorDirection: widget.anchorDirection,
|
|
||||||
// barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
|
||||||
// anchorPosition: widget.anchorPosition,
|
|
||||||
// maxWidth: widget.maxWidth ?? renderBox.size.width,
|
|
||||||
// maxHeight: widget.maxHeight ?? renderBox.size.height,
|
|
||||||
// );
|
|
||||||
// _createRouteAnimation(_overlayRoute!);
|
|
||||||
|
|
||||||
// navigator.push(_overlayRoute!);
|
|
||||||
// }
|
|
@ -69,7 +69,10 @@ class _OverlayPannelState extends State<OverlayPannel> with WidgetsBindingObserv
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container();
|
return FadeTransition(
|
||||||
|
opacity: _fadeOpacity,
|
||||||
|
child: widget.route.widgetBuilder(context),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -14,6 +14,7 @@ class OverlayPannelRoute extends PopupRoute<_OverlayRouteResult> {
|
|||||||
final Offset anchorPosition;
|
final Offset anchorPosition;
|
||||||
final double maxWidth;
|
final double maxWidth;
|
||||||
final double maxHeight;
|
final double maxHeight;
|
||||||
|
final WidgetBuilder widgetBuilder;
|
||||||
|
|
||||||
OverlayPannelRoute({
|
OverlayPannelRoute({
|
||||||
this.padding = EdgeInsets.zero,
|
this.padding = EdgeInsets.zero,
|
||||||
@ -23,6 +24,7 @@ class OverlayPannelRoute extends PopupRoute<_OverlayRouteResult> {
|
|||||||
required this.anchorPosition,
|
required this.anchorPosition,
|
||||||
required this.maxWidth,
|
required this.maxWidth,
|
||||||
required this.maxHeight,
|
required this.maxHeight,
|
||||||
|
required this.widgetBuilder,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
Loading…
Reference in New Issue
Block a user