cpd/lib/main.dart

34 lines
925 B
Dart

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) {
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',
debugShowCheckedModeBanner: false,
theme: ThemeData(
useMaterial3: true,
),
home: MyHomePage(database: database, title: 'homepage'),
);
}
}