Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. Widget build(BuildContext context) {
  2. final Bloc bloc = Provider.of(context);
  3.  
  4. return Padding(
  5. padding: const EdgeInsets.symmetric(horizontal: 16.0),
  6. child: ListView(
  7. children: <Widget>[
  8. SizedBox(
  9. height: 32,
  10. ),
  11. _buildEmailField(bloc),
  12. SizedBox(
  13. height: 16,
  14. ),
  15. _buildPasswordField(bloc),
  16. SizedBox(
  17. height: 25,
  18. ),
  19. _buildSubmitButton(),
  20. ],
  21. ),
  22. );
  23. }
  24.  
  25. void main() {
  26. runApp(LogIn());
  27. }
  28.  
  29. class MyApp extends StatelessWidget {
  30. @override
  31. Widget build(BuildContext context) {
  32. return Provider(
  33. child: MaterialApp(
  34. home: Scaffold(
  35. body: LogIn(),
  36. ),
  37. ),
  38. );
  39. }
  40. }
  41.  
  42. class Provider extends InheritedWidget {
  43. final Bloc bloc;
  44.  
  45. Provider({Key key, Widget child})
  46. : bloc = Bloc(),
  47. super(key: key, child: child);
  48.  
  49. @override
  50. bool updateShouldNotify(_) => true;
  51.  
  52. static Bloc of(BuildContext context) {
  53. return (context.inheritFromWidgetOfExactType(Provider) as Provider).bloc;
  54. }
  55. }
  56.  
  57. flutter: The following NoSuchMethodError was thrown building LogIn(dirty, state: _LogInState#1c0be):
  58. flutter: The getter 'bloc' was called on null.
  59. flutter: Receiver: null
  60. flutter: Tried calling: bloc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement