2

When I am using the navigation in it, the previous page theme is getting selected. My previous page theme is getting selected automatically even after navigating to new page. I just want to remove the previous logged in user theme data. Or simply and the page components on going to another page. I am creating a multi-paged app on flutter.


    return ThemeSwitchingArea(
      child: Builder(
        builder: (context) {
          return Scaffold(
            body:  _isLoading
                ? Container(
              color: Colors.white70.withOpacity(0.3),
              width: MediaQuery.of(context).size.width, //70.0,
              height: MediaQuery.of(context).size.height, //70.0,
              child: new Padding(
                  padding: const EdgeInsets.all(5.0),
                  child: new Center(child: new CircularProgressIndicator())),
            )
                : Column(
              children: <Widget>[
                SizedBox(height: kSpacingUnit.w * 5),
                header,
                Expanded(
                  child: ListView(
                    children: <Widget>[
                      ProfileListItem(
                        icon: LineAwesomeIcons.question_circle,
                        text: 'Help & Support',
                      ),
                      Container(
                        height: kSpacingUnit.w * 5.5,
                        margin: EdgeInsets.symmetric(
                          horizontal: kSpacingUnit.w * 4,
                        ).copyWith(
                          bottom: kSpacingUnit.w * 2,
                        ),
                        padding: EdgeInsets.symmetric(
                          horizontal: kSpacingUnit.w * 2,
                        ),
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(kSpacingUnit.w * 3),
                          color: Theme.of(context).backgroundColor,
                        ),
                        child: InkWell(
                          child: Row(
                            children: <Widget>[
                              Icon(
                                LineAwesomeIcons.alternate_sign_out,
                                size: kSpacingUnit.w * 2.5,
                              ),
                              SizedBox(width: kSpacingUnit.w * 1.5),
                              Text(
                                "Logout",
                                style: kTitleTextStyle.copyWith(
                                  fontWeight: FontWeight.w500,
                                ),
                              ),
                              Spacer(),
                                Icon(
                                  LineAwesomeIcons.angle_right,
                                  size: kSpacingUnit.w * 2.5,
                                ),
                            ],
                          ),
                            onTap: () async {
                              super.dispose();
                              SharedPreferences preferences = await SharedPreferences.getInstance();
                              await preferences.clear();
                              Navigator.of(context).pop();
                              Navigator.of(context)
                                  .push(MaterialPageRoute(builder: (__) => WelcomeScreen()));
                            }
                        ),
                      ),
                    ],
                  ),
                )
              ],
            ),
            bottomNavigationBar: BottomNavigation(email: _emailController.text,),
          );
        },
      ),
    );
  }
  @override
  void dispose() {
    print("Disposing second route");
    super.deactivate();
  }
}
***
Hemant N. Karmur
  • 840
  • 1
  • 7
  • 21
Bishal Rana
  • 21
  • 1
  • 5
  • **Welcome to Stackoverflow**, `to maximise your chance of getting an answer`, please **[Take the tour](https://stackoverflow.com/tour)** and read **[How do I ask a good question](https://stackoverflow.com/help/how-to-ask)**. `Update your question` with just enough code to allow others to reproduce the problem. For help with this, read **[How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/minimal-reproducible-example)**. – amarinediary Dec 25 '20 at 19:21

0 Answers0