Use the dispose() method to reset the global values. Works excellently!! :D

This commit is contained in:
Hyperling 2025-03-26 13:17:08 -07:00
parent 6f9d0d8afb
commit fa852faadc

View File

@ -31,7 +31,17 @@ class ProjectionPage extends StatefulWidget {
} }
class _ProjectionPageState extends State<ProjectionPage> { 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -50,7 +60,6 @@ class _ProjectionPageState extends State<ProjectionPage> {
); );
// Calculations for the projections. // Calculations for the projections.
Widget projections; Widget projections;
if (_assetTotal < 0 || if (_assetTotal < 0 ||
_incomeMonthly < 0 || _incomeMonthly < 0 ||
@ -59,7 +68,11 @@ class _ProjectionPageState extends State<ProjectionPage> {
_expenseYearly < 0) { _expenseYearly < 0) {
_showProjections = false; _showProjections = false;
projections = Center(child: SizedBox(child: CircularProgressIndicator())); projections = Center(
child: SizedBox(
child: CircularProgressIndicator(),
),
);
Future.delayed(Duration(seconds: 1), () { Future.delayed(Duration(seconds: 1), () {
setState(() { setState(() {