A cross platform Audiobookshelf client for Android and iOS
Dart
WIP ebook reader - tap-to-turn, settings sheet, SafeArea for cutouts
Nathan Poulson1f159e069d8a
diff --git a/lib/screens/ebook_reader_screen.dart b/lib/screens/ebook_reader_screen.dartnew file mode 100644index 00000000..ca5f2941--- /dev/null+++ b/lib/screens/ebook_reader_screen.dart@@ -0,0 +1,623 @@+import 'dart:io';+import 'package:flutter/material.dart';+import 'package:flutter/services.dart';+import 'package:flutter_epub_viewer/flutter_epub_viewer.dart';+import 'package:path_provider/path_provider.dart';+import 'package:http/http.dart' as http;+import 'package:provider/provider.dart';+import '../providers/auth_provider.dart';+import '../providers/library_provider.dart';+import '../services/scoped_prefs.dart';++class EbookReaderScreen extends StatefulWidget {+ final String itemId;+ final String title;+ final Map<String, dynamic> ebookFile;++ const EbookReaderScreen({+ super.key,+ required this.itemId,+ required this.title,+ required this.ebookFile,+ });++ @override+ State<EbookReaderScreen> createState() => _EbookReaderScreenState();+}++class _EbookReaderScreenState extends State<EbookReaderScreen> {+ EpubController? _epubController;+ bool _loading = true;+ String? _error;+ File? _cachedFile;+ String? _initialCfi;+ bool _showControls = false;+ List<EpubChapter> _chapters = [];+ double _progress = 0;++ // Track touch start position to distinguish taps from swipes+ double? _touchDownX;+ double? _touchDownY;++ // Key to force-rebuild EpubViewer when layout mode changes+ int _viewerKey = 0;++ // Reader settings+ int _fontSize = 16;+ double _lineHeight = 1.4;+ int _margin = 16;+ bool _isPaginated = true;++ static const _kFontSize = 'ereader_fontSize';+ static const _kLineHeight = 'ereader_lineHeight';+ static const _kMargin = 'ereader_margin';+ static const _kPaginated = 'ereader_paginated';++ @override+ void initState() {+ super.initState();+ _epubController = EpubController();+ _loadInitialLocation();+ _loadSettings().then((_) => _downloadAndOpen());+ _setFullscreen(true);+ }++ Future<void> _loadSettings() async {+ _fontSize = await ScopedPrefs.getInt(_kFontSize) ?? 16;+ _lineHeight = await ScopedPrefs.getDouble(_kLineHeight) ?? 1.4;+ _margin = await ScopedPrefs.getInt(_kMargin) ?? 16;+ _isPaginated = await ScopedPrefs.getBool(_kPaginated) ?? true;+ if (mounted) setState(() {});+ }++ void _applySettings() {+ // Font size and line-height are safe to set after load.+ // Do NOT call setFlow here - it's already set via displaySettings+ // and re-calling it breaks snap animation on Android.+ _epubController?.setFontSize(fontSize: _fontSize.toDouble());+ _epubController?.webViewController?.evaluateJavascript(+ source: '''+ (function() {+ try {+ if (typeof rendition !== 'undefined') {+ rendition.themes.override('line-height', '$_lineHeight');+ rendition.themes.override('margin', '${_margin}px');+ }+ } catch(e) {}+ })();+ ''',+ );+ }++ Future<void> _updateFontSize(int size) async {+ setState(() => _fontSize = size);+ _epubController?.setFontSize(fontSize: size.toDouble());+ await ScopedPrefs.setInt(_kFontSize, size);+ }++ Future<void> _updateLineHeight(double height) async {+ setState(() => _lineHeight = height);+ _epubController?.webViewController?.evaluateJavascript(+ source: "rendition.themes.override('line-height', '$height')",+ );+ await ScopedPrefs.setDouble(_kLineHeight, height);+ }++ Future<void> _updateMargin(int margin) async {+ setState(() => _margin = margin);+ _epubController?.webViewController?.evaluateJavascript(+ source: "rendition.themes.override('margin', '${margin}px')",+ );+ await ScopedPrefs.setInt(_kMargin, margin);+ }++ Future<void> _updatePaginated(bool paginated) async {+ // Save current position before rebuilding+ try {+ final loc = await _epubController?.getCurrentLocation();+ if (loc != null) _initialCfi = loc.startCfi;+ } catch (_) {}+ _epubController = EpubController();+ setState(() {+ _isPaginated = paginated;+ _viewerKey++;+ });+ await ScopedPrefs.setBool(_kPaginated, paginated);+ }++ @override+ void dispose() {+ // Restore system UI when leaving+ _setFullscreen(false);+ super.dispose();+ }++ void _setFullscreen(bool fullscreen) {+ if (fullscreen) {+ SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);+ } else {+ SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);+ }+ }++ void _toggleControls() {+ setState(() => _showControls = !_showControls);+ _setFullscreen(!_showControls);+ }++ void _loadInitialLocation() {+ final lib = context.read<LibraryProvider>();+ final progressData = lib.getProgressData(widget.itemId);+ final loc = progressData?['ebookLocation'] as String?;+ if (loc != null && loc.isNotEmpty) {+ _initialCfi = loc;+ }+ }++ Future<void> _downloadAndOpen() async {+ try {+ final auth = context.read<AuthProvider>();+ final api = auth.apiService;+ if (api == null) {+ setState(() { _error = 'Not connected to server'; _loading = false; });+ return;+ }++ final ino = widget.ebookFile['ino'] as String?;+ if (ino == null) {+ setState(() { _error = 'No ebook file found'; _loading = false; });+ return;+ }++ final ebookName = widget.ebookFile['metadata']?['filename'] as String?+ ?? widget.ebookFile['name'] as String?+ ?? 'book.epub';+ final ext = ebookName.contains('.')+ ? ebookName.substring(ebookName.lastIndexOf('.'))+ : '.epub';+ final safeTitle = widget.title.replaceAll(RegExp(r'[^\w\s-]'), '').trim();++ final cacheDir = await getTemporaryDirectory();+ final cachedFile = File('${cacheDir.path}/ereader_$safeTitle$ext');++ if (!cachedFile.existsSync()) {+ final cleanBase = api.baseUrl.endsWith('/')+ ? api.baseUrl.substring(0, api.baseUrl.length - 1)+ : api.baseUrl;+ final url = '$cleanBase/api/items/${widget.itemId}/file/$ino';++ final request = http.Request('GET', Uri.parse(url));+ request.followRedirects = false;+ api.mediaHeaders.forEach((k, v) => request.headers[k] = v);+ final client = http.Client();+ try {+ var response = await client.send(request);++ // Follow redirects preserving auth headers+ var redirects = 0;+ while ([301, 302, 303, 307, 308].contains(response.statusCode) && redirects < 5) {+ final location = response.headers['location'];+ if (location == null) break;+ final redirectUrl = Uri.parse(url).resolve(location);+ final rReq = http.Request('GET', redirectUrl);+ api.mediaHeaders.forEach((k, v) => rReq.headers[k] = v);+ rReq.followRedirects = false;+ response = await client.send(rReq);+ redirects++;+ }++ if (response.statusCode != 200) {+ setState(() { _error = 'Failed to download ebook (${response.statusCode})'; _loading = false; });+ return;+ }++ final ct = response.headers['content-type'] ?? '';+ if (ct.contains('text/html')) {+ setState(() { _error = 'Server returned an error page'; _loading = false; });+ return;+ }++ final sink = cachedFile.openWrite();+ try {+ await response.stream.pipe(sink);+ } finally {+ await sink.close();+ }+ } finally {+ client.close();+ }+ }++ if (mounted) {+ setState(() {+ _cachedFile = cachedFile;+ _loading = false;+ });+ }+ } catch (e) {+ debugPrint('[EbookReader] Error: $e');+ if (mounted) {+ setState(() { _error = 'Error loading ebook: $e'; _loading = false; });+ }+ }+ }++ void _syncProgress(String cfi, double progress) {+ final auth = context.read<AuthProvider>();+ final api = auth.apiService;+ if (api == null) return;+ api.updateEbookProgress(+ widget.itemId,+ ebookLocation: cfi,+ ebookProgress: progress,+ );+ }++ void _showChapterList() {+ final cs = Theme.of(context).colorScheme;+ showModalBottomSheet(+ context: context,+ backgroundColor: cs.surface,+ shape: const RoundedRectangleBorder(+ borderRadius: BorderRadius.vertical(top: Radius.circular(20)),+ ),+ builder: (ctx) => SafeArea(+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ Padding(+ padding: const EdgeInsets.all(16),+ child: Text('Chapters', style: Theme.of(ctx).textTheme.titleMedium?.copyWith(fontWeight: FontWeight.w600)),+ ),+ Flexible(+ child: ListView.builder(+ shrinkWrap: true,+ itemCount: _chapters.length,+ itemBuilder: (ctx, i) {+ final ch = _chapters[i];+ return ListTile(+ title: Text(ch.title, maxLines: 1, overflow: TextOverflow.ellipsis),+ dense: true,+ onTap: () {+ Navigator.pop(ctx);+ _epubController?.display(cfi: ch.href);+ },+ );+ },+ ),+ ),+ ],+ ),+ ),+ );+ }++ void _showSettingsSheet() {+ final cs = Theme.of(context).colorScheme;+ final tt = Theme.of(context).textTheme;+ showModalBottomSheet(+ context: context,+ backgroundColor: cs.surface,+ shape: const RoundedRectangleBorder(+ borderRadius: BorderRadius.vertical(top: Radius.circular(20)),+ ),+ builder: (ctx) => StatefulBuilder(+ builder: (ctx, setSheetState) => SafeArea(+ child: Padding(+ padding: const EdgeInsets.fromLTRB(24, 16, 24, 16),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Center(+ child: Container(+ width: 32, height: 4,+ decoration: BoxDecoration(+ color: cs.onSurface.withValues(alpha: 0.15),+ borderRadius: BorderRadius.circular(2),+ ),+ ),+ ),+ const SizedBox(height: 16),+ Text('Reader Settings', style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600)),+ const SizedBox(height: 20),++ // Font size+ Row(children: [+ Icon(Icons.text_fields_rounded, size: 20, color: cs.onSurfaceVariant),+ const SizedBox(width: 12),+ Text('Font Size', style: tt.bodyMedium),+ const Spacer(),+ IconButton(+ icon: Icon(Icons.remove_rounded, size: 20, color: cs.onSurfaceVariant),+ onPressed: _fontSize > 10 ? () {+ setSheetState(() {});+ _updateFontSize(_fontSize - 1);+ } : null,+ ),+ Text('$_fontSize', style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600)),+ IconButton(+ icon: Icon(Icons.add_rounded, size: 20, color: cs.onSurfaceVariant),+ onPressed: _fontSize < 32 ? () {+ setSheetState(() {});+ _updateFontSize(_fontSize + 1);+ } : null,+ ),+ ]),+ const SizedBox(height: 8),++ // Line height+ Row(children: [+ Icon(Icons.format_line_spacing_rounded, size: 20, color: cs.onSurfaceVariant),+ const SizedBox(width: 12),+ Text('Line Spacing', style: tt.bodyMedium),+ const Spacer(),+ Text(_lineHeight.toStringAsFixed(1), style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600)),+ ]),+ Slider(+ value: _lineHeight,+ min: 1.0,+ max: 2.5,+ divisions: 15,+ onChanged: (v) {+ setSheetState(() {});+ _updateLineHeight(double.parse(v.toStringAsFixed(1)));+ },+ ),+ const SizedBox(height: 8),++ // Margins+ Row(children: [+ Icon(Icons.padding_rounded, size: 20, color: cs.onSurfaceVariant),+ const SizedBox(width: 12),+ Text('Margins', style: tt.bodyMedium),+ const Spacer(),+ Text('${_margin}px', style: tt.bodyMedium?.copyWith(fontWeight: FontWeight.w600)),+ ]),+ Slider(+ value: _margin.toDouble(),+ min: 0,+ max: 48,+ divisions: 12,+ onChanged: (v) {+ setSheetState(() {});+ _updateMargin(v.round());+ },+ ),+ const SizedBox(height: 8),++ // Layout mode+ Row(children: [+ Icon(Icons.auto_stories_rounded, size: 20, color: cs.onSurfaceVariant),+ const SizedBox(width: 12),+ Text('Layout', style: tt.bodyMedium),+ const Spacer(),+ SegmentedButton<bool>(+ segments: const [+ ButtonSegment(value: true, label: Text('Page')),+ ButtonSegment(value: false, label: Text('Scroll')),+ ],+ selected: {_isPaginated},+ onSelectionChanged: (v) {+ setSheetState(() {});+ _updatePaginated(v.first);+ },+ style: ButtonStyle(+ visualDensity: VisualDensity.compact,+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,+ ),+ ),+ ]),+ ],+ ),+ ),+ ),+ ),+ );+ }++ @override+ Widget build(BuildContext context) {+ final cs = Theme.of(context).colorScheme;+ final isDark = Theme.of(context).brightness == Brightness.dark;+ final bg = isDark ? Colors.black : Colors.white;++ if (_loading) {+ return Scaffold(+ backgroundColor: bg,+ appBar: AppBar(+ title: Text(widget.title, maxLines: 1, overflow: TextOverflow.ellipsis),+ backgroundColor: Colors.transparent,+ ),+ body: const Center(child: CircularProgressIndicator(strokeWidth: 2)),+ );+ }++ if (_error != null || _cachedFile == null) {+ return Scaffold(+ appBar: AppBar(title: Text(widget.title)),+ body: Center(+ child: Padding(+ padding: const EdgeInsets.all(32),+ child: Text(_error ?? 'Unknown error', textAlign: TextAlign.center,+ style: TextStyle(color: cs.onSurfaceVariant)),+ ),+ ),+ );+ }++ return Scaffold(+ backgroundColor: bg,+ body: Stack(+ children: [+ // Epub viewer with safe area padding for camera cutouts+ SafeArea(+ child: SizedBox.expand(+ child: EpubViewer(+ key: ValueKey(_viewerKey),+ epubSource: EpubSource.fromFile(_cachedFile!),+ epubController: _epubController!,+ initialCfi: _initialCfi,+ displaySettings: EpubDisplaySettings(+ flow: _isPaginated ? EpubFlow.paginated : EpubFlow.scrolled,+ useSnapAnimationAndroid: true,+ theme: isDark ? EpubTheme.dark() : EpubTheme.light(),+ ),+ onChaptersLoaded: (chapters) {+ if (mounted) setState(() => _chapters = chapters);+ },+ onEpubLoaded: () {+ debugPrint('[EbookReader] Epub loaded');+ _applySettings();+ // Disable epub.js built-in click-to-navigate to prevent double page turns+ _epubController?.webViewController?.evaluateJavascript(+ source: '''+ (function() {+ try {+ if (typeof rendition !== 'undefined' && rendition.manager) {+ var views = rendition.manager.views;+ if (views && views._views) {+ views._views.forEach(function(view) {+ if (view.document) {+ view.document.addEventListener('click', function(e) {+ e.stopImmediatePropagation();+ }, { capture: true });+ }+ });+ }+ }+ } catch(e) { console.log('disable click nav error:', e); }+ })();+ ''',+ );+ },+ onRelocated: (value) {+ if (mounted) {+ setState(() => _progress = value.progress);+ _syncProgress(value.startCfi, value.progress);+ }+ },+ onTouchDown: (x, y) {+ _touchDownX = x;+ _touchDownY = y;+ },+ onTouchUp: (x, y) {+ final dx = _touchDownX != null ? (x - _touchDownX!).abs() : 1.0;+ final dy = _touchDownY != null ? (y - _touchDownY!).abs() : 1.0;+ _touchDownX = null;+ _touchDownY = null;+ if (dx > 0.05 || dy > 0.05) return;+ if (x < 0.2) {+ Future.delayed(const Duration(milliseconds: 100), () => _epubController?.prev());+ } else if (x > 0.8) {+ Future.delayed(const Duration(milliseconds: 100), () => _epubController?.next());+ } else {+ _toggleControls();+ }+ },+ ),+ )),++ // Top bar overlay+ AnimatedOpacity(+ opacity: _showControls ? 1.0 : 0.0,+ duration: const Duration(milliseconds: 200),+ child: IgnorePointer(+ ignoring: !_showControls,+ child: Container(+ decoration: BoxDecoration(+ gradient: LinearGradient(+ begin: Alignment.topCenter,+ end: Alignment.bottomCenter,+ colors: [bg.withValues(alpha: 0.9), bg.withValues(alpha: 0.0)],+ ),+ ),+ child: SafeArea(+ bottom: false,+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 4),+ child: Row(+ children: [+ IconButton(+ icon: Icon(Icons.arrow_back_rounded, color: cs.onSurface),+ onPressed: () => Navigator.pop(context),+ ),+ Expanded(+ child: Text(+ widget.title,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: TextStyle(+ color: cs.onSurface,+ fontWeight: FontWeight.w600,+ fontSize: 16,+ ),+ ),+ ),+ IconButton(+ icon: Icon(Icons.text_fields_rounded, color: cs.onSurface),+ onPressed: _showSettingsSheet,+ ),+ if (_chapters.isNotEmpty)+ IconButton(+ icon: Icon(Icons.list_rounded, color: cs.onSurface),+ onPressed: _showChapterList,+ ),+ ],+ ),+ ),+ ),+ ),+ ),+ ),++ // Bottom progress bar overlay+ Positioned(+ left: 0, right: 0, bottom: 0,+ child: AnimatedOpacity(+ opacity: _showControls ? 1.0 : 0.0,+ duration: const Duration(milliseconds: 200),+ child: IgnorePointer(+ ignoring: !_showControls,+ child: Container(+ decoration: BoxDecoration(+ gradient: LinearGradient(+ begin: Alignment.bottomCenter,+ end: Alignment.topCenter,+ colors: [bg.withValues(alpha: 0.9), bg.withValues(alpha: 0.0)],+ ),+ ),+ child: SafeArea(+ top: false,+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ ClipRRect(+ borderRadius: BorderRadius.circular(2),+ child: LinearProgressIndicator(+ value: _progress.clamp(0.0, 1.0),+ minHeight: 3,+ backgroundColor: cs.onSurface.withValues(alpha: 0.1),+ valueColor: AlwaysStoppedAnimation(cs.primary),+ ),+ ),+ const SizedBox(height: 4),+ Text(+ '${(_progress * 100).toStringAsFixed(1)}%',+ style: TextStyle(color: cs.onSurfaceVariant, fontSize: 11),+ ),+ ],+ ),+ ),+ ),+ ),+ ),+ ),+ ),+ ],+ ),+ );+ }+}diff --git a/lib/services/api_service.dart b/lib/services/api_service.dartindex bda7e2f9..199372ba 100644--- a/lib/services/api_service.dart+++ b/lib/services/api_service.dart@@ -750,6 +750,34 @@ class ApiService {}}+ /// Update ebook reading progress on the server.+ /// PATCH /api/me/progress/:id+ Future<void> updateEbookProgress(+ String itemId, {+ required String ebookLocation,+ required double ebookProgress,+ }) async {+ try {+ final body = jsonEncode({+ 'ebookLocation': ebookLocation,+ 'ebookProgress': ebookProgress,+ 'isFinished': ebookProgress >= 1.0,+ });+ final progressPath = itemId.length > 36+ ? '${itemId.substring(0, 36)}/${itemId.substring(37)}'+ : itemId;+ debugPrint('[API] updateEbookProgress PATCH /api/me/progress/$progressPath');+ final resp = await http.patch(+ Uri.parse('$_cleanBaseUrl/api/me/progress/$progressPath'),+ headers: _headers,+ body: body,+ ).timeout(const Duration(seconds: 10));+ debugPrint('[API] updateEbookProgress response: ${resp.statusCode} ${resp.body}');+ } catch (e) {+ debugPrint('[API] updateEbookProgress error: $e');+ }+ }+/// Mark a book as finished on the server.Future<void> markFinished(String itemId, double duration) async {await updateProgress(diff --git a/lib/widgets/book_detail_sheet.dart b/lib/widgets/book_detail_sheet.dartindex 4fc5228b..e28122ff 100644--- a/lib/widgets/book_detail_sheet.dart+++ b/lib/widgets/book_detail_sheet.dart@@ -37,6 +37,7 @@ import 'collection_picker_sheet.dart';import 'absorb_wave_icon.dart';import 'edit_metadata_sheet.dart';import 'stackable_sheet.dart';+import '../screens/ebook_reader_screen.dart';// ─── BOOK DETAIL BOTTOM SHEET ───────────────────────────────@@ -443,7 +444,15 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant)),const SizedBox(height: 12),],- if (isEbookOnly)+ if (isEbookOnly && ebookFile != null)+ SizedBox(height: 52, child: FilledButton.icon(+ onPressed: () => _openEbookReader(context, auth, ebookFile, title),+ icon: const Icon(Icons.menu_book_rounded, size: 24),+ label: Text('Read',+ style: tt.titleMedium?.copyWith(fontWeight: FontWeight.w600, color: cs.onPrimary)),+ style: FilledButton.styleFrom(shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16))),+ ))+ else if (isEbookOnly)SizedBox(height: 52, child: FilledButton.icon(onPressed: null,icon: const Icon(Icons.menu_book_rounded, size: 24),@@ -693,6 +702,9 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {Navigator.pop(ctx);CollectionPickerSheet.show(context, widget.itemId);}),+ if (ebookFile != null)+ _moreItem(cs, Icons.menu_book_rounded, 'Read eBook',+ onTap: () { Navigator.pop(ctx); _openEbookReader(context, auth, ebookFile, title); }),if (ebookFile != null)_moreItem(cs, _ebookSaved ? Icons.download_done_rounded : Icons.save_alt_rounded,_ebookSaved ? l.downloadEbookAgain : l.downloadEbook,@@ -970,6 +982,66 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {);}+ void _openEbookReader(BuildContext context, AuthProvider auth, Map<String, dynamic> ebookFile, String title) {+ Navigator.of(context, rootNavigator: true).push(+ MaterialPageRoute(+ builder: (_) => EbookReaderScreen(+ itemId: widget.itemId,+ title: title,+ ebookFile: ebookFile,+ ),+ ),+ );+ }++ Widget _ebookOverflowButton(BuildContext context, AuthProvider auth, Map<String, dynamic> ebookFile, String title, bool isEbookOnly) {+ final cs = Theme.of(context).colorScheme;+ return GestureDetector(+ onTap: () {+ showModalBottomSheet(+ context: context,+ backgroundColor: cs.surface,+ shape: const RoundedRectangleBorder(+ borderRadius: BorderRadius.vertical(top: Radius.circular(20)),+ ),+ builder: (ctx) => SafeArea(+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ const SizedBox(height: 8),+ Center(child: Container(width: 40, height: 4,+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.24), borderRadius: BorderRadius.circular(2)))),+ const SizedBox(height: 16),+ ListTile(+ leading: Icon(_ebookSaving+ ? Icons.hourglass_top_rounded+ : _ebookSaved ? Icons.download_done_rounded : Icons.save_alt_rounded,+ color: cs.onSurfaceVariant),+ title: Text(_ebookSaving ? 'Saving...' : _ebookSaved ? 'Download eBook Again' : 'Download eBook'),+ subtitle: const Text('Save the file to your device'),+ onTap: _ebookSaving ? null : () {+ Navigator.pop(ctx);+ _saveEbook(context, auth, ebookFile, title);+ },+ ),+ const SizedBox(height: 8),+ ],+ ),+ ),+ );+ },+ child: Container(+ width: 36, height: 36,+ decoration: BoxDecoration(+ color: cs.onSurface.withValues(alpha: 0.06),+ borderRadius: BorderRadius.circular(14),+ border: Border.all(color: cs.onSurface.withValues(alpha: 0.08)),+ ),+ child: Icon(Icons.more_horiz_rounded, size: 16, color: cs.onSurfaceVariant),+ ),+ );+ }+bool _ebookSaving = false;Future<void> _saveEbook(BuildContext context, AuthProvider auth, Map<String, dynamic> ebookFile, String bookTitle) async {diff --git a/pubspec.lock b/pubspec.lockindex 131aecef..f5878682 100644--- a/pubspec.lock+++ b/pubspec.lock@@ -301,6 +301,78 @@ packages:url: "https://pub.dev"source: hostedversion: "1.4.1"+ flutter_epub_viewer:+ dependency: "direct main"+ description:+ name: flutter_epub_viewer+ sha256: "39d8ff469700fea41f103ae1ec01e06c805c3602eef0fecb1c5b325688dcb5b2"+ url: "https://pub.dev"+ source: hosted+ version: "1.2.8"+ flutter_inappwebview:+ dependency: transitive+ description:+ name: flutter_inappwebview+ sha256: "80092d13d3e29b6227e25b67973c67c7210bd5e35c4b747ca908e31eb71a46d5"+ url: "https://pub.dev"+ source: hosted+ version: "6.1.5"+ flutter_inappwebview_android:+ dependency: transitive+ description:+ name: flutter_inappwebview_android+ sha256: "62557c15a5c2db5d195cb3892aab74fcaec266d7b86d59a6f0027abd672cddba"+ url: "https://pub.dev"+ source: hosted+ version: "1.1.3"+ flutter_inappwebview_internal_annotations:+ dependency: transitive+ description:+ name: flutter_inappwebview_internal_annotations+ sha256: e30fba942e3debea7b7e6cdd4f0f59ce89dd403a9865193e3221293b6d1544c6+ url: "https://pub.dev"+ source: hosted+ version: "1.3.0"+ flutter_inappwebview_ios:+ dependency: transitive+ description:+ name: flutter_inappwebview_ios+ sha256: "5818cf9b26cf0cbb0f62ff50772217d41ea8d3d9cc00279c45f8aabaa1b4025d"+ url: "https://pub.dev"+ source: hosted+ version: "1.1.2"+ flutter_inappwebview_macos:+ dependency: transitive+ description:+ name: flutter_inappwebview_macos+ sha256: c1fbb86af1a3738e3541364d7d1866315ffb0468a1a77e34198c9be571287da1+ url: "https://pub.dev"+ source: hosted+ version: "1.1.2"+ flutter_inappwebview_platform_interface:+ dependency: transitive+ description:+ name: flutter_inappwebview_platform_interface+ sha256: cf5323e194096b6ede7a1ca808c3e0a078e4b33cc3f6338977d75b4024ba2500+ url: "https://pub.dev"+ source: hosted+ version: "1.3.0+1"+ flutter_inappwebview_web:+ dependency: transitive+ description:+ name: flutter_inappwebview_web+ sha256: "55f89c83b0a0d3b7893306b3bb545ba4770a4df018204917148ebb42dc14a598"+ url: "https://pub.dev"+ source: hosted+ version: "1.1.2"+ flutter_inappwebview_windows:+ dependency: transitive+ description:+ name: flutter_inappwebview_windows+ sha256: "8b4d3a46078a2cdc636c4a3d10d10f2a16882f6be607962dbfff8874d1642055"+ url: "https://pub.dev"+ source: hosted+ version: "0.6.0"flutter_launcher_icons:dependency: "direct dev"description:diff --git a/pubspec.yaml b/pubspec.yamlindex d8ed3fa9..dccdef8d 100644--- a/pubspec.yaml+++ b/pubspec.yaml@@ -89,6 +89,9 @@ dependencies:flutter_markdown_plus: ^1.0.7palette_generator: ^0.3.3+7+ # eBook reader+ flutter_epub_viewer: ^1.2.6+dev_dependencies:flutter_test:sdk: flutter