cpd/lib/main.dart

34 lines
930 B
Dart
Raw Normal View History

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();
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'),
);
}
}