init
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'app/app.dart';
|
||||
import 'app/app_bootstrap.dart';
|
||||
import 'database/app_database.dart';
|
||||
import 'services/bar_tab_service.dart';
|
||||
import 'services/product_service.dart';
|
||||
import 'viewmodels/bar_screen_view_model.dart';
|
||||
import 'viewmodels/product_list_view_model.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
await SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.landscapeLeft,
|
||||
DeviceOrientation.landscapeRight,
|
||||
]);
|
||||
|
||||
runApp(
|
||||
MultiProvider(
|
||||
providers: [
|
||||
Provider<AppDatabase>(
|
||||
create: (_) => AppDatabase(),
|
||||
dispose: (_, database) => database.close(),
|
||||
),
|
||||
Provider<ProductService>(
|
||||
create: (context) => DriftProductService(
|
||||
database: context.read<AppDatabase>(),
|
||||
),
|
||||
),
|
||||
Provider<BarTabService>(
|
||||
create: (context) => DriftBarTabService(
|
||||
database: context.read<AppDatabase>(),
|
||||
),
|
||||
),
|
||||
ChangeNotifierProvider<ProductListViewModel>(
|
||||
create: (context) => ProductListViewModel(
|
||||
productService: context.read<ProductService>(),
|
||||
),
|
||||
),
|
||||
ChangeNotifierProvider<BarScreenViewModel>(
|
||||
create: (context) => BarScreenViewModel(
|
||||
barTabService: context.read<BarTabService>(),
|
||||
),
|
||||
),
|
||||
],
|
||||
child: const AppBootstrap(
|
||||
child: KoolTabApp(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user