full_icon_button 0.0.1+3
full_icon_button: ^0.0.1+3 copied to clipboard

Flutter Android iOS web

A button with icon around it.

full_icon_button #

A button and a text with icon around it.

FullIconButton 继承自MaterialButton,在构造函数里我加了这些属性

    double minWidth,
    double height,
    Widget leftIcon,
    Widget topIcon,
    Widget rightIcon,
    Widget bottomIcon,
    EdgeInsetsGeometry textPadding,

我们可以定义宽高,上下左右图标,还有文字和图标的间距,这样用起来会比较方便了。当然如果你有其他需求一样可以自己加进去。 另外我们用了Column,Row,OffstageColumn控制竖排的widget,Row控制横排的widget,Offstage控制icon的显示或隐藏,Offstage有2个属性offstagechild,其中offstage=true时Offstage就不显示了。 下面我们用下这个FullIconButton

  label: Text("GitHub登录"),
  color: Colors.blue,
  textColor: Colors.white,
  onPressed: () {},
  minWidth: double.infinity,
  leftIcon: Image.asset(
    width: 24,
    height: 24,
    color: Colors.white,
  rightIcon: Icon(Icons.group),
  topIcon: Text("我是👆"),
  bottomIcon: Text("我是👇"),
  textPadding: EdgeInsets.only(left: 10, right: 10),

效果如下: WechatIMG3.png



Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.