Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Widget build(BuildContext context) {
- final Bloc bloc = Provider.of(context);
- return Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: ListView(
- children: <Widget>[
- SizedBox(
- height: 32,
- ),
- _buildEmailField(bloc),
- SizedBox(
- height: 16,
- ),
- _buildPasswordField(bloc),
- SizedBox(
- height: 25,
- ),
- _buildSubmitButton(),
- ],
- ),
- );
- }
- void main() {
- runApp(LogIn());
- }
- class MyApp extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return Provider(
- child: MaterialApp(
- home: Scaffold(
- body: LogIn(),
- ),
- ),
- );
- }
- }
- class Provider extends InheritedWidget {
- final Bloc bloc;
- Provider({Key key, Widget child})
- : bloc = Bloc(),
- super(key: key, child: child);
- @override
- bool updateShouldNotify(_) => true;
- static Bloc of(BuildContext context) {
- return (context.inheritFromWidgetOfExactType(Provider) as Provider).bloc;
- }
- }
- flutter: The following NoSuchMethodError was thrown building LogIn(dirty, state: _LogInState#1c0be):
- flutter: The getter 'bloc' was called on null.
- flutter: Receiver: null
- flutter: Tried calling: bloc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement