Bertoni
Bertoni

Reputation: 3

Flutter - Flexible not expanding correctly

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

Upvotes: 0

Views: 217

Answers (0)

Related Questions