fnotes/lib/main.dart

33 lines
845 B
Dart
Raw Normal View History

2024-03-17 13:15:50 +00:00
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:fnotes/notes_app.dart';
2024-03-17 17:38:57 +00:00
import 'package:fnotes/persistence_bloc.dart';
2024-03-17 13:15:50 +00:00
import 'package:fnotes/theme_bloc.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized(); //for drift
2024-03-17 13:15:50 +00:00
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
2024-03-17 17:38:57 +00:00
return MultiBlocProvider(
providers: [
BlocProvider(create: (context) => ThemeBloc()),
BlocProvider(create: (context) => PersistenceBloc())
],
2024-03-17 13:15:50 +00:00
child: BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
return MaterialApp(
theme: state.theme,
home: const NotesApp(),
2024-03-17 13:15:50 +00:00
);
},
),
);
}
}