Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 是否可以在列中插入AspectRatio?_Flutter_Dart - Fatal编程技术网

Flutter 是否可以在列中插入AspectRatio?

Flutter 是否可以在列中插入AspectRatio?,flutter,dart,Flutter,Dart,我想在列中插入一个AspectRatio。并在列表视图中插入此列。 可能吗? 我想创建一个百分比,其中包含有关它的信息 @override Widget build(BuildContext context) { return Padding( padding: EdgeInsets.only( left: 28, right: 28, bottom: 8, top: 8, ),

我想在列中插入一个AspectRatio。并在列表视图中插入此列。 可能吗? 我想创建一个百分比,其中包含有关它的信息

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.only(
        left: 28,
        right: 28,
        bottom: 8,
        top: 8,
      ),
      child: Container(
        height: heightElement,
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.all(Radius.circular(16)),
          boxShadow: [
            BoxShadow(
              color: SVConst.circularItemsColors[index].withOpacity(0.5),
              spreadRadius: 5,
              blurRadius: 7,
              offset: Offset(0, 3), // changes position of shadow
            ),
          ],
        ),
        child: Column(
          children: [
            Container(
              height: 0.7 * heightElement,
              child: Expanded(
                child: AspectRatio(
                  aspectRatio: 1.3,
                  child: Center(
                    child: CircularPercentIndicator(
                      backgroundColor: Colors.white,
                      radius: 120.0,
                      lineWidth: 13.0,
                      percent: (double.parse(percentuage) / 100),
                      center: Text(
                        percentuage + "%",
                        style: TextStyle(
                            fontWeight: FontWeight.bold, fontSize: 20.0),
                      ),
                      footer: Container(
                        child: AutoSizeText(
                          nameItem,
                          style: TextStyle(
                              color: SVConst.circularItemsColors[index],
                              fontWeight: FontWeight.bold,
                              fontSize: 17.0),
                        ),
                      ),
                      circularStrokeCap: CircularStrokeCap.round,
                      progressColor: SVConst.circularItemsColors[index],
                    ),
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
但它抛出了一个例外。 我尝试将AspectRatio插入到高度为70%的容器中,但它不起作用

你有什么建议吗?
你能帮我一下吗?

扩展的
小部件应该有一个
,或者一个
Flex
。因此有例外

AspectRatio
中删除
扩展的
小部件

   height: 0.7 * heightElement,
这是错误的,您需要删除appbar和状态栏的高度,然后才能获得精确的0.7%

现在可以使用0.6,因为我们可以考虑AppBar和StaseBar大小可以消耗0.1。 所以你的代码应该是

   height: 0.6 * heightElement,

删除扩展的小部件