Skip to content

Commit

Permalink
Document more classes and add additional comments in several places
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidDWiser committed Feb 28, 2022
1 parent bd1eae1 commit d2922b0
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 18 deletions.
4 changes: 4 additions & 0 deletions lib/bindings/managers_binding.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import 'package:get/get.dart';

import '../helpers/bookmark_manager.dart';
import '../helpers/network_manager.dart';
import '../helpers/recent_watch_manager.dart';
import '../helpers/webview_manager.dart';

/// [ManagerBinding] registers all domain specific controllers used across the
/// whole app. All dependencies are registered using the GetX state management
/// (more about the state management here: https://pub.dev/packages/get ).
class ManagerBinding extends Bindings {
@override
void dependencies() {
Expand Down
11 changes: 6 additions & 5 deletions lib/database/bookmark_database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import '../models/bookmark.dart';

class BookMarksDatabase {
BookMarksDatabase._privateConstructor();

static final BookMarksDatabase instance =
BookMarksDatabase._privateConstructor();
static Database? _database;

String tableBookmark = 'Bookmark';
String idCol = 'id';
String nameCol = 'name';
String imageUrlCol = 'imageUrl';
String animeUrlCol = 'animeUrl';
final String tableBookmark = 'Bookmark';
final String idCol = 'id';
final String nameCol = 'name';
final String imageUrlCol = 'imageUrl';
final String animeUrlCol = 'animeUrl';
final dbName = 'takobookmarks.db';
final idType = 'TEXT NOT NULL';
final textType = 'TEXT NOT NULL';
Expand Down
17 changes: 9 additions & 8 deletions lib/database/recent_watch_anime_database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@ import '../models/recent_anime.dart';

class RecentWatchAnimeDatabase {
RecentWatchAnimeDatabase._privateConstructor();

static final RecentWatchAnimeDatabase instance =
RecentWatchAnimeDatabase._privateConstructor();

Database? _database;

String tableName = 'RecentAnime';
String idCol = 'id';
String nameCol = 'name';
String epUrlCol = 'epUrl';
String currentEpCol = 'currentEp';
String imageUrlCol = 'imageUrl';
// String animeUrlCol = 'animeUrl';
final String tableName = 'RecentAnime';
final String idCol = 'id';
final String nameCol = 'name';
final String epUrlCol = 'epUrl';
final String currentEpCol = 'currentEp';
final String imageUrlCol = 'imageUrl';
// final String animeUrlCol = 'animeUrl';

String type = 'TEXT NOT NULL';
final String type = 'TEXT NOT NULL';

Future<Database> get database async {
if (_database != null) return _database!;
Expand Down
8 changes: 6 additions & 2 deletions lib/services/anime_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import '../models/anime.dart';
import '../services/request_service.dart';
import '../utils/constants.dart';

/// [AnimeService] contains a lot of convenience methods that allow easier
/// access, management and data handling from remote APIs with the goal of
/// providing the user with the best anime experience.
class AnimeService {
var uuid = const Uuid();
final _uuid = const Uuid();

Future<AnimeResults> getAnimes(request) async {
List<Anime> _animeList = [];
final response = await request;
Expand Down Expand Up @@ -47,7 +51,7 @@ class AnimeService {
element.getElementsByClassName('released').first.text.trim();

Anime animeInfo = Anime(
id: uuid.v4(),
id: _uuid.v4(),
name: name,
animeUrl: animeUrl,
imageUrl: img,
Expand Down
8 changes: 7 additions & 1 deletion lib/services/request_service.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import 'package:chopper/chopper.dart';

import '../utils/constants.dart';

part 'request_service.chopper.dart';

/// [RequestService] is a data source consuming remote APIs for fetching and
/// managing data about the actual anime. The implementation of those requests
/// can be found in the auto-generated file `request_service.chopper.dart` which
/// should not be manually edited, since any changes will be overridden after
/// running the build command.
@ChopperApi(baseUrl: baseUrl)
abstract class RequestService extends ChopperService {

Future<Response> requestRecentlyAddedResponse();

@Get(path: '$search{title}')
Expand Down
2 changes: 2 additions & 0 deletions lib/theme/tako_theme.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

import '../utils/constants.dart';

/// Main app theme, called [TakoTheme], is defined here.
class TakoTheme {
static TextTheme darkTextTheme = TextTheme(
bodyText1: GoogleFonts.questrial(
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/constants.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Network Request

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';

/// Collection of all app related constants go here
const String version = 'v1.4.3';
String updateLink = '';
bool isSameVersion = true;
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/routes.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// [Routes] represents a list of all screen paths used for their respective
/// screen widgets inside the app.
class Routes {
static const String mainScreen = '/';
static const String homeScreen = '/home';
Expand Down
3 changes: 3 additions & 0 deletions lib/utils/tako_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ import '../screens/video_player_screen.dart';
import '../screens/webview_screen.dart';
import 'routes.dart';

/// [TakoRoute] holds a list of all accessible app screens. In order for any new
/// screen to be properly detected, it needs to be registered here first.
class TakoRoute {
TakoRoute._();

static final pages = [
GetPage(
name: Routes.mainScreen,
Expand Down

0 comments on commit d2922b0

Please sign in to comment.