From a9486727b2624d4c5010a2e2a2058a702338ff6c Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Thu, 30 Nov 2023 13:02:50 +1300 Subject: [PATCH] Ran dart fix --apply --- lib/delete_all_sets.dart | 6 +++--- lib/dynamic_color_scheme.dart | 2 +- lib/edit_plan.dart | 9 ++++----- lib/edit_set.dart | 18 +++++++++--------- lib/home_page.dart | 2 +- lib/plans_page.dart | 8 ++++---- lib/set_tile.dart | 4 ++-- lib/settings_page.dart | 16 ++++++++-------- lib/sound_picker.dart | 2 +- lib/start_plan.dart | 18 +++++++++--------- 10 files changed, 42 insertions(+), 43 deletions(-) diff --git a/lib/delete_all_sets.dart b/lib/delete_all_sets.dart index 8e240ad..5f6ab92 100644 --- a/lib/delete_all_sets.dart +++ b/lib/delete_all_sets.dart @@ -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: [ 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(); }, ), ], ); - }); + },); }, ), ); diff --git a/lib/dynamic_color_scheme.dart b/lib/dynamic_color_scheme.dart index 472f026..03ef065 100644 --- a/lib/dynamic_color_scheme.dart +++ b/lib/dynamic_color_scheme.dart @@ -46,7 +46,7 @@ class _DynamicColorSchemeState extends State { context, colorScheme.copyWith( primary: color, - )); + ),); }, ); } diff --git a/lib/edit_plan.dart b/lib/edit_plan.dart index 0207b5e..696e84a 100644 --- a/lib/edit_plan.dart +++ b/lib/edit_plan.dart @@ -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 { 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 { 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 { }, child: const Icon(Icons.check), ), - )); + ),); } List get getChildren { @@ -169,7 +168,7 @@ class _EditPlanPageState extends State { Expanded( child: ListView( children: children, - )) + ),), ]; } } diff --git a/lib/edit_set.dart b/lib/edit_set.dart index 20131ec..f375830 100644 --- a/lib/edit_set.dart +++ b/lib/edit_set.dart @@ -34,7 +34,7 @@ class _EditGymSetPageState extends State { 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 { 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 { 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 { 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 { 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 { 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 { 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 { }, child: const Icon(Icons.check), ), - )); + ),); } } diff --git a/lib/home_page.dart b/lib/home_page.dart index 62fdadd..ddd3d98 100644 --- a/lib/home_page.dart +++ b/lib/home_page.dart @@ -101,6 +101,6 @@ class _HomePage extends State { ], ), body: getBody(), - )); + ),); } } diff --git a/lib/plans_page.dart b/lib/plans_page.dart index 1273fb6..27c90e3 100644 --- a/lib/plans_page.dart +++ b/lib/plans_page.dart @@ -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),),); } } diff --git a/lib/set_tile.dart b/lib/set_tile.dart index c819ada..405342a 100644 --- a/lib/set_tile.dart +++ b/lib/set_tile.dart @@ -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: [ ElevatedButton( child: const Text('Cancel'), diff --git a/lib/settings_page.dart b/lib/settings_page.dart index 06fe184..f2f4d9e 100644 --- a/lib/settings_page.dart +++ b/lib/settings_page.dart @@ -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 diff --git a/lib/sound_picker.dart b/lib/sound_picker.dart index 518ce33..e2894b8 100644 --- a/lib/sound_picker.dart +++ b/lib/sound_picker.dart @@ -37,7 +37,7 @@ class _SoundPickerState extends State { }, child: Text(widget.path != null ? "Sound: ${basename(widget.path!)}" - : 'Alarm sound'), + : 'Alarm sound',), ); } } diff --git a/lib/start_plan.dart b/lib/start_plan.dart index 9c538da..9a961be 100644 --- a/lib/start_plan.dart +++ b/lib/start_plan.dart @@ -31,10 +31,10 @@ class _StartPlanState extends State { ..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 { .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 { 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 { ), ); }, - 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 { 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 { 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 { 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 { }, child: const Icon(Icons.check), ), - )); + ),); } }