Skip to content

Instantly share code, notes, and snippets.

@rapPayne
Last active March 24, 2019 14:14
Show Gist options
  • Select an option

  • Save rapPayne/72f2dd7d6c2d45b6857de22a4548c9cc to your computer and use it in GitHub Desktop.

Select an option

Save rapPayne/72f2dd7d6c2d45b6857de22a4548c9cc to your computer and use it in GitHub Desktop.
React Native vs Flutter - Flutter stateful widget
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