Ran dart fix --apply

This commit is contained in:
Brandon Presley 2023-11-30 13:02:50 +13:00
parent e4ba71ad4b
commit a9486727b2
10 changed files with 42 additions and 43 deletions

View File

@ -22,7 +22,7 @@ class DeleteAllSets extends StatelessWidget {
return AlertDialog(
title: const Text("Delete all sets"),
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>[
ElevatedButton(
child: const Text('Cancel'),
@ -36,14 +36,14 @@ class DeleteAllSets extends StatelessWidget {
await db.gymSets.delete().go();
if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Deleted all sets')));
const SnackBar(content: Text('Deleted all sets')),);
final navigator = Navigator.of(context);
navigator.pop();
},
),
],
);
});
},);
},
),
);

View File

@ -46,7 +46,7 @@ class _DynamicColorSchemeState extends State<DynamicColorScheme> {
context,
colorScheme.copyWith(
primary: color,
));
),);
},
);
}

View File

@ -3,7 +3,6 @@ import 'package:flutter/material.dart' as material;
import 'package:fmassive/constants.dart';
import 'package:fmassive/database.dart';
import 'package:fmassive/main.dart';
import 'package:fmassive/start_plan.dart';
import 'package:moor_flutter/moor_flutter.dart';
class EditPlanPage extends StatefulWidget {
@ -87,7 +86,7 @@ class _EditPlanPageState extends State<EditPlanPage> {
if (!mounted) return;
Navigator.pop(context);
},
icon: const Icon(Icons.delete)));
icon: const Icon(Icons.delete),),);
return SafeArea(
child: Scaffold(
@ -113,7 +112,7 @@ class _EditPlanPageState extends State<EditPlanPage> {
var newPlan = widget.plan.copyWith(
days: Value(days.join(',')),
exercises: Value(exercises.join(',')));
exercises: Value(exercises.join(',')),);
if (widget.plan.id.present)
await db.update(db.plans).replace(newPlan);
@ -127,7 +126,7 @@ class _EditPlanPageState extends State<EditPlanPage> {
},
child: const Icon(Icons.check),
),
));
),);
}
List<Widget> get getChildren {
@ -169,7 +168,7 @@ class _EditPlanPageState extends State<EditPlanPage> {
Expanded(
child: ListView(
children: children,
))
),),
];
}
}

View File

@ -34,7 +34,7 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
if (gymSet.id.present) {
repsNode.requestFocus();
_repsController.selection = TextSelection(
baseOffset: 0, extentOffset: _repsController.text.length);
baseOffset: 0, extentOffset: _repsController.text.length,);
} else
nameNode.requestFocus();
}
@ -56,7 +56,7 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
if (!mounted) return;
Navigator.pop(context);
},
icon: const Icon(Icons.delete)));
icon: const Icon(Icons.delete),),);
return SafeArea(
child: Scaffold(
@ -72,7 +72,7 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
decoration: const InputDecoration(labelText: 'Name'),
onTap: () {
_nameController.selection = TextSelection(
baseOffset: 0, extentOffset: _nameController.text.length);
baseOffset: 0, extentOffset: _nameController.text.length,);
},
onChanged: (value) {
setState(() {
@ -85,7 +85,7 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
focusNode: repsNode,
onTap: () {
_repsController.selection = TextSelection(
baseOffset: 0, extentOffset: _repsController.text.length);
baseOffset: 0, extentOffset: _repsController.text.length,);
},
decoration: const InputDecoration(labelText: 'Reps'),
keyboardType: TextInputType.number,
@ -102,12 +102,12 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
keyboardType: TextInputType.number,
onTap: () {
_weightController.selection = TextSelection(
baseOffset: 0, extentOffset: _weightController.text.length);
baseOffset: 0, extentOffset: _weightController.text.length,);
},
onChanged: (value) {
setState(() {
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 {
if (_nameController.text.isEmpty) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Please enter a name')));
const SnackBar(content: Text('Please enter a name')),);
nameNode.requestFocus();
return;
}
@ -127,7 +127,7 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
else {
await Permission.notification.request();
final newSet = gymSet.copyWith(
created: Value(DateTime.now().toIso8601String()));
created: Value(DateTime.now().toIso8601String()),);
await db.into(db.gymSets).insert(newSet);
const platform = MethodChannel('com.massive/android');
platform.invokeMethod('timer', [3000]);
@ -137,6 +137,6 @@ class _EditGymSetPageState extends State<EditGymSetPage> {
},
child: const Icon(Icons.check),
),
));
),);
}
}

View File

@ -101,6 +101,6 @@ class _HomePage extends State<HomePage> {
],
),
body: getBody(),
));
),);
}
}

View File

@ -73,13 +73,13 @@ class _PlansPageState extends State<_PlansPage> {
child: Text(
'Error: ${snapshot.error}',
style: Theme.of(context).textTheme.headlineSmall,
)),
),),
);
if (plans == null) return Container();
return PlanList(plans: plans);
}),
},),
floatingActionButton: FloatingActionButton(
onPressed: () async {
await Navigator.push(
@ -87,10 +87,10 @@ class _PlansPageState extends State<_PlansPage> {
MaterialPageRoute(
builder: (context) => const EditPlanPage(
plan: PlansCompanion(
days: Value(''), exercises: Value(''))),
days: Value(''), exercises: Value(''),),),
),
);
},
child: const Icon(Icons.add)));
child: const Icon(Icons.add),),);
}
}

View File

@ -21,7 +21,7 @@ class SetTile extends StatelessWidget {
return ListTile(
title: Text(gymSet.name),
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"),
onTap: () async {
await Navigator.push(
@ -40,7 +40,7 @@ class SetTile extends StatelessWidget {
return AlertDialog(
title: const Text('Delete set'),
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>[
ElevatedButton(
child: const Text('Cancel'),

View File

@ -68,7 +68,7 @@ class _SettingsPageState extends State<_SettingsPage> {
]
.where((item) => (item['title'] as String)
.toLowerCase()
.contains(widget.search.toLowerCase()))
.contains(widget.search.toLowerCase()),)
.toList();
return material.Column(
@ -89,7 +89,7 @@ class _SettingsPageState extends State<_SettingsPage> {
onPressed: () async {
final result = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['csv']);
allowedExtensions: ['csv'],);
if (result == null) return;
final file = File(result.files.single.path!);
@ -112,14 +112,14 @@ class _SettingsPageState extends State<_SettingsPage> {
minutes: Value(int.tryParse(row[9]) ?? 0),
seconds: Value(int.tryParse(row[10]) ?? 0),
steps: Value(row[11]),
));
),);
await db.batch(
(batch) => batch.insertAll(db.gymSets, gymSets));
(batch) => batch.insertAll(db.gymSets, gymSets),);
if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Imported sets')));
const SnackBar(content: Text('Imported sets')),);
},
));
),);
if (item['title'] == 'Sound') {
return Center(
@ -146,7 +146,7 @@ class _SettingsPageState extends State<_SettingsPage> {
break;
case 'Vibrate':
db.update(db.settings).write(
SettingsCompanion(vibrate: Value(value)));
SettingsCompanion(vibrate: Value(value)),);
break;
case 'Notify':
db
@ -160,7 +160,7 @@ class _SettingsPageState extends State<_SettingsPage> {
break;
case 'Show Unit':
db.update(db.settings).write(
SettingsCompanion(showUnit: Value(value)));
SettingsCompanion(showUnit: Value(value)),);
break;
case 'Steps':
db

View File

@ -37,7 +37,7 @@ class _SoundPickerState extends State<SoundPicker> {
},
child: Text(widget.path != null
? "Sound: ${basename(widget.path!)}"
: 'Alarm sound'),
: 'Alarm sound',),
);
}
}

View File

@ -31,10 +31,10 @@ class _StartPlanState extends State<StartPlan> {
..where(db.gymSets.name.isIn(exercises))
..groupBy([db.gymSets.name, db.gymSets.sets]))
.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();
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(() {
totals = [];
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)))
.get();
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(() {
counts = [];
for (var exercise in exercises) {
@ -76,7 +76,7 @@ class _StartPlanState extends State<StartPlan> {
final firstSet = sets.first;
repsController.text = firstSet.reps.toString();
repsController.selection = TextSelection(
baseOffset: 0, extentOffset: firstSet.reps.toString().length);
baseOffset: 0, extentOffset: firstSet.reps.toString().length,);
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();
@ -157,7 +157,7 @@ class _StartPlanState extends State<StartPlan> {
focusNode: repsNode,
onTap: () {
repsController.selection = TextSelection(
baseOffset: 0, extentOffset: repsController.text.length);
baseOffset: 0, extentOffset: repsController.text.length,);
},
),
TextFormField(
@ -166,7 +166,7 @@ class _StartPlanState extends State<StartPlan> {
focusNode: weightNode,
onTap: () {
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()),
name: Value(exercises[selectedExercise]),
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);
const platform = MethodChannel('com.massive/android');
platform.invokeMethod('timer', [180000]);
@ -186,6 +186,6 @@ class _StartPlanState extends State<StartPlan> {
},
child: const Icon(Icons.check),
),
));
),);
}
}