Skip to content

Commit

Permalink
fix: stores and state select
Browse files Browse the repository at this point in the history
  • Loading branch information
robsonsilv4 committed Mar 21, 2020
1 parent f3366f4 commit 7206101
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/stores/brazil_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ abstract class _BrazilStoreBase with Store {

@action
Future<void> changeSelectedState(String stateName) async {
if (statistics != null) {
if (statistics.data.isNotEmpty) {
statistics.data.asMap().forEach((index, state) {
if (state.uf == stateName) {
if (state.state == stateName) {
selectedState = index;
}
});
Expand Down
28 changes: 27 additions & 1 deletion lib/stores/brazil_store.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions lib/ui/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class _HomePageState extends State<HomePage> {
void initState() {
super.initState();

store.fetchBrazilStatistics();
countryStore.fetchCountryStatistics();

if (store.statistics.data.isEmpty) {
store.fetchBrazilStatistics();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/widgets/share_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ShareButton extends StatelessWidget {
),
color: Colors.greenAccent,
padding: EdgeInsets.all(15.0),
onPressed: onPress ?? () => {},
onPressed: onPress ?? () {},
);
}
}

0 comments on commit 7206101

Please sign in to comment.