简体   繁体   English

如何将浮动动作固定到底部颤动(底部对齐)

[英]how to stick floating action to bottom flutter (bottom Align)

I want to have a FAB that sticks to bottom of the screen without any padding or anything.我想要一个固定在屏幕底部的 FAB,没有任何填充或任何东西。 but have not seen the right widget yet.但还没有看到正确的小部件。 I prefer not to use a stack.我不喜欢使用堆栈。 any suggestions?有什么建议?

i use like below我使用如下在此处输入图片说明

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

button按钮

Material(
      elevation: 8,
      shadowColor: this.color,
      borderRadius: BorderRadius.circular(4),
      color: this.color,
      child: InkWell(
        highlightColor: 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(),
                    ],
                  ),
          ),
        ),
      ),
    );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM