0
votes

I can't solve this problem. I'm trying to do this step by step. When users push the button, first they gonna see AlertDialog, then the function startFilePickerBig will run. After the user chose files and is done with the startFilePickerBig function AlertDialog must close. But when I add Navigator.pop(context) after "await startFilePickerBig()" , alertdialog not working. When I remove "Navigator.pop(context)" which I wrote under the "await startFilePickerBig()", AlarmDialog works fine. How can I fix this?

OutlinedButton(
     style: ButtonStyle(side: MaterialStateProperty.all(const BorderSide(width: 1.0, color: Color(0xFFF38F1D))), shape: MaterialStateProperty.all(RoundedRectangleBorder(borderRadius: BorderRadius.circular(7))), foregroundColor: MaterialStateProperty.all(const Color(0xFFF38F1D))),
      onPressed: () async {
        showDialog(
            context: context,
            builder: (context) {
            return AlertDialog(
                title: const Text(''),
                content: const Text('Pease wait, Images loading... '),
                actions: <Widget>[
                     TextButton(
                       onPressed: () {
                            Navigator.pop(context);
                      },
                      child: const Text('Close')),],
                 );
});

await startFilePickerBig();
Navigator.pop(context);
},

child: const Text("Add Image"), )

Did you try answers from there <stackoverflow.com/questions/68692512/…>? - Karol Wiśniewski