From bed93338b4bd2e019e9b1570a7c2195394d122da Mon Sep 17 00:00:00 2001 From: Yuliya Rudenko <3000014@stud.hs-mannheim.de> Date: Wed, 19 Jun 2024 16:25:05 +0200 Subject: [PATCH] final --- lib/database/habit.dart | 2 -- lib/main.dart | 1 - lib/pages/homepage.dart | 5 +---- lib/pages/iconpage.dart | 2 +- lib/widgets/addhabit_popup.dart | 1 - lib/widgets/edithabit_dialog.dart | 1 - lib/widgets/listview.dart | 3 --- test/widget_testing/homepage_test.dart | 2 +- test/widget_testing/listview_test.dart | 4 ++-- 9 files changed, 5 insertions(+), 16 deletions(-) diff --git a/lib/database/habit.dart b/lib/database/habit.dart index cd7c881..e501bd9 100644 --- a/lib/database/habit.dart +++ b/lib/database/habit.dart @@ -19,13 +19,11 @@ class Habit { IconData get icon => IconData(iconCodePoint, fontFamily: iconFontFamily); - // Methode zum Aktualisieren der Icon-Daten void updateIcon(int newCodePoint, String newFontFamily) { iconCodePoint = newCodePoint; iconFontFamily = newFontFamily; } - //erstellt ein Habit-Objekt aus der DB-Abfrage factory Habit.fromSqfliteDatabase(Map map) { return Habit( id: map['id']?.toInt() ?? 0, diff --git a/lib/main.dart b/lib/main.dart index 96f6f99..7e0ed73 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,7 +9,6 @@ void main() async { WidgetsFlutterBinding.ensureInitialized(); if (defaultTargetPlatform == TargetPlatform.macOS) { - // Initialisierung sqflite_ffi für macOS sqfliteFfiInit(); databaseFactory = databaseFactoryFfi; } diff --git a/lib/pages/homepage.dart b/lib/pages/homepage.dart index 27f184f..e0dc093 100644 --- a/lib/pages/homepage.dart +++ b/lib/pages/homepage.dart @@ -18,7 +18,7 @@ class MyHomePage extends StatefulWidget { class MyHomePageState extends State with SingleTickerProviderStateMixin { Future>? futureTodos; late ToDoInterface todoDB; - int counterCompleted = 0; //Zähler für abgeschlossene Gewohnheiten + int counterCompleted = 0; @override void initState() { @@ -106,7 +106,6 @@ class MyHomePageState extends State with SingleTickerProviderStateMi fontFamily: "Arial"), ), - //UI gebaut basierend auf dem Zustand von futureTodos Expanded(child: FutureBuilder>( future: futureTodos, builder: (context, snapshot) { @@ -124,7 +123,6 @@ class MyHomePageState extends State with SingleTickerProviderStateMi final todos = snapshot.data; final habitCount = countHabits(todos!); //Fortschritt der abgeschlossenen Geowhnheiten - //Parameter unten bei LinearProgressIndicator double progressValue = counterCompleted / habitCount; return Column( @@ -205,7 +203,6 @@ class MyHomePageState extends State with SingleTickerProviderStateMi ), ), - //öffnet ein Popup zum Hinzufügen einer neue Gewohnheit floatingActionButton: FloatingActionButton( foregroundColor: Colors.deepPurpleAccent, child: const Icon(Icons.add), diff --git a/lib/pages/iconpage.dart b/lib/pages/iconpage.dart index 3b29aee..a55febd 100644 --- a/lib/pages/iconpage.dart +++ b/lib/pages/iconpage.dart @@ -70,4 +70,4 @@ class IconPage extends StatelessWidget { ), ); } -} +} \ No newline at end of file diff --git a/lib/widgets/addhabit_popup.dart b/lib/widgets/addhabit_popup.dart index a39e77e..8efa583 100644 --- a/lib/widgets/addhabit_popup.dart +++ b/lib/widgets/addhabit_popup.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:cpd/pages/iconpage.dart'; class AddHabitPopup extends StatefulWidget { - //Callback nimmt Titel, Untertitel und Icon als Parameter der neuen Gewohnheit an final void Function(String, String, IconData) onSubmit; @override diff --git a/lib/widgets/edithabit_dialog.dart b/lib/widgets/edithabit_dialog.dart index 0b79d50..74aaf14 100644 --- a/lib/widgets/edithabit_dialog.dart +++ b/lib/widgets/edithabit_dialog.dart @@ -27,7 +27,6 @@ class EditHabitDialogState extends State { @override void initState() { super.initState(); - // Initialisierung mit den aktuellen Daten der Gewohnheit newTitle = widget.todo.title; newSubtitle = widget.todo.subtitle; newIcon = widget.todo.icon; diff --git a/lib/widgets/listview.dart b/lib/widgets/listview.dart index d536c03..ab24594 100644 --- a/lib/widgets/listview.dart +++ b/lib/widgets/listview.dart @@ -6,7 +6,6 @@ import '../database/todo_interface.dart'; class MyListView extends StatefulWidget { final List habits; - //DB-Schnittstelle für Gewohnheiten final ToDoInterface todoDB; final Function fetchTodos; //Eine Funktion zum Aktualisieren des Zählers für abgeschlossene Gewohnheiten @@ -62,7 +61,6 @@ class MyListViewState extends State { ), ), onDismissed: (direction) async { - // Löschen if (direction == DismissDirection.endToStart) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( @@ -74,7 +72,6 @@ class MyListViewState extends State { }); widget.fetchTodos(); } - // Bearbeiten else if (direction == DismissDirection.startToEnd) { showDialog( context: context, diff --git a/test/widget_testing/homepage_test.dart b/test/widget_testing/homepage_test.dart index 6a62834..82e59e4 100644 --- a/test/widget_testing/homepage_test.dart +++ b/test/widget_testing/homepage_test.dart @@ -24,7 +24,7 @@ void main() { await tester.tap(find.byType(FloatingActionButton)); await tester.pumpAndSettle(); - // close the addhabit-dialog, as it was already tested in addhabit_popup.dart + //schließt das addhabit-dialog, da es schon in addhabit-popup.dart getestet wurde await tester.tap(find.byType(IconButton)); await tester.pumpAndSettle(); }); diff --git a/test/widget_testing/listview_test.dart b/test/widget_testing/listview_test.dart index 5c7074c..a3af7a1 100644 --- a/test/widget_testing/listview_test.dart +++ b/test/widget_testing/listview_test.dart @@ -67,8 +67,8 @@ void main() { await tester.pumpAndSettle(); expect(find.byType(EditHabitDialog), findsOneWidget); - - //close the EditHabitDialog as it was already tested in edithabit_dialog_test.dart + + //schließt das Edithabit-Dialog, da es schon in edithabit_dialog.dart getestet wurde final cancelButtonFinder = find.widgetWithText(TextButton, 'Cancel'); expect(cancelButtonFinder, findsOneWidget); await tester.tap(cancelButtonFinder);