mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: add secondary button
This commit is contained in:
parent
fe549e8d67
commit
072d94ebe6
@ -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"),
|
||||
),
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user