Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/93.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
Android RenderFlex对象在布局-颤振期间被赋予无限大的尺寸_Android_Ios_Flutter_Widget_Flutter Layout - Fatal编程技术网

Android RenderFlex对象在布局-颤振期间被赋予无限大的尺寸

Android RenderFlex对象在布局-颤振期间被赋予无限大的尺寸,android,ios,flutter,widget,flutter-layout,Android,Ios,Flutter,Widget,Flutter Layout,我正在尝试创建一个可重新编辑的列表视图,但我遇到了一个无法修复的错误。 我已经看过了所有这些没有效果的东西: 他们都没有工作。 这是我的密码: 当我尝试在buildListTile函数(用于显示卡片)中打印项目的键值时,它打印了1到9个键值,但打印了3到4次。这似乎是最后一个错误的原因 多个小部件使用相同的GlobalKey 最后,我按照下面的步骤编写了这段代码 谢谢你的帮助 import 'package:flutter/material.dart'; import "p

我正在尝试创建一个可重新编辑的列表视图,但我遇到了一个无法修复的错误。 我已经看过了所有这些没有效果的东西:


  • 他们都没有工作。
    这是我的密码:
  • 当我尝试在buildListTile函数(用于显示卡片)中打印项目的键值时,它打印了1到9个键值,但打印了3到4次。这似乎是最后一个错误的原因

    多个小部件使用相同的GlobalKey

    最后,我按照下面的步骤编写了这段代码
    谢谢你的帮助

    import 'package:flutter/material.dart';
    import "package:TodoApp/models/global.dart";
    import "package:TodoApp/models/widgets/intray_todo_widget.dart";
    
    class IntrayPage extends StatefulWidget {
      @override
      _IntrayPageState createState() => _IntrayPageState();
    }
    
    class _IntrayPageState extends State<IntrayPage> {
      List<IntrayTodo> todoItems = [];
    
      @override
      Widget build(BuildContext context) {
        todoItems = getList();
        return _buildReorderableListSimple(context);
      }
    
      Widget _buildListTile(BuildContext context, IntrayTodo item) {
        // print statement here
        return Card(
          color: blueColor,
          key: ValueKey(item.keyValue),
          elevation: 2,
          child: ListTile(
            title: Text("hi"),
          ),
        );
      }
    
    
      Widget _buildReorderableListSimple(BuildContext context) {
        return ReorderableListView(
          padding: EdgeInsets.only(top: 300.0),
          onReorder: (oldIndex, newIndex) => _onReorder(oldIndex, newIndex),
          children: todoItems.map((IntrayTodo item) => _buildListTile(context, item)).toList(),
        );
      }
    
      void _onReorder(oldIndex, newIndex) {
        setState(() {
          IntrayTodo item = todoItems[oldIndex];
          print(item.keyValue);
          todoItems.remove(item);
          todoItems.insert(newIndex, item);
        },
        );
      }
    
      List<Widget> getList() {
        for (int i = 0; i < 10; i++){
          todoItems.add(IntrayTodo(keyValue: i.toString(),title: "Hello"));
        }
        return todoItems;
      }
    }
    
    
    
    
    
    ════════ Exception caught by rendering library ═════════════════════════════════════════════════════
    RenderPointerListener object was given an infinite size during layout.
    The relevant error-causing widget was: 
      ReorderableListView file:///C:/Users/1234/Programming/Dart/flutter/TodoApp/lib/UI/Intray/intray_page.dart:38:12
    ════════════════════════════════════════════════════════════════════════════════════════════════════
    
    ════════ Exception caught by rendering library ═════════════════════════════════════════════════════
    RenderMetaData object was given an infinite size during layout.
    The relevant error-causing widget was: 
      ReorderableListView file:///C:/Users/1234/Programming/Dart/flutter/TodoApp/lib/UI/Intray/intray_page.dart:38:12
    The following RenderObject was being processed when the exception was fired: RenderMetaData#62cba relayoutBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
      needs compositing
      parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
      constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
      size: Size(411.4, Infinity)
      behavior: translucent
      metaData: _DragTargetState<Key>#26dd1
      child: RenderPointerListener#b076b relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
        needs compositing
        parentData: <none> (can use size)
        constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
        size: Size(411.4, Infinity)
        behavior: deferToChild
        listeners: down
    RenderObject: RenderMetaData#62cba relayoutBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
      needs compositing
      parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
      constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
      size: Size(411.4, Infinity)
      behavior: translucent
      metaData: _DragTargetState<Key>#26dd1
      child: RenderPointerListener#b076b relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
        needs compositing
        parentData: <none> (can use size)
        constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
        size: Size(411.4, Infinity)
        behavior: deferToChild
        listeners: down
    ════════════════════════════════════════════════════════════════════════════════════════════════════
    
    ════════ Exception caught by rendering library ═════════════════════════════════════════════════════
    RenderFlex object was given an infinite size during layout.
    The relevant error-causing widget was: 
      ReorderableListView file:///C:/Users/1234/Programming/Dart/flutter/TodoApp/lib/UI/Intray/intray_page.dart:38:12
    ════════════════════════════════════════════════════════════════════════════════════════════════════
    
    ════════ Exception caught by rendering library ═════════════════════════════════════════════════════
    RenderPadding object was given an infinite size during layout.
    The relevant error-causing widget was: 
      ReorderableListView file:///C:/Users/1234/Programming/Dart/flutter/TodoApp/lib/UI/Intray/intray_page.dart:38:12
    ════════════════════════════════════════════════════════════════════════════════════════════════════
    
    ════════ Exception caught by rendering library ═════════════════════════════════════════════════════
    Null check operator used on a null value
    The relevant error-causing widget was: 
      ReorderableListView file:///C:/Users/1234/Programming/Dart/flutter/TodoApp/lib/UI/Intray/intray_page.dart:38:12
    ════════════════════════════════════════════════════════════════════════════════════════════════════
    
    ════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
    Multiple widgets used the same GlobalKey.
    ════════════════════════════════════════════════════════════════════════════════════════════════════