diff --git a/lib/pages/scanner_page.dart b/lib/pages/scanner_page.dart index fcd2c30..1513ab3 100644 --- a/lib/pages/scanner_page.dart +++ b/lib/pages/scanner_page.dart @@ -1,9 +1,12 @@ import 'package:flutter/material.dart'; import 'package:mobile_scanner/mobile_scanner.dart'; +import 'package:smoke_cess_app/models/mood.dart'; import 'package:smoke_cess_app/models/settings.dart'; +import 'package:smoke_cess_app/service/database_service.dart'; import 'package:smoke_cess_app/service/json_service.dart'; import 'package:smoke_cess_app/service/settings_service.dart'; +import '../models/sleep.dart'; import '../widgets/missing_config_popup.dart'; class ScannerPage extends StatefulWidget { @@ -69,6 +72,23 @@ class ScannerPageState extends State { loadSettingsFromLocalJSON(); }, child: const Text('Read JSON'), + ), + const SizedBox(height: 30), + ElevatedButton( + style: ElevatedButton.styleFrom( + textStyle: const TextStyle(fontSize: 20)), + onPressed: () async { + List moods = await DatabaseService.instance.getMoodRecords(); + List sleeps = + await DatabaseService.instance.getSleepRecords(); + for (Mood mood in moods) { + print(mood.toCSV()); + } + for (Sleep sleep in sleeps) { + print(sleep.toCSV()); + } + }, + child: const Text('Export'), ) ], ));