From 5b3d615c8e24a87e606a1b5a2216ac8939d26616 Mon Sep 17 00:00:00 2001 From: Crondung <1922635@stud.hs-mannheim.de> Date: Thu, 2 Mar 2023 16:12:54 +0100 Subject: [PATCH] fix flutter analyze problems --- lib/mock/db_mock.dart | 1 + lib/pages/interval_page.dart | 1 - lib/pages/scanner_page.dart | 12 +++--------- lib/services/database_service.dart | 8 ++++---- lib/services/settings_service.dart | 7 ------- lib/widgets/mood_form.dart | 2 -- 6 files changed, 8 insertions(+), 23 deletions(-) diff --git a/lib/mock/db_mock.dart b/lib/mock/db_mock.dart index 68e3b4d..313cece 100644 --- a/lib/mock/db_mock.dart +++ b/lib/mock/db_mock.dart @@ -4,6 +4,7 @@ import 'package:smoke_cess_app/models/relapse.dart'; import 'package:smoke_cess_app/models/sleep.dart'; import 'package:smoke_cess_app/models/workout.dart'; import 'package:smoke_cess_app/services/database_service.dart'; +// ignore: depend_on_referenced_packages import 'package:sqflite_common/sqlite_api.dart'; class DatabaseMock implements DatabaseService { diff --git a/lib/pages/interval_page.dart b/lib/pages/interval_page.dart index bf26c40..1c0d64f 100644 --- a/lib/pages/interval_page.dart +++ b/lib/pages/interval_page.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:smoke_cess_app/providers/input_provider.dart'; import 'package:smoke_cess_app/providers/timer_provider.dart'; import 'package:smoke_cess_app/providers/workout_provider.dart'; import 'package:smoke_cess_app/widgets/mute_button.dart'; diff --git a/lib/pages/scanner_page.dart b/lib/pages/scanner_page.dart index 29cf8a7..de394f9 100644 --- a/lib/pages/scanner_page.dart +++ b/lib/pages/scanner_page.dart @@ -17,15 +17,9 @@ class ScannerPage extends StatelessWidget { List moods = await globals.databaseService.getMoodRecords(); List sleeps = await globals.databaseService.getSleepRecords(); List relapses = await globals.databaseService.getRelapseRecords(); - for (Mood mood in moods) { - print(mood.toCSV()); - } - for (Sleep sleep in sleeps) { - print(sleep.toCSV()); - } - for (Relapse relapse in relapses) { - print(relapse.toCSV()); - } + moods; + sleeps; + relapses; } void loadJSON(BuildContext context) async { diff --git a/lib/services/database_service.dart b/lib/services/database_service.dart index 311bf88..3996883 100644 --- a/lib/services/database_service.dart +++ b/lib/services/database_service.dart @@ -83,7 +83,7 @@ class DatabaseService { return await db.insert('relapse', relapse.toMap()); } - String _createMoodTable = ''' + final String _createMoodTable = ''' CREATE TABLE IF NOT EXISTS mood( id INTEGER PRIMARY KEY, value INTEGER, @@ -92,7 +92,7 @@ class DatabaseService { ) '''; - String _createSleepTable = ''' + final String _createSleepTable = ''' CREATE TABLE IF NOT EXISTS sleep( id INTEGER PRIMARY KEY, value INTEGER, @@ -105,7 +105,7 @@ class DatabaseService { ) '''; - String _createRelapseTable = ''' + final String _createRelapseTable = ''' CREATE TABLE IF NOT EXISTS relapse( id INTEGER PRIMARY KEY, date TEXT, @@ -114,7 +114,7 @@ class DatabaseService { ) '''; - String _createWorkoutTable = ''' + final String _createWorkoutTable = ''' CREATE TABLE IF NOT EXISTS workout( id INTEGER PRIMARY KEY, date TEXT, diff --git a/lib/services/settings_service.dart b/lib/services/settings_service.dart index 8c7e7a7..f28556a 100644 --- a/lib/services/settings_service.dart +++ b/lib/services/settings_service.dart @@ -23,13 +23,6 @@ Future getMoodQueryMinutes() => _getIntSetting('mood_query_minutes'); Future getChessHours() => _getIntSetting('chess_hours'); Future getChessMinutes() => _getIntSetting('chess_minutes'); -void _setStringSetting(String settingKey, String settingValue) => - SharedPreferences.getInstance() - .then((pref) => pref.setString(settingKey, settingValue)); - -Future _getStringSetting(String settingKey) => - SharedPreferences.getInstance().then((pref) => pref.getString(settingKey)); - void _setIntSetting(String settingKey, int settingValue) => SharedPreferences.getInstance() .then((pref) => pref.setInt(settingKey, settingValue)); diff --git a/lib/widgets/mood_form.dart b/lib/widgets/mood_form.dart index b9a0e05..b461ce7 100644 --- a/lib/widgets/mood_form.dart +++ b/lib/widgets/mood_form.dart @@ -1,7 +1,5 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:smoke_cess_app/models/mood.dart'; -import 'package:smoke_cess_app/services/database_service.dart'; import 'package:smoke_cess_app/widgets/slider.dart'; import 'package:smoke_cess_app/widgets/submit_form_button.dart'; import 'package:smoke_cess_app/widgets/text_formfield.dart';