簡體   English   中英

Flutter 行列問題

[英]Flutter Row and Column Problems

我在顫動中遇到 Rows 問題,我想將我的資產放在容器的底部,我如何使用 Row 做到這一點? 我試過 mainAxisAlignment: MainAxisAlignment.end 和 cross.end 但不工作...

  Widget build(BuildContext context) {
    double wi = MediaQuery.of(context).size.width;
    return Scaffold(
      body: Container(
        child: Column(
          children: <Widget>[
            Container(
              color: Colors.blue,
              width: wi,
              height: 200,
            ),
            Container(
              width: wi,
              height: 200,
              color: Colors.red,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.end,
                crossAxisAlignment: CrossAxisAlignment.end,
                children: <Widget>[
                  SvgPicture.asset('assets/escapa.svg', semanticsLabel: 'Flask', color: Colors.black, width: 100,height: 100,)
                ]
              ),
              )
          ],
        ),
      ),
    );

SVG1

SVG2

你可以在這里下載資產/image.svg http://filesharing24.com/d/DVh

容器具有屬性對齊使用,您可以像這樣使用它

alignment: Alignment(0.0, 0.0), // this means center, range is from -1 to +1

您需要將其設置為 Alignment(-1.0, 1.0) 或像這樣使用它

alignment: Alignment.bottomRight,

你不需要玩行軸或列軸,容器屬性就足夠了。 使用其中一種方法來獲得准確位置

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM