0
showModalBottomSheet(
  backgroundColor: Colors.white,
  elevation: 0,
  context: context,
  builder: (context) {
    return StatefulBuilder(
      builder: (context, setState) {
        return SizedBox(
          width: MediaQuery.of(context).size.width,
          child: Padding(
            padding: const EdgeInsets.all(25),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisSize: MainAxisSize.min,
              children: [
                const Text('Seleccione un equipo', style: TextStyle(color: Color(0xFFFDA24D), fontWeight: FontWeight.bold, fontSize: 20),),
                Container(
                  width: double.maxFinite,
                  child: ListView.builder(
                    shrinkWrap: true,
                    itemCount: widget.listString.length,
                    itemBuilder: (context, index) {
                      return CheckBoxItem(
                        title: widget.listString[index], 
                        isSelected: listSelected.contains(widget.listString[index]), 
                        selected: (value) {
                          if(listSelected.contains(value)) {
                            listSelected.remove(value);
                          } else { listSelected.add(value); }
                          setState((){});
                        }
                      );
                    },
                  ),
                )
              ],
            )
          ),
        );
      },
    );
  },
);

El problema con el que me encuentro es con este: Se produjo una excepción. FlutterError (RenderFlex children have non-zero flex but incoming height constraints are unbounded. When a column is in a parent that does not provide a finite height constraint, for example if it is in a vertical scrollable, it will try to shrink-wrap its children along the vertical axis. Setting a flex on a child (e.g. using Expanded) indicates that the child is to expand to fill the remaining space in the vertical direction. These two directives are mutually exclusive. If a parent is to shrink-wrap its child, the child cannot simultaneously expand to fit its parent. Consider setting mainAxisSize to MainAxisSize.min and using FlexFit.loose fits for the flexible children (using Flexible rather than Expanded). This will allow the flexible children to size themselves to less than the infinite remaining space they would otherwise be forced to take, and then will cause the RenderFlex to shrink-wrap the children rather than expanding to fit the maximum constraints provided by the parent. If this message did not help you determine the problem, consider using debugDumpRenderTree(): https://flutter.dev/debugging/#rendering-layer http://api.flutter.dev/flutter/rendering/debugDumpRenderTree.html The affected RenderFlex is: RenderFlex#39b3c relayoutBoundary=up10 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE(creator: Column ← Column ← Padding ← SizedBox ← StatefulBuilder ← NotificationListener ← DefaultTextStyle ← AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#85dfc ink renderer] ← NotificationListener ← CustomPaint ← _ShapeBorderPaint ← ⋯, parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size), constraints: BoxConstraints(0.0<=w<=342.7, 0.0<=h<=Infinity), size: MISSING, direction: vertical, mainAxisAlignment: start, mainAxisSize: max, crossAxisAlignment: center, verticalDirection: down) The creator information is set to: Column ← Column ← Padding ← SizedBox ← StatefulBuilder ← NotificationListener ← DefaultTextStyle ← AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#85dfc ink renderer] ← NotificationListener ← CustomPaint ← _ShapeBorderPaint ← ⋯ The nearest ancestor providing an unbounded width constraint is: RenderFlex#75bd6 relayoutBoundary=up9 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE: creator: Column ← Padding ← SizedBox ← StatefulBuilder ← NotificationListener ← DefaultTextStyle ← AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#85dfc ink renderer] ← NotificationListener ← CustomPaint ← _ShapeBorderPaint ← PhysicalShape ← ⋯ parentData: offset=Offset(0.0, 0.0) (can use size) constraints: BoxConstraints(w=342.7, 0.0<=h<=419.6) size: MISSING direction: vertical mainAxisAlignment: start mainAxisSize: max crossAxisAlignment: start textDirection: ltr verticalDirection: down See also: https://flutter.dev/unbounded-constraints If none of the above helps enough to fix this problem, please don't hesitate to file a bug: https://github.com/flutter/flutter/issues/new?template=2_bug.yml)

2

1 respuesta 1

0

Reemplaza el container que envuelve el listview por un expanded.

Las vistas con scroll vertical necesitan que le limiten el alto. Si usas un listview dentro de un columna, envuelve lo en un expanded para evitar problemas de overflow.

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.