android - 如何根据Flutter Widget中的括号设置宽度

标签 android ios flutter dart

Material (
海拔:0,

      child:

        Container(
          margin: const EdgeInsets.only(
            bottom: 10
          ),
          child: Stack(

            children: <Widget>[
              Positioned(
                left: 30,
                child: Container(

                  padding: EdgeInsets.only(
                      left: 50
                  ),
                  height: 80,
                  color: Colors.black12,
                  child: Text("From : " + bills[index].fromDate.toString() + ""
                      "to : " + bills[index].toDate.toString()),
                ),
              ),
                  Container(
                        width: 80.0,
                        height: 80.0,
                        decoration: new BoxDecoration(
                          color: Colors.orange,
                          shape: BoxShape.circle,
                        ),
                ),
              Positioned(
                top: 20,
                left: 10,
                child: Text(bills[index].bill.toString() + bills[index].currency),
              ),


          ],

      ),
        ),
    );

在上面的代码中,下面的这个小部件是堆栈的成员,我无法根据父级设置宽度。通常,我会在 flutter 中设置match_parent属性。
我应用了SizedBox.extend解决方案。该解决方案对我不起作用。
定位(
左:30,
子代:容器(
                  padding: EdgeInsets.only(
                      left: 50
                  ),
                  height: 80,
                  color: Colors.black12,
                  child: Text("From : " + bills[index].fromDate.toString() + ""
                      "to : " + bills[index].toDate.toString()),
                ),
              ),

请帮帮我。提前致谢。

最佳答案

你可以试试:

Positioned(
   left: 30,
   right: 0,
   child: Container(
      /* your widget */
   )
)

关于android - 如何根据Flutter Widget中的括号设置宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61430204/

相关文章:

android - 0 Android APK 版本支持的设备

ios - 为什么无法在 UIWebView iOS7.1 应用程序中打开 itms-services 协议(protocol)?

ios - Swift 3 - 带填充的 UICollectionView 中心单元

google-api - 错误 : Not found: 'dart:html' when using googleapis_auth dart team package with flutter

Flutter 创造无限屏幕

java - Android - 帮助我使用 ArrayList

android - 如何让 Google Now 在 Android 的后台持续运行

javascript - 如何在 Android 上使用 Javascript Core (JSC)?

ios - 我使 Messenger 应用程序基于 APNS,但是如果客户端的通知被触发,则客户端不会收到 APNS 发送的其他客户端的消息

Flutter - 如何设置 AppBar 标题高度