Automatic linting

This commit is contained in:
Github-actions
2021-10-02 10:58:18 +00:00
parent 681470b377
commit 1a84fec097
4 changed files with 69 additions and 64 deletions

View File

@@ -65,8 +65,7 @@ class MyApp extends StatelessWidget {
ChangeNotifierProxyProvider<AuthProvider, ExercisesProvider>(
create: (context) =>
ExercisesProvider(Provider.of<AuthProvider>(context, listen: false), []),
update: (context, auth, previous) =>
previous ?? ExercisesProvider(auth, []),
update: (context, auth, previous) => previous ?? ExercisesProvider(auth, []),
),
ChangeNotifierProxyProvider2<AuthProvider, ExercisesProvider, WorkoutPlansProvider>(
create: (context) => WorkoutPlansProvider(
@@ -80,8 +79,7 @@ class MyApp extends StatelessWidget {
ChangeNotifierProxyProvider<AuthProvider, NutritionPlansProvider>(
create: (context) =>
NutritionPlansProvider(Provider.of<AuthProvider>(context, listen: false), []),
update: (context, auth, previous) =>
previous ?? NutritionPlansProvider(auth, []),
update: (context, auth, previous) => previous ?? NutritionPlansProvider(auth, []),
),
ChangeNotifierProxyProvider<AuthProvider, MeasurementProvider>(
create: (context) => MeasurementProvider(
@@ -92,14 +90,12 @@ class MyApp extends StatelessWidget {
ChangeNotifierProxyProvider<AuthProvider, BodyWeightProvider>(
create: (context) =>
BodyWeightProvider(Provider.of<AuthProvider>(context, listen: false), []),
update: (context, auth, previous) =>
previous ?? BodyWeightProvider(auth, []),
update: (context, auth, previous) => previous ?? BodyWeightProvider(auth, []),
),
ChangeNotifierProxyProvider<AuthProvider, GalleryProvider>(
create: (context) =>
GalleryProvider(Provider.of<AuthProvider>(context, listen: false), []),
update: (context, auth, previous) =>
previous ?? GalleryProvider(auth, []),
update: (context, auth, previous) => previous ?? GalleryProvider(auth, []),
),
],
child: Consumer<AuthProvider>(

View File

@@ -37,8 +37,7 @@ class MeasurementChartWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final unitTickFormatter =
charts.BasicNumericTickFormatterSpec((num? value) => '$value $unit');
final unitTickFormatter = charts.BasicNumericTickFormatterSpec((num? value) => '$value $unit');
return charts.TimeSeriesChart(
[

View File

@@ -177,23 +177,26 @@ class _DashboardNutritionWidgetState extends State<DashboardNutritionWidget> {
});
},
),
if (_hasContent) Container(
padding: EdgeInsets.only(left: 10),
child: Column(
children: [
...getContent(),
Container(
padding: EdgeInsets.all(15),
height: 180,
child: NutritionalPlanPieChartWidget(_plan!.nutritionalValues),
)
],
),
) else NothingFound(
AppLocalizations.of(context).noNutritionalPlans,
AppLocalizations.of(context).newNutritionalPlan,
PlanForm(),
),
if (_hasContent)
Container(
padding: EdgeInsets.only(left: 10),
child: Column(
children: [
...getContent(),
Container(
padding: EdgeInsets.all(15),
height: 180,
child: NutritionalPlanPieChartWidget(_plan!.nutritionalValues),
)
],
),
)
else
NothingFound(
AppLocalizations.of(context).noNutritionalPlans,
AppLocalizations.of(context).newNutritionalPlan,
PlanForm(),
),
if (_hasContent)
Row(
mainAxisAlignment: MainAxisAlignment.end,
@@ -253,31 +256,34 @@ class _DashboardWeightWidgetState extends State<DashboardWeightWidget> {
),
Column(
children: [
if (weightEntriesData.items.isNotEmpty) Column(
children: [
Container(
padding: EdgeInsets.all(15),
height: 180,
child: MeasurementChartWidget(weightEntriesData.items
.map((e) => MeasurementChartEntry(e.weight, e.date))
.toList()),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
TextButton(
child: Text(AppLocalizations.of(context).goToDetailPage),
onPressed: () {
Navigator.of(context).pushNamed(WeightScreen.routeName);
}),
],
),
],
) else NothingFound(
AppLocalizations.of(context).noWeightEntries,
AppLocalizations.of(context).newEntry,
WeightForm(),
if (weightEntriesData.items.isNotEmpty)
Column(
children: [
Container(
padding: EdgeInsets.all(15),
height: 180,
child: MeasurementChartWidget(weightEntriesData.items
.map((e) => MeasurementChartEntry(e.weight, e.date))
.toList()),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
TextButton(
child: Text(AppLocalizations.of(context).goToDetailPage),
onPressed: () {
Navigator.of(context).pushNamed(WeightScreen.routeName);
}),
],
),
],
)
else
NothingFound(
AppLocalizations.of(context).noWeightEntries,
AppLocalizations.of(context).newEntry,
WeightForm(),
),
],
),
],
@@ -406,18 +412,21 @@ class _DashboardWorkoutWidgetState extends State<DashboardWorkoutWidget> {
});
},
),
if (_hasContent) Container(
padding: EdgeInsets.only(left: 10),
child: Column(
children: [
...getContent(),
],
),
) else NothingFound(
AppLocalizations.of(context).noWorkoutPlans,
AppLocalizations.of(context).newWorkout,
WorkoutForm(WorkoutPlan.empty()),
),
if (_hasContent)
Container(
padding: EdgeInsets.only(left: 10),
child: Column(
children: [
...getContent(),
],
),
)
else
NothingFound(
AppLocalizations.of(context).noWorkoutPlans,
AppLocalizations.of(context).newWorkout,
WorkoutForm(WorkoutPlan.empty()),
),
if (_hasContent)
Row(
mainAxisAlignment: MainAxisAlignment.end,

View File

@@ -30,7 +30,8 @@ void main() {
});
test('Test that the weight entries are correctly converted from json', () async {
final WeightEntry weightEntryObj = WeightEntry(id: 1, weight: 80, date: DateTime(2020, 12, 31));
final WeightEntry weightEntryObj =
WeightEntry(id: 1, weight: 80, date: DateTime(2020, 12, 31));
final WeightEntry weightEntry = WeightEntry.fromJson({
'id': 1,
'weight': '80',