【问题标题】:my flutter app is not fitting in different devices我的颤振应用程序不适合不同的设备
【发布时间】:2018-12-03 03:17:49
【问题描述】:
new Container(
          margin: const EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
          color: Colors.black12,
          child: new Row(

            children: <Widget>[
              new Image.asset('images/driver.jpeg',
                  height: 80.0,
                  width:150.0,
                alignment: Alignment.topLeft,
                repeat:ImageRepeat.repeat ,
                fit: BoxFit.fitHeight,
              ),
              new Image.asset('images/car.png',
                  height: 80.0,
                  width:150.0,
                alignment: Alignment.centerLeft,

              )
            ],
          ),
        ),

【问题讨论】:

    标签: flutter flutter-layout flutter-dependencies flutter-test flutter-sliver


    【解决方案1】:

    什么应该合适?

    如果您的意思是您的 Container 应该填充其父级,您可以将 inifinity 设置为其高度

    new Container(
          height: double.infinity,
          ...
    

    或拉伸Row的交叉轴对齐方式

     Row(
         crossAxisAlignment: CrossAxisAlignment.stretch,
         ...
    

    【讨论】:

    • 感谢 Zroq 的帮助。我遇到了问题
    猜你喜欢
    • 2022-01-11
    • 1970-01-01
    • 2018-03-28
    • 1970-01-01
    • 2020-02-09
    • 1970-01-01
    • 1970-01-01
    • 2011-09-17
    • 2021-01-26
    相关资源
    最近更新 更多