2024-06-08 11:52:29 +02:00
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:cpd/pages/homepage.dart';
|
|
|
|
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
|
|
|
import 'database/db.dart';
|
|
|
|
import 'database/db_interface.dart';
|
|
|
|
|
|
|
|
void main() async {
|
|
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
|
|
|
|
if (defaultTargetPlatform == TargetPlatform.macOS) {
|
|
|
|
// Initialisierung sqflite_ffi für macOS
|
|
|
|
sqfliteFfiInit();
|
|
|
|
databaseFactory = databaseFactoryFfi;
|
|
|
|
}
|
|
|
|
final HabitDatabase database = HabitDatabase();
|
2024-06-09 17:45:17 +02:00
|
|
|
//await HabitDatabase().updateDatabase();
|
2024-06-08 11:52:29 +02:00
|
|
|
runApp(MyApp(database: database));
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
|
|
|
final HabitDbInterface database;
|
|
|
|
const MyApp({super.key, required this.database});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return MaterialApp(
|
|
|
|
title: 'homepage',
|
|
|
|
theme: ThemeData(
|
|
|
|
useMaterial3: true,
|
|
|
|
),
|
|
|
|
home: MyHomePage(database: database, title: 'homepage'),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|