Ran dart fix --apply
This commit is contained in:
parent
e4ba71ad4b
commit
a9486727b2
|
@ -22,7 +22,7 @@ class DeleteAllSets extends StatelessWidget {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text("Delete all sets"),
|
title: const Text("Delete all sets"),
|
||||||
content: const Text(
|
content: const Text(
|
||||||
"This will irreversibly destroy all your gym set data. Are you sure?"),
|
"This will irreversibly destroy all your gym set data. Are you sure?",),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
child: const Text('Cancel'),
|
child: const Text('Cancel'),
|
||||||
|
@ -36,14 +36,14 @@ class DeleteAllSets extends StatelessWidget {
|
||||||
await db.gymSets.delete().go();
|
await db.gymSets.delete().go();
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
const SnackBar(content: Text('Deleted all sets')));
|
const SnackBar(content: Text('Deleted all sets')),);
|
||||||
final navigator = Navigator.of(context);
|
final navigator = Navigator.of(context);
|
||||||
navigator.pop();
|
navigator.pop();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
});
|
},);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -46,7 +46,7 @@ class _DynamicColorSchemeState extends State<DynamicColorScheme> {
|
||||||
context,
|
context,
|
||||||
colorScheme.copyWith(
|
colorScheme.copyWith(
|
||||||
primary: color,
|
primary: color,
|
||||||
));
|
),);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ import 'package:flutter/material.dart' as material;
|
||||||
import 'package:fmassive/constants.dart';
|
import 'package:fmassive/constants.dart';
|
||||||
import 'package:fmassive/database.dart';
|
import 'package:fmassive/database.dart';
|
||||||
import 'package:fmassive/main.dart';
|
import 'package:fmassive/main.dart';
|
||||||
import 'package:fmassive/start_plan.dart';
|
|
||||||
import 'package:moor_flutter/moor_flutter.dart';
|
import 'package:moor_flutter/moor_flutter.dart';
|
||||||
|
|
||||||
class EditPlanPage extends StatefulWidget {
|
class EditPlanPage extends StatefulWidget {
|
||||||
|
@ -87,7 +86,7 @@ class _EditPlanPageState extends State<EditPlanPage> {
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.delete)));
|
icon: const Icon(Icons.delete),),);
|
||||||
|
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
@ -113,7 +112,7 @@ class _EditPlanPageState extends State<EditPlanPage> {
|
||||||
|
|
||||||
var newPlan = widget.plan.copyWith(
|
var newPlan = widget.plan.copyWith(
|
||||||
days: Value(days.join(',')),
|
days: Value(days.join(',')),
|
||||||
exercises: Value(exercises.join(',')));
|
exercises: Value(exercises.join(',')),);
|
||||||
|
|
||||||
if (widget.plan.id.present)
|
if (widget.plan.id.present)
|
||||||
await db.update(db.plans).replace(newPlan);
|
await db.update(db.plans).replace(newPlan);
|
||||||
|
@ -127,7 +126,7 @@ class _EditPlanPageState extends State<EditPlanPage> {
|
||||||
},
|
},
|
||||||
child: const Icon(Icons.check),
|
child: const Icon(Icons.check),
|
||||||
),
|
),
|
||||||
));
|
),);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> get getChildren {
|
List<Widget> get getChildren {
|
||||||
|
@ -169,7 +168,7 @@ class _EditPlanPageState extends State<EditPlanPage> {
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: children,
|
children: children,
|
||||||
))
|
),),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
|
||||||
if (gymSet.id.present) {
|
if (gymSet.id.present) {
|
||||||
repsNode.requestFocus();
|
repsNode.requestFocus();
|
||||||
_repsController.selection = TextSelection(
|
_repsController.selection = TextSelection(
|
||||||
baseOffset: 0, extentOffset: _repsController.text.length);
|
baseOffset: 0, extentOffset: _repsController.text.length,);
|
||||||
} else
|
} else
|
||||||
nameNode.requestFocus();
|
nameNode.requestFocus();
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.delete)));
|
icon: const Icon(Icons.delete),),);
|
||||||
|
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
@ -72,7 +72,7 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
|
||||||
decoration: const InputDecoration(labelText: 'Name'),
|
decoration: const InputDecoration(labelText: 'Name'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_nameController.selection = TextSelection(
|
_nameController.selection = TextSelection(
|
||||||
baseOffset: 0, extentOffset: _nameController.text.length);
|
baseOffset: 0, extentOffset: _nameController.text.length,);
|
||||||
},
|
},
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
@ -85,7 +85,7 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
|
||||||
focusNode: repsNode,
|
focusNode: repsNode,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_repsController.selection = TextSelection(
|
_repsController.selection = TextSelection(
|
||||||
baseOffset: 0, extentOffset: _repsController.text.length);
|
baseOffset: 0, extentOffset: _repsController.text.length,);
|
||||||
},
|
},
|
||||||
decoration: const InputDecoration(labelText: 'Reps'),
|
decoration: const InputDecoration(labelText: 'Reps'),
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
|
@ -102,12 +102,12 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_weightController.selection = TextSelection(
|
_weightController.selection = TextSelection(
|
||||||
baseOffset: 0, extentOffset: _weightController.text.length);
|
baseOffset: 0, extentOffset: _weightController.text.length,);
|
||||||
},
|
},
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
gymSet = gymSet.copyWith(
|
gymSet = gymSet.copyWith(
|
||||||
weight: Value(double.tryParse(value) ?? 0));
|
weight: Value(double.tryParse(value) ?? 0),);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -118,7 +118,7 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
if (_nameController.text.isEmpty) {
|
if (_nameController.text.isEmpty) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
const SnackBar(content: Text('Please enter a name')));
|
const SnackBar(content: Text('Please enter a name')),);
|
||||||
nameNode.requestFocus();
|
nameNode.requestFocus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
|
||||||
else {
|
else {
|
||||||
await Permission.notification.request();
|
await Permission.notification.request();
|
||||||
final newSet = gymSet.copyWith(
|
final newSet = gymSet.copyWith(
|
||||||
created: Value(DateTime.now().toIso8601String()));
|
created: Value(DateTime.now().toIso8601String()),);
|
||||||
await db.into(db.gymSets).insert(newSet);
|
await db.into(db.gymSets).insert(newSet);
|
||||||
const platform = MethodChannel('com.massive/android');
|
const platform = MethodChannel('com.massive/android');
|
||||||
platform.invokeMethod('timer', [3000]);
|
platform.invokeMethod('timer', [3000]);
|
||||||
|
@ -137,6 +137,6 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
|
||||||
},
|
},
|
||||||
child: const Icon(Icons.check),
|
child: const Icon(Icons.check),
|
||||||
),
|
),
|
||||||
));
|
),);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,6 +101,6 @@ class _HomePage extends State<HomePage> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: getBody(),
|
body: getBody(),
|
||||||
));
|
),);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,13 +73,13 @@ class _PlansPageState extends State<_PlansPage> {
|
||||||
child: Text(
|
child: Text(
|
||||||
'Error: ${snapshot.error}',
|
'Error: ${snapshot.error}',
|
||||||
style: Theme.of(context).textTheme.headlineSmall,
|
style: Theme.of(context).textTheme.headlineSmall,
|
||||||
)),
|
),),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (plans == null) return Container();
|
if (plans == null) return Container();
|
||||||
|
|
||||||
return PlanList(plans: plans);
|
return PlanList(plans: plans);
|
||||||
}),
|
},),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
|
@ -87,10 +87,10 @@ class _PlansPageState extends State<_PlansPage> {
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => const EditPlanPage(
|
builder: (context) => const EditPlanPage(
|
||||||
plan: PlansCompanion(
|
plan: PlansCompanion(
|
||||||
days: Value(''), exercises: Value(''))),
|
days: Value(''), exercises: Value(''),),),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: const Icon(Icons.add)));
|
child: const Icon(Icons.add),),);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ class SetTile extends StatelessWidget {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(gymSet.name),
|
title: Text(gymSet.name),
|
||||||
subtitle: Text(DateFormat("yyyy-MM-dd HH:mm")
|
subtitle: Text(DateFormat("yyyy-MM-dd HH:mm")
|
||||||
.format(DateTime.parse(gymSet.created))),
|
.format(DateTime.parse(gymSet.created)),),
|
||||||
trailing: Text("${gymSet.reps} x ${gymSet.weight}kg"),
|
trailing: Text("${gymSet.reps} x ${gymSet.weight}kg"),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
|
@ -40,7 +40,7 @@ class SetTile extends StatelessWidget {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('Delete set'),
|
title: const Text('Delete set'),
|
||||||
content: Text(
|
content: Text(
|
||||||
'Are you sure you want to delete ${gymSet.name} ${gymSet.reps}x${gymSet.weight}${gymSet.unit}?'),
|
'Are you sure you want to delete ${gymSet.name} ${gymSet.reps}x${gymSet.weight}${gymSet.unit}?',),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
child: const Text('Cancel'),
|
child: const Text('Cancel'),
|
||||||
|
|
|
@ -68,7 +68,7 @@ class _SettingsPageState extends State<_SettingsPage> {
|
||||||
]
|
]
|
||||||
.where((item) => (item['title'] as String)
|
.where((item) => (item['title'] as String)
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(widget.search.toLowerCase()))
|
.contains(widget.search.toLowerCase()),)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
return material.Column(
|
return material.Column(
|
||||||
|
@ -89,7 +89,7 @@ class _SettingsPageState extends State<_SettingsPage> {
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final result = await FilePicker.platform.pickFiles(
|
final result = await FilePicker.platform.pickFiles(
|
||||||
type: FileType.custom,
|
type: FileType.custom,
|
||||||
allowedExtensions: ['csv']);
|
allowedExtensions: ['csv'],);
|
||||||
if (result == null) return;
|
if (result == null) return;
|
||||||
|
|
||||||
final file = File(result.files.single.path!);
|
final file = File(result.files.single.path!);
|
||||||
|
@ -112,14 +112,14 @@ class _SettingsPageState extends State<_SettingsPage> {
|
||||||
minutes: Value(int.tryParse(row[9]) ?? 0),
|
minutes: Value(int.tryParse(row[9]) ?? 0),
|
||||||
seconds: Value(int.tryParse(row[10]) ?? 0),
|
seconds: Value(int.tryParse(row[10]) ?? 0),
|
||||||
steps: Value(row[11]),
|
steps: Value(row[11]),
|
||||||
));
|
),);
|
||||||
await db.batch(
|
await db.batch(
|
||||||
(batch) => batch.insertAll(db.gymSets, gymSets));
|
(batch) => batch.insertAll(db.gymSets, gymSets),);
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
const SnackBar(content: Text('Imported sets')));
|
const SnackBar(content: Text('Imported sets')),);
|
||||||
},
|
},
|
||||||
));
|
),);
|
||||||
|
|
||||||
if (item['title'] == 'Sound') {
|
if (item['title'] == 'Sound') {
|
||||||
return Center(
|
return Center(
|
||||||
|
@ -146,7 +146,7 @@ class _SettingsPageState extends State<_SettingsPage> {
|
||||||
break;
|
break;
|
||||||
case 'Vibrate':
|
case 'Vibrate':
|
||||||
db.update(db.settings).write(
|
db.update(db.settings).write(
|
||||||
SettingsCompanion(vibrate: Value(value)));
|
SettingsCompanion(vibrate: Value(value)),);
|
||||||
break;
|
break;
|
||||||
case 'Notify':
|
case 'Notify':
|
||||||
db
|
db
|
||||||
|
@ -160,7 +160,7 @@ class _SettingsPageState extends State<_SettingsPage> {
|
||||||
break;
|
break;
|
||||||
case 'Show Unit':
|
case 'Show Unit':
|
||||||
db.update(db.settings).write(
|
db.update(db.settings).write(
|
||||||
SettingsCompanion(showUnit: Value(value)));
|
SettingsCompanion(showUnit: Value(value)),);
|
||||||
break;
|
break;
|
||||||
case 'Steps':
|
case 'Steps':
|
||||||
db
|
db
|
||||||
|
|
|
@ -37,7 +37,7 @@ class _SoundPickerState extends State<SoundPicker> {
|
||||||
},
|
},
|
||||||
child: Text(widget.path != null
|
child: Text(widget.path != null
|
||||||
? "Sound: ${basename(widget.path!)}"
|
? "Sound: ${basename(widget.path!)}"
|
||||||
: 'Alarm sound'),
|
: 'Alarm sound',),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,10 @@ class _StartPlanState extends State<StartPlan> {
|
||||||
..where(db.gymSets.name.isIn(exercises))
|
..where(db.gymSets.name.isIn(exercises))
|
||||||
..groupBy([db.gymSets.name, db.gymSets.sets]))
|
..groupBy([db.gymSets.name, db.gymSets.sets]))
|
||||||
.map((row) =>
|
.map((row) =>
|
||||||
MapEntry(row.read(db.gymSets.name), row.read(db.gymSets.sets)))
|
MapEntry(row.read(db.gymSets.name), row.read(db.gymSets.sets)),)
|
||||||
.get();
|
.get();
|
||||||
final map = Map.fromIterables(
|
final map = Map.fromIterables(
|
||||||
query.map((entry) => entry.key), query.map((entry) => entry.value));
|
query.map((entry) => entry.key), query.map((entry) => entry.value),);
|
||||||
setState(() {
|
setState(() {
|
||||||
totals = [];
|
totals = [];
|
||||||
for (var exercise in exercises) {
|
for (var exercise in exercises) {
|
||||||
|
@ -54,7 +54,7 @@ class _StartPlanState extends State<StartPlan> {
|
||||||
.map((row) => MapEntry(row.read(db.gymSets.name), row.read(countExp)))
|
.map((row) => MapEntry(row.read(db.gymSets.name), row.read(countExp)))
|
||||||
.get();
|
.get();
|
||||||
final map = Map.fromIterables(
|
final map = Map.fromIterables(
|
||||||
query.map((entry) => entry.key), query.map((entry) => entry.value));
|
query.map((entry) => entry.key), query.map((entry) => entry.value),);
|
||||||
setState(() {
|
setState(() {
|
||||||
counts = [];
|
counts = [];
|
||||||
for (var exercise in exercises) {
|
for (var exercise in exercises) {
|
||||||
|
@ -76,7 +76,7 @@ class _StartPlanState extends State<StartPlan> {
|
||||||
final firstSet = sets.first;
|
final firstSet = sets.first;
|
||||||
repsController.text = firstSet.reps.toString();
|
repsController.text = firstSet.reps.toString();
|
||||||
repsController.selection = TextSelection(
|
repsController.selection = TextSelection(
|
||||||
baseOffset: 0, extentOffset: firstSet.reps.toString().length);
|
baseOffset: 0, extentOffset: firstSet.reps.toString().length,);
|
||||||
weightController.text = firstSet.weight.toString();
|
weightController.text = firstSet.weight.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ class _StartPlanState extends State<StartPlan> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.edit)));
|
icon: const Icon(Icons.edit),),);
|
||||||
|
|
||||||
if (totals.isEmpty || counts.isEmpty) return Container();
|
if (totals.isEmpty || counts.isEmpty) return Container();
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ class _StartPlanState extends State<StartPlan> {
|
||||||
focusNode: repsNode,
|
focusNode: repsNode,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
repsController.selection = TextSelection(
|
repsController.selection = TextSelection(
|
||||||
baseOffset: 0, extentOffset: repsController.text.length);
|
baseOffset: 0, extentOffset: repsController.text.length,);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
|
@ -166,7 +166,7 @@ class _StartPlanState extends State<StartPlan> {
|
||||||
focusNode: weightNode,
|
focusNode: weightNode,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
weightController.selection = TextSelection(
|
weightController.selection = TextSelection(
|
||||||
baseOffset: 0, extentOffset: weightController.text.length);
|
baseOffset: 0, extentOffset: weightController.text.length,);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -178,7 +178,7 @@ class _StartPlanState extends State<StartPlan> {
|
||||||
created: Value(DateTime.now().toIso8601String()),
|
created: Value(DateTime.now().toIso8601String()),
|
||||||
name: Value(exercises[selectedExercise]),
|
name: Value(exercises[selectedExercise]),
|
||||||
reps: Value(int.tryParse(repsController.text) ?? 0),
|
reps: Value(int.tryParse(repsController.text) ?? 0),
|
||||||
weight: Value(double.tryParse(weightController.text) ?? 0));
|
weight: Value(double.tryParse(weightController.text) ?? 0),);
|
||||||
await db.into(db.gymSets).insert(gymSet);
|
await db.into(db.gymSets).insert(gymSet);
|
||||||
const platform = MethodChannel('com.massive/android');
|
const platform = MethodChannel('com.massive/android');
|
||||||
platform.invokeMethod('timer', [180000]);
|
platform.invokeMethod('timer', [180000]);
|
||||||
|
@ -186,6 +186,6 @@ class _StartPlanState extends State<StartPlan> {
|
||||||
},
|
},
|
||||||
child: const Icon(Icons.check),
|
child: const Icon(Icons.check),
|
||||||
),
|
),
|
||||||
));
|
),);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user