├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── no-repsonse.yml └── workflows │ └── publish.yml ├── .gitignore ├── .metadata ├── .vscode └── settings.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── example ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── values-night │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── assets │ └── pdf │ │ └── file-example.pdf ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ └── main.dart ├── pubspec.yaml └── test │ └── widget_test.dart ├── lib ├── flutter_cached_pdfview.dart └── src │ ├── asset │ ├── asset_pdf_view.dart │ └── copy_pdf_from_asset_to_storge.dart │ ├── pdf.dart │ ├── pdf_view_types.dart │ ├── pdf_view_wrapper.dart │ ├── url │ ├── cached_pdf_view.dart │ └── custom_cache_manger.dart │ └── utils │ ├── download_indicator.dart │ ├── error_widget.dart │ └── show_progress.dart ├── pub_login.sh ├── pubspec.yaml └── test └── flutter_cached_pdfview_test.dart /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | ko_fi: abdosaed 5 | custom: ['https://www.paypal.com/paypalme/abdoosaed/5'] 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: AbdOoSaed 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behaviour: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behaviour** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Version [e.g. 22] 35 | 36 | **Additional context** 37 | Add any other context about the problem here. 38 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/no-repsonse.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-no-response - https://github.com/probot/no-response 2 | 3 | # Number of days of inactivity before an Issue is closed for lack of response 4 | daysUntilClose: 14 5 | 6 | # Label requiring a response 7 | responseRequiredLabel: "awaiting response" 8 | 9 | # Comment to post when closing an Issue for lack of response. Set to `false` to disable 10 | closeComment: >- 11 | Without additional information, we are unfortunately not sure how to resolve 12 | this issue. We are therefore reluctantly going to close this issue for now. 13 | Please don't hesitate to comment on the issue if you have any more 14 | information for us; we will reopen it right away! 15 | 16 | Thanks for your contribution. 17 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | #https://birjuvachhani.dev/posts/publish-your-flutter-package-using-github-actions/ 2 | #https://github.com/k-paxian/dart-package-publisher/blob/master/entrypoint.sh 3 | name: Dart CI 4 | 5 | on: 6 | push: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v1 15 | - name: Install Flutter 16 | uses: subosito/flutter-action@v1 17 | with: 18 | flutter-version: '3.7.12' 19 | - name: Install dependencies 20 | run: flutter pub get 21 | - name: Analyze 22 | run: flutter analyze 23 | - name: Run tests 24 | run: flutter test 25 | - name: flutter format lib 26 | run: flutter format lib/** --set-exit-if-changed 27 | - name: Setup Pub Credentials 28 | shell: bash 29 | env: 30 | PUB_DEV_PUBLISH_ACCESS_TOKEN: ${{ secrets.PUB_DEV_PUBLISH_ACCESS_TOKEN }} 31 | PUB_DEV_PUBLISH_REFRESH_TOKEN: ${{ secrets.PUB_DEV_PUBLISH_REFRESH_TOKEN }} 32 | PUB_DEV_PUBLISH_TOKEN_ENDPOINT: ${{ secrets.PUB_DEV_PUBLISH_TOKEN_ENDPOINT }} 33 | PUB_DEV_PUBLISH_EXPIRATION: ${{ secrets.PUB_DEV_PUBLISH_EXPIRATION }} 34 | run: | 35 | sh ./pub_login.sh 36 | - name: Check Publish Warnings 37 | run: pub publish --dry-run 38 | - name: Publish Package 39 | run: flutter pub publish -f 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | build/ 32 | 33 | # Android related 34 | **/android/**/gradle-wrapper.jar 35 | **/android/.gradle 36 | **/android/captures/ 37 | **/android/gradlew 38 | **/android/gradlew.bat 39 | **/android/local.properties 40 | **/android/**/GeneratedPluginRegistrant.java 41 | 42 | # iOS/XCode related 43 | ios/.symlinks 44 | **/ios/**/*.mode1v3 45 | **/ios/**/*.mode2v3 46 | **/ios/**/*.moved-aside 47 | **/ios/**/*.pbxuser 48 | **/ios/**/*.perspectivev3 49 | **/ios/**/*sync/ 50 | **/ios/**/.sconsign.dblite 51 | **/ios/**/.tags* 52 | **/ios/**/.vagrant/ 53 | **/ios/**/DerivedData/ 54 | **/ios/**/Icon? 55 | **/ios/**/Pods/ 56 | **/ios/**/.symlinks/ 57 | **/ios/**/profile 58 | **/ios/**/xcuserdata 59 | **/ios/.generated/ 60 | **/ios/Flutter/App.framework 61 | **/ios/Flutter/Flutter.framework 62 | **/ios/Flutter/Flutter.podspec 63 | **/ios/Flutter/Generated.xcconfig 64 | **/ios/Flutter/app.flx 65 | **/ios/Flutter/app.zip 66 | **/ios/Flutter/flutter_assets/ 67 | **/ios/Flutter/flutter_export_environment.sh 68 | **/ios/ServiceDefinitions.json 69 | **/ios/Runner/GeneratedPluginRegistrant.* 70 | 71 | # Exceptions to above rules. 72 | !**/ios/**/default.mode1v3 73 | !**/ios/**/default.mode2v3 74 | !**/ios/**/default.pbxuser 75 | !**/ios/**/default.perspectivev3 76 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 77 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: f139b11009aeb8ed2a3a3aa8b0066e482709dde3 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "BracketHighlighter.enableExtension": false 3 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [0.4.3] - 22/10/2024. 2 | 3 | * add background color -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at abdoo.dev@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Abdelrahman Saed 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flutter_cached_pdfview 2 | 3 | 4 | 5 | Awesome Flutter 6 | 7 | 8 | ![Pub Version](https://img.shields.io/pub/v/flutter_cached_pdfview?color=1&label=flutter_cached_pdfview) 9 | ![GitHub repo size](https://img.shields.io/github/repo-size/AbdOoSaed/flutter_cached_pdfview) 10 | ![issues-raw](https://img.shields.io/github/issues-raw/AbdOoSaed/flutter_cached_pdfview) 11 | ![license](https://img.shields.io/github/license/AbdOoSaed/flutter_cached_pdfview) 12 | ![last-commit](https://img.shields.io/github/last-commit/AbdOoSaed/flutter_cached_pdfview) 13 | ![stars](https://img.shields.io/github/stars/AbdOoSaed/flutter_cached_pdfview?style=social) 14 | ![Dart CI](https://github.com/AbdOoSaed/flutter_cached_pdfview/workflows/Dart%20CI/badge.svg) 15 | 16 |

17 | 18 | 19 | 20 |
A package to show Native PDF View for iOS and Android, support Open from a different resource like Path, Asset or Url and Cache it. 21 | 22 | ### Support = [**[ Android , IOS and _WEB_(soon) ](#video)**]; 23 | 24 | * Open Pdf From Path(local file) 25 | * Open Pdf From Asset 26 | * Open Pdf From URl and Cache it 27 | * Display horizontally or vertically 28 | * Drag and zoom 29 | * Double tap for zoom 30 | * Support password protected pdf 31 | * Jump to a specific page in the pdf 32 | 33 | --- 34 | ### Setup 35 | 36 | #### iOS 37 | Opt-in to the embedded views preview by adding a boolean property to the app's `Info.plist` file 38 | with the key `io.flutter.embedded_views_preview` and the value `YES`. 39 | 40 | 41 | iOS (only support> 11.0) you need to add this line in your ios/Podfile 42 | 43 | `platform :ios, '11.0'` 44 | 45 | ready-made in the [Example](https://github.com/AbdOoSaed/flutter_cached_pdfview/tree/master/example) 46 | 47 | ### Import it 48 | 49 | Now in your Dart code, you can use: 50 | 51 | ``` 52 | import 'package:flutter_cached_pdfview/flutter_cached_pdfview.dart'; 53 | ``` 54 | 55 | ## Options 56 | 57 | | Name | Android | iOS | Default | 58 | |:----------------------| :-----: | :-: |:-----------------:| 59 | | defaultPage | ✅ | ✅ | `0` | 60 | | onViewCreated | ✅ | ✅ | `null` | 61 | | onRender | ✅ | ✅ | `null` | 62 | | onPageChanged | ✅ | ✅ | `null` | 63 | | onError | ✅ | ✅ | `null` | 64 | | onPageError | ✅ | ❌ | `null` | 65 | | onLinkHandle | ✅ | ✅ | `null` | 66 | | gestureRecognizers | ✅ | ✅ | `null` | 67 | | filePath | ✅ | ✅ | | 68 | | fitPolicy | ✅ | ❌ | `FitPolicy.WIDTH` | 69 | | enableSwipe | ✅ | ✅ | `true` | 70 | | swipeHorizontal | ✅ | ✅ | `false` | 71 | | password | ✅ | ✅ | `null` | 72 | | nightMode | ✅ | ❌ | `false` | 73 | | autoSpacing | ✅ | ✅ | `true` | 74 | | pageFling | ✅ | ✅ | `true` | 75 | | pageSnap | ✅ | ❌ | `true` | 76 | | preventLinkNavigation | ✅ | ✅ | `false` | 77 | | bockgroundColor | ✅ | ✅ | `null` | 78 | 79 | ## Controller Options 80 | 81 | | Name | Description | Parameters | Return | 82 | | :------------- | :------------------: | :--------: | :------------: | 83 | | getPageCount | Get total page count | - | `Future` | 84 | | getCurrentPage | Get current page | - | `Future` | 85 | | setPage | Go to/Set page | `int page` | `Future` | 86 | 87 | ## [Example](https://github.com/AbdOoSaed/flutter_cached_pdfview/tree/master/example) 88 | #### from Asset 89 | ```dart 90 | PDF( 91 | enableSwipe: true, 92 | swipeHorizontal: true, 93 | autoSpacing: false, 94 | pageFling: false, 95 | backgroundColor: Colors.grey, 96 | onError: (error) { 97 | print(error.toString()); 98 | }, 99 | onPageError: (page, error) { 100 | print('$page: ${error.toString()}'); 101 | }, 102 | onPageChanged: (int page, int total) { 103 | print('page change: $page/$total'); 104 | }, 105 | ).fromAsset('assets/pdf/file-example.pdf'), 106 | 107 | ``` 108 | #### cached From Url 109 | ```dart 110 | PDF( 111 | swipeHorizontal: true, 112 | ).cachedFromUrl('https://ontheline.trincoll.edu/images/bookdown/sample-local-pdf.pdf'), 113 | 114 | ``` 115 | #### with placeholder until pdfFile download and errorWidget if there are problem 116 | ```dart 117 | PDF().cachedFromUrl( 118 | 'https://ontheline.trincoll.edu/images/bookdown/sample-local-pdf.pdf', 119 | placeholder: (progress) => Center(child: Text('$progress %')), 120 | errorWidget: (error) => Center(child: Text(error.toString())), 121 | ) 122 | ``` 123 | 124 | # For production usage 125 | 126 | If you use proguard, you should include this line [ready-made in the [Example](https://github.com/AbdOoSaed/flutter_cached_pdfview/tree/master/example)]. 127 | 128 | ``` 129 | -keep class com.shockwave.** 130 | ``` 131 | 132 | # Dependencies 133 | 134 | ### Flutter 135 | 136 | [flutter_pdfview](https://pub.dev/packages/flutter_pdfview) 137 | 138 | [flutter_cache_manager](https://pub.dev/packages/flutter_cache_manager) 139 | 140 | ### Android (only support >= api 20) 141 | 142 | [AndroidPdfViewer](https://github.com/barteksc/AndroidPdfViewer) 143 | 144 | ### iOS (only support> 11.0) 145 | 146 | [PDFKit](https://developer.apple.com/documentation/pdfkit) 147 | 148 | 149 | 150 |

151 | 152 | 153 | 154 | 155 |
156 | 157 | # Video 158 | ![IOS](https://user-images.githubusercontent.com/33700292/84393190-913c2380-abfb-11ea-9e4e-1f1bd1fe2305.gif) 159 | 160 | 161 | 162 | ![WEB](https://user-images.githubusercontent.com/33700292/86278983-8ca2d380-bbd9-11ea-8861-7780fe9eee03.gif) 163 | 164 | 165 | 166 | ### Developer 167 | 168 | - [Abdelrahman Saed](https://github.com/binSaed) 169 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # Specify analysis options. 2 | # 3 | # Until there are meta linter rules, each desired lint must be explicitly enabled. 4 | # See: https://github.com/dart-lang/linter/issues/288 5 | # 6 | # For a list of lints, see: http://dart-lang.github.io/linter/lints/ 7 | # See the configuration guide for more 8 | # https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer 9 | # 10 | # There are other similar analysis options files in the flutter repos, 11 | # which should be kept in sync with this file: 12 | # 13 | # - analysis_options.yaml (this file) 14 | # - packages/flutter/lib/analysis_options_user.yaml 15 | # - https://github.com/flutter/plugins/blob/master/analysis_options.yaml 16 | # - https://github.com/flutter/engine/blob/master/analysis_options.yaml 17 | # 18 | # This file contains the analysis options used by Flutter tools, such as IntelliJ, 19 | # Android Studio, and the `flutter analyze` command. 20 | 21 | analyzer: 22 | strong-mode: 23 | implicit-casts: false 24 | implicit-dynamic: true 25 | errors: 26 | # treat missing required parameters as a warning (not a hint) 27 | missing_required_param: warning 28 | # treat missing returns as a warning (not a hint) 29 | missing_return: warning 30 | # allow having TODOs in the code 31 | todo: ignore 32 | # allow self-reference to deprecated members (we do this because otherwise we have 33 | # to annotate every member in every test, assert, etc, when we deprecate something) 34 | deprecated_member_use_from_same_package: ignore 35 | # Ignore analyzer hints for updating pubspecs when using Future or 36 | # Stream and not importing dart:async 37 | # Please see https://github.com/flutter/flutter/pull/24528 for details. 38 | sdk_version_async_exported_from_core: ignore 39 | exclude: 40 | - "bin/cache/**" 41 | # the following two are relative to the stocks example and the flutter package respectively 42 | # see https://github.com/dart-lang/sdk/issues/28463 43 | - "lib/i18n/messages_*.dart" 44 | - "lib/src/http/**" 45 | 46 | linter: 47 | rules: 48 | # these rules are documented on and in the same order as 49 | # the Dart Lint rules page to make maintenance easier 50 | # https://github.com/dart-lang/linter/blob/master/example/all.yaml 51 | - always_declare_return_types 52 | - always_put_control_body_on_new_line 53 | # - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/flutter/issues/10219 54 | - always_require_non_null_named_parameters 55 | - always_specify_types 56 | - annotate_overrides 57 | # - avoid_annotating_with_dynamic # conflicts with always_specify_types 58 | # - avoid_as # required for implicit-casts: true 59 | - avoid_bool_literals_in_conditional_expressions 60 | - avoid_catches_without_on_clauses # we do this commonly 61 | - avoid_catching_errors # we do this commonly 62 | - avoid_classes_with_only_static_members 63 | # - avoid_double_and_int_checks # only useful when targeting JS runtime 64 | - avoid_empty_else 65 | - avoid_equals_and_hash_code_on_mutable_classes 66 | - avoid_field_initializers_in_const_classes 67 | - avoid_function_literals_in_foreach_calls 68 | # - avoid_implementing_value_types # not yet tested 69 | - avoid_init_to_null 70 | # - avoid_js_rounded_ints # only useful when targeting JS runtime 71 | - avoid_null_checks_in_equality_operators 72 | # - avoid_positional_boolean_parameters # not yet tested 73 | # - avoid_print # not yet tested 74 | # - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356) 75 | # - avoid_redundant_argument_values # not yet tested 76 | - avoid_relative_lib_imports 77 | - avoid_renaming_method_parameters 78 | - avoid_return_types_on_setters 79 | # - avoid_returning_null # there are plenty of valid reasons to return null 80 | # - avoid_returning_null_for_future # not yet tested 81 | - avoid_returning_null_for_void 82 | # - avoid_returning_this # there are plenty of valid reasons to return this 83 | # - avoid_setters_without_getters # not yet tested 84 | # - avoid_shadowing_type_parameters # not yet tested 85 | - avoid_single_cascade_in_expression_statements 86 | - avoid_slow_async_io 87 | - avoid_types_as_parameter_names 88 | # - avoid_types_on_closure_parameters # conflicts with always_specify_types 89 | - avoid_unnecessary_containers # not yet tested 90 | - avoid_unused_constructor_parameters 91 | - avoid_void_async 92 | # - avoid_web_libraries_in_flutter # not yet tested 93 | - await_only_futures 94 | - camel_case_extensions 95 | - camel_case_types 96 | - cancel_subscriptions 97 | # - cascade_invocations # not yet tested 98 | # - close_sinks # not reliable enough 99 | # - comment_references # blocked on https://github.com/flutter/flutter/issues/20765 100 | # - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204 101 | - control_flow_in_finally 102 | # - curly_braces_in_flow_control_structures # not yet tested 103 | # - diagnostic_describe_all_properties # not yet tested 104 | - directives_ordering 105 | - empty_catches 106 | - empty_constructor_bodies 107 | - empty_statements 108 | # - file_names # not yet tested 109 | - flutter_style_todos 110 | - hash_and_equals 111 | - implementation_imports 112 | # - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811 113 | - iterable_contains_unrelated_type 114 | # - join_return_with_assignment # not yet tested 115 | - library_names 116 | - library_prefixes 117 | # - lines_longer_than_80_chars # not yet tested 118 | - list_remove_unrelated_type 119 | # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181 120 | # - missing_whitespace_between_adjacent_strings # not yet tested 121 | - no_adjacent_strings_in_list 122 | - no_duplicate_case_values 123 | # - no_logic_in_create_state # not yet tested 124 | # - no_runtimeType_toString # not yet tested 125 | - non_constant_identifier_names 126 | # - null_closures # not yet tested 127 | # - omit_local_variable_types # opposite of always_specify_types 128 | # - one_member_abstracts # too many false positives 129 | # - only_throw_errors # https://github.com/flutter/flutter/issues/5792 130 | - overridden_fields 131 | - package_api_docs 132 | - package_names 133 | - package_prefixed_library_names 134 | - parameter_assignments # we do this commonly 135 | - prefer_adjacent_string_concatenation 136 | - prefer_asserts_in_initializer_lists 137 | # - prefer_asserts_with_message # not yet tested 138 | - prefer_collection_literals 139 | - prefer_conditional_assignment 140 | - prefer_const_constructors 141 | - prefer_const_constructors_in_immutables 142 | - prefer_const_declarations 143 | - prefer_const_literals_to_create_immutables 144 | # - prefer_constructors_over_static_methods # not yet tested 145 | - prefer_contains 146 | # - prefer_double_quotes # opposite of prefer_single_quotes 147 | - prefer_equal_for_default_values 148 | # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods 149 | - prefer_final_fields 150 | - prefer_final_in_for_each 151 | - prefer_final_locals 152 | - prefer_for_elements_to_map_fromIterable 153 | - prefer_foreach 154 | # - prefer_function_declarations_over_variables # not yet tested 155 | - prefer_generic_function_type_aliases 156 | - prefer_if_elements_to_conditional_expressions 157 | - prefer_if_null_operators 158 | - prefer_initializing_formals 159 | - prefer_inlined_adds 160 | # - prefer_int_literals # not yet tested 161 | # - prefer_interpolation_to_compose_strings # not yet tested 162 | - prefer_is_empty 163 | - prefer_is_not_empty 164 | - prefer_is_not_operator 165 | - prefer_iterable_whereType 166 | # - prefer_mixin # https://github.com/dart-lang/language/issues/32 167 | # - prefer_null_aware_operators # disable until NNBD, see https://github.com/flutter/flutter/pull/32711#issuecomment-492930932 168 | # - prefer_relative_imports # not yet tested 169 | - prefer_single_quotes 170 | - prefer_spread_collections 171 | - prefer_typing_uninitialized_variables 172 | - prefer_void_to_null 173 | # - provide_deprecation_message # not yet tested 174 | # - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml 175 | - recursive_getters 176 | - slash_for_doc_comments 177 | # - sort_child_properties_last # not yet tested 178 | - sort_constructors_first 179 | - sort_unnamed_constructors_first 180 | - test_types_in_equals 181 | - throw_in_finally 182 | # - type_annotate_public_apis # subset of always_specify_types 183 | - type_init_formals 184 | # - unawaited_futures # too many false positives 185 | # - unnecessary_await_in_return # not yet tested 186 | - unnecessary_brace_in_string_interps 187 | - unnecessary_const 188 | # - unnecessary_final # conflicts with prefer_final_locals 189 | - unnecessary_getters_setters 190 | # - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498 191 | - unnecessary_new 192 | - unnecessary_null_aware_assignments 193 | - unnecessary_null_in_if_null_operators 194 | - unnecessary_overrides 195 | - unnecessary_parenthesis 196 | - unnecessary_statements 197 | - unnecessary_string_interpolations 198 | - unnecessary_this 199 | - unrelated_type_equality_checks 200 | # - unsafe_html # not yet tested 201 | - use_full_hex_values_for_flutter_colors 202 | # - use_function_type_syntax_for_parameters # not yet tested 203 | # - use_key_in_widget_constructors # not yet tested 204 | - use_rethrow_when_possible 205 | # - use_setters_to_change_properties # not yet tested 206 | # - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182 207 | # - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review 208 | - valid_regexps 209 | - void_checks 210 | - avoid_shadowing_type_parameters 211 | - curly_braces_in_flow_control_structures 212 | - null_closures 213 | - unawaited_futures 214 | - use_function_type_syntax_for_parameters -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf 17 | base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf 18 | - platform: android 19 | create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf 20 | base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf 21 | - platform: ios 22 | create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf 23 | base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf 24 | - platform: linux 25 | create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf 26 | base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf 27 | - platform: macos 28 | create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf 29 | base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf 30 | - platform: web 31 | create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf 32 | base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf 33 | - platform: windows 34 | create_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf 35 | base_revision: 4d9e56e694b656610ab87fcf2efbcd226e0ed8cf 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) 13 | 14 | For help getting started with Flutter development, view the 15 | [online documentation](https://docs.flutter.dev/), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "com.example.example" 48 | // You can update the following values to match your application needs. 49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 50 | minSdkVersion flutter.minSdkVersion 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | } 55 | 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | signingConfig signingConfigs.debug 61 | // Enables code shrinking, obfuscation, and optimization for only 62 | // your project's release build type. 63 | minifyEnabled true 64 | 65 | // Enables resource shrinking, which is performed by the 66 | // Android Gradle plugin. 67 | shrinkResources true 68 | // Includes the default ProGuard rules files that are packaged with 69 | // the Android Gradle plugin. To learn more, go to the section about 70 | // R8 configuration files. 71 | useProguard true 72 | proguardFiles getDefaultProguardFile( 73 | 'proguard-android-optimize.txt'), 74 | 'proguard-rules.pro' 75 | } 76 | } 77 | } 78 | 79 | flutter { 80 | source '../..' 81 | } 82 | 83 | dependencies { 84 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 85 | } 86 | -------------------------------------------------------------------------------- /example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | -keep class com.shockwave.** -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.2.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip 6 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /example/assets/pdf/file-example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/assets/pdf/file-example.pdf -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '11.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - flutter_pdfview (1.0.2): 4 | - Flutter 5 | - FMDB (2.7.5): 6 | - FMDB/standard (= 2.7.5) 7 | - FMDB/standard (2.7.5) 8 | - path_provider_foundation (0.0.1): 9 | - Flutter 10 | - FlutterMacOS 11 | - sqflite (0.0.3): 12 | - Flutter 13 | - FMDB (>= 2.7.5) 14 | 15 | DEPENDENCIES: 16 | - Flutter (from `Flutter`) 17 | - flutter_pdfview (from `.symlinks/plugins/flutter_pdfview/ios`) 18 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`) 19 | - sqflite (from `.symlinks/plugins/sqflite/ios`) 20 | 21 | SPEC REPOS: 22 | trunk: 23 | - FMDB 24 | 25 | EXTERNAL SOURCES: 26 | Flutter: 27 | :path: Flutter 28 | flutter_pdfview: 29 | :path: ".symlinks/plugins/flutter_pdfview/ios" 30 | path_provider_foundation: 31 | :path: ".symlinks/plugins/path_provider_foundation/ios" 32 | sqflite: 33 | :path: ".symlinks/plugins/sqflite/ios" 34 | 35 | SPEC CHECKSUMS: 36 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 37 | flutter_pdfview: 25f53dd6097661e6395b17de506e6060585946bd 38 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a 39 | path_provider_foundation: eaf5b3e458fc0e5fbb9940fb09980e853fe058b8 40 | sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a 41 | 42 | PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 43 | 44 | COCOAPODS: 1.12.0 45 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 4FB688BD1449102BA26750EE /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D665893B7D34C4CF3B6DEB2 /* Pods_Runner.framework */; }; 13 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 14 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 15 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 16 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXCopyFilesBuildPhase section */ 20 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 21 | isa = PBXCopyFilesBuildPhase; 22 | buildActionMask = 2147483647; 23 | dstPath = ""; 24 | dstSubfolderSpec = 10; 25 | files = ( 26 | ); 27 | name = "Embed Frameworks"; 28 | runOnlyForDeploymentPostprocessing = 0; 29 | }; 30 | /* End PBXCopyFilesBuildPhase section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 34 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 35 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 36 | 5D665893B7D34C4CF3B6DEB2 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 38 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 39 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 40 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 41 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 42 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 44 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 45 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 46 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 47 | AAAD17EC0C4C6B4A17F91620 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 48 | AD7F478D45068D6C3345ECC4 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 49 | BDFB99AAC3E5B62E224649AA /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | 4FB688BD1449102BA26750EE /* Pods_Runner.framework in Frameworks */, 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | /* End PBXFrameworksBuildPhase section */ 62 | 63 | /* Begin PBXGroup section */ 64 | 1C8DD525543F432A4C960260 /* Pods */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | AD7F478D45068D6C3345ECC4 /* Pods-Runner.debug.xcconfig */, 68 | AAAD17EC0C4C6B4A17F91620 /* Pods-Runner.release.xcconfig */, 69 | BDFB99AAC3E5B62E224649AA /* Pods-Runner.profile.xcconfig */, 70 | ); 71 | name = Pods; 72 | path = Pods; 73 | sourceTree = ""; 74 | }; 75 | 55BE7921D1D70E67D0BB7911 /* Frameworks */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 5D665893B7D34C4CF3B6DEB2 /* Pods_Runner.framework */, 79 | ); 80 | name = Frameworks; 81 | sourceTree = ""; 82 | }; 83 | 9740EEB11CF90186004384FC /* Flutter */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 87 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 88 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 89 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 90 | ); 91 | name = Flutter; 92 | sourceTree = ""; 93 | }; 94 | 97C146E51CF9000F007C117D = { 95 | isa = PBXGroup; 96 | children = ( 97 | 9740EEB11CF90186004384FC /* Flutter */, 98 | 97C146F01CF9000F007C117D /* Runner */, 99 | 97C146EF1CF9000F007C117D /* Products */, 100 | 1C8DD525543F432A4C960260 /* Pods */, 101 | 55BE7921D1D70E67D0BB7911 /* Frameworks */, 102 | ); 103 | sourceTree = ""; 104 | }; 105 | 97C146EF1CF9000F007C117D /* Products */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 97C146EE1CF9000F007C117D /* Runner.app */, 109 | ); 110 | name = Products; 111 | sourceTree = ""; 112 | }; 113 | 97C146F01CF9000F007C117D /* Runner */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 117 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 118 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 119 | 97C147021CF9000F007C117D /* Info.plist */, 120 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 121 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 122 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 123 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 124 | ); 125 | path = Runner; 126 | sourceTree = ""; 127 | }; 128 | /* End PBXGroup section */ 129 | 130 | /* Begin PBXNativeTarget section */ 131 | 97C146ED1CF9000F007C117D /* Runner */ = { 132 | isa = PBXNativeTarget; 133 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 134 | buildPhases = ( 135 | D5B106A673C217519289CB38 /* [CP] Check Pods Manifest.lock */, 136 | 9740EEB61CF901F6004384FC /* Run Script */, 137 | 97C146EA1CF9000F007C117D /* Sources */, 138 | 97C146EB1CF9000F007C117D /* Frameworks */, 139 | 97C146EC1CF9000F007C117D /* Resources */, 140 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 141 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 142 | 4B00365F452C8C792EC1DA5B /* [CP] Embed Pods Frameworks */, 143 | ); 144 | buildRules = ( 145 | ); 146 | dependencies = ( 147 | ); 148 | name = Runner; 149 | productName = Runner; 150 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 151 | productType = "com.apple.product-type.application"; 152 | }; 153 | /* End PBXNativeTarget section */ 154 | 155 | /* Begin PBXProject section */ 156 | 97C146E61CF9000F007C117D /* Project object */ = { 157 | isa = PBXProject; 158 | attributes = { 159 | LastUpgradeCheck = 1300; 160 | ORGANIZATIONNAME = ""; 161 | TargetAttributes = { 162 | 97C146ED1CF9000F007C117D = { 163 | CreatedOnToolsVersion = 7.3.1; 164 | LastSwiftMigration = 1100; 165 | }; 166 | }; 167 | }; 168 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 169 | compatibilityVersion = "Xcode 9.3"; 170 | developmentRegion = en; 171 | hasScannedForEncodings = 0; 172 | knownRegions = ( 173 | en, 174 | Base, 175 | ); 176 | mainGroup = 97C146E51CF9000F007C117D; 177 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 178 | projectDirPath = ""; 179 | projectRoot = ""; 180 | targets = ( 181 | 97C146ED1CF9000F007C117D /* Runner */, 182 | ); 183 | }; 184 | /* End PBXProject section */ 185 | 186 | /* Begin PBXResourcesBuildPhase section */ 187 | 97C146EC1CF9000F007C117D /* Resources */ = { 188 | isa = PBXResourcesBuildPhase; 189 | buildActionMask = 2147483647; 190 | files = ( 191 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 192 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 193 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 194 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | }; 198 | /* End PBXResourcesBuildPhase section */ 199 | 200 | /* Begin PBXShellScriptBuildPhase section */ 201 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 202 | isa = PBXShellScriptBuildPhase; 203 | alwaysOutOfDate = 1; 204 | buildActionMask = 2147483647; 205 | files = ( 206 | ); 207 | inputPaths = ( 208 | ); 209 | name = "Thin Binary"; 210 | outputPaths = ( 211 | ); 212 | runOnlyForDeploymentPostprocessing = 0; 213 | shellPath = /bin/sh; 214 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 215 | }; 216 | 4B00365F452C8C792EC1DA5B /* [CP] Embed Pods Frameworks */ = { 217 | isa = PBXShellScriptBuildPhase; 218 | buildActionMask = 2147483647; 219 | files = ( 220 | ); 221 | inputFileListPaths = ( 222 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", 223 | ); 224 | name = "[CP] Embed Pods Frameworks"; 225 | outputFileListPaths = ( 226 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", 227 | ); 228 | runOnlyForDeploymentPostprocessing = 0; 229 | shellPath = /bin/sh; 230 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 231 | showEnvVarsInLog = 0; 232 | }; 233 | 9740EEB61CF901F6004384FC /* Run Script */ = { 234 | isa = PBXShellScriptBuildPhase; 235 | alwaysOutOfDate = 1; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | ); 239 | inputPaths = ( 240 | ); 241 | name = "Run Script"; 242 | outputPaths = ( 243 | ); 244 | runOnlyForDeploymentPostprocessing = 0; 245 | shellPath = /bin/sh; 246 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 247 | }; 248 | D5B106A673C217519289CB38 /* [CP] Check Pods Manifest.lock */ = { 249 | isa = PBXShellScriptBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | ); 253 | inputFileListPaths = ( 254 | ); 255 | inputPaths = ( 256 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 257 | "${PODS_ROOT}/Manifest.lock", 258 | ); 259 | name = "[CP] Check Pods Manifest.lock"; 260 | outputFileListPaths = ( 261 | ); 262 | outputPaths = ( 263 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | shellPath = /bin/sh; 267 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 268 | showEnvVarsInLog = 0; 269 | }; 270 | /* End PBXShellScriptBuildPhase section */ 271 | 272 | /* Begin PBXSourcesBuildPhase section */ 273 | 97C146EA1CF9000F007C117D /* Sources */ = { 274 | isa = PBXSourcesBuildPhase; 275 | buildActionMask = 2147483647; 276 | files = ( 277 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 278 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 279 | ); 280 | runOnlyForDeploymentPostprocessing = 0; 281 | }; 282 | /* End PBXSourcesBuildPhase section */ 283 | 284 | /* Begin PBXVariantGroup section */ 285 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 286 | isa = PBXVariantGroup; 287 | children = ( 288 | 97C146FB1CF9000F007C117D /* Base */, 289 | ); 290 | name = Main.storyboard; 291 | sourceTree = ""; 292 | }; 293 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 294 | isa = PBXVariantGroup; 295 | children = ( 296 | 97C147001CF9000F007C117D /* Base */, 297 | ); 298 | name = LaunchScreen.storyboard; 299 | sourceTree = ""; 300 | }; 301 | /* End PBXVariantGroup section */ 302 | 303 | /* Begin XCBuildConfiguration section */ 304 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 305 | isa = XCBuildConfiguration; 306 | buildSettings = { 307 | ALWAYS_SEARCH_USER_PATHS = NO; 308 | CLANG_ANALYZER_NONNULL = YES; 309 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 310 | CLANG_CXX_LIBRARY = "libc++"; 311 | CLANG_ENABLE_MODULES = YES; 312 | CLANG_ENABLE_OBJC_ARC = YES; 313 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 314 | CLANG_WARN_BOOL_CONVERSION = YES; 315 | CLANG_WARN_COMMA = YES; 316 | CLANG_WARN_CONSTANT_CONVERSION = YES; 317 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 318 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 319 | CLANG_WARN_EMPTY_BODY = YES; 320 | CLANG_WARN_ENUM_CONVERSION = YES; 321 | CLANG_WARN_INFINITE_RECURSION = YES; 322 | CLANG_WARN_INT_CONVERSION = YES; 323 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 324 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 325 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 326 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 327 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 328 | CLANG_WARN_STRICT_PROTOTYPES = YES; 329 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 330 | CLANG_WARN_UNREACHABLE_CODE = YES; 331 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 332 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 333 | COPY_PHASE_STRIP = NO; 334 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 335 | ENABLE_NS_ASSERTIONS = NO; 336 | ENABLE_STRICT_OBJC_MSGSEND = YES; 337 | GCC_C_LANGUAGE_STANDARD = gnu99; 338 | GCC_NO_COMMON_BLOCKS = YES; 339 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 340 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 341 | GCC_WARN_UNDECLARED_SELECTOR = YES; 342 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 343 | GCC_WARN_UNUSED_FUNCTION = YES; 344 | GCC_WARN_UNUSED_VARIABLE = YES; 345 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 346 | MTL_ENABLE_DEBUG_INFO = NO; 347 | SDKROOT = iphoneos; 348 | SUPPORTED_PLATFORMS = iphoneos; 349 | TARGETED_DEVICE_FAMILY = "1,2"; 350 | VALIDATE_PRODUCT = YES; 351 | }; 352 | name = Profile; 353 | }; 354 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 355 | isa = XCBuildConfiguration; 356 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 357 | buildSettings = { 358 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 359 | CLANG_ENABLE_MODULES = YES; 360 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 361 | DEVELOPMENT_TEAM = SPYDF9565A; 362 | ENABLE_BITCODE = NO; 363 | INFOPLIST_FILE = Runner/Info.plist; 364 | LD_RUNPATH_SEARCH_PATHS = ( 365 | "$(inherited)", 366 | "@executable_path/Frameworks", 367 | ); 368 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 369 | PRODUCT_NAME = "$(TARGET_NAME)"; 370 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 371 | SWIFT_VERSION = 5.0; 372 | VERSIONING_SYSTEM = "apple-generic"; 373 | }; 374 | name = Profile; 375 | }; 376 | 97C147031CF9000F007C117D /* Debug */ = { 377 | isa = XCBuildConfiguration; 378 | buildSettings = { 379 | ALWAYS_SEARCH_USER_PATHS = NO; 380 | CLANG_ANALYZER_NONNULL = YES; 381 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 382 | CLANG_CXX_LIBRARY = "libc++"; 383 | CLANG_ENABLE_MODULES = YES; 384 | CLANG_ENABLE_OBJC_ARC = YES; 385 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 386 | CLANG_WARN_BOOL_CONVERSION = YES; 387 | CLANG_WARN_COMMA = YES; 388 | CLANG_WARN_CONSTANT_CONVERSION = YES; 389 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 390 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 391 | CLANG_WARN_EMPTY_BODY = YES; 392 | CLANG_WARN_ENUM_CONVERSION = YES; 393 | CLANG_WARN_INFINITE_RECURSION = YES; 394 | CLANG_WARN_INT_CONVERSION = YES; 395 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 396 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 397 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 398 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 399 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 400 | CLANG_WARN_STRICT_PROTOTYPES = YES; 401 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 402 | CLANG_WARN_UNREACHABLE_CODE = YES; 403 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 404 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 405 | COPY_PHASE_STRIP = NO; 406 | DEBUG_INFORMATION_FORMAT = dwarf; 407 | ENABLE_STRICT_OBJC_MSGSEND = YES; 408 | ENABLE_TESTABILITY = YES; 409 | GCC_C_LANGUAGE_STANDARD = gnu99; 410 | GCC_DYNAMIC_NO_PIC = NO; 411 | GCC_NO_COMMON_BLOCKS = YES; 412 | GCC_OPTIMIZATION_LEVEL = 0; 413 | GCC_PREPROCESSOR_DEFINITIONS = ( 414 | "DEBUG=1", 415 | "$(inherited)", 416 | ); 417 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 418 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 419 | GCC_WARN_UNDECLARED_SELECTOR = YES; 420 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 421 | GCC_WARN_UNUSED_FUNCTION = YES; 422 | GCC_WARN_UNUSED_VARIABLE = YES; 423 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 424 | MTL_ENABLE_DEBUG_INFO = YES; 425 | ONLY_ACTIVE_ARCH = YES; 426 | SDKROOT = iphoneos; 427 | TARGETED_DEVICE_FAMILY = "1,2"; 428 | }; 429 | name = Debug; 430 | }; 431 | 97C147041CF9000F007C117D /* Release */ = { 432 | isa = XCBuildConfiguration; 433 | buildSettings = { 434 | ALWAYS_SEARCH_USER_PATHS = NO; 435 | CLANG_ANALYZER_NONNULL = YES; 436 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 437 | CLANG_CXX_LIBRARY = "libc++"; 438 | CLANG_ENABLE_MODULES = YES; 439 | CLANG_ENABLE_OBJC_ARC = YES; 440 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 441 | CLANG_WARN_BOOL_CONVERSION = YES; 442 | CLANG_WARN_COMMA = YES; 443 | CLANG_WARN_CONSTANT_CONVERSION = YES; 444 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 445 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 446 | CLANG_WARN_EMPTY_BODY = YES; 447 | CLANG_WARN_ENUM_CONVERSION = YES; 448 | CLANG_WARN_INFINITE_RECURSION = YES; 449 | CLANG_WARN_INT_CONVERSION = YES; 450 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 451 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 452 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 453 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 454 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 455 | CLANG_WARN_STRICT_PROTOTYPES = YES; 456 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 457 | CLANG_WARN_UNREACHABLE_CODE = YES; 458 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 459 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 460 | COPY_PHASE_STRIP = NO; 461 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 462 | ENABLE_NS_ASSERTIONS = NO; 463 | ENABLE_STRICT_OBJC_MSGSEND = YES; 464 | GCC_C_LANGUAGE_STANDARD = gnu99; 465 | GCC_NO_COMMON_BLOCKS = YES; 466 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 467 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 468 | GCC_WARN_UNDECLARED_SELECTOR = YES; 469 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 470 | GCC_WARN_UNUSED_FUNCTION = YES; 471 | GCC_WARN_UNUSED_VARIABLE = YES; 472 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 473 | MTL_ENABLE_DEBUG_INFO = NO; 474 | SDKROOT = iphoneos; 475 | SUPPORTED_PLATFORMS = iphoneos; 476 | SWIFT_COMPILATION_MODE = wholemodule; 477 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 478 | TARGETED_DEVICE_FAMILY = "1,2"; 479 | VALIDATE_PRODUCT = YES; 480 | }; 481 | name = Release; 482 | }; 483 | 97C147061CF9000F007C117D /* Debug */ = { 484 | isa = XCBuildConfiguration; 485 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 486 | buildSettings = { 487 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 488 | CLANG_ENABLE_MODULES = YES; 489 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 490 | DEVELOPMENT_TEAM = SPYDF9565A; 491 | ENABLE_BITCODE = NO; 492 | INFOPLIST_FILE = Runner/Info.plist; 493 | LD_RUNPATH_SEARCH_PATHS = ( 494 | "$(inherited)", 495 | "@executable_path/Frameworks", 496 | ); 497 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 498 | PRODUCT_NAME = "$(TARGET_NAME)"; 499 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 500 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 501 | SWIFT_VERSION = 5.0; 502 | VERSIONING_SYSTEM = "apple-generic"; 503 | }; 504 | name = Debug; 505 | }; 506 | 97C147071CF9000F007C117D /* Release */ = { 507 | isa = XCBuildConfiguration; 508 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 509 | buildSettings = { 510 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 511 | CLANG_ENABLE_MODULES = YES; 512 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 513 | DEVELOPMENT_TEAM = SPYDF9565A; 514 | ENABLE_BITCODE = NO; 515 | INFOPLIST_FILE = Runner/Info.plist; 516 | LD_RUNPATH_SEARCH_PATHS = ( 517 | "$(inherited)", 518 | "@executable_path/Frameworks", 519 | ); 520 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 521 | PRODUCT_NAME = "$(TARGET_NAME)"; 522 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 523 | SWIFT_VERSION = 5.0; 524 | VERSIONING_SYSTEM = "apple-generic"; 525 | }; 526 | name = Release; 527 | }; 528 | /* End XCBuildConfiguration section */ 529 | 530 | /* Begin XCConfigurationList section */ 531 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 532 | isa = XCConfigurationList; 533 | buildConfigurations = ( 534 | 97C147031CF9000F007C117D /* Debug */, 535 | 97C147041CF9000F007C117D /* Release */, 536 | 249021D3217E4FDB00AE95B9 /* Profile */, 537 | ); 538 | defaultConfigurationIsVisible = 0; 539 | defaultConfigurationName = Release; 540 | }; 541 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 542 | isa = XCConfigurationList; 543 | buildConfigurations = ( 544 | 97C147061CF9000F007C117D /* Debug */, 545 | 97C147071CF9000F007C117D /* Release */, 546 | 249021D4217E4FDB00AE95B9 /* Profile */, 547 | ); 548 | defaultConfigurationIsVisible = 0; 549 | defaultConfigurationName = Release; 550 | }; 551 | /* End XCConfigurationList section */ 552 | }; 553 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 554 | } 555 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/binSaed/flutter_cached_pdfview/db86738f0328dc415bd86c5bac87d99fbd91ef44/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | example 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_cached_pdfview/flutter_cached_pdfview.dart'; 5 | 6 | void main() => runApp(MyApp()); 7 | 8 | class MyApp extends StatelessWidget { 9 | @override 10 | Widget build(BuildContext context) => MaterialApp( 11 | home: MyHomePage(), 12 | debugShowCheckedModeBanner: false, 13 | ); 14 | } 15 | 16 | class MyHomePage extends StatelessWidget { 17 | @override 18 | Widget build(BuildContext context) { 19 | return Scaffold( 20 | appBar: AppBar( 21 | title: const Text('flutter_cached_pdfview Demo'), 22 | ), 23 | body: Column( 24 | mainAxisAlignment: MainAxisAlignment.center, 25 | crossAxisAlignment: CrossAxisAlignment.stretch, 26 | children: [ 27 | TextButton( 28 | onPressed: () => Navigator.push( 29 | context, 30 | MaterialPageRoute( 31 | builder: (_) => const PDFViewerFromUrl( 32 | url: 33 | 'https://ontheline.trincoll.edu/images/bookdown/sample-local-pdf.pdf', 34 | ), 35 | ), 36 | ), 37 | child: const Text('PDF From Url'), 38 | ), 39 | TextButton( 40 | onPressed: () => Navigator.push( 41 | context, 42 | MaterialPageRoute( 43 | builder: (_) => const PDFViewerCachedFromUrl( 44 | url: 45 | 'https://ontheline.trincoll.edu/images/bookdown/sample-local-pdf.pdf', 46 | ), 47 | ), 48 | ), 49 | child: const Text('Cashed PDF From Url'), 50 | ), 51 | TextButton( 52 | onPressed: () => Navigator.push( 53 | context, 54 | MaterialPageRoute( 55 | builder: (_) => PDFViewerFromAsset( 56 | pdfAssetPath: 'assets/pdf/file-example.pdf', 57 | ), 58 | ), 59 | ), 60 | child: const Text('PDF From Asset'), 61 | ), 62 | ], 63 | ), 64 | ); 65 | } 66 | } 67 | 68 | class PDFViewerFromUrl extends StatelessWidget { 69 | const PDFViewerFromUrl({Key? key, required this.url}) : super(key: key); 70 | 71 | final String url; 72 | 73 | @override 74 | Widget build(BuildContext context) { 75 | return Scaffold( 76 | appBar: AppBar( 77 | title: const Text('PDF From Url'), 78 | ), 79 | body: const PDF().fromUrl( 80 | url, 81 | placeholder: (double progress) => Center(child: Text('$progress %')), 82 | errorWidget: (dynamic error) => Center(child: Text(error.toString())), 83 | ), 84 | ); 85 | } 86 | } 87 | 88 | class PDFViewerCachedFromUrl extends StatelessWidget { 89 | const PDFViewerCachedFromUrl({Key? key, required this.url}) : super(key: key); 90 | 91 | final String url; 92 | 93 | @override 94 | Widget build(BuildContext context) { 95 | return Scaffold( 96 | appBar: AppBar( 97 | title: const Text('Cached PDF From Url'), 98 | ), 99 | body: const PDF().cachedFromUrl( 100 | url, 101 | placeholder: (double progress) => Center(child: Text('$progress %')), 102 | errorWidget: (dynamic error) => Center(child: Text(error.toString())), 103 | ), 104 | ); 105 | } 106 | } 107 | 108 | class PDFViewerFromAsset extends StatelessWidget { 109 | PDFViewerFromAsset({Key? key, required this.pdfAssetPath}) : super(key: key); 110 | final String pdfAssetPath; 111 | final Completer _pdfViewController = 112 | Completer(); 113 | final StreamController _pageCountController = 114 | StreamController(); 115 | 116 | @override 117 | Widget build(BuildContext context) { 118 | return Scaffold( 119 | appBar: AppBar( 120 | title: const Text('PDF From Asset'), 121 | actions: [ 122 | StreamBuilder( 123 | stream: _pageCountController.stream, 124 | builder: (_, AsyncSnapshot snapshot) { 125 | if (snapshot.hasData) { 126 | return Center( 127 | child: Container( 128 | padding: const EdgeInsets.all(16), 129 | decoration: BoxDecoration( 130 | shape: BoxShape.circle, 131 | color: Colors.blue[900], 132 | ), 133 | child: Text(snapshot.data!), 134 | ), 135 | ); 136 | } 137 | return const SizedBox(); 138 | }), 139 | ], 140 | ), 141 | body: PDF( 142 | enableSwipe: true, 143 | swipeHorizontal: true, 144 | autoSpacing: false, 145 | pageFling: false, 146 | backgroundColor: Colors.grey, 147 | onPageChanged: (int? current, int? total) => 148 | _pageCountController.add('${current! + 1} - $total'), 149 | onViewCreated: (PDFViewController pdfViewController) async { 150 | _pdfViewController.complete(pdfViewController); 151 | final int currentPage = await pdfViewController.getCurrentPage() ?? 0; 152 | final int? pageCount = await pdfViewController.getPageCount(); 153 | _pageCountController.add('${currentPage + 1} - $pageCount'); 154 | }, 155 | ).fromAsset( 156 | pdfAssetPath, 157 | errorWidget: (dynamic error) => Center(child: Text(error.toString())), 158 | ), 159 | floatingActionButton: FutureBuilder( 160 | future: _pdfViewController.future, 161 | builder: (_, AsyncSnapshot snapshot) { 162 | if (snapshot.hasData && snapshot.data != null) { 163 | return Row( 164 | mainAxisSize: MainAxisSize.max, 165 | mainAxisAlignment: MainAxisAlignment.spaceAround, 166 | children: [ 167 | FloatingActionButton( 168 | heroTag: '-', 169 | child: const Text('-'), 170 | onPressed: () async { 171 | final PDFViewController pdfController = snapshot.data!; 172 | final int currentPage = 173 | (await pdfController.getCurrentPage())! - 1; 174 | if (currentPage >= 0) { 175 | await pdfController.setPage(currentPage); 176 | } 177 | }, 178 | ), 179 | FloatingActionButton( 180 | heroTag: '+', 181 | child: const Text('+'), 182 | onPressed: () async { 183 | final PDFViewController pdfController = snapshot.data!; 184 | final int currentPage = 185 | (await pdfController.getCurrentPage())! + 1; 186 | final int numberOfPages = 187 | await pdfController.getPageCount() ?? 0; 188 | if (numberOfPages > currentPage) { 189 | await pdfController.setPage(currentPage); 190 | } 191 | }, 192 | ), 193 | ], 194 | ); 195 | } 196 | return const SizedBox(); 197 | }, 198 | ), 199 | ); 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter project. 3 | version: 1.0.0+1 4 | 5 | publish_to: 'none' 6 | 7 | environment: 8 | sdk: '>=2.19.6 <3.0.0' 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | flutter_cached_pdfview: 14 | path: ../ 15 | cupertino_icons: ^1.0.2 16 | 17 | dev_dependencies: 18 | flutter_test: 19 | sdk: flutter 20 | flutter: 21 | assets: 22 | - assets/pdf/ 23 | uses-material-design: true -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | void main() {} 2 | -------------------------------------------------------------------------------- /lib/flutter_cached_pdfview.dart: -------------------------------------------------------------------------------- 1 | library flutter_cached_pdfview; 2 | 3 | export 'package:flutter_cached_pdfview/src/pdf.dart'; 4 | export 'package:flutter_cached_pdfview/src/pdf_view_types.dart'; 5 | export 'package:flutter_pdfview/flutter_pdfview.dart' 6 | show PDFViewController, FitPolicy; 7 | -------------------------------------------------------------------------------- /lib/src/asset/asset_pdf_view.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | import '../../flutter_cached_pdfview.dart'; 6 | import '../pdf_view_wrapper.dart'; 7 | import '../utils/show_progress.dart'; 8 | import 'copy_pdf_from_asset_to_storge.dart'; 9 | 10 | typedef AssetErrorWidget = Widget Function(dynamic error); 11 | 12 | class AssetPDFView extends StatelessWidget { 13 | const AssetPDFView( 14 | {Key? key, 15 | this.assetPath, 16 | required this.pdf, 17 | required this.errorWidget, 18 | required this.loadingWidget}) 19 | : super(key: key); 20 | 21 | /// assetPath like 'asset/example.pdf' 22 | final String? assetPath; 23 | 24 | /// Pdf Model 25 | final PDF pdf; 26 | 27 | /// Widget displayed while the target [assetPath] failed to get from asset. 28 | final AssetErrorWidget errorWidget; 29 | 30 | /// Widget displayed while [assetPath] copying to local storage 31 | final LoadingWidget loadingWidget; 32 | 33 | @override 34 | Widget build(BuildContext context) { 35 | return FutureBuilder( 36 | future: getPdfFromAsset(assetPath!), 37 | builder: (BuildContext context, AsyncSnapshot snapshot) { 38 | if (snapshot.hasData && snapshot.data != null) { 39 | return PDFViewWrapper(pdf: pdf, path: snapshot.data!.path); 40 | } 41 | 42 | if (snapshot.hasData && snapshot.data == null || snapshot.hasError) { 43 | return errorWidget(snapshot.error); 44 | } 45 | 46 | return loadingWidget(); 47 | }, 48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/src/asset/copy_pdf_from_asset_to_storge.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | 4 | import 'package:flutter/services.dart'; 5 | import 'package:path_provider/path_provider.dart'; 6 | 7 | Future getPdfFromAsset(String assetPath) async { 8 | // To open from assets, you can copy them to the app storage folder, and then access them "locally" 9 | assert(assetPath.toLowerCase().endsWith('.pdf'), 10 | throw '($assetPath) should endsWith ".pdf".'); 11 | final RegExp regexp = RegExp(r'[\w-]+\.(pdf|PDF)'); 12 | final String? pdfName = regexp.stringMatch(assetPath); 13 | if (pdfName == null || pdfName.trim().isEmpty) { 14 | throw Exception('Error opening asset file: $pdfName'); 15 | } 16 | final Directory dir = await getApplicationDocumentsDirectory(); 17 | File file = File('${dir.path}/$pdfName'); 18 | try { 19 | if (!file.existsSync()) { 20 | //not exist 21 | final ByteData data = await rootBundle.load(assetPath); 22 | final Uint8List bytes = data.buffer.asUint8List(); 23 | file = await file.writeAsBytes(bytes); 24 | } 25 | return file; 26 | } on Exception catch (e) { 27 | throw Exception('Error opening asset file: ' + e.toString()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/src/pdf.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/foundation.dart'; 4 | import 'package:flutter/gestures.dart'; 5 | import 'package:flutter_pdfview/flutter_pdfview.dart'; 6 | 7 | class PDF { 8 | const PDF({ 9 | this.onViewCreated, 10 | this.onRender, 11 | this.onPageChanged, 12 | this.onError, 13 | this.onPageError, 14 | this.onLinkHandler, 15 | this.gestureRecognizers, 16 | this.enableSwipe = true, 17 | this.swipeHorizontal = false, 18 | this.password, 19 | this.nightMode = false, 20 | this.autoSpacing = true, 21 | this.pageFling = true, 22 | this.pageSnap = true, 23 | this.fitEachPage = true, 24 | this.defaultPage = 0, 25 | this.fitPolicy = FitPolicy.WIDTH, 26 | this.preventLinkNavigation = false, 27 | this.backgroundColor, 28 | }); 29 | 30 | ///enable or disable Swipe 31 | final bool enableSwipe; 32 | 33 | ///swipeHorizontal or vertical 34 | final bool swipeHorizontal; 35 | final bool preventLinkNavigation; 36 | 37 | /// if pdf is protected u should provide a password 38 | final String? password; 39 | 40 | ///set nightMode true, false 41 | final bool nightMode; 42 | final bool autoSpacing; 43 | final bool pageFling; 44 | final bool pageSnap; 45 | 46 | /// init page 47 | final int defaultPage; 48 | final FitPolicy fitPolicy; 49 | final bool fitEachPage; 50 | 51 | /// If not null invoked once the web view is created. 52 | final PDFViewCreatedCallback? onViewCreated; 53 | 54 | /// If not null invoked once the web view is created. 55 | final RenderCallback? onRender; 56 | final PageChangedCallback? onPageChanged; 57 | 58 | /// return dynamic error 59 | final ErrorCallback? onError; 60 | final PageErrorCallback? onPageError; 61 | final LinkHandlerCallback? onLinkHandler; 62 | 63 | final Color? backgroundColor; 64 | 65 | /// Which gestures should be consumed by the pdf view. 66 | /// 67 | /// It is possible for other gesture recognizers to be competing with the pdf view on pointer 68 | /// events, e.g if the pdf view is inside a [ListView] the [ListView] will want to handle 69 | /// vertical drags. The pdf view will claim gestures that are recognized by any of the 70 | /// recognizers on this list. 71 | /// 72 | /// When this set is empty or null, the pdf view will only handle pointer events for gestures that 73 | /// were not claimed by any other gesture recognizer. 74 | final Set>? gestureRecognizers; 75 | } 76 | -------------------------------------------------------------------------------- /lib/src/pdf_view_types.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'asset/asset_pdf_view.dart'; 4 | import 'pdf.dart'; 5 | import 'pdf_view_wrapper.dart'; 6 | import 'url/cached_pdf_view.dart'; 7 | import 'utils/download_indicator.dart'; 8 | import 'utils/error_widget.dart'; 9 | import 'utils/show_progress.dart'; 10 | 11 | extension PDFViewTypes on PDF { 12 | Widget fromUrl( 13 | String url, { 14 | Key? key, 15 | PlaceholderWidget placeholder = downloadIndicator, 16 | DownloadingErrorWidget errorWidget = errorWidgetHolder, 17 | Map? headers, 18 | }) { 19 | return CachedPDFView( 20 | 'without_cache', 21 | key: key, 22 | pdf: this, 23 | url: url, 24 | placeholder: placeholder, 25 | errorWidget: errorWidget, 26 | headers: headers, 27 | maxAgeCacheObject: const Duration(microseconds: 0), 28 | maxNrOfCacheObjects: 0, 29 | ); 30 | } 31 | 32 | Widget cachedFromUrl( 33 | String url, { 34 | Key? key, 35 | PlaceholderWidget placeholder = downloadIndicator, 36 | DownloadingErrorWidget errorWidget = errorWidgetHolder, 37 | Map? headers, 38 | Duration maxAgeCacheObject = const Duration(days: 10), 39 | int maxNrOfCacheObjects = 100, 40 | WhenDone? whenDone, 41 | }) { 42 | return CachedPDFView( 43 | 'libCachedPdfView', 44 | key: key, 45 | pdf: this, 46 | url: url, 47 | placeholder: placeholder, 48 | errorWidget: errorWidget, 49 | headers: headers, 50 | maxAgeCacheObject: maxAgeCacheObject, 51 | maxNrOfCacheObjects: maxNrOfCacheObjects, 52 | whenDone: whenDone, 53 | ); 54 | } 55 | 56 | Widget fromPath(String path, {Key? key}) { 57 | return PDFViewWrapper( 58 | key: key, 59 | pdf: this, 60 | path: path, 61 | ); 62 | } 63 | 64 | Widget fromAsset( 65 | String pathOfAsset, { 66 | Key? key, 67 | AssetErrorWidget errorWidget = errorWidgetHolder, 68 | LoadingWidget loadingWidget = loadingWidgetHolder, 69 | }) { 70 | return AssetPDFView( 71 | key: key, 72 | pdf: this, 73 | assetPath: pathOfAsset, 74 | errorWidget: errorWidget, 75 | loadingWidget: loadingWidget, 76 | ); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /lib/src/pdf_view_wrapper.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_pdfview/flutter_pdfview.dart'; 3 | 4 | import '../flutter_cached_pdfview.dart'; 5 | 6 | class PDFViewWrapper extends StatelessWidget { 7 | const PDFViewWrapper({ 8 | Key? key, 9 | required this.pdf, 10 | required this.path, 11 | }) : super(key: key); 12 | 13 | /// path for pdf file in phone storage 14 | final String path; 15 | 16 | /// Pdf Model 17 | final PDF pdf; 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return PDFView( 22 | filePath: path, 23 | onLinkHandler: pdf.onLinkHandler, 24 | onViewCreated: pdf.onViewCreated, 25 | onRender: pdf.onRender, 26 | onPageChanged: pdf.onPageChanged, 27 | onError: pdf.onError, 28 | onPageError: pdf.onPageError, 29 | gestureRecognizers: pdf.gestureRecognizers, 30 | enableSwipe: pdf.enableSwipe, 31 | swipeHorizontal: pdf.swipeHorizontal, 32 | password: pdf.password, 33 | nightMode: pdf.nightMode, 34 | autoSpacing: pdf.autoSpacing, 35 | pageFling: pdf.pageFling, 36 | pageSnap: pdf.pageSnap, 37 | fitEachPage: pdf.fitEachPage, 38 | defaultPage: pdf.defaultPage, 39 | fitPolicy: pdf.fitPolicy, 40 | preventLinkNavigation: pdf.preventLinkNavigation, 41 | backgroundColor: pdf.backgroundColor, 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/src/url/cached_pdf_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:flutter_cache_manager/flutter_cache_manager.dart'; 4 | 5 | import '../pdf.dart'; 6 | import '../pdf_view_wrapper.dart'; 7 | import '../utils/download_indicator.dart'; 8 | import 'custom_cache_manger.dart'; 9 | 10 | typedef DownloadingErrorWidget = Widget Function(dynamic error); 11 | typedef WhenDone = void Function(String filePath); 12 | 13 | class CachedPDFView extends StatelessWidget { 14 | const CachedPDFView( 15 | this._cacheKey, { 16 | Key? key, 17 | required this.url, 18 | required this.pdf, 19 | this.placeholder, 20 | this.errorWidget, 21 | this.headers, 22 | this.maxAgeCacheObject, 23 | this.maxNrOfCacheObjects, 24 | this.whenDone, 25 | }) : super(key: key); 26 | 27 | /// pdf url like 'www.test.example,pdf' 28 | final String url; 29 | 30 | /// Pdf Model 31 | final PDF pdf; 32 | 33 | /// Widget displayed while the target [url] is loading. 34 | final PlaceholderWidget? placeholder; 35 | 36 | /// Widget displayed while the target [url] failed Downloading. 37 | final DownloadingErrorWidget? errorWidget; 38 | 39 | /// [headers] can be used for example for authentication. 40 | final Map? headers; 41 | 42 | /// Files are removed when they haven't been used for longer than [maxAgeCacheObject] 43 | final Duration? maxAgeCacheObject; 44 | 45 | /// or when this cache has grown too big. When the cache is larger than [maxNrOfCacheObjects] 46 | /// files the files that haven't been used longest will be removed. 47 | final int? maxNrOfCacheObjects; 48 | final String _cacheKey; 49 | 50 | /// whenDone call when file download and cached 51 | final WhenDone? whenDone; 52 | 53 | @override 54 | Widget build(BuildContext context) { 55 | return StreamBuilder( 56 | stream: CustomCacheManger( 57 | key: _cacheKey, 58 | maxAgeCacheObject: maxAgeCacheObject, 59 | maxNrOfCacheObjects: maxNrOfCacheObjects, 60 | ).getFileStream(url, withProgress: true, headers: headers), 61 | builder: (_, AsyncSnapshot snapshot) { 62 | final bool loading = 63 | !snapshot.hasData || snapshot.data is DownloadProgress; 64 | 65 | if (snapshot.hasError) { 66 | return errorWidget!(snapshot.error); 67 | } else if (loading) { 68 | final double progress = 69 | (((snapshot.data as DownloadProgress?)?.progress ?? 0) * 100) 70 | .roundToDouble(); 71 | return placeholder!(progress); 72 | } else { 73 | final String filePath = (snapshot.data as FileInfo).file.path; 74 | if (whenDone != null) { 75 | whenDone!(filePath); 76 | } 77 | return PDFViewWrapper( 78 | path: filePath, 79 | pdf: pdf, 80 | key: key, 81 | ); 82 | } 83 | }, 84 | ); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /lib/src/url/custom_cache_manger.dart: -------------------------------------------------------------------------------- 1 | import 'dart:collection'; 2 | 3 | import 'package:flutter/foundation.dart'; 4 | import 'package:flutter_cache_manager/flutter_cache_manager.dart'; 5 | 6 | final HashMap<_CacheOption, CacheManager> hashMap = 7 | HashMap<_CacheOption, CacheManager>(); 8 | 9 | class CustomCacheManger extends CacheManager { 10 | factory CustomCacheManger({ 11 | required String key, 12 | required Duration? maxAgeCacheObject, 13 | required int? maxNrOfCacheObjects, 14 | }) { 15 | final _CacheOption cacheOption = _CacheOption( 16 | key: key, 17 | maxAgeCacheObject: maxAgeCacheObject, 18 | maxNrOfCacheObjects: maxNrOfCacheObjects, 19 | ); 20 | 21 | if (!hashMap.containsKey(cacheOption)) { 22 | hashMap[cacheOption] = CustomCacheManger._(cacheOption); 23 | } 24 | return hashMap[cacheOption] as CustomCacheManger; 25 | } 26 | 27 | CustomCacheManger._(_CacheOption cacheOption) 28 | : super(Config( 29 | cacheOption.key!, 30 | stalePeriod: cacheOption.maxAgeCacheObject!, 31 | maxNrOfCacheObjects: cacheOption.maxNrOfCacheObjects!, 32 | )); 33 | } 34 | 35 | @immutable 36 | class _CacheOption { 37 | const _CacheOption( 38 | {this.key, this.maxAgeCacheObject, this.maxNrOfCacheObjects}); 39 | 40 | final String? key; 41 | 42 | final Duration? maxAgeCacheObject; 43 | final int? maxNrOfCacheObjects; 44 | 45 | @override 46 | bool operator ==(Object other) => 47 | identical(this, other) || 48 | other is _CacheOption && 49 | runtimeType == other.runtimeType && 50 | key == other.key && 51 | maxAgeCacheObject == other.maxAgeCacheObject && 52 | maxNrOfCacheObjects == other.maxNrOfCacheObjects; 53 | 54 | @override 55 | int get hashCode => 56 | key.hashCode ^ maxAgeCacheObject.hashCode ^ maxNrOfCacheObjects.hashCode; 57 | 58 | @override 59 | String toString() { 60 | return 'CacheOption{key: $key, maxAgeCacheObject: $maxAgeCacheObject, maxNrOfCacheObjects: $maxNrOfCacheObjects}'; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lib/src/utils/download_indicator.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'show_progress.dart'; 4 | 5 | typedef PlaceholderWidget = Widget Function(double progress); 6 | 7 | class _DownloadIndicator extends StatelessWidget { 8 | const _DownloadIndicator({Key? key, this.progress}) : super(key: key); 9 | 10 | /// progress for Download 11 | final double? progress; 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Center( 16 | child: Column( 17 | mainAxisAlignment: MainAxisAlignment.center, 18 | children: [ 19 | Container( 20 | width: 50.0, 21 | height: 50.0, 22 | child: ShowProgress(progress: progress), 23 | ), 24 | const SizedBox(width: 20.0), 25 | const Text('Downloading...'), 26 | ], 27 | ), 28 | ); 29 | } 30 | } 31 | 32 | Widget downloadIndicator(double progress) => 33 | _DownloadIndicator(progress: progress); 34 | -------------------------------------------------------------------------------- /lib/src/utils/error_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | typedef ErrorWidget = Widget Function(dynamic error); 4 | 5 | Widget errorWidgetHolder(dynamic error) => Center( 6 | child: Center( 7 | child: Text( 8 | error.toString(), 9 | textAlign: TextAlign.center, 10 | style: const TextStyle(fontSize: 16), 11 | ), 12 | ), 13 | ); 14 | -------------------------------------------------------------------------------- /lib/src/utils/show_progress.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | typedef LoadingWidget = Widget Function(); 7 | 8 | class ShowProgress extends StatelessWidget { 9 | /// progress optional only worked with android 10 | const ShowProgress({Key? key, this.progress}) : super(key: key); 11 | final double? progress; 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Center( 16 | child: Platform.isIOS 17 | ? const CupertinoActivityIndicator() 18 | : CircularProgressIndicator( 19 | value: progress, 20 | ), 21 | ); 22 | } 23 | } 24 | 25 | Widget loadingWidgetHolder() => const ShowProgress(); 26 | -------------------------------------------------------------------------------- /pub_login.sh: -------------------------------------------------------------------------------- 1 | # This script creates/updates credentials.json file which is used 2 | # to authorize publisher when publishing packages to pub.dev 3 | 4 | # Checking whether the secrets are available as environment 5 | # variables or not. 6 | if [ -z "${PUB_DEV_PUBLISH_ACCESS_TOKEN}" ]; then 7 | echo "Missing PUB_DEV_PUBLISH_ACCESS_TOKEN environment variable" 8 | exit 1 9 | fi 10 | 11 | if [ -z "${PUB_DEV_PUBLISH_REFRESH_TOKEN}" ]; then 12 | echo "Missing PUB_DEV_PUBLISH_REFRESH_TOKEN environment variable" 13 | exit 1 14 | fi 15 | 16 | if [ -z "${PUB_DEV_PUBLISH_TOKEN_ENDPOINT}" ]; then 17 | echo "Missing PUB_DEV_PUBLISH_TOKEN_ENDPOINT environment variable" 18 | exit 1 19 | fi 20 | 21 | if [ -z "${PUB_DEV_PUBLISH_EXPIRATION}" ]; then 22 | echo "Missing PUB_DEV_PUBLISH_EXPIRATION environment variable" 23 | exit 1 24 | fi 25 | # ADD THIS LINE TO CREATE THE DIRECTORY 26 | mkdir -p ~/.pub-cache 27 | 28 | # Create credentials.json file. 29 | cat < ~/.pub-cache/credentials.json 30 | { 31 | "accessToken":"${PUB_DEV_PUBLISH_ACCESS_TOKEN}", 32 | "refreshToken":"${PUB_DEV_PUBLISH_REFRESH_TOKEN}", 33 | "tokenEndpoint":"${PUB_DEV_PUBLISH_TOKEN_ENDPOINT}", 34 | "scopes":["https://www.googleapis.com/auth/userinfo.email","openid"], 35 | "expiration":${PUB_DEV_PUBLISH_EXPIRATION} 36 | } 37 | EOF 38 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_cached_pdfview 2 | description: A package to show Native PDF View for iOS and Android, support Open from a different resource like Path, Asset or Url and Cache it. 3 | version: 0.4.3 4 | homepage: https://bnsaed.com/ 5 | repository: https://github.com/binSaed/flutter_cached_pdfview 6 | issue_tracker: https://github.com/binSaed/flutter_cached_pdfview/issues 7 | 8 | 9 | topics: 10 | - pdf 11 | - cache 12 | - pdf-cache 13 | - pdf-view 14 | 15 | environment: 16 | sdk: ">=2.12.0 <3.0.0" 17 | # new pubspec 18 | #https://flutter.dev/docs/development/packages-and-plugins/developing-packages 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | flutter_pdfview: ">=1.0.0 <2.0.0" 23 | flutter_cache_manager: ">=3.0.0 <4.0.0" 24 | path_provider: ">=2.0.0 <3.0.0" 25 | path: ">=1.0.0 <2.0.0" 26 | 27 | dev_dependencies: 28 | flutter_test: 29 | sdk: flutter 30 | flutter: 31 | -------------------------------------------------------------------------------- /test/flutter_cached_pdfview_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | 3 | void main() { 4 | test('adds one to input values', () { 5 | expect(null, null); 6 | }); 7 | } 8 | --------------------------------------------------------------------------------