Flutter-中间的FloatingActionButton [英] Flutter - FloatingActionButton in the center

查看:611
本文介绍了Flutter-中间的FloatingActionButton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将FloatingActionButton置于中心而不是右侧?

Is it possible to make the FloatingActionButton in the centre instead of the right side?

import 'package:flutter/material.dart';
import 'number.dart';
import 'keyboard.dart';

class ContaPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) => new Scaffold(
    body: new Column(
      children: <Widget>[
        new Number(),
        new Keyboard(),
      ],
    ),
    floatingActionButton: new FloatingActionButton(
      elevation: 0.0,
      child: new Icon(Icons.check),
      backgroundColor: new Color(0xFFE57373),
      onPressed: (){}
    )
  );
}

推荐答案

尝试将其包装在Center小部件中,或者在Column上使用CrossAxisAlignment.centercrossAxisAlignment.

Try wrapping it in a Center widget or use a crossAxisAlignment of CrossAxisAlignment.center on your Column.

您应该选择Column的一部分包裹在Flexible中,该部分会折叠起来以避免溢出,或者将其中的部分或全部替换为ListView,以便用户可以滚动查看哪些部分隐藏.

You should pick one part of your Column to be wrapped in a Flexible that will collapse to avoid overflow, or replace some or all of it with a ListView so users can scroll to see the parts that are hidden.

这篇关于Flutter-中间的FloatingActionButton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆