vendredi 16 octobre 2020

Error creating Multi CheckList inside a container

Here, im trying to insert a checkbox inside a container that is generated by the quantity of _lstNomeData.. The Checkbox is generated and appears on the Demo Mobile, but its unclickable and i get those errors.

Code i have on body:

body: ListView.builder(
                itemCount: _lstNomeData.length,
                shrinkWrap: true,
                itemBuilder: (BuildContext context, int index) => Container(
                    width: MediaQuery.of(context).size.width,
                    padding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 5.0),
                    child: Card(
                      elevation: 5.0,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(10.0),
                      ),
                      child: Container(
                          width: MediaQuery.of(context).size.width,
                          padding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0),
                          child: Row(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: <Widget>[
                              Container(
                                  alignment: Alignment.centerLeft,
                                  width: 30.0,
                                  height: 35.0,
                                  color: Colors.transparent,
                                  child: new CheckboxListTile(
                                      value: selected,
                                      activeColor: Colors.blue,
                                      checkColor: Colors.white,
                                      onChanged: (bool value) {
                                        setState(() {
                                          selected = value;
                                        });
                                      })),
                              SizedBox(width: 15.0),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text(
                                    '${_lstNomeData[index]}',
                                    style: TextStyle(color: Colors.white, fontSize: 14),
                                  ),
                                  Text(
                                    '${_lstNumData[index]}',
                                    style: TextStyle(color: Colors.white, fontSize: 14),
                                  ),
                                ],
                              )
                            ],
                          )),
                    )),
              )

I get this errors :

════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderPointerListener#bd277 relayoutBoundary=up5 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1702 pos 12: 'hasSize'
The relevant error-causing widget was
    CheckboxListTile 


elided 5 frames from class _AssertionError and dart:async)
The following RenderObject was being processed when the exception was fired: _RenderListTile#51ab6 relayoutBoundary=up8 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
 creator: _ListTile ← MediaQuery ← Padding ← SafeArea ← Semantics ← _PointerListener ← Listener ←
   _GestureSemantics ← RawGestureDetector ← GestureDetector ← _RawMouseRegion ← MouseRegion ← ⋯
 parentData: offset=Offset(0.0, 0.0) (can use size)
 constraints: BoxConstraints(w=0.0, 0.0<=h<=35.0)
 size: MISSING
This RenderObject had the following descendants (showing up to depth 5):
   title: RenderConstrainedBox#59669 NEEDS-LAYOUT NEEDS-PAINT
   trailing: RenderMouseRegion#e5365 relayoutBoundary=up9 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
     child: RenderSemanticsAnnotations#f7fae relayoutBoundary=up10 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
       child: _RenderCheckbox#f21e6 relayoutBoundary=up11 NEEDS-PAINT
════════════════════════════════════════════════════════════════════════════════════════════════════
Another exception was thrown: RenderBox was not laid out: _RenderListTile#51ab6 relayoutBoundary=up8 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: RenderPadding#de8c7 relayoutBoundary=up7 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#74945 relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

If you guys need something more, please let me know and i will add ASAP. Thanks.




Aucun commentaire:

Enregistrer un commentaire