hinzufügen geht, löschen nur teilweise, db (mysqllite?) noch zum speichern notwendig

main
Yuliya Rudenko 2024-05-09 23:13:43 +02:00
parent b055113559
commit 961def0f6f
100 changed files with 58 additions and 28 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -123,8 +123,8 @@
/Users/yuliyarudenko/cpd/lib/model/habit.dart /Users/yuliyarudenko/cpd/lib/model/habit.dart
/Users/yuliyarudenko/cpd/lib/model/habit_list.dart /Users/yuliyarudenko/cpd/lib/model/habit_list.dart
/Users/yuliyarudenko/cpd/lib/pages/homepage.dart /Users/yuliyarudenko/cpd/lib/pages/homepage.dart
/Users/yuliyarudenko/cpd/lib/widgets/addhabit_popup.dart
/Users/yuliyarudenko/cpd/lib/widgets/listview.dart /Users/yuliyarudenko/cpd/lib/widgets/listview.dart
/Users/yuliyarudenko/cpd/lib/widgets/popup.dart
/Users/yuliyarudenko/cpd/pubspec.yaml /Users/yuliyarudenko/cpd/pubspec.yaml
/Users/yuliyarudenko/flutter/bin/cache/artifacts/material_fonts/MaterialIcons-Regular.otf /Users/yuliyarudenko/flutter/bin/cache/artifacts/material_fonts/MaterialIcons-Regular.otf
/Users/yuliyarudenko/flutter/bin/cache/pkg/sky_engine/LICENSE /Users/yuliyarudenko/flutter/bin/cache/pkg/sky_engine/LICENSE

View File

@ -119,10 +119,12 @@
/Users/yuliyarudenko/.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib/vector_math_64.dart /Users/yuliyarudenko/.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib/vector_math_64.dart
/Users/yuliyarudenko/.pub-cache/hosted/pub.dev/vm_service-13.0.0/LICENSE /Users/yuliyarudenko/.pub-cache/hosted/pub.dev/vm_service-13.0.0/LICENSE
/Users/yuliyarudenko/cpd/assets/appbar_background.png /Users/yuliyarudenko/cpd/assets/appbar_background.png
/Users/yuliyarudenko/cpd/lib/controller/habitmanager.dart
/Users/yuliyarudenko/cpd/lib/model/habit.dart
/Users/yuliyarudenko/cpd/lib/model/habit_list.dart /Users/yuliyarudenko/cpd/lib/model/habit_list.dart
/Users/yuliyarudenko/cpd/lib/pages/homepage.dart /Users/yuliyarudenko/cpd/lib/pages/homepage.dart
/Users/yuliyarudenko/cpd/lib/widgets/addhabit_popup.dart
/Users/yuliyarudenko/cpd/lib/widgets/listview.dart /Users/yuliyarudenko/cpd/lib/widgets/listview.dart
/Users/yuliyarudenko/cpd/lib/widgets/popup.dart
/Users/yuliyarudenko/cpd/pubspec.yaml /Users/yuliyarudenko/cpd/pubspec.yaml
/Users/yuliyarudenko/flutter/bin/cache/artifacts/material_fonts/MaterialIcons-Regular.otf /Users/yuliyarudenko/flutter/bin/cache/artifacts/material_fonts/MaterialIcons-Regular.otf
/Users/yuliyarudenko/flutter/bin/cache/pkg/sky_engine/LICENSE /Users/yuliyarudenko/flutter/bin/cache/pkg/sky_engine/LICENSE

View File

@ -119,10 +119,12 @@
/Users/yuliyarudenko/.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib/vector_math_64.dart /Users/yuliyarudenko/.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib/vector_math_64.dart
/Users/yuliyarudenko/.pub-cache/hosted/pub.dev/vm_service-13.0.0/LICENSE /Users/yuliyarudenko/.pub-cache/hosted/pub.dev/vm_service-13.0.0/LICENSE
/Users/yuliyarudenko/cpd/assets/appbar_background.png /Users/yuliyarudenko/cpd/assets/appbar_background.png
/Users/yuliyarudenko/cpd/lib/controller/habitmanager.dart
/Users/yuliyarudenko/cpd/lib/model/habit.dart
/Users/yuliyarudenko/cpd/lib/model/habit_list.dart /Users/yuliyarudenko/cpd/lib/model/habit_list.dart
/Users/yuliyarudenko/cpd/lib/pages/homepage.dart /Users/yuliyarudenko/cpd/lib/pages/homepage.dart
/Users/yuliyarudenko/cpd/lib/widgets/addhabit_popup.dart
/Users/yuliyarudenko/cpd/lib/widgets/listview.dart /Users/yuliyarudenko/cpd/lib/widgets/listview.dart
/Users/yuliyarudenko/cpd/lib/widgets/popup.dart
/Users/yuliyarudenko/cpd/pubspec.yaml /Users/yuliyarudenko/cpd/pubspec.yaml
/Users/yuliyarudenko/flutter/bin/cache/artifacts/material_fonts/MaterialIcons-Regular.otf /Users/yuliyarudenko/flutter/bin/cache/artifacts/material_fonts/MaterialIcons-Regular.otf
/Users/yuliyarudenko/flutter/bin/cache/pkg/sky_engine/LICENSE /Users/yuliyarudenko/flutter/bin/cache/pkg/sky_engine/LICENSE

View File

@ -119,10 +119,12 @@
/Users/yuliyarudenko/.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib/vector_math_64.dart /Users/yuliyarudenko/.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib/vector_math_64.dart
/Users/yuliyarudenko/.pub-cache/hosted/pub.dev/vm_service-13.0.0/LICENSE /Users/yuliyarudenko/.pub-cache/hosted/pub.dev/vm_service-13.0.0/LICENSE
/Users/yuliyarudenko/cpd/assets/appbar_background.png /Users/yuliyarudenko/cpd/assets/appbar_background.png
/Users/yuliyarudenko/cpd/lib/controller/habitmanager.dart
/Users/yuliyarudenko/cpd/lib/model/habit.dart
/Users/yuliyarudenko/cpd/lib/model/habit_list.dart /Users/yuliyarudenko/cpd/lib/model/habit_list.dart
/Users/yuliyarudenko/cpd/lib/pages/homepage.dart /Users/yuliyarudenko/cpd/lib/pages/homepage.dart
/Users/yuliyarudenko/cpd/lib/widgets/addhabit_popup.dart
/Users/yuliyarudenko/cpd/lib/widgets/listview.dart /Users/yuliyarudenko/cpd/lib/widgets/listview.dart
/Users/yuliyarudenko/cpd/lib/widgets/popup.dart
/Users/yuliyarudenko/cpd/pubspec.yaml /Users/yuliyarudenko/cpd/pubspec.yaml
/Users/yuliyarudenko/flutter/bin/cache/artifacts/material_fonts/MaterialIcons-Regular.otf /Users/yuliyarudenko/flutter/bin/cache/artifacts/material_fonts/MaterialIcons-Regular.otf
/Users/yuliyarudenko/flutter/bin/cache/pkg/sky_engine/LICENSE /Users/yuliyarudenko/flutter/bin/cache/pkg/sky_engine/LICENSE

View File

@ -38,7 +38,7 @@
</data> </data>
<key>Resources/flutter_assets/kernel_blob.bin</key> <key>Resources/flutter_assets/kernel_blob.bin</key>
<data> <data>
mk2QhxIcbu+g6Mv7Skkowc5d08Q= HIeAwNh9CQM/RwKkjRrYpmltVQM=
</data> </data>
<key>Resources/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf</key> <key>Resources/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf</key>
<data> <data>
@ -115,7 +115,7 @@
<dict> <dict>
<key>hash2</key> <key>hash2</key>
<data> <data>
fsNaUyNP9+AGifG+ZRvf9T6lIh8HQ/NodS+L8XeGCwA= qJ78aG6cr3/lBObN0ROkrD8/GVjAwcnZ54GB4mM5UtU=
</data> </data>
</dict> </dict>
<key>Resources/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf</key> <key>Resources/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf</key>

View File

@ -23,10 +23,10 @@
<dict> <dict>
<key>cdhash</key> <key>cdhash</key>
<data> <data>
MiPZIrUrQ5TaBKTItz8k6wE7pLE= BU1pDyGDb6z8px20eCHbESMykjY=
</data> </data>
<key>requirement</key> <key>requirement</key>
<string>cdhash H"3223d922b52b4394da04a4c8b73f24eb013ba4b1"</string> <string>cdhash H"054d690f21836facfca71db47821db1123329236"</string>
</dict> </dict>
<key>Frameworks/FlutterMacOS.framework</key> <key>Frameworks/FlutterMacOS.framework</key>
<dict> <dict>

View File

@ -1 +1 @@
1715266840.056203: Module build session file for module cache at Path(str: "/Users/yuliyarudenko/cpd/build/macos/ModuleCache.noindex") 1715288502.38862: Module build session file for module cache at Path(str: "/Users/yuliyarudenko/cpd/build/macos/ModuleCache.noindex")

View File

@ -3,7 +3,7 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>LastAccessedDate</key> <key>LastAccessedDate</key>
<date>2024-05-09T15:00:38Z</date> <date>2024-05-09T21:01:41Z</date>
<key>WorkspacePath</key> <key>WorkspacePath</key>
<string>/Users/yuliyarudenko/cpd/macos/Runner.xcworkspace</string> <string>/Users/yuliyarudenko/cpd/macos/Runner.xcworkspace</string>
</dict> </dict>

View File

@ -1,7 +1,7 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cpd/widgets/listview.dart'; import 'package:cpd/widgets/listview.dart';
import 'package:cpd/widgets/popup.dart'; import 'package:cpd/widgets/addhabit_popup.dart';
final List<double> data = [50, 80, 120, 60, 150]; final List<double> data = [50, 80, 120, 60, 150];

View File

@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cpd/controller/habitmanager.dart'; import 'package:cpd/controller/habitmanager.dart';
import 'package:cpd/model/habit_list.dart';
// save button + speichern durch enter // save button + speichern durch enter
@ -105,6 +106,10 @@ class _AddHabitPopupState extends State<AddHabitPopup> {
String title = widget.titleController.text; String title = widget.titleController.text;
String subtitle = widget.subtitleController.text; String subtitle = widget.subtitleController.text;
habitmanager.addNewHabit(false, title, subtitle, const Icon(Icons.label_important)); habitmanager.addNewHabit(false, title, subtitle, const Icon(Icons.label_important));
print('Current list after add:');
habits.forEach((habit) {
print('${habit.title}: ${habit.subtitle}');
});
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
const SnackBar( const SnackBar(
content: Text('Form saved!'), content: Text('Form saved!'),

View File

@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
import 'package:cpd/model/habit_list.dart'; import 'package:cpd/model/habit_list.dart';
class MyListView extends StatelessWidget { class MyListView extends StatelessWidget {
const MyListView({Key? key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListView.builder( return ListView.builder(
@ -17,23 +19,40 @@ class MyListView extends StatelessWidget {
child: Dismissible( child: Dismissible(
key: Key(habits[index].title), key: Key(habits[index].title),
background: Container( background: Container(
color: Colors.red, color: Colors.blue,
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: const Padding( child: const Padding(
padding: EdgeInsets.only(left: 16), padding: EdgeInsets.only(left: 16),
child: Row( child: Icon(Icons.edit),
children: [
Icon(Icons.delete),
],
), ),
), ),
secondaryBackground: Container(
color: Colors.red,
alignment: Alignment.centerRight,
child: const Padding(
padding: EdgeInsets.only(right: 16),
child: Icon(Icons.delete),
),
), ),
onDismissed: (direction) { onDismissed: (direction) {
// Löschen
if (direction == DismissDirection.endToStart) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("${habits[index].title} was dismissed")) SnackBar(content: Text("${habits[index].title} was dismissed"))
); );
// Hier wird das Element aus der Liste entfernt
habits.removeAt(index); habits.removeAt(index);
print("Das Widget wurde gelöscht: ${habits[index].title}");
// Ausgabe der aktualisierten Liste zur Kontrolle
print('Current list:');
habits.forEach((habit) {
print('${habit.title}: ${habit.subtitle}');
});
}
// Bearbeiten
else if(direction == DismissDirection.startToEnd) {
//muss noch implementiert werden
}
}, },
child: ListTile( child: ListTile(
title: Text(habits[index].title), title: Text(habits[index].title),