54 lines
1.5 KiB
Dart
54 lines
1.5 KiB
Dart
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(),
|
|
),
|
|
),
|
|
);
|
|
} |