[infra_ui][overlay] Remove deprecated files

This commit is contained in:
Jaylen Bian 2021-08-02 00:31:16 +08:00
parent d7a3e7b2ec
commit e2d063e3ad
3 changed files with 0 additions and 365 deletions

View File

@ -1,187 +0,0 @@
// import 'package:flowy_infra_ui/src/overlay/overlay_basis.dart';
// import 'package:flowy_infra_ui/src/overlay/overlay_route.dart';
// import 'package:flutter/material.dart';
// import 'overlay_hittest.dart';
// final GlobalKey<OverlayManagerState> _key = GlobalKey<OverlayManagerState>();
// /// Invoke this method in app generation process
// TransitionBuilder overlayManagerBuilder() {
// return (context, child) {
// return OverlayManager(key: _key, child: child);
// };
// }
// class OverlayManager extends StatefulWidget {
// const OverlayManager({Key? key, required this.child}) : super(key: key);
// final Widget? child;
// static OverlayManagerState of(
// BuildContext context, {
// bool rootOverlay = false,
// }) {
// OverlayManagerState? overlayManager;
// if (rootOverlay) {
// overlayManager = context.findRootAncestorStateOfType<OverlayManagerState>() ?? overlayManager;
// } else {
// overlayManager = overlayManager ?? context.findAncestorStateOfType<OverlayManagerState>();
// }
// assert(() {
// if (overlayManager == null) {
// throw FlutterError(
// 'Can\'t find overlay manager in current context, please check if already wrapped by overlay manager.',
// );
// }
// return true;
// }());
// return overlayManager!;
// }
// static OverlayManagerState? maybeOf(
// BuildContext context, {
// bool rootOverlay = false,
// }) {
// OverlayManagerState? overlayManager;
// if (rootOverlay) {
// overlayManager = context.findRootAncestorStateOfType<OverlayManagerState>() ?? overlayManager;
// } else {
// overlayManager = overlayManager ?? context.findAncestorStateOfType<OverlayManagerState>();
// }
// return overlayManager;
// }
// @override
// OverlayManagerState createState() => OverlayManagerState();
// }
// class OverlayManagerState extends State<OverlayManager> {
// final Map<String, Map<String, OverlayEntry>> _overlayEntrys = {};
// List<OverlayEntry> get _overlays => _overlayEntrys.values.fold<List<OverlayEntry>>(<OverlayEntry>[], (value, items) {
// return value..addAll(items.values);
// });
// OverlayPannelRoute? _overlayRoute;
// bool isShowingOverlayRoute = false;
// @override
// void initState() {
// super.initState();
// OverlayManagerNavigatorObserver.didPushCallback = _handleDidPush;
// OverlayManagerNavigatorObserver.didPopCallback = _handleDidPop;
// }
// void insert(Widget widget, String featureKey, String key) {
// final overlay = Overlay.of(context);
// assert(overlay != null);
// if (!isShowingOverlayRoute) {
// _showOverlayRoutePage(context: context);
// }
// final entry = OverlayEntry(builder: (_) => widget);
// _overlayEntrys[featureKey] ??= {};
// _overlayEntrys[featureKey]![key] = entry;
// overlay!.insert(entry);
// }
// void insertAll(List<Widget> widgets, String featureKey, List<String> keys) {
// assert(widgets.isNotEmpty);
// assert(widgets.length == keys.length);
// final overlay = Overlay.of(context);
// assert(overlay != null);
// List<OverlayEntry> entries = [];
// _overlayEntrys[featureKey] ??= {};
// for (int idx = 0; idx < widgets.length; idx++) {
// final entry = OverlayEntry(builder: (_) => widget);
// entries.add(entry);
// _overlayEntrys[featureKey]![keys[idx]] = entry;
// }
// overlay!.insertAll(entries);
// }
// void remove(String featureKey, String key) {
// if (_overlayEntrys.containsKey(featureKey)) {
// final entry = _overlayEntrys[featureKey]!.remove(key);
// entry?.remove();
// }
// }
// void removeAll(String featureKey) {
// if (_overlayEntrys.containsKey(featureKey)) {
// final entries = _overlayEntrys.remove(featureKey);
// entries?.forEach((_, overlay) {
// overlay.remove();
// });
// }
// }
// @override
// Widget build(BuildContext context) {
// assert(widget.child != null);
// return GestureDetector(
// behavior: _overlayEntrys.isEmpty ? HitTestBehavior.deferToChild : HitTestBehavior.opaque,
// onTapDown: _handleTapDown,
// child: widget.child,
// );
// }
// void _showOverlayRoutePage({
// required BuildContext context,
// }) {
// _overlayRoute = OverlayPannelRoute(
// barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
// );
// final navigator = Navigator.of(context);
// // TODO: junlin - Use Navigation Overservers
// navigator.push(_overlayRoute!);
// }
// void _handleTapDown(TapDownDetails tapDownDetails) {
// bool hitOnOverlay = false;
// _overlays.forEach((overlay) {});
// }
// void _handleDidPush(Route route, Route? previousRoute) {
// if (route is OverlayPannelRoute) {
// isShowingOverlayRoute = true;
// _showPendingOverlays();
// }
// }
// void _handleDidPop(Route route, Route? previousRoute) {
// if (previousRoute is OverlayPannelRoute) {
// isShowingOverlayRoute = false;
// _removeOverlays();
// }
// }
// void _showPendingOverlays() {}
// void _removeOverlays() {}
// }
// class OverlayManagerNavigatorObserver extends NavigatorObserver {
// static void Function(Route route, Route? previousRoute)? didPushCallback;
// static void Function(Route route, Route? previousRoute)? didPopCallback;
// @override
// void didPush(Route route, Route? previousRoute) {
// if (didPushCallback != null) {
// didPushCallback!(route, previousRoute);
// }
// super.didPush(route, previousRoute);
// }
// @override
// void didPop(Route route, Route? previousRoute) {
// if (didPopCallback != null) {
// didPopCallback!(route, previousRoute);
// }
// super.didPop(route, previousRoute);
// }
// }

View File

@ -1,123 +0,0 @@
// import 'dart:ui' show window;
// import 'package:flowy_infra_ui/src/overlay/overlay_route.dart';
// import 'package:flutter/material.dart';
// import 'overlay_.dart';
// class OverlayPannel extends StatefulWidget {
// const OverlayPannel({
// Key? key,
// this.focusNode,
// this.padding = EdgeInsets.zero,
// this.anchorDirection = AnchorDirection.topRight,
// required this.anchorPosition,
// required this.route,
// }) : super(key: key);
// final FocusNode? focusNode;
// final EdgeInsetsGeometry padding;
// final AnchorDirection anchorDirection;
// final Offset anchorPosition;
// final OverlayPannelRoute route;
// @override
// _OverlayPannelState createState() => _OverlayPannelState();
// }
// class _OverlayPannelState extends State<OverlayPannel> with WidgetsBindingObserver {
// FocusNode? _internalNode;
// FocusNode? get focusNode => widget.focusNode ?? _internalNode;
// late FocusHighlightMode _focusHighlightMode;
// bool _hasPrimaryFocus = false;
// late CurvedAnimation _fadeOpacity;
// late CurvedAnimation _resize;
// OverlayPannelRoute? _overlayRoute;
// @override
// void initState() {
// super.initState();
// _fadeOpacity = CurvedAnimation(
// parent: widget.route.animation!,
// curve: const Interval(0.0, 0.25),
// reverseCurve: const Interval(0.75, 1.0),
// );
// _resize = CurvedAnimation(
// parent: widget.route.animation!,
// curve: const Interval(0.25, 0.5),
// reverseCurve: const Threshold(0.0),
// );
// // TODO: junlin - handle focus action or remove it
// if (widget.focusNode == null) {
// _internalNode ??= _createFocusNode();
// }
// focusNode!.addListener(_handleFocusChanged);
// final FocusManager focusManager = WidgetsBinding.instance!.focusManager;
// _focusHighlightMode = focusManager.highlightMode;
// focusManager.addHighlightModeListener(_handleFocusHighlightModeChanged);
// }
// @override
// void dispose() {
// WidgetsBinding.instance!.removeObserver(this);
// focusNode!.removeListener(_handleFocusChanged);
// WidgetsBinding.instance!.focusManager.removeHighlightModeListener(_handleFocusHighlightModeChanged);
// _internalNode?.dispose();
// super.dispose();
// }
// @override
// Widget build(BuildContext context) {
// return FadeTransition(
// opacity: _fadeOpacity,
// );
// }
// @override
// void didUpdateWidget(OverlayPannel oldWidget) {
// super.didUpdateWidget(oldWidget);
// if (widget.focusNode != oldWidget.focusNode) {
// oldWidget.focusNode?.removeListener(_handleFocusChanged);
// if (widget.focusNode == null) {
// _internalNode ??= _createFocusNode();
// }
// _hasPrimaryFocus = focusNode!.hasPrimaryFocus;
// focusNode!.addListener(_handleFocusChanged);
// }
// }
// // MARK: Focus & Route
// FocusNode _createFocusNode() {
// return FocusNode(debugLabel: '${widget.runtimeType}');
// }
// void _handleFocusChanged() {
// if (_hasPrimaryFocus != focusNode!.hasPrimaryFocus) {
// setState(() {
// _hasPrimaryFocus = focusNode!.hasPrimaryFocus;
// });
// }
// }
// void _handleFocusHighlightModeChanged(FocusHighlightMode mode) {
// if (!mounted) {
// return;
// }
// setState(() {
// _focusHighlightMode = mode;
// });
// }
// // MARK: Layout
// Orientation _getOrientation(BuildContext context) {
// Orientation? result = MediaQuery.maybeOf(context)?.orientation;
// if (result == null) {
// final Size size = window.physicalSize;
// result = size.width > size.height ? Orientation.landscape : Orientation.portrait;
// }
// return result;
// }
// }

View File

@ -1,55 +0,0 @@
// import 'package:flutter/material.dart';
// class _OverlayRouteResult {}
// const Duration _kOverlayDuration = Duration(milliseconds: 0);
// class OverlayPannelRoute extends PopupRoute<_OverlayRouteResult> {
// OverlayPannelRoute({
// this.barrierColor,
// required this.barrierLabel,
// });
// @override
// bool get barrierDismissible => true;
// @override
// Color? barrierColor;
// @override
// String? barrierLabel;
// @override
// Duration get transitionDuration => _kOverlayDuration;
// @override
// Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {
// return LayoutBuilder(builder: (context, contraints) {
// return const _OverlayRoutePage();
// });
// }
// }
// class _OverlayRoutePage extends StatelessWidget {
// const _OverlayRoutePage({
// Key? key,
// }) : super(key: key);
// @override
// Widget build(BuildContext context) {
// assert(debugCheckHasDirectionality(context));
// final TextDirection? textDirection = Directionality.maybeOf(context);
// // TODO: junlin - Use overlay pannel to manage focus node
// return MediaQuery.removePadding(
// context: context,
// removeTop: true,
// removeBottom: true,
// removeLeft: true,
// removeRight: true,
// child: Container(
// color: Colors.blue[100],
// ),
// );
// }
// }