final
parent
9069c1ff85
commit
bed93338b4
|
@ -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<String, dynamic> map) {
|
||||
return Habit(
|
||||
id: map['id']?.toInt() ?? 0,
|
||||
|
|
|
@ -9,7 +9,6 @@ void main() async {
|
|||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
if (defaultTargetPlatform == TargetPlatform.macOS) {
|
||||
// Initialisierung sqflite_ffi für macOS
|
||||
sqfliteFfiInit();
|
||||
databaseFactory = databaseFactoryFfi;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ class MyHomePage extends StatefulWidget {
|
|||
class MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin {
|
||||
Future<List<Habit>>? 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<MyHomePage> with SingleTickerProviderStateMi
|
|||
fontFamily: "Arial"),
|
||||
),
|
||||
|
||||
//UI gebaut basierend auf dem Zustand von futureTodos
|
||||
Expanded(child: FutureBuilder<List<Habit>>(
|
||||
future: futureTodos,
|
||||
builder: (context, snapshot) {
|
||||
|
@ -124,7 +123,6 @@ class MyHomePageState extends State<MyHomePage> 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<MyHomePage> with SingleTickerProviderStateMi
|
|||
),
|
||||
),
|
||||
|
||||
//öffnet ein Popup zum Hinzufügen einer neue Gewohnheit
|
||||
floatingActionButton: FloatingActionButton(
|
||||
foregroundColor: Colors.deepPurpleAccent,
|
||||
child: const Icon(Icons.add),
|
||||
|
|
|
@ -70,4 +70,4 @@ class IconPage extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -27,7 +27,6 @@ class EditHabitDialogState extends State<EditHabitDialog> {
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// Initialisierung mit den aktuellen Daten der Gewohnheit
|
||||
newTitle = widget.todo.title;
|
||||
newSubtitle = widget.todo.subtitle;
|
||||
newIcon = widget.todo.icon;
|
||||
|
|
|
@ -6,7 +6,6 @@ import '../database/todo_interface.dart';
|
|||
|
||||
class MyListView extends StatefulWidget {
|
||||
final List<Habit> 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<MyListView> {
|
|||
),
|
||||
),
|
||||
onDismissed: (direction) async {
|
||||
// Löschen
|
||||
if (direction == DismissDirection.endToStart) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
|
@ -74,7 +72,6 @@ class MyListViewState extends State<MyListView> {
|
|||
});
|
||||
widget.fetchTodos();
|
||||
}
|
||||
// Bearbeiten
|
||||
else if (direction == DismissDirection.startToEnd) {
|
||||
showDialog(
|
||||
context: context,
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue