-1
Good morning!
Could someone assist me in a doubt?
- What am I doing:
I made a search
for the user to search for an Infraction in the app, and right after the action on the keyboard I redirect it to another page (Filtroinicioview) passing the data as parameter.
onFieldSubmitted: (string) {
print(filterNomeInfracao);
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => FiltroinicioView(filterNomeInfracao),
),
);
},
After redirecting the user to the View page of the searched infringement, I show the List of Infractions within one Listview.Builder, passing a Return in the list() and passing the filterNomeInfracao[index] (Here he will bring me all the data), and passing one String calling for 'INFRINGEMENTS'
body: Column(
children: <Widget>[
Expanded(
child: ListView.builder(
padding: EdgeInsets.all(10.0),
itemCount: filterNomeInfracao.length,
itemBuilder: (BuildContext context, int index) {
return Lista(
filterNomeInfracao[index],
'INFRAÇÕES'
);
},
),
),
],
),
And then inside Do Buildcontext (Top Code) I make the call to render the List that in the case would be a card, as it is below:
class Lista extends StatelessWidget {
final Infracao infracao;
final txtInfracoes;
Lista(this.infracao, this.txtInfracoes);
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Card(child: ListTile(title: Text(txtInfracoes))),
Card(
child: ListTile(
title: Text(infracao.descricao),
),
),
],
);
}
}
And in that he lists the infractions according to the print image, However, as you can see String "INFRINGEMENTS" is repeating, that is I needed it to be a fixed field, for example:
INFRAÇÕES
E aqui todas descrições
- THE EXPECTED RESULT WOULD THEN BE WITH STRING INFRINGEMENTS AS FIXED:
Print(done in Paint) below expected result:
Is not repeating. Infringement and Attachments are being listed (manually)
– Elanio
I needed Infringement and Attachments to be fixed
– victor
Shows your entire class... How you are loading the data into
filterNomeInfracao
? Think if you were helping someone, I could tell you what the problem is without seeing the whole context? Edita your question and more information– Matheus Ribeiro
Good morning, Matheus.
– victor
Dude, you did a good editing. But you see I also asked you the following "How you are loading the data into filterNomeInfracao?", your code displayed apparently is all OK, the problem is probably where you are taking the data from your API and clicking on the variable
filterNomeInfracao
. So of two one, either you are bringing repeated from your API or you are not loading right into the filter variable.– Matheus Ribeiro
So it doesn’t involve the API if you notice I’m calling infraction.Description (this yes comes from the API) plus the string as the object to notice up there that I pass a Text string(Infractions) and call it in the list is the STRING that repeats and not my API data
– victor