mucke/lib/presentation/widgets/injection_widget.dart

34 lines
838 B
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
2020-05-27 21:54:33 +02:00
import '../../injection_container.dart';
2020-04-10 20:12:26 +02:00
import '../state/audio_store.dart';
import '../state/music_data_store.dart';
2020-04-12 12:34:19 +02:00
import '../state/navigation_store.dart';
2020-04-10 20:12:26 +02:00
class InjectionWidget extends StatelessWidget {
const InjectionWidget({Key key, this.child}) : super(key: key);
final Widget child;
@override
Widget build(BuildContext context) {
2020-04-10 20:12:26 +02:00
print('InjectionWidget.build');
2020-05-27 21:54:33 +02:00
2020-04-07 22:06:43 +02:00
return MultiProvider(
child: child,
2020-04-07 22:06:43 +02:00
providers: [
Provider<MusicDataStore>(
2020-05-27 21:54:33 +02:00
create: (_) => getIt<MusicDataStore>(),
2020-04-07 22:06:43 +02:00
),
Provider<AudioStore>(
2020-05-27 21:54:33 +02:00
create: (_) => getIt<AudioStore>(),
),
2020-04-12 12:34:19 +02:00
Provider<NavigationStore>(
2020-05-27 21:54:33 +02:00
create: (_) => getIt<NavigationStore>(),
2020-04-12 12:34:19 +02:00
),
2020-04-07 22:06:43 +02:00
],
);
}
}