I am trying to display a file on tap of button. But before the file loads, I want the circular progress indicator to start and after the file loads, I want it to stop. I have implemented the following code but the problem is the indicator keeps on loading even after file loads.
InkWell(
onTap: () async {
player.stop();
Center(
child: CircularProgressIndicator(),
);
final files = await loadPdfFromNetwork(file.url);
openPdf(context, files, file.url,file.name.split('.').first);
}
CodePudding user response:
You could use Navigator.of(context).pop .
InkWell(
onTap: () async {
player.stop();
Center(
child: CircularProgressIndicator(),
);
final files = await loadPdfFromNetwork(file.url);
openPdf(context, files, file.url,file.name.split('.').first);
Navigator.of(context).pop
}
CodePudding user response:
You can use stream builder to avoid any error in future as well.