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.

feat: add secondary button

Vincent Chan072d94ebe6e9
diff --git a/frontend/app_flowy/packages/appflowy_popover/example/lib/example_button.dart b/frontend/app_flowy/packages/appflowy_popover/example/lib/example_button.dart
index d98c37d99d..8f1a6997d5 100644
--- a/frontend/app_flowy/packages/appflowy_popover/example/lib/example_button.dart
+++ b/frontend/app_flowy/packages/appflowy_popover/example/lib/example_button.dart
@@ -1,8 +1,14 @@
import 'package:flutter/material.dart';
import 'package:appflowy_popover/appflowy_popover.dart';
-class PopoverMenu extends StatelessWidget {
+class PopoverMenu extends StatefulWidget {
+ @override
+ State<StatefulWidget> createState() => _PopoverMenuState();
+}
+
+class _PopoverMenuState extends State<PopoverMenu> {
final AppFlowyPopoverController popover = AppFlowyPopoverController();
+ final AppFlowyPopoverController hoverPopover = AppFlowyPopoverController();
@override
Widget build(BuildContext context) {
return Container(
@@ -23,6 +29,35 @@ class PopoverMenu extends StatelessWidget {
onPressed: () {
popover.show();
},
+ onHover: (value) {
+ if (value) {
+ popover.show();
+ } else {
+ popover.close();
+ }
+ },
+ child: const Text("First"),
+ ),
+ ),
+ AppFlowyPopover(
+ controller: hoverPopover,
+ offset: const Offset(10, 0),
+ targetAnchor: Alignment.topRight,
+ followerAnchor: Alignment.topLeft,
+ popupBuilder: (BuildContext context) {
+ return PopoverMenu();
+ },
+ child: TextButton(
+ onPressed: () {
+ hoverPopover.show();
+ },
+ onHover: (value) {
+ if (value) {
+ hoverPopover.show();
+ } else {
+ hoverPopover.close();
+ }
+ },
child: const Text("Second"),
),
),