pop_up_window.dart 807 B

12345678910111213141516171819202122232425262728
  1. import 'package:flowy_infra_ui/flowy_infra_ui.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:window_size/window_size.dart';
  4. class FlowyPoppuWindow extends StatelessWidget {
  5. final Widget child;
  6. const FlowyPoppuWindow({Key? key, required this.child}) : super(key: key);
  7. @override
  8. Widget build(BuildContext context) {
  9. return child;
  10. }
  11. static Future<void> show(
  12. BuildContext context, {
  13. required Widget child,
  14. }) async {
  15. final window = await getWindowInfo();
  16. FlowyOverlay.of(context).insertWithRect(
  17. widget: FlowyPoppuWindow(child: child),
  18. identifier: 'FlowyPoppuWindow',
  19. anchorPosition: Offset.zero,
  20. anchorSize: window.frame.size,
  21. anchorDirection: AnchorDirection.center,
  22. style: FlowyOverlayStyle(blur: true),
  23. );
  24. }
  25. }