Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinusX committed Dec 2, 2017
2 parents 0bc270f + 16a1380 commit b41c89e
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions lib/screens/statistics_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:weight_tracker/logic/actions.dart';
import 'package:weight_tracker/logic/constants.dart';
import 'package:weight_tracker/logic/redux_state.dart';
import 'package:weight_tracker/model/weight_entry.dart';
Expand All @@ -12,13 +13,16 @@ class _StatisticsPageViewModel {
final double last30daysProgress;
final List<WeightEntry> entries;
final String unit;
final Function() openAddEntryDialog;

_StatisticsPageViewModel({this.last7daysProgress,
this.last30daysProgress,
this.totalProgress,
this.currentWeight,
this.entries,
this.unit});
this.unit,
this.openAddEntryDialog,
});
}

class StatisticsPage extends StatelessWidget {
Expand Down Expand Up @@ -59,16 +63,24 @@ class StatisticsPage extends StatelessWidget {
last30daysEntries.last.weight),
entries: entries,
unit: unit,
openAddEntryDialog: () {
if (last30daysEntries.isEmpty) {
store.dispatch(new OpenAddEntryDialog(context));
}
},
);
},
builder: (context, viewModel) {
return new ListView(
children: <Widget>[
new _StatisticCardWrapper(
child: new Padding(
padding: new EdgeInsets.all(8.0),
child: new ProgressChart(viewModel.entries)),
height: 200.0,
new GestureDetector(
onTap: viewModel.openAddEntryDialog,
child: new _StatisticCardWrapper(
child: new Padding(
padding: new EdgeInsets.all(8.0),
child: new ProgressChart(viewModel.entries)),
height: 200.0,
),
),
new _StatisticCard(
title: "Current weight",
Expand Down

0 comments on commit b41c89e

Please sign in to comment.