0

i am new to flutter. my problem / question is this:

when I run my app the Flexible widget looks like this enter image description here

if I click in anywhere on the screen, automatically correct itself like this

enter image description here

the code:

Widget _resultados(BuildContext context) => PagedListView<int, Criminosos>(
      pagingController: _pagingController,
      builderDelegate: PagedChildBuilderDelegate<Criminosos>(
          noItemsFoundIndicatorBuilder: (_) => const Center(
            child: Text('Nenhum cadastro encontrado'),
          ),
          itemBuilder: (_, item, __) => Padding(
            padding: const EdgeInsets.all(1.5),
            child: InkWell(
              onTap: () {
                print("${item.name}\n${item.vulgo}");
                Navigator.of(context).pushNamed("/teste",arguments: {
                  "nome": item.name
                });
                //Navigator.of(context).pushNamed("/cad");
                // Navigator.push(context, MaterialPageRoute(builder: (_)=> Teste(nome: "${model.nome}")));
              },
              child: Ink(
                padding: const EdgeInsets.all(2),
                decoration: BoxDecoration(
                  boxShadow: kElevationToShadow[3],
                  borderRadius: BorderRadius.circular(10),
                  color: Theme
                      .of(context)
                      .cardColor,
                ),
                child: Column(
                  children: [
                    Row(
                      children: [
                        Expanded(
                          flex: 2,
                          child: ClipRRect(
                            borderRadius: BorderRadius.circular(8.0),
                            child: Image.asset("assets/criminoso.webp",
                              fit: BoxFit.fill,),
                          ),
                        ),
                        Expanded(
                            flex: 3,
                            child: Padding(
                              padding: const EdgeInsets.only(left: 8.0),
                              child: Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  //Text(model.rg.toString(), style: TextStyle(color: Colors.red),),
                                  //Text("Cadastro N ${reverseIndex + 1}"),
                                  Text("Nome: ${item.name}"),
                                  Text("Apelido: ${item.vulgo}"),
                                 // Text("Endereco: ${model.endereco}"),
                                  //Text("Nascimento: ${model.nascimento}"),
                                ],
                              ),
                            ))
                      ],
                    )
                  ],
                ),
              ),
            ),
          ),
      ),
  );

i am searching for a solution but until now I didn't found one. thank all of you for the time and patience.

the app records criminals, and then show all criminals in a column. It is working with, the problem it is with the second flexible. The first one got the size of the image just right, the second get only the size of the text and show of in a word way, then after doing literally anything it get pretty, with the same size as the flexible from the image.

tryed change flexible for expanded

Bertoni
  • 3
  • 2
  • if you try without the `infinite_scroll_pagination` package, you get the same issue? – Rodrigo João Bertotti Apr 06 '23 at 01:02
  • Can you try with listview.builder and ScrollController instead of using PageListView? Also try wrapping your _resultados widget with Expanded – Fahmida Apr 06 '23 at 04:15
  • @wisetap.com yes. same issue. in fact i have another screen with identical structure, without infinite scroll. Dosent affect the result. same problem – Bertoni Apr 06 '23 at 04:44
  • @Fahmida with ListView.builder or PageListView I got the same result. But I wrapped mi widget with expanded and worked once. But only once. now I got this error: Exception caught by widgets library The following assertion was thrown while looking for parent data.: Incorrect use of ParentDataWidget. The following ParentDataWidgets are providing parent data to the same RenderObject: - Expanded(flex: 1) (typically placed directly inside a Flex widget) However, a RenderObject can only receive parent data from at most one ParentDataWidget. – Bertoni Apr 06 '23 at 19:11
  • @Bertoni https://stackoverflow.com/a/62982693/11445727 these cases you can use Expanded. Hope this helps – Fahmida Apr 10 '23 at 03:25

0 Answers0