anusii / solidpod

MIT License
1 stars 2 forks source link

SOLID POD and ABOUT: BuildContext issues and Child Instantiation Issues #96

Open gjwgit opened 6 months ago

gjwgit commented 6 months ago

Description

As demonstrated in the DeadlyBushTucker app the showAbout Dialog using SolidLogin wrapper has issues..

The code is at https://github.com/gjwgit/deadly-bush-tucker. The main branch shows the missing build context if I choose CONTINUE on the login screen. If I login on the login screen then the about works - the build context is not lost.

The original error I was seeing:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: This BuildContext is no longer valid.
The showDialog function context parameter is a BuildContext that is no longer valid.
This can commonly occur when the showDialog function is called after awaiting a Future. In this situation the BuildContext might refer to a widget that has already been disposed during the await. Consider using a parent context instead.
#0      _debugIsActive (package:flutter/src/material/dialog.dart:1491:5)
#1      showDialog (package:flutter/src/material/dialog.dart:1412:10)
#2      showAboutDialog (package:flutter/src/material/about.dart:190:3)
#3      InnerPod.build.<anonymous closure> (package:innerpod/main.dart:97:17)
<asynchronous suspension>
gjwgit commented 6 months ago

Seems like if it is inside a Stateful widget it is okay! Though some more testing and found not always.

This task, in essence, is how to properly add the top right About button for a solid pod app?