Use the dispose() method to reset the global values. Works excellently!! :D
This commit is contained in:
parent
6f9d0d8afb
commit
fa852faadc
@ -31,7 +31,17 @@ class ProjectionPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ProjectionPageState extends State<ProjectionPage> {
|
||||
bool? _showProjections = true;
|
||||
bool _showProjections = true;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_assetTotal = -2;
|
||||
_expenseMonthly = -2;
|
||||
_expenseYearly = -2;
|
||||
_incomeMonthly = -2;
|
||||
_incomeYearly = -2;
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -50,7 +60,6 @@ class _ProjectionPageState extends State<ProjectionPage> {
|
||||
);
|
||||
|
||||
// Calculations for the projections.
|
||||
|
||||
Widget projections;
|
||||
if (_assetTotal < 0 ||
|
||||
_incomeMonthly < 0 ||
|
||||
@ -59,7 +68,11 @@ class _ProjectionPageState extends State<ProjectionPage> {
|
||||
_expenseYearly < 0) {
|
||||
_showProjections = false;
|
||||
|
||||
projections = Center(child: SizedBox(child: CircularProgressIndicator()));
|
||||
projections = Center(
|
||||
child: SizedBox(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
|
||||
Future.delayed(Duration(seconds: 1), () {
|
||||
setState(() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user