'''buildShowDialog(BuildContext context) { return showDialog( context: context, barrierDismissible: false, builder: (BuildContext cont1) { return Center( child: LoadingAnimationWidget.threeArchedCircle( color: Colors.white, size: 50), ); }); }
loginFunction(http.Client client, jsonBody) async { buildShowDialog(context);
var url = Uri.parse("https://my-office-timesheet.herokuapp.com/api/signin");
var respsonse = await client.post(url, body: jsonBody);
if (respsonse.statusCode == 200) {
Navigator.of(context).pop();
if (this.mounted) {
setState(() {
jsonResponse = Post.fromJson(json.decode(respsonse.body));
});
}
if (jsonResponse!.success == true) {
if (this.mounted) {
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (BuildContext context) => Dashboard()),
(Route<dynamic> route) => false);
//this code is to route without a back button.
}
} else {
showDialog(
context: context,
builder: (ctx) => AlertDialog(
title: Text("Message:"),
content: Text("${jsonResponse?.message}"),
actions: [
ElevatedButton(
onPressed: () {
Navigator.of(ctx).pop();
if (this.mounted) {
setState(() {
jsonResponse = null;
});
}
},
child: const Text("Ok"),
),
],
),
);
}
}
return respsonse;
}'''
List view builder
ListView.builder(
physics: const NeverScrollableScrollPhysics(),
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: _fieldNames.length,
itemBuilder: (context, index) {
return Column(
children: [
FieldBuilderForm(
key: ValueKey(index),
fieldColor: _fieldColor[index],
fieldTextColor: _fieldTextColor[index],
fieldName: _fieldNames[index],
controller: controller[index],
size: displaySize,
),
In the above code when I pop the LoadingAnimationWidget. The list view builder which I made is the one popping instead. Any suggestions?