import 'package:fis_ui/index.dart';
import 'package:fis_ui/interface/interactive_container.dart';
import 'package:flutter/material.dart';

/// 自定义扁平按钮（原MiniButton）
class FCustomFlatButton extends StatelessWidget implements FWidget {
  static const double _fontsize = 14;
  final void Function() onPressed;
  final String text;
  final Color? fontColor;

  ///父级节点
  final FInteractiveContainer businessParent;
  FCustomFlatButton(this.text, this.onPressed,
      {required this.businessParent, this.fontColor});
  @override
  FWidget build(BuildContext context) {
    return FExpanded(
      child: FGestureDetector(
        name: text,
        businessParent: businessParent,
        onTap: () {
          onPressed.call();
        },
        child: FContainer(
          alignment: Alignment.center,
          decoration: new BoxDecoration(),
          margin: EdgeInsets.symmetric(
            horizontal: 2,
            vertical: 1,
          ),
          child: FText(
            text,
            style: TextStyle(
              fontSize: _fontsize,
              color: fontColor ?? Colors.black87,
            ),
          ),
        ),
      ),
    );
  }
}
