Last active
June 17, 2020 17:07
-
-
Save Tajcore/a82015b26439ea9ec49911c9129fb733 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
runApp(App()); | |
} | |
class App extends StatefulWidget { | |
@override | |
_AppState createState() => _AppState(); | |
} | |
class _AppState extends State<App> { | |
@override | |
Widget build(BuildContext context) { | |
return ChangeNotifierProvider<AgentsManager>(create: (_) => AgentsManager()), | |
child: Consumer<AgentsManager>(builder: (context, agent, _) { | |
return ClientProvider( | |
uri: Provider.of<AgentsManager>(context).loaded | |
? Provider.of<AgentsManager>(context).httpLink | |
: "None", // The Agent Provider will have its httpLink attribute being able to change | |
child: MaterialApp( //But I need the app to rebuild in order for the changes to be seen elsewhere | |
debugShowCheckedModeBanner: false, | |
theme: manager.themeData, | |
initialRoute: '/', | |
routes: { | |
'/': (context) => LoginScreen(), | |
'/Homescreen': (context) => HomeScreen(), | |
'/Settings': (context) => SettingsScreen() | |
})); | |
}); | |
})); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment