Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

[infra_ui][overlay] Impl route and pannel

Jaylen Biana231c96aee3d
diff --git a/app_flowy/packages/flowy_infra_ui/lib/src/overlay/overlay_manager.dart b/app_flowy/packages/flowy_infra_ui/lib/src/overlay/overlay_manager.dart
index 99a0f81bac..fffa1de802 100644
--- a/app_flowy/packages/flowy_infra_ui/lib/src/overlay/overlay_manager.dart
+++ b/app_flowy/packages/flowy_infra_ui/lib/src/overlay/overlay_manager.dart
@@ -1,7 +1,15 @@
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 {
- const OverlayManager({Key? key}) : super(key: key);
+ const OverlayManager({Key? key, required this.child}) : super(key: key);
+ final Widget? child;
static OverlayManagerState of(
BuildContext context, {
@@ -49,23 +57,4 @@ class OverlayManagerState extends State<OverlayManager> {
Navigator.of(context, rootNavigator: true);
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!);
- // }
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/app_flowy/packages/flowy_infra_ui/lib/src/overlay/overlay_pannel.dart b/app_flowy/packages/flowy_infra_ui/lib/src/overlay/overlay_pannel.dart
index a3b4b83331..92f55e88bf 100644
--- a/app_flowy/packages/flowy_infra_ui/lib/src/overlay/overlay_pannel.dart
+++ b/app_flowy/packages/flowy_infra_ui/lib/src/overlay/overlay_pannel.dart
@@ -69,7 +69,10 @@ class _OverlayPannelState extends State<OverlayPannel> with WidgetsBindingObserv
@override
Widget build(BuildContext context) {
- return Container();
+ return FadeTransition(
+ opacity: _fadeOpacity,
+ child: widget.route.widgetBuilder(context),
+ );
}
@override
diff --git a/app_flowy/packages/flowy_infra_ui/lib/src/overlay/overlay_route.dart b/app_flowy/packages/flowy_infra_ui/lib/src/overlay/overlay_route.dart
index 6efe4fb74f..68cf2a853f 100644
--- a/app_flowy/packages/flowy_infra_ui/lib/src/overlay/overlay_route.dart
+++ b/app_flowy/packages/flowy_infra_ui/lib/src/overlay/overlay_route.dart
@@ -14,6 +14,7 @@ class OverlayPannelRoute extends PopupRoute<_OverlayRouteResult> {
final Offset anchorPosition;
final double maxWidth;
final double maxHeight;
+ final WidgetBuilder widgetBuilder;
OverlayPannelRoute({
this.padding = EdgeInsets.zero,
@@ -23,6 +24,7 @@ class OverlayPannelRoute extends PopupRoute<_OverlayRouteResult> {
required this.anchorPosition,
required this.maxWidth,
required this.maxHeight,
+ required this.widgetBuilder,
});
@override