Last active
March 24, 2019 14:14
-
-
Save rapPayne/72f2dd7d6c2d45b6857de22a4548c9cc to your computer and use it in GitHub Desktop.
React Native vs Flutter - Flutter stateful widget
This file contains hidden or 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
| import 'package:flutter/material.dart'; // <-- 1 | |
| import 'package:flutter_redux/flutter_redux.dart'; | |
| import 'package:redux/redux.dart'; // <-- 2 | |
| import 'store/Actions.dart'; // <-- 2 | |
| import 'store/AppState.dart'; // <-- 2 | |
| import 'FilmBrief.dart'; // <-- 3 | |
| import 'FilmDetails.dart'; // <-- 3 | |
| import 'DatePicker.dart'; // <-- 3 | |
| import 'ShowingTimes.dart'; // <-- 3 | |
| class Landing extends StatefulWidget { // <-- 4 | |
| final Store<AppState> store; | |
| Landing({this.store}) { // <-- 5 | |
| this.store.dispatch({'type': Actions.FETCH_FILMS}); // <-- 6 | |
| } | |
| @override | |
| _Landing createState() { | |
| return _Landing(store: this.store); | |
| } | |
| } | |
| class _Landing extends State<Landing> { // <-- 4, 7 | |
| final Store<AppState> store; | |
| _Landing({this.store}); | |
| @override | |
| Widget build(BuildContext context) { // <-- 8 | |
| // This is where the subcomponents will be drawn. | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment