pull_down_button.dart 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import 'package:flutter/material.dart';
  2. import 'package:flyinsono/lab/components/pull_down_button/more_pull_down_button.dart';
  3. import 'package:flyinsono/lab/components/pull_down_button/more_pull_down_menu.dart';
  4. class PullDownButton extends StatefulWidget {
  5. const PullDownButton({
  6. super.key,
  7. required this.onClick,
  8. this.iconData = Icons.menu,
  9. this.moreOperateButtons = const [],
  10. this.child,
  11. });
  12. final VoidCallback onClick;
  13. final List<MorePullDownButton> moreOperateButtons;
  14. final IconData iconData;
  15. final Widget? child;
  16. @override
  17. State<PullDownButton> createState() => _OperateButtonState();
  18. }
  19. class _OperateButtonState extends State<PullDownButton> {
  20. @override
  21. Widget build(BuildContext context) {
  22. return Column(
  23. children: [
  24. // if (widget.operateName != null) Text(widget.operateName!),
  25. // 如果有更多操作按钮,则显示更多操作按钮
  26. if (widget.moreOperateButtons.isNotEmpty)
  27. MorePullDownMenu(
  28. child: widget.child,
  29. buttons: widget.moreOperateButtons,
  30. ),
  31. ],
  32. );
  33. }
  34. }