【问题标题】:how to achieve LinearLayout like layout in flutter?如何在颤动中实现类似LinearLayout的布局?
【发布时间】:2018-12-05 07:05:41
【问题描述】:

我是flutter的新手,如何在flutter中实现类似布局的Linear Layout?布局视图的水平和垂直。

【问题讨论】:

    标签: android ios flutter android-linearlayout flutter-layout


    【解决方案1】:

    Row 是水平线性布局

    new Row(
      children: <Widget>[
       ///display children in a horizontal manner
      ],
    

    Column是垂直线性布局

    new Column (
      children: <Widget>[
       ///display children in a vertical manner 
      ],
    

    【讨论】:

      【解决方案2】:

      首先你应该尝试理解 Flutter 中的线性布局链接如下。

      https://flutter.io/flutter-for-android/#what-is-the-equivalent-of-a-linearlayout

      之后你就可以实现它了。

      【讨论】:

        【解决方案3】:

        在flutter中实现纯线性布局,在管理主轴和交叉轴对齐的同时使用row widget

        示例

        假设您想以相同的重量水平显示两个图标,即每个图标 1-1 像这样使用行

        Container(
                    color: Colors.yellowAccent,
                    child: new Row(
                      mainAxisSize: MainAxisSize.max,
                      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        new Icon(
                          Icons.access_time,
                          size: 50.0,
                        ),
                        new Icon(
                          Icons.pie_chart,
                          size: 100.0,
                        ),
                      ],
                    ),
                  )
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2021-10-05
          • 2015-03-03
          • 2021-09-21
          • 1970-01-01
          • 1970-01-01
          • 2020-07-19
          • 2011-03-10
          • 1970-01-01
          相关资源
          最近更新 更多