Closed tenhobi closed 6 years ago
Explore InheritedWidget
on http://fluttersamples.com/.
@Kenny11CZ @stasidom @vojtechdalecky @michaldrabina now if you wanna access state or blocs, you will do something like
class CustomDrawer extends StatelessWidget {
@override
Widget build(BuildContext context) {
final container = StateContainer.of(context); // initialization
return Drawer(
child: Column(
children: <Widget>[
UserAccountsDrawerHeader(
accountName: Text(container.authenticationBloc.user.displayName), // usage
accountEmail: Text(container.authenticationBloc.user.email), // usage
The same ruleas apply to other methods which returns Widget
.
Current solution
might not be the best one. The task is to find better solution, maybe somehow add this functionality inside
AppData
?