Skip to content

Commit

Permalink
Merge pull request #110 from IamMuuo/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
IamMuuo authored Dec 14, 2024
2 parents 1168198 + f806cdf commit d6953f3
Show file tree
Hide file tree
Showing 27 changed files with 779 additions and 749 deletions.
9 changes: 9 additions & 0 deletions build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# build.yaml for drift
# build.yaml. This file is quite powerful, see https://pub.dev/packages/build_config

targets:
$default:
builders:
drift_dev:
options:
store_date_time_values_as_text: true
23 changes: 15 additions & 8 deletions lib/app.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:academia/features/auth/cubit/auth_cubit.dart';
import 'package:academia/utils/router/router.dart';
import 'package:flutter/material.dart';
import 'package:dynamic_color/dynamic_color.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:google_fonts/google_fonts.dart';

class Academia extends StatelessWidget {
Expand All @@ -12,14 +14,19 @@ class Academia extends StatelessWidget {

@override
Widget build(BuildContext context) {
return DynamicColorBuilder(
builder: (lightscheme, darkscheme) => MaterialApp.router(
title: flavor,
routerConfig: AcademiaRouter.router,
theme: ThemeData(
colorScheme: lightscheme,
useMaterial3: true,
fontFamily: GoogleFonts.inter().fontFamily,
return MultiBlocProvider(
providers: [
BlocProvider(create: (_) => AuthCubit()),
],
child: DynamicColorBuilder(
builder: (lightscheme, darkscheme) => MaterialApp.router(
title: flavor,
routerConfig: AcademiaRouter.router,
theme: ThemeData(
colorScheme: lightscheme,
useMaterial3: true,
fontFamily: GoogleFonts.inter().fontFamily,
),
),
),
);
Expand Down
27 changes: 23 additions & 4 deletions lib/database/database.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:io';

import 'package:academia/features/auth/repository/user.dart';
import 'package:academia/features/auth/repository/user_credentials.dart';
import 'package:academia/features/auth/repository/user_profile.dart';
import 'package:academia/features/auth/models/user.dart';
import 'package:academia/features/auth/models/user_credentials.dart';
import 'package:academia/features/auth/models/user_profile.dart';
import 'package:drift/drift.dart';
import 'package:drift/native.dart';
import 'package:drift_flutter/drift_flutter.dart';
Expand Down Expand Up @@ -51,11 +51,30 @@ class AppDatabase extends _$AppDatabase {
AppDatabase() : super(_openConnection());

@override
int get schemaVersion => 1;
int get schemaVersion => 2;

static QueryExecutor _openConnection() {
// driftDatabase from package:drift_flutter stores the database in
// getApplicationDocumentsDirectory().
driftRuntimeOptions.defaultSerializer =
const ValueSerializer.defaults(serializeDateTimeValuesAsString: true);
return driftDatabase(name: 'academia');
}
}

/// A singleton class to reference the local database.
/// Use this instead of AppDatabase to ensure you always
/// have an initialized instance
final class LocalDatabase {
static final LocalDatabase _instance = LocalDatabase._internal();

LocalDatabase._internal();

factory LocalDatabase() {
return _instance;
}

AppDatabase getInstance() {
return AppDatabase();
}
}
Loading

0 comments on commit d6953f3

Please sign in to comment.