如何将浮动动作粘贴到底部颤振(底部对齐)

时间:2019-06-19 12:40:45

标签: flutter dart

我想要一个FAB粘在屏幕底部,而没有任何填充或其他任何东西。但尚未看到正确的小部件。我宁愿不使用堆栈。有什么建议吗?

1 个答案:

答案 0 :(得分:1)

我使用如下   enter image description here

 floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
          floatingActionButton: Padding(
            padding: const EdgeInsets.all(12.0),
            child: CustomMaterialButton(
              color: Colors.green,
              icon: Icons.check,
              text: 'Uygula',
              onTap: () {},
              iconPosition: IconPosition.LEFT,
            ),
          ),

按钮

Material(
      elevation: 8,
      shadowColor: this.color,
      borderRadius: BorderRadius.circular(4),
      color: this.color,
      child: InkWell(
        highlightC

olor: Colors.transparent,
        onTap: this.onTap,
        child: Container(
          width: double.infinity,
          height: 48,
          child: Center(
            child: this.iconPosition == IconPosition.LEFT
                ? Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: <Widget>[
                      this.icon != null
                          ? Icon(
                              this.icon,
                              color: Colors.white,
                              semanticLabel: 'a',
                            )
                          : Container(),
                      AutoSizeText(
                        ' ${this.text}',
                        textScaleFactor: 1,
                        textAlign: TextAlign.center,
                        style: TextStyle(color: Colors.white, fontSize: 18, 
                        fontFamily: 'Muli'),
                      ),
                    ],
                  )
                : Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: <Widget>[
                      AutoSizeText(
                        ' ${this.text}',
                        textScaleFactor: 1,
                        textAlign: TextAlign.center,
                        style: TextStyle(color: Colors.white, fontSize: 18, 
                        fontFamily: 'Muli'),
                      ),
                      this.icon != null
                          ? Icon(
                              this.icon,
                              semanticLabel: 'a',
                              color: Colors.white,
                            )
                          : Container(),
                    ],
                  ),
          ),
        ),
      ),
    );