import 'package:flutter/material.dart';
import 'package:flyinsono/lab/components/pull_down_button/more_pull_down_button.dart';
import 'package:flyinsono/lab/components/pull_down_button/more_pull_down_menu.dart';

class PullDownButton extends StatefulWidget {
  const PullDownButton({
    super.key,
    required this.onClick,
    this.iconData = Icons.menu,
    this.moreOperateButtons = const [],
    this.child,
  });
  final VoidCallback onClick;
  final List<MorePullDownButton> moreOperateButtons;
  final IconData iconData;
  final Widget? child;

  @override
  State<PullDownButton> createState() => _OperateButtonState();
}

class _OperateButtonState extends State<PullDownButton> {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        // if (widget.operateName != null) Text(widget.operateName!),

        // 如果有更多操作按钮，则显示更多操作按钮
        if (widget.moreOperateButtons.isNotEmpty)
          MorePullDownMenu(
            child: widget.child,
            buttons: widget.moreOperateButtons,
          ),
      ],
    );
  }
}
