美文网首页
JUIKit---JFlatButton

JUIKit---JFlatButton

作者: Leo_L | 来源:发表于2020-07-29 10:52 被阅读0次

flutter 常用控件,Button--------JFlatButton。

import 'package:flutter/material.dart';

typedef VoidCallback = void Function();

class JFlatButton extends StatelessWidget {

  final String title;
  final TextStyle textStyle;
  final Color color;
  final Color highlightColor;
  final Brightness colorBrightness;
  final Color splashColor;
  final ShapeBorder shape;
  final VoidCallback onPressed;
  final ValueChanged<bool> onHighlightChanged;
  final ButtonTextTheme textTheme;
  final Color textColor;
  final Color disabledTextColor;
  final Color disabledColor;
  final Color focusColor;
  final Color hoverColor;
  final EdgeInsetsGeometry padding;
  final Clip clipBehavior = Clip.none;
  final FocusNode focusNode;
  final bool autofocus = false;
  final MaterialTapTargetSize materialTapTargetSize;
  final double height;
  final EdgeInsetsGeometry frameMargin;///外边框
  final EdgeInsetsGeometry framePadding;///外边框
  final int flex;///大小是否根据文字 自适应 0: 是,1:不是

  const JFlatButton({
    Key key,
    @required this.title,
    @required this.onPressed,
    this.textStyle,
    this.color = Colors.blue,
    this.highlightColor,
    this.colorBrightness = Brightness.dark,
    this.splashColor = Colors.grey,
    this.shape,
    this.height ,
    this.frameMargin,
    this.framePadding,
    this.flex = 1,

    this.onHighlightChanged,
    this.textTheme,
    this.textColor,
    this.disabledTextColor,
    this.disabledColor,
    this.focusColor,
    this.hoverColor,
    this.padding,
    this.focusNode,
    this.materialTapTargetSize,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Expanded(
          flex: this.flex,
          child: Container(
            height: this.height,
            margin: this.frameMargin,
            padding: this.framePadding,
            child: FlatButton(
              onPressed: this.onPressed,
              child:Text(this.title,style: this.textStyle),
              color: this.color,
              highlightColor: this.highlightColor,
              colorBrightness: this.colorBrightness,
              splashColor: this.splashColor,
              shape: this.shape,
              onHighlightChanged: this.onHighlightChanged,
              textTheme: this.textTheme,
              textColor: this.textColor,
              disabledTextColor: this.disabledTextColor,
              disabledColor: this.disabledColor,
              focusColor: this.focusColor,
              hoverColor: this.hoverColor,
              padding: this.padding,
              focusNode: this.focusNode,
              materialTapTargetSize: this.materialTapTargetSize,
            ),
          ),
        ),
      ],
    );
  }
}

相关文章

网友评论

      本文标题:JUIKit---JFlatButton

      本文链接:https://www.haomeiwen.com/subject/ehhhrktx.html