wip
This commit is contained in:
parent
6593ec0fc3
commit
d795157b30
@ -8,6 +8,8 @@ import 'package:sqlite3_flutter_libs/sqlite3_flutter_libs.dart';
|
||||
|
||||
part 'database.g.dart';
|
||||
|
||||
var database = AppDatabase(); //global, since we should only use one instance
|
||||
|
||||
class PersistentNote extends Table {
|
||||
TextColumn get id => text()();
|
||||
TextColumn get content => text()();
|
||||
|
@ -1,9 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:fnotes/database.dart';
|
||||
import 'package:fnotes/notes_app.dart';
|
||||
import 'package:fnotes/persistent_notes_bloc.dart';
|
||||
import 'package:fnotes/theme_bloc.dart';
|
||||
|
||||
var database = AppDatabase();
|
||||
|
||||
void main() {
|
||||
WidgetsFlutterBinding.ensureInitialized(); //for drift
|
||||
runApp(const MainApp());
|
||||
@ -17,7 +20,7 @@ class MainApp extends StatelessWidget {
|
||||
return MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider(create: (context) => ThemeBloc()),
|
||||
BlocProvider(create: (context) => PersistentNotesBloc())
|
||||
BlocProvider(create: (context) => PersistentNotesBloc()),
|
||||
],
|
||||
child: BlocBuilder<ThemeBloc, ThemeState>(
|
||||
builder: (context, state) {
|
||||
|
@ -4,8 +4,6 @@ import 'package:fnotes/note.dart';
|
||||
|
||||
class PersistentNotesBloc
|
||||
extends Bloc<PersistentNotesEvent, PersistentNotesState> {
|
||||
static final database = AppDatabase();
|
||||
|
||||
PersistentNotesBloc() : super(PersistentNotesState.init()) {
|
||||
on<LoadNotesEvent>(loadAllNotes);
|
||||
on<NoteEntered>(storeNote);
|
||||
|
@ -4,8 +4,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:fnotes/database.dart';
|
||||
|
||||
class ThemeBloc extends Bloc<ThemeEvent, ThemeState> {
|
||||
static final database = AppDatabase();
|
||||
|
||||
ThemeBloc() : super(ThemeState.init()) {
|
||||
on<ThemeChangedEvent>(switchTheme);
|
||||
on<LoadThemeEvent>(loadTheme);
|
||||
|
@ -513,7 +513,7 @@ packages:
|
||||
source: hosted
|
||||
version: "1.5.1"
|
||||
provider:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: provider
|
||||
sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c
|
||||
|
@ -17,6 +17,7 @@ dependencies:
|
||||
sqlite3_flutter_libs: ^0.5.20
|
||||
uuid: ^4.3.3
|
||||
sqlite3: ^2.4.0
|
||||
provider: ^6.1.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Loading…
Reference in New Issue
Block a user