Skip to content

Commit

Permalink
Merge pull request #232 from DattatreyaReddy/195-pinch-zoom-mobile
Browse files Browse the repository at this point in the history
Added Pinch to zoom for mobile (Not desktop and web) and changed CPI to logo
  • Loading branch information
DattatreyaReddy authored Oct 15, 2023
2 parents 619b717 + c236476 commit eb92165
Show file tree
Hide file tree
Showing 32 changed files with 644 additions and 262 deletions.
1 change: 1 addition & 0 deletions lib/src/constants/db_keys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ enum DBKeys {
libraryDisplayMode(DisplayMode.grid),
sourceDisplayMode(DisplayMode.grid),
gridMangaCoverWidth(192.0),
readerOverlay(true),
;

const DBKeys(this.initial);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import '../../../../../constants/app_sizes.dart';

import '../../../../../routes/router_config.dart';
import '../../../../../utils/extensions/custom_extensions.dart';
import '../../../../../widgets/custom_circular_progress_indicator.dart';
import '../../../../../widgets/emoticons.dart';
import '../../../../../widgets/manga_cover/grid/manga_cover_grid_tile.dart';
import '../../../../manga_book/domain/manga/manga_model.dart';
Expand All @@ -27,6 +28,10 @@ class SourceMangaGridView extends ConsumerWidget {
return PagedGridView(
pagingController: controller,
builderDelegate: PagedChildBuilderDelegate<Manga>(
firstPageProgressIndicatorBuilder: (context) =>
const CenterSorayomiShimmerIndicator(),
newPageProgressIndicatorBuilder: (context) =>
const CenterSorayomiShimmerIndicator(),
firstPageErrorIndicatorBuilder: (context) => Emoticons(
text: controller.error.toString(),
button: TextButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@

import 'package:flutter/material.dart';
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
import 'package:shimmer/shimmer.dart';

import '../../../../../constants/app_sizes.dart';
import '../../../../../routes/router_config.dart';
import '../../../../../utils/extensions/custom_extensions.dart';
import '../../../../../widgets/custom_circular_progress_indicator.dart';
import '../../../../../widgets/emoticons.dart';
import '../../../../../widgets/manga_cover/list/manga_cover_list_tile.dart';
import '../../../../manga_book/domain/manga/manga_model.dart';
Expand All @@ -23,6 +26,36 @@ class SourceMangaListView extends StatelessWidget {
return PagedListView(
pagingController: controller,
builderDelegate: PagedChildBuilderDelegate<Manga>(
firstPageProgressIndicatorBuilder: (context) =>
const CenterSorayomiShimmerIndicator(),
newPageProgressIndicatorBuilder: (context) => Row(
children: [
SizedBox(
height: 80,
width: 80,
child: ClipRRect(
borderRadius: KBorderRadius.r8.radius,
child: const SorayomiShimmerIndicator(),
),
),
Padding(
padding: KEdgeInsets.h8.size,
child: Shimmer.fromColors(
baseColor: context.colorScheme.background,
highlightColor: context.theme.indicatorColor,
child: Container(
width: context.width * .3,
decoration: BoxDecoration(
borderRadius: KBorderRadius.r8.radius,
color: Colors.white,
),
height: 12,
),
),
),
const Spacer()
],
),
firstPageErrorIndicatorBuilder: (context) => Emoticons(
text: controller.error.toString(),
button: TextButton(
Expand Down
8 changes: 8 additions & 0 deletions lib/src/features/manga_book/domain/chapter/chapter_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

import 'package:flutter/material.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

import '../../../../utils/extensions/custom_extensions.dart';
Expand Down Expand Up @@ -41,4 +42,11 @@ class Chapter with _$Chapter {
bool query([String? query]) {
return name.query(query) || index == int.tryParse(query ?? '');
}

String getDisplayName(BuildContext context) {
return name ??
context.l10n!.chapterNumber(
chapterNumber ?? index?.toDouble() ?? 0,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,11 @@ Chapter? firstUnreadInFilteredChapterList(
}

@riverpod
({Chapter? first, Chapter? second})? getPreviousAndNextChapters(
GetPreviousAndNextChaptersRef ref, {
({Chapter? first, Chapter? second})? getNextAndPreviousChapters(
GetNextAndPreviousChaptersRef ref, {
required int mangaId,
required String chapterIndex,
bool shouldAscSort = true,
}) {
final isAscSorted = ref.watch(mangaChapterSortDirectionProvider) ??
DBKeys.chapterSortDirection.initial;
Expand All @@ -234,8 +235,8 @@ Chapter? firstUnreadInFilteredChapterList(
? filteredList[currentChapterIndex + 1]
: null;
return (
first: isAscSorted ? nextChapter : prevChapter,
second: isAscSorted ? prevChapter : nextChapter,
first: shouldAscSort && isAscSorted ? nextChapter : prevChapter,
second: shouldAscSort && isAscSorted ? prevChapter : nextChapter,
);
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ class MangaDetailsScreen extends HookConsumerWidget {
ReaderRoute(
mangaId: firstUnreadChapter.mangaId ?? mangaId,
chapterIndex: firstUnreadChapter.index ?? 0,
showReaderLayoutAnimation: true,
).push(context);
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class ChapterListTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GestureDetector(
key: Key("manga-${manga.id}-chapter-${chapter.id}"),
onSecondaryTap: () => toggleSelect(chapter),
child: ListTile(
title: Row(
Expand All @@ -49,8 +50,7 @@ class ChapterListTile extends StatelessWidget {
],
Expanded(
child: Text(
chapter.name ??
context.l10n!.chapterNumber(chapter.chapterNumber ?? 0),
chapter.getDisplayName(context),
style: TextStyle(
color: chapter.read.ifNull() ? Colors.grey : null,
),
Expand Down Expand Up @@ -105,6 +105,7 @@ class ChapterListTile extends StatelessWidget {
: () => ReaderRoute(
mangaId: manga.id!,
chapterIndex: chapter.index!,
showReaderLayoutAnimation: true,
).push(context),
onLongPress: () => toggleSelect(chapter),
),
Expand Down
Loading

0 comments on commit eb92165

Please sign in to comment.