diff --git a/isolate.pdf b/isolate.pdf deleted file mode 100644 index b410a897..00000000 Binary files a/isolate.pdf and /dev/null differ diff --git a/lib/data/cache_provider.dart b/lib/lib/data/cache_provider.dart similarity index 100% rename from lib/data/cache_provider.dart rename to lib/lib/data/cache_provider.dart diff --git a/lib/data/data.dart b/lib/lib/data/data.dart similarity index 100% rename from lib/data/data.dart rename to lib/lib/data/data.dart diff --git a/lib/data/file_system_data_provider.dart b/lib/lib/data/file_system_data_provider.dart similarity index 100% rename from lib/data/file_system_data_provider.dart rename to lib/lib/data/file_system_data_provider.dart diff --git a/lib/data/hive_data_provider.dart b/lib/lib/data/hive_data_provider.dart similarity index 100% rename from lib/data/hive_data_provider.dart rename to lib/lib/data/hive_data_provider.dart diff --git a/lib/main.dart b/lib/lib/main.dart similarity index 95% rename from lib/main.dart rename to lib/lib/main.dart index d292496d..4d1fa320 100644 --- a/lib/main.dart +++ b/lib/lib/main.dart @@ -76,9 +76,7 @@ class OtzariaApp extends StatelessWidget { "he", "IL"), // OR Locale('ar', 'AE') OR Other RTL locales, title: 'אוצריא', theme: appModel.isDarkMode.value - ? ThemeData.dark(useMaterial3: true).copyWith( - colorScheme: ColorScheme.fromSeed( - seedColor: appModel.seedColor.value)) + ? ThemeData.dark(useMaterial3: true) : ThemeData( visualDensity: VisualDensity.adaptivePlatformDensity, fontFamily: 'Roboto', diff --git a/lib/models/app_model.dart b/lib/lib/models/app_model.dart similarity index 100% rename from lib/models/app_model.dart rename to lib/lib/models/app_model.dart diff --git a/lib/models/bookmark.dart b/lib/lib/models/bookmark.dart similarity index 100% rename from lib/models/bookmark.dart rename to lib/lib/models/bookmark.dart diff --git a/lib/models/books.dart b/lib/lib/models/books.dart similarity index 100% rename from lib/models/books.dart rename to lib/lib/models/books.dart diff --git a/lib/models/full_text_search.dart b/lib/lib/models/full_text_search.dart similarity index 100% rename from lib/models/full_text_search.dart rename to lib/lib/models/full_text_search.dart diff --git a/lib/models/library.dart b/lib/lib/models/library.dart similarity index 100% rename from lib/models/library.dart rename to lib/lib/models/library.dart diff --git a/lib/models/links.dart b/lib/lib/models/links.dart similarity index 100% rename from lib/models/links.dart rename to lib/lib/models/links.dart diff --git a/lib/models/search_results.dart b/lib/lib/models/search_results.dart similarity index 100% rename from lib/models/search_results.dart rename to lib/lib/models/search_results.dart diff --git a/lib/models/tabs.dart b/lib/lib/models/tabs.dart similarity index 100% rename from lib/models/tabs.dart rename to lib/lib/models/tabs.dart diff --git a/lib/models/text_book_searcher.dart b/lib/lib/models/text_book_searcher.dart similarity index 100% rename from lib/models/text_book_searcher.dart rename to lib/lib/models/text_book_searcher.dart diff --git a/lib/screens/book_tree_checklist.dart b/lib/lib/screens/book_tree_checklist.dart similarity index 100% rename from lib/screens/book_tree_checklist.dart rename to lib/lib/screens/book_tree_checklist.dart diff --git a/lib/screens/bookmark_screen.dart b/lib/lib/screens/bookmark_screen.dart similarity index 100% rename from lib/screens/bookmark_screen.dart rename to lib/lib/screens/bookmark_screen.dart diff --git a/lib/screens/combined_book_screen.dart b/lib/lib/screens/combined_book_screen.dart similarity index 100% rename from lib/screens/combined_book_screen.dart rename to lib/lib/screens/combined_book_screen.dart diff --git a/lib/screens/commentators_list_screen.dart b/lib/lib/screens/commentators_list_screen.dart similarity index 100% rename from lib/screens/commentators_list_screen.dart rename to lib/lib/screens/commentators_list_screen.dart diff --git a/lib/screens/favoriets.dart b/lib/lib/screens/favoriets.dart similarity index 100% rename from lib/screens/favoriets.dart rename to lib/lib/screens/favoriets.dart diff --git a/lib/screens/find_book_screen.dart b/lib/lib/screens/find_book_screen.dart similarity index 100% rename from lib/screens/find_book_screen.dart rename to lib/lib/screens/find_book_screen.dart diff --git a/lib/screens/full_text_search_screen.dart b/lib/lib/screens/full_text_search_screen.dart similarity index 100% rename from lib/screens/full_text_search_screen.dart rename to lib/lib/screens/full_text_search_screen.dart diff --git a/lib/screens/history_screen.dart b/lib/lib/screens/history_screen.dart similarity index 100% rename from lib/screens/history_screen.dart rename to lib/lib/screens/history_screen.dart diff --git a/lib/screens/library_browser.dart b/lib/lib/screens/library_browser.dart similarity index 100% rename from lib/screens/library_browser.dart rename to lib/lib/screens/library_browser.dart diff --git a/lib/screens/links_screen.dart b/lib/lib/screens/links_screen.dart similarity index 100% rename from lib/screens/links_screen.dart rename to lib/lib/screens/links_screen.dart diff --git a/lib/screens/main_window_screen.dart b/lib/lib/screens/main_window_screen.dart similarity index 99% rename from lib/screens/main_window_screen.dart rename to lib/lib/screens/main_window_screen.dart index b160d597..9f06aeb2 100644 --- a/lib/screens/main_window_screen.dart +++ b/lib/lib/screens/main_window_screen.dart @@ -111,7 +111,7 @@ class MainWindowScreenState extends State )); return jsonDecode(data.body)["body"]; }, - currentVersion: '0.1.7+7', + currentVersion: '0.1.8-dev.0', updateChipBuilder: flatChip, callback: (status) {}, diff --git a/lib/screens/pdf_book_screen.dart b/lib/lib/screens/pdf_book_screen.dart similarity index 97% rename from lib/screens/pdf_book_screen.dart rename to lib/lib/screens/pdf_book_screen.dart index b778bd38..5413f29c 100644 --- a/lib/screens/pdf_book_screen.dart +++ b/lib/lib/screens/pdf_book_screen.dart @@ -125,20 +125,14 @@ class _PdfBookViewrState extends State pageNumber: widget.tab.pdfViewerController.pages.length), ), IconButton( - icon: const Icon(Icons.print), - tooltip: 'הדפסה', + icon: const Icon(Icons.share), + tooltip: 'שיתוף', onPressed: () async { //display dialog to choose the pages to print - if (widget.tab.pdfViewerController.isReady) { - final pages = await showNumberOfPagesDialog(context); - if (pages != null) { - await Printing.layoutPdf( - onLayout: (PdfPageFormat format) async => - File(widget.tab.book.path).readAsBytes(), - ); - } - } + await Printing.sharePdf( + bytes: File(widget.tab.book.path).readAsBytesSync(), + ); }), ], ), diff --git a/lib/screens/pdf_outlines_screen.dart b/lib/lib/screens/pdf_outlines_screen.dart similarity index 100% rename from lib/screens/pdf_outlines_screen.dart rename to lib/lib/screens/pdf_outlines_screen.dart diff --git a/lib/screens/pdf_search_screen.dart b/lib/lib/screens/pdf_search_screen.dart similarity index 100% rename from lib/screens/pdf_search_screen.dart rename to lib/lib/screens/pdf_search_screen.dart diff --git a/lib/screens/pdf_thumbnails_screen.dart b/lib/lib/screens/pdf_thumbnails_screen.dart similarity index 100% rename from lib/screens/pdf_thumbnails_screen.dart rename to lib/lib/screens/pdf_thumbnails_screen.dart diff --git a/lib/screens/printing_screen.dart b/lib/lib/screens/printing_screen.dart similarity index 98% rename from lib/screens/printing_screen.dart rename to lib/lib/screens/printing_screen.dart index 1022e834..f7a8b4f1 100644 --- a/lib/screens/printing_screen.dart +++ b/lib/lib/screens/printing_screen.dart @@ -1,5 +1,6 @@ import 'dart:io'; import 'dart:isolate'; +import 'dart:math'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -38,7 +39,12 @@ class _PrintingScreenState extends State { void initState() { super.initState(); startLine = widget.startLine; - endLine = startLine + 3; + endLine = startLine; + () async { + endLine = min(startLine + 3, (await widget.data).split('\n').length); + setState(() {}); + }(); + pdf = createPdf(format); } diff --git a/lib/screens/reading_screen.dart b/lib/lib/screens/reading_screen.dart similarity index 100% rename from lib/screens/reading_screen.dart rename to lib/lib/screens/reading_screen.dart diff --git a/lib/screens/settings_screen.dart b/lib/lib/screens/settings_screen.dart similarity index 96% rename from lib/screens/settings_screen.dart rename to lib/lib/screens/settings_screen.dart index 41f41533..b2e4ad30 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/lib/screens/settings_screen.dart @@ -137,11 +137,25 @@ class _MySettingsScreenState extends State { titleTextStyle: TextStyle(fontSize: 25), children: [ DropDownSettingsTile( - selected: 'ctrl+b', - settingKey: 'key-shortcut-open-book-browser', - title: 'דפדוף בספריה', + selected: 'ctrl+o', + settingKey: 'key-shortcut-open-library-browser', + title: 'ספרייה', + values: shortcuctsList, + leading: Icon(Icons.library_books), + ), + DropDownSettingsTile( + selected: 'ctrl+r', + settingKey: 'key-shortcut-open-reading-screen', + title: 'עיון', + leading: Icon(Icons.menu_book_rounded), + values: shortcuctsList, + ), + DropDownSettingsTile( + selected: 'ctrl+q', + settingKey: 'key-shortcut-open-new-search', + title: 'חלון חיפוש חדש', + leading: Icon(Icons.search), values: shortcuctsList, - leading: Icon(Icons.folder), ), DropDownSettingsTile( selected: 'ctrl+w', @@ -157,20 +171,6 @@ class _MySettingsScreenState extends State { leading: Icon(Icons.close), values: shortcuctsList, ), - DropDownSettingsTile( - selected: 'ctrl+o', - settingKey: 'key-shortcut-open-book-search', - title: 'איתור ספר', - leading: Icon(Icons.library_books), - values: shortcuctsList, - ), - DropDownSettingsTile( - selected: 'ctrl+q', - settingKey: 'key-shortcut-open-new-search', - title: 'חלון חיפוש חדש', - leading: Icon(Icons.search), - values: shortcuctsList, - ), ]), const SettingsGroup( title: 'הגדרות ממשק', diff --git a/lib/screens/simple_book_view.dart b/lib/lib/screens/simple_book_view.dart similarity index 100% rename from lib/screens/simple_book_view.dart rename to lib/lib/screens/simple_book_view.dart diff --git a/lib/screens/splited_view_screen.dart b/lib/lib/screens/splited_view_screen.dart similarity index 100% rename from lib/screens/splited_view_screen.dart rename to lib/lib/screens/splited_view_screen.dart diff --git a/lib/screens/text_book_screen.dart b/lib/lib/screens/text_book_screen.dart similarity index 100% rename from lib/screens/text_book_screen.dart rename to lib/lib/screens/text_book_screen.dart diff --git a/lib/screens/text_book_search_screen.dart b/lib/lib/screens/text_book_search_screen.dart similarity index 100% rename from lib/screens/text_book_search_screen.dart rename to lib/lib/screens/text_book_search_screen.dart diff --git a/lib/screens/toc_navigator_screen.dart b/lib/lib/screens/toc_navigator_screen.dart similarity index 100% rename from lib/screens/toc_navigator_screen.dart rename to lib/lib/screens/toc_navigator_screen.dart diff --git a/lib/utils/docx_to_otzaria.dart b/lib/lib/utils/docx_to_otzaria.dart similarity index 82% rename from lib/utils/docx_to_otzaria.dart rename to lib/lib/utils/docx_to_otzaria.dart index b7d9ec52..edb14e4a 100644 --- a/lib/utils/docx_to_otzaria.dart +++ b/lib/lib/utils/docx_to_otzaria.dart @@ -22,8 +22,15 @@ String docxToText(Uint8List bytes, String title) { final paragraphNodes = document.findAllElements('w:p'); for (final paragraph in paragraphNodes) { - final textNodes = paragraph.findAllElements('w:t'); - var text = textNodes.map((node) => node.innerText).join(); + final textNodes = paragraph.findAllElements('w:r'); + var text = textNodes.map((node) { + final innerText = node.getElement('w:t')?.innerText ?? ''; + //mark bold text + if (node.getElement('w:rPr')?.getElement('w:b') != null) { + return '$innerText'; + } + return innerText; + }).join(); //mark up headings var style = paragraph diff --git a/lib/utils/text_manipulation.dart b/lib/lib/utils/text_manipulation.dart similarity index 100% rename from lib/utils/text_manipulation.dart rename to lib/lib/utils/text_manipulation.dart diff --git a/lib/widgets/commentary_content.dart b/lib/lib/widgets/commentary_content.dart similarity index 100% rename from lib/widgets/commentary_content.dart rename to lib/lib/widgets/commentary_content.dart diff --git a/lib/widgets/commentary_list.dart b/lib/lib/widgets/commentary_list.dart similarity index 100% rename from lib/widgets/commentary_list.dart rename to lib/lib/widgets/commentary_list.dart diff --git a/lib/widgets/grid_items.dart b/lib/lib/widgets/grid_items.dart similarity index 87% rename from lib/widgets/grid_items.dart rename to lib/lib/widgets/grid_items.dart index 18c67aae..f5713be6 100644 --- a/lib/widgets/grid_items.dart +++ b/lib/lib/widgets/grid_items.dart @@ -138,12 +138,30 @@ class BookGridItem extends StatelessWidget { Expanded( child: ListTile( mouseCursor: SystemMouseCursors.click, - title: Text( - showCategory - ? '${book.category?.parent?.title}/${book.category?.title}/${book.title}' - : book.title, - style: const TextStyle( - fontSize: 14, fontWeight: FontWeight.bold), + title: RichText( + text: TextSpan( + children: [ + TextSpan( + text: '${book.title} ', + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + color: Theme.of(context).colorScheme.onSurface), + ), + showCategory + ? TextSpan( + text: + '(בתוך ${book.category?.parent?.title}/${book.category?.title})', + style: TextStyle( + fontSize: 11, + color: Theme.of(context) + .colorScheme + .onSurface + .withOpacity(0.7)), + ) + : TextSpan() + ], + ), ), subtitle: Text( (book.author == "" || book.author == null) diff --git a/lib/widgets/keyboard_shortcuts.dart b/lib/lib/widgets/keyboard_shortcuts.dart similarity index 90% rename from lib/widgets/keyboard_shortcuts.dart rename to lib/lib/widgets/keyboard_shortcuts.dart index 34429168..f2187bcf 100644 --- a/lib/widgets/keyboard_shortcuts.dart +++ b/lib/lib/widgets/keyboard_shortcuts.dart @@ -93,12 +93,13 @@ class KeyboardShortcuts extends StatelessWidget { return Consumer( builder: (context, appModel, child) => CallbackShortcuts( bindings: { - shortcuts[ - Settings.getValue('key-shortcut-open-book-browser') != - null - ? Settings.getValue('key-shortcut-open-book-browser') - : 'ctrl+b']!: () { + shortcuts[Settings.getValue( + 'key-shortcut-open-library-browser') != + null + ? Settings.getValue('key-shortcut-open-library-browser') + : 'ctrl+o']!: () { appModel.currentView.value = Screens.library; + appModel.bookLocatorFocusNode.requestFocus(); }, shortcuts[Settings.getValue('key-shortcut-close-tab') != null ? Settings.getValue('key-shortcut-close-tab') @@ -111,12 +112,12 @@ class KeyboardShortcuts extends StatelessWidget { : 'ctrl+x']!: () { appModel.closeAllTabs(); }, - shortcuts[ - Settings.getValue('key-shortcut-open-book-search') != null - ? Settings.getValue('key-shortcut-open-book-search') - : 'ctrl+o']!: () { - appModel.currentView.value = Screens.library; - appModel.bookLocatorFocusNode.requestFocus(); + shortcuts[Settings.getValue( + 'key-shortcut-open-reading-screen') != + null + ? Settings.getValue('key-shortcut-open-reading-screen') + : 'ctrl+r']!: () { + appModel.currentView.value = Screens.reading; }, shortcuts[ Settings.getValue('key-shortcut-open-new-search') != null diff --git a/lib/widgets/password_dialog.dart b/lib/lib/widgets/password_dialog.dart similarity index 100% rename from lib/widgets/password_dialog.dart rename to lib/lib/widgets/password_dialog.dart diff --git a/pubspec.yaml b/pubspec.yaml index 45afcfe9..4b6a94d6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -33,7 +33,7 @@ msix_config: # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 0.1.7 +version: 0.1.8-dev.0 environment: sdk: ">=3.2.6 <4.0.0" @@ -73,7 +73,6 @@ dependencies: printing: pdf: ^3.10.8 - flutter_launcher_icons: android: true ios: true @@ -110,7 +109,6 @@ flutter: assets: - assets/metadata.json - # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware @@ -150,5 +148,3 @@ flutter: - family: NotoSerifHebrew fonts: - asset: fonts/NotoSerifHebrew-VariableFont_wdth,wght.ttf - - \ No newline at end of file diff --git a/test/widget_test.dart b/test/widget_test.dart index 89ad7684..4fec46ea 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -4,12 +4,18 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:otzaria/screens/main_window_screen.dart'; void main() { - testWidgets('showing app test', (WidgetTester tester) async { + testWidgets('finds main window', (WidgetTester tester) async { await Settings.init(); + // Build our app and trigger a frame. - await tester.pumpWidget(const MainWindowScreen()); + await tester.pumpWidget(const MaterialApp(home: MainWindowScreen())); + + // Verify that main window is shown + expect(find.byType(MainWindowScreen), findsOneWidget); - //verify that the navigation sidebar is visible - expect(find.byType(NavigationRail), findsOneWidget); + + //if the oriention is landscape Verify that the navigation bar is shown + expect(find.byType(Scaffold), findsOneWidget); + }); }