├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── README_CH.md ├── example ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ ├── sign.keystore │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── interactiveviewer_gallery │ │ │ │ │ └── example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── 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 │ │ │ │ └── styles.xml │ │ │ │ └── xml │ │ │ │ └── network_security_config.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── 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 │ ├── display_gesture_widget.dart │ └── main.dart ├── pubspec.lock ├── pubspec.yaml └── test │ └── widget_test.dart ├── lib ├── custom_dismissible.dart ├── hero_dialog_route.dart ├── interactive_viewer_boundary.dart └── interactiveviewer_gallery.dart ├── pubspec.lock └── pubspec.yaml /.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/**/*.mode1v3 44 | **/ios/**/*.mode2v3 45 | **/ios/**/*.moved-aside 46 | **/ios/**/*.pbxuser 47 | **/ios/**/*.perspectivev3 48 | **/ios/**/*sync/ 49 | **/ios/**/.sconsign.dblite 50 | **/ios/**/.tags* 51 | **/ios/**/.vagrant/ 52 | **/ios/**/DerivedData/ 53 | **/ios/**/Icon? 54 | **/ios/**/Pods/ 55 | **/ios/**/.symlinks/ 56 | **/ios/**/profile 57 | **/ios/**/xcuserdata 58 | **/ios/.generated/ 59 | **/ios/Flutter/App.framework 60 | **/ios/Flutter/Flutter.framework 61 | **/ios/Flutter/Flutter.podspec 62 | **/ios/Flutter/Generated.xcconfig 63 | **/ios/Flutter/app.flx 64 | **/ios/Flutter/app.zip 65 | **/ios/Flutter/flutter_assets/ 66 | **/ios/Flutter/flutter_export_environment.sh 67 | **/ios/ServiceDefinitions.json 68 | **/ios/Runner/GeneratedPluginRegistrant.* 69 | 70 | # Exceptions to above rules. 71 | !**/ios/**/default.mode1v3 72 | !**/ios/**/default.mode2v3 73 | !**/ios/**/default.pbxuser 74 | !**/ios/**/default.perspectivev3 75 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 2 | 3 | ## 0.6.0 - 25.06.2021 4 | * fix nullable error 5 | 6 | ## 0.5.0 - 06.04.2021 7 | 8 | * add onPageChanged 9 | * optimize the position of double-click to enlarge 10 | 11 | ## 0.4.0 - 12.03.2021 12 | 13 | * support null safe 14 | 15 | ## 0.3.0 - 04.11.2020 16 | 17 | * fix itemBuilder's initState multi run 18 | * optimized demo: reclaim invisible items -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [2020] [Nell] 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. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # interactiveviewer_gallery 2 | [![pub package](https://img.shields.io/pub/v/interactiveviewer_gallery.svg)](https://pub.dartlang.org/packages/interactiveviewer_gallery) 3 | 4 | [中文文档](./README_CH.md) 5 | 6 | A flutter library to show picture and video preview gallery 7 | support 8 | 1. two-finger gesture zoom 9 | 2. double-click to zoom 10 | 3. switch left and right 11 | 4. gesture back: scale, transfer, opacity of background 12 | 5. video auto paused when miss focus 13 | 14 | ## Preview 15 | [video for youtube](https://youtu.be/S-93Et_nYQs) 16 | 17 | [video for qiniu](http://file.jinxianyun.com/interactiveviewer_gallery_0_1_0.mp4) 18 | 19 | [apk download](http://file.jinxianyun.com/interactiveviewer_gallery_0_1_0.apk) 20 | 21 | ## Setup 22 | 23 | because the library is base on InteractiveViewer so require flutter verion above or equal 1.20.0 24 | ```dart 25 | interactiveviewer_gallery: ${last_version} 26 | ``` 27 | 28 | ## How to use 29 | 30 | 1. Wrap Hero in your image gridview item: 31 | ```dart 32 | Hero( 33 | tag: source.url, 34 | child: ${gridview item} 35 | ) 36 | ``` 37 | 38 | 2. gridview item's GestureDetector add jumping to interactiveviewer_gallery: 39 | ```dart 40 | // DemoSourceEntity is your data model 41 | // itemBuilder is gallery page item 42 | void _openGallery(DemoSourceEntity source) { 43 | Navigator.of(context).push( 44 | HeroDialogRoute( 45 | // DisplayGesture is just debug, please remove it when use 46 | builder: (BuildContext context) => InteractiveviewerGallery( 47 | sources: sourceList, 48 | initIndex: sourceList.indexOf(source), 49 | itemBuilder: itemBuilder, 50 | onPageChanged: (int pageIndex) { 51 | print("nell-pageIndex:$pageIndex"); 52 | }, 53 | ), 54 | ), 55 | ); 56 | } 57 | ``` 58 | 59 | 3. edit itemBuilder: you can reference the [example/lib/main.dart](https://github.com/qq326646683/interactiveviewer_gallery/blob/main/example/lib/main.dart) then customize 60 | 61 | ```dart 62 | Widget itemBuilder(BuildContext context, int index, bool isFocus) { 63 | DemoSourceEntity sourceEntity = sourceList[index]; 64 | if (sourceEntity.type == 'video') { 65 | return DemoVideoItem( 66 | sourceEntity, 67 | isFocus: isFocus, 68 | ); 69 | } else { 70 | return DemoImageItem(sourceEntity); 71 | } 72 | } 73 | ``` 74 | 75 | ## Other 76 | Comments and pr are welcome 77 | -------------------------------------------------------------------------------- /README_CH.md: -------------------------------------------------------------------------------- 1 | # interactiveviewer_gallery 2 | [![pub package](https://img.shields.io/pub/v/interactiveviewer_gallery.svg)](https://pub.dartlang.org/packages/interactiveviewer_gallery) 3 | 4 | 图片预览&视频预览&图片视频混合预览的容器UI 5 | 1. 支持双指缩放 6 | 2. 支持双击放大 7 | 3. 支持左右切换图片 8 | 4. 支持下拉手势返回, 伴随缩小、移动、透明度变化 9 | 5. 支持视频失去焦点自动暂停 10 | 11 | ## 预览 12 | [qiniu](http://file.jinxianyun.com/interactiveviewer_gallery_0_1_0.mp4)/[youtube](https://youtu.be/S-93Et_nYQs) 13 | 14 | 15 | [apk download](http://file.jinxianyun.com/interactiveviewer_gallery_0_1_0.apk) 16 | 17 | ## 安装 18 | 19 | 因为该库是在InteractiveViewer基础上实现的, 所以flutter版本不低于1.20.0 20 | ```dart 21 | interactiveviewer_gallery: ${last_version} 22 | ``` 23 | 24 | ## 如何使用 25 | 1. 九宫格图片页面中图片组件包裹Hero(用来跳转的承接动画) 26 | ```dart 27 | Hero( 28 | tag: source.url, 29 | child: ${gridview item} 30 | ) 31 | ``` 32 | 33 | 2. 点击九宫格图片跳转到图片预览页面 34 | ```dart 35 | Navigator.of(context).push( 36 | HeroDialogRoute( 37 | builder: (BuildContext context) => InteractiveviewerGallery( 38 | sources: sourceList, 39 | initIndex: sourceList.indexOf(source), 40 | // 定义自己的item 41 | itemBuilder: itemBuilder, 42 | onPageChanged: (int pageIndex) { 43 | print("nell-pageIndex:$pageIndex"); 44 | }, 45 | ), 46 | ), 47 | ); 48 | ``` 49 | 50 | 3. 定义自己的item (因为每个人的UI设计不一样, 所以这里需要自己实现item, 该库只是一个UI容器), 可以参考预览视频中的实现: [example/lib/main.dart](https://github.com/qq326646683/interactiveviewer_gallery/blob/main/example/lib/main.dart) 51 | 52 | ```dart 53 | Widget itemBuilder(BuildContext context, int index, bool isFocus) { 54 | DemoSourceEntity sourceEntity = sourceList[index]; 55 | if (sourceEntity.type == 'video') { 56 | return DemoVideoItem( 57 | sourceEntity, 58 | isFocus: isFocus, 59 | ); 60 | } else { 61 | return DemoImageItem(sourceEntity); 62 | } 63 | } 64 | ``` 65 | 66 | ## 其他 67 | 欢迎pr和讨论 68 | -------------------------------------------------------------------------------- /example/.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 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | -------------------------------------------------------------------------------- /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 and should not be manually edited. 5 | 6 | version: 7 | revision: 84f3d28555368a70270e9ac8390a9441df95e752 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | interactiveviewer_gallery example 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://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), 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 | -------------------------------------------------------------------------------- /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 29 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.interactiveviewer_gallery.example" 42 | minSdkVersion 16 43 | targetSdkVersion 29 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | } 47 | 48 | signingConfigs { 49 | release { 50 | storeFile file("sign.keystore") // 替换成你实际密匙文件所在位置 51 | storePassword "123456" // 替换成你实际的密码 52 | keyAlias "sign.keystore" // 替换 53 | keyPassword "123456" // 替换 54 | } 55 | } 56 | 57 | buildTypes { 58 | release { 59 | // TODO: Add your own signing config for the release build. 60 | // Signing with the debug keys for now, so `flutter run --release` works. 61 | signingConfig signingConfigs.debug 62 | } 63 | } 64 | } 65 | 66 | flutter { 67 | source '../..' 68 | } 69 | 70 | dependencies { 71 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 72 | } 73 | -------------------------------------------------------------------------------- /example/android/app/sign.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/example/android/app/sign.keystore -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 9 | 14 | 21 | 25 | 29 | 34 | 38 | 39 | 40 | 41 | 42 | 43 | 45 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/interactiveviewer_gallery/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.interactiveviewer_gallery.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/xml/network_security_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 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.useAndroidX=true 3 | android.enableJetifier=true 4 | android.enableR8=true 5 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /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/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | 9.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, '9.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 | - FMDB (2.7.5): 4 | - FMDB/standard (= 2.7.5) 5 | - FMDB/standard (2.7.5) 6 | - path_provider (0.0.1): 7 | - Flutter 8 | - sqflite (0.0.2): 9 | - Flutter 10 | - FMDB (>= 2.7.5) 11 | - video_player (0.0.1): 12 | - Flutter 13 | 14 | DEPENDENCIES: 15 | - Flutter (from `Flutter`) 16 | - path_provider (from `.symlinks/plugins/path_provider/ios`) 17 | - sqflite (from `.symlinks/plugins/sqflite/ios`) 18 | - video_player (from `.symlinks/plugins/video_player/ios`) 19 | 20 | SPEC REPOS: 21 | trunk: 22 | - FMDB 23 | 24 | EXTERNAL SOURCES: 25 | Flutter: 26 | :path: Flutter 27 | path_provider: 28 | :path: ".symlinks/plugins/path_provider/ios" 29 | sqflite: 30 | :path: ".symlinks/plugins/sqflite/ios" 31 | video_player: 32 | :path: ".symlinks/plugins/video_player/ios" 33 | 34 | SPEC CHECKSUMS: 35 | Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c 36 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a 37 | path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c 38 | sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 39 | video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e 40 | 41 | PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c 42 | 43 | COCOAPODS: 1.10.0 44 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0B8ED936FE1F9FC7149B67F6 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55035C04E232F685CBAA82C7 /* Pods_Runner.framework */; }; 11 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 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 | 3E309F6EAEEAD0E35F79DB0C /* 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 = ""; }; 37 | 55035C04E232F685CBAA82C7 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | 683C864BA8DBCFA046C4474B /* 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 = ""; }; 39 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 40 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 41 | 7874D8CCCD2CAFCC2EB87F83 /* 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 = ""; }; 42 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 43 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 44 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 45 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 47 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 48 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 49 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | 0B8ED936FE1F9FC7149B67F6 /* Pods_Runner.framework in Frameworks */, 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | /* End PBXFrameworksBuildPhase section */ 62 | 63 | /* Begin PBXGroup section */ 64 | 7EC2D56B0E40EC105195FC7D /* Pods */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | 7874D8CCCD2CAFCC2EB87F83 /* Pods-Runner.debug.xcconfig */, 68 | 683C864BA8DBCFA046C4474B /* Pods-Runner.release.xcconfig */, 69 | 3E309F6EAEEAD0E35F79DB0C /* Pods-Runner.profile.xcconfig */, 70 | ); 71 | path = Pods; 72 | sourceTree = ""; 73 | }; 74 | 96F263274BB73708288CE195 /* Frameworks */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 55035C04E232F685CBAA82C7 /* Pods_Runner.framework */, 78 | ); 79 | name = Frameworks; 80 | sourceTree = ""; 81 | }; 82 | 9740EEB11CF90186004384FC /* Flutter */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 86 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 87 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 88 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 89 | ); 90 | name = Flutter; 91 | sourceTree = ""; 92 | }; 93 | 97C146E51CF9000F007C117D = { 94 | isa = PBXGroup; 95 | children = ( 96 | 9740EEB11CF90186004384FC /* Flutter */, 97 | 97C146F01CF9000F007C117D /* Runner */, 98 | 97C146EF1CF9000F007C117D /* Products */, 99 | 7EC2D56B0E40EC105195FC7D /* Pods */, 100 | 96F263274BB73708288CE195 /* Frameworks */, 101 | ); 102 | sourceTree = ""; 103 | }; 104 | 97C146EF1CF9000F007C117D /* Products */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 97C146EE1CF9000F007C117D /* Runner.app */, 108 | ); 109 | name = Products; 110 | sourceTree = ""; 111 | }; 112 | 97C146F01CF9000F007C117D /* Runner */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 116 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 117 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 118 | 97C147021CF9000F007C117D /* Info.plist */, 119 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 120 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 121 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 122 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 123 | ); 124 | path = Runner; 125 | sourceTree = ""; 126 | }; 127 | /* End PBXGroup section */ 128 | 129 | /* Begin PBXNativeTarget section */ 130 | 97C146ED1CF9000F007C117D /* Runner */ = { 131 | isa = PBXNativeTarget; 132 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 133 | buildPhases = ( 134 | 81CCD9FC8776883E6F90080B /* [CP] Check Pods Manifest.lock */, 135 | 9740EEB61CF901F6004384FC /* Run Script */, 136 | 97C146EA1CF9000F007C117D /* Sources */, 137 | 97C146EB1CF9000F007C117D /* Frameworks */, 138 | 97C146EC1CF9000F007C117D /* Resources */, 139 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 140 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 141 | 79D745846CCB0DC17FDB1A92 /* [CP] Embed Pods Frameworks */, 142 | ); 143 | buildRules = ( 144 | ); 145 | dependencies = ( 146 | ); 147 | name = Runner; 148 | productName = Runner; 149 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 150 | productType = "com.apple.product-type.application"; 151 | }; 152 | /* End PBXNativeTarget section */ 153 | 154 | /* Begin PBXProject section */ 155 | 97C146E61CF9000F007C117D /* Project object */ = { 156 | isa = PBXProject; 157 | attributes = { 158 | LastUpgradeCheck = 1020; 159 | ORGANIZATIONNAME = ""; 160 | TargetAttributes = { 161 | 97C146ED1CF9000F007C117D = { 162 | CreatedOnToolsVersion = 7.3.1; 163 | LastSwiftMigration = 1100; 164 | }; 165 | }; 166 | }; 167 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 168 | compatibilityVersion = "Xcode 9.3"; 169 | developmentRegion = en; 170 | hasScannedForEncodings = 0; 171 | knownRegions = ( 172 | en, 173 | Base, 174 | ); 175 | mainGroup = 97C146E51CF9000F007C117D; 176 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 177 | projectDirPath = ""; 178 | projectRoot = ""; 179 | targets = ( 180 | 97C146ED1CF9000F007C117D /* Runner */, 181 | ); 182 | }; 183 | /* End PBXProject section */ 184 | 185 | /* Begin PBXResourcesBuildPhase section */ 186 | 97C146EC1CF9000F007C117D /* Resources */ = { 187 | isa = PBXResourcesBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 191 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 192 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 193 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 194 | ); 195 | runOnlyForDeploymentPostprocessing = 0; 196 | }; 197 | /* End PBXResourcesBuildPhase section */ 198 | 199 | /* Begin PBXShellScriptBuildPhase section */ 200 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 201 | isa = PBXShellScriptBuildPhase; 202 | buildActionMask = 2147483647; 203 | files = ( 204 | ); 205 | inputPaths = ( 206 | ); 207 | name = "Thin Binary"; 208 | outputPaths = ( 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | shellPath = /bin/sh; 212 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 213 | }; 214 | 79D745846CCB0DC17FDB1A92 /* [CP] Embed Pods Frameworks */ = { 215 | isa = PBXShellScriptBuildPhase; 216 | buildActionMask = 2147483647; 217 | files = ( 218 | ); 219 | inputFileListPaths = ( 220 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", 221 | ); 222 | name = "[CP] Embed Pods Frameworks"; 223 | outputFileListPaths = ( 224 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | shellPath = /bin/sh; 228 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 229 | showEnvVarsInLog = 0; 230 | }; 231 | 81CCD9FC8776883E6F90080B /* [CP] Check Pods Manifest.lock */ = { 232 | isa = PBXShellScriptBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | ); 236 | inputFileListPaths = ( 237 | ); 238 | inputPaths = ( 239 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 240 | "${PODS_ROOT}/Manifest.lock", 241 | ); 242 | name = "[CP] Check Pods Manifest.lock"; 243 | outputFileListPaths = ( 244 | ); 245 | outputPaths = ( 246 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | shellPath = /bin/sh; 250 | 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"; 251 | showEnvVarsInLog = 0; 252 | }; 253 | 9740EEB61CF901F6004384FC /* Run Script */ = { 254 | isa = PBXShellScriptBuildPhase; 255 | buildActionMask = 2147483647; 256 | files = ( 257 | ); 258 | inputPaths = ( 259 | ); 260 | name = "Run Script"; 261 | outputPaths = ( 262 | ); 263 | runOnlyForDeploymentPostprocessing = 0; 264 | shellPath = /bin/sh; 265 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 266 | }; 267 | /* End PBXShellScriptBuildPhase section */ 268 | 269 | /* Begin PBXSourcesBuildPhase section */ 270 | 97C146EA1CF9000F007C117D /* Sources */ = { 271 | isa = PBXSourcesBuildPhase; 272 | buildActionMask = 2147483647; 273 | files = ( 274 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 275 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | /* End PBXSourcesBuildPhase section */ 280 | 281 | /* Begin PBXVariantGroup section */ 282 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 283 | isa = PBXVariantGroup; 284 | children = ( 285 | 97C146FB1CF9000F007C117D /* Base */, 286 | ); 287 | name = Main.storyboard; 288 | sourceTree = ""; 289 | }; 290 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 291 | isa = PBXVariantGroup; 292 | children = ( 293 | 97C147001CF9000F007C117D /* Base */, 294 | ); 295 | name = LaunchScreen.storyboard; 296 | sourceTree = ""; 297 | }; 298 | /* End PBXVariantGroup section */ 299 | 300 | /* Begin XCBuildConfiguration section */ 301 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 302 | isa = XCBuildConfiguration; 303 | buildSettings = { 304 | ALWAYS_SEARCH_USER_PATHS = NO; 305 | CLANG_ANALYZER_NONNULL = YES; 306 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 307 | CLANG_CXX_LIBRARY = "libc++"; 308 | CLANG_ENABLE_MODULES = YES; 309 | CLANG_ENABLE_OBJC_ARC = YES; 310 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 311 | CLANG_WARN_BOOL_CONVERSION = YES; 312 | CLANG_WARN_COMMA = YES; 313 | CLANG_WARN_CONSTANT_CONVERSION = YES; 314 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 315 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 316 | CLANG_WARN_EMPTY_BODY = YES; 317 | CLANG_WARN_ENUM_CONVERSION = YES; 318 | CLANG_WARN_INFINITE_RECURSION = YES; 319 | CLANG_WARN_INT_CONVERSION = YES; 320 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 321 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 322 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 323 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 324 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 325 | CLANG_WARN_STRICT_PROTOTYPES = YES; 326 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 327 | CLANG_WARN_UNREACHABLE_CODE = YES; 328 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 329 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 330 | COPY_PHASE_STRIP = NO; 331 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 332 | ENABLE_NS_ASSERTIONS = NO; 333 | ENABLE_STRICT_OBJC_MSGSEND = YES; 334 | GCC_C_LANGUAGE_STANDARD = gnu99; 335 | GCC_NO_COMMON_BLOCKS = YES; 336 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 337 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 338 | GCC_WARN_UNDECLARED_SELECTOR = YES; 339 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 340 | GCC_WARN_UNUSED_FUNCTION = YES; 341 | GCC_WARN_UNUSED_VARIABLE = YES; 342 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 343 | MTL_ENABLE_DEBUG_INFO = NO; 344 | SDKROOT = iphoneos; 345 | SUPPORTED_PLATFORMS = iphoneos; 346 | TARGETED_DEVICE_FAMILY = "1,2"; 347 | VALIDATE_PRODUCT = YES; 348 | }; 349 | name = Profile; 350 | }; 351 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 352 | isa = XCBuildConfiguration; 353 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 354 | buildSettings = { 355 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 356 | CLANG_ENABLE_MODULES = YES; 357 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 358 | DEVELOPMENT_TEAM = LP6XNBRN86; 359 | ENABLE_BITCODE = NO; 360 | FRAMEWORK_SEARCH_PATHS = ( 361 | "$(inherited)", 362 | "$(PROJECT_DIR)/Flutter", 363 | ); 364 | INFOPLIST_FILE = Runner/Info.plist; 365 | LD_RUNPATH_SEARCH_PATHS = ( 366 | "$(inherited)", 367 | "@executable_path/Frameworks", 368 | ); 369 | LIBRARY_SEARCH_PATHS = ( 370 | "$(inherited)", 371 | "$(PROJECT_DIR)/Flutter", 372 | ); 373 | PRODUCT_BUNDLE_IDENTIFIER = com.interactiveviewergallery.example; 374 | PRODUCT_NAME = "$(TARGET_NAME)"; 375 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 376 | SWIFT_VERSION = 5.0; 377 | VERSIONING_SYSTEM = "apple-generic"; 378 | }; 379 | name = Profile; 380 | }; 381 | 97C147031CF9000F007C117D /* Debug */ = { 382 | isa = XCBuildConfiguration; 383 | buildSettings = { 384 | ALWAYS_SEARCH_USER_PATHS = NO; 385 | CLANG_ANALYZER_NONNULL = YES; 386 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 387 | CLANG_CXX_LIBRARY = "libc++"; 388 | CLANG_ENABLE_MODULES = YES; 389 | CLANG_ENABLE_OBJC_ARC = YES; 390 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 391 | CLANG_WARN_BOOL_CONVERSION = YES; 392 | CLANG_WARN_COMMA = YES; 393 | CLANG_WARN_CONSTANT_CONVERSION = YES; 394 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 395 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 396 | CLANG_WARN_EMPTY_BODY = YES; 397 | CLANG_WARN_ENUM_CONVERSION = YES; 398 | CLANG_WARN_INFINITE_RECURSION = YES; 399 | CLANG_WARN_INT_CONVERSION = YES; 400 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 401 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 402 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 403 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 404 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 405 | CLANG_WARN_STRICT_PROTOTYPES = YES; 406 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 407 | CLANG_WARN_UNREACHABLE_CODE = YES; 408 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 409 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 410 | COPY_PHASE_STRIP = NO; 411 | DEBUG_INFORMATION_FORMAT = dwarf; 412 | ENABLE_STRICT_OBJC_MSGSEND = YES; 413 | ENABLE_TESTABILITY = YES; 414 | GCC_C_LANGUAGE_STANDARD = gnu99; 415 | GCC_DYNAMIC_NO_PIC = NO; 416 | GCC_NO_COMMON_BLOCKS = YES; 417 | GCC_OPTIMIZATION_LEVEL = 0; 418 | GCC_PREPROCESSOR_DEFINITIONS = ( 419 | "DEBUG=1", 420 | "$(inherited)", 421 | ); 422 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 423 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 424 | GCC_WARN_UNDECLARED_SELECTOR = YES; 425 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 426 | GCC_WARN_UNUSED_FUNCTION = YES; 427 | GCC_WARN_UNUSED_VARIABLE = YES; 428 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 429 | MTL_ENABLE_DEBUG_INFO = YES; 430 | ONLY_ACTIVE_ARCH = YES; 431 | SDKROOT = iphoneos; 432 | TARGETED_DEVICE_FAMILY = "1,2"; 433 | }; 434 | name = Debug; 435 | }; 436 | 97C147041CF9000F007C117D /* Release */ = { 437 | isa = XCBuildConfiguration; 438 | buildSettings = { 439 | ALWAYS_SEARCH_USER_PATHS = NO; 440 | CLANG_ANALYZER_NONNULL = YES; 441 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 442 | CLANG_CXX_LIBRARY = "libc++"; 443 | CLANG_ENABLE_MODULES = YES; 444 | CLANG_ENABLE_OBJC_ARC = YES; 445 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 446 | CLANG_WARN_BOOL_CONVERSION = YES; 447 | CLANG_WARN_COMMA = YES; 448 | CLANG_WARN_CONSTANT_CONVERSION = YES; 449 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 450 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 451 | CLANG_WARN_EMPTY_BODY = YES; 452 | CLANG_WARN_ENUM_CONVERSION = YES; 453 | CLANG_WARN_INFINITE_RECURSION = YES; 454 | CLANG_WARN_INT_CONVERSION = YES; 455 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 456 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 457 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 458 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 459 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 460 | CLANG_WARN_STRICT_PROTOTYPES = YES; 461 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 462 | CLANG_WARN_UNREACHABLE_CODE = YES; 463 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 464 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 465 | COPY_PHASE_STRIP = NO; 466 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 467 | ENABLE_NS_ASSERTIONS = NO; 468 | ENABLE_STRICT_OBJC_MSGSEND = YES; 469 | GCC_C_LANGUAGE_STANDARD = gnu99; 470 | GCC_NO_COMMON_BLOCKS = YES; 471 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 472 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 473 | GCC_WARN_UNDECLARED_SELECTOR = YES; 474 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 475 | GCC_WARN_UNUSED_FUNCTION = YES; 476 | GCC_WARN_UNUSED_VARIABLE = YES; 477 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 478 | MTL_ENABLE_DEBUG_INFO = NO; 479 | SDKROOT = iphoneos; 480 | SUPPORTED_PLATFORMS = iphoneos; 481 | SWIFT_COMPILATION_MODE = wholemodule; 482 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 483 | TARGETED_DEVICE_FAMILY = "1,2"; 484 | VALIDATE_PRODUCT = YES; 485 | }; 486 | name = Release; 487 | }; 488 | 97C147061CF9000F007C117D /* Debug */ = { 489 | isa = XCBuildConfiguration; 490 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 491 | buildSettings = { 492 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 493 | CLANG_ENABLE_MODULES = YES; 494 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 495 | DEVELOPMENT_TEAM = LP6XNBRN86; 496 | ENABLE_BITCODE = NO; 497 | FRAMEWORK_SEARCH_PATHS = ( 498 | "$(inherited)", 499 | "$(PROJECT_DIR)/Flutter", 500 | ); 501 | INFOPLIST_FILE = Runner/Info.plist; 502 | LD_RUNPATH_SEARCH_PATHS = ( 503 | "$(inherited)", 504 | "@executable_path/Frameworks", 505 | ); 506 | LIBRARY_SEARCH_PATHS = ( 507 | "$(inherited)", 508 | "$(PROJECT_DIR)/Flutter", 509 | ); 510 | PRODUCT_BUNDLE_IDENTIFIER = com.interactiveviewergallery.example; 511 | PRODUCT_NAME = "$(TARGET_NAME)"; 512 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 513 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 514 | SWIFT_VERSION = 5.0; 515 | VERSIONING_SYSTEM = "apple-generic"; 516 | }; 517 | name = Debug; 518 | }; 519 | 97C147071CF9000F007C117D /* Release */ = { 520 | isa = XCBuildConfiguration; 521 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 522 | buildSettings = { 523 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 524 | CLANG_ENABLE_MODULES = YES; 525 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 526 | DEVELOPMENT_TEAM = LP6XNBRN86; 527 | ENABLE_BITCODE = NO; 528 | FRAMEWORK_SEARCH_PATHS = ( 529 | "$(inherited)", 530 | "$(PROJECT_DIR)/Flutter", 531 | ); 532 | INFOPLIST_FILE = Runner/Info.plist; 533 | LD_RUNPATH_SEARCH_PATHS = ( 534 | "$(inherited)", 535 | "@executable_path/Frameworks", 536 | ); 537 | LIBRARY_SEARCH_PATHS = ( 538 | "$(inherited)", 539 | "$(PROJECT_DIR)/Flutter", 540 | ); 541 | PRODUCT_BUNDLE_IDENTIFIER = com.interactiveviewergallery.example; 542 | PRODUCT_NAME = "$(TARGET_NAME)"; 543 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 544 | SWIFT_VERSION = 5.0; 545 | VERSIONING_SYSTEM = "apple-generic"; 546 | }; 547 | name = Release; 548 | }; 549 | /* End XCBuildConfiguration section */ 550 | 551 | /* Begin XCConfigurationList section */ 552 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 553 | isa = XCConfigurationList; 554 | buildConfigurations = ( 555 | 97C147031CF9000F007C117D /* Debug */, 556 | 97C147041CF9000F007C117D /* Release */, 557 | 249021D3217E4FDB00AE95B9 /* Profile */, 558 | ); 559 | defaultConfigurationIsVisible = 0; 560 | defaultConfigurationName = Release; 561 | }; 562 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 563 | isa = XCConfigurationList; 564 | buildConfigurations = ( 565 | 97C147061CF9000F007C117D /* Debug */, 566 | 97C147071CF9000F007C117D /* Release */, 567 | 249021D4217E4FDB00AE95B9 /* Profile */, 568 | ); 569 | defaultConfigurationIsVisible = 0; 570 | defaultConfigurationName = Release; 571 | }; 572 | /* End XCConfigurationList section */ 573 | }; 574 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 575 | } 576 | -------------------------------------------------------------------------------- /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 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qq326646683/interactiveviewer_gallery/366e6408824dbcb45a0f852424e83e4987c87a79/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 | interactiveviewergallery 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 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | 32 | UILaunchStoryboardName 33 | LaunchScreen 34 | UIMainStoryboardFile 35 | Main 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UISupportedInterfaceOrientations~ipad 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationPortraitUpsideDown 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/lib/display_gesture_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class DisplayGesture extends StatefulWidget { 4 | final Widget? child; 5 | 6 | DisplayGesture({this.child}); 7 | 8 | @override 9 | _DisplayGestureState createState() => _DisplayGestureState(); 10 | } 11 | 12 | class _DisplayGestureState extends State { 13 | List displayModelList = []; 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Listener( 18 | onPointerDown: (PointerDownEvent event) { 19 | displayModelList.add(event); 20 | setState(() {}); 21 | }, 22 | onPointerMove: (PointerMoveEvent event) { 23 | for (int i = 0; i < displayModelList.length; i++) { 24 | if (displayModelList[i].pointer == event.pointer) { 25 | displayModelList[i] = event; 26 | setState(() {}); 27 | return; 28 | } 29 | } 30 | }, 31 | onPointerUp: (PointerUpEvent event) { 32 | for (int i = 0; i < displayModelList.length; i++) { 33 | if (displayModelList[i].pointer == event.pointer) { 34 | displayModelList.removeAt(i); 35 | setState(() {}); 36 | return; 37 | } 38 | } 39 | }, 40 | child: Stack( 41 | children: [ 42 | widget.child!, 43 | ...displayModelList.map((PointerEvent e) { 44 | return Positioned( 45 | left: e.position.dx - 30, 46 | top: e.position.dy - 30, 47 | child: Container( 48 | width: 60, 49 | height: 60, 50 | alignment: Alignment.center, 51 | decoration: BoxDecoration( 52 | color: Color(0x99ffffff), 53 | borderRadius: BorderRadius.all(Radius.circular(30)) 54 | ), 55 | child: Icon( 56 | Icons.adjust, 57 | size: 40, 58 | color: Colors.greenAccent, 59 | ), 60 | ), 61 | ); 62 | }).toList() 63 | ], 64 | ), 65 | ); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:example/display_gesture_widget.dart'; 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:interactiveviewer_gallery/hero_dialog_route.dart'; 6 | import 'package:interactiveviewer_gallery/interactiveviewer_gallery.dart'; 7 | import 'package:video_player/video_player.dart'; 8 | 9 | void main() { 10 | runApp(MyApp()); 11 | } 12 | 13 | class MyApp extends StatelessWidget { 14 | @override 15 | Widget build(BuildContext context) { 16 | return MaterialApp( 17 | title: 'InteraGallery Demo', 18 | // DisplayGesture is just debug, please remove it when use 19 | home: DisplayGesture( 20 | child: InteractiveviewDemoPage(), 21 | ), 22 | ); 23 | } 24 | } 25 | 26 | class DemoSourceEntity { 27 | int id; 28 | String url; 29 | String? previewUrl; 30 | String type; 31 | 32 | DemoSourceEntity(this.id, this.type, this.url, {this.previewUrl}); 33 | } 34 | 35 | class InteractiveviewDemoPage extends StatefulWidget { 36 | static final String sName = "/"; 37 | 38 | @override 39 | _InteractiveviewDemoPageState createState() => 40 | _InteractiveviewDemoPageState(); 41 | } 42 | 43 | class _InteractiveviewDemoPageState extends State { 44 | List sourceList = [ 45 | DemoSourceEntity(0, 'image', 'http://file.jinxianyun.com/inter_06.jpg'), 46 | DemoSourceEntity(1, 'image', 'http://file.jinxianyun.com/inter_05.jpg'), 47 | DemoSourceEntity(2, 'image', 'http://file.jinxianyun.com/inter_02.jpg'), 48 | DemoSourceEntity(3, 'image', 'http://file.jinxianyun.com/inter_03.gif'), 49 | DemoSourceEntity(4, 'video', 'http://file.jinxianyun.com/inter_04.mp4', 50 | previewUrl: 'http://file.jinxianyun.com/inter_04_pre.png'), 51 | DemoSourceEntity(5, 'video', 52 | 'http://file.jinxianyun.com/6438BF272694486859D5DE899DD2D823.mp4', 53 | previewUrl: 'http://file.jinxianyun.com/102.png'), 54 | ]; 55 | 56 | @override 57 | Widget build(BuildContext context) { 58 | return Scaffold( 59 | appBar: AppBar( 60 | title: Text('InteractiveviewerGallery Demo'), 61 | ), 62 | body: Padding( 63 | padding: const EdgeInsets.only(top: 50.0), 64 | child: Wrap( 65 | children: sourceList.map((source) => _buildItem(source)).toList(), 66 | ), 67 | ), 68 | ); 69 | } 70 | 71 | Widget _buildItem(DemoSourceEntity source) { 72 | return Hero( 73 | tag: source.id, 74 | placeholderBuilder: (BuildContext context, Size heroSize, Widget child) { 75 | // keep building the image since the images can be visible in the 76 | // background of the image gallery 77 | return child; 78 | }, 79 | child: GestureDetector( 80 | onTap: () => _openGallery(source), 81 | child: Stack( 82 | alignment: Alignment.center, 83 | children: [ 84 | CachedNetworkImage( 85 | imageUrl: source.type == 'video' ? source.previewUrl! : source.url, 86 | fit: BoxFit.cover, 87 | width: 100, 88 | height: 100, 89 | ), 90 | source.type == 'video' 91 | ? Icon( 92 | Icons.play_arrow, 93 | color: Colors.white, 94 | ) 95 | : SizedBox(), 96 | ], 97 | ), 98 | ), 99 | ); 100 | } 101 | 102 | void _openGallery(DemoSourceEntity source) { 103 | Navigator.of(context).push( 104 | HeroDialogRoute( 105 | // DisplayGesture is just debug, please remove it when use 106 | builder: (BuildContext context) => DisplayGesture( 107 | child: InteractiveviewerGallery( 108 | sources: sourceList, 109 | initIndex: sourceList.indexOf(source), 110 | itemBuilder: itemBuilder, 111 | onPageChanged: (int pageIndex) { 112 | print("nell-pageIndex:$pageIndex"); 113 | }, 114 | ), 115 | ), 116 | ), 117 | ); 118 | } 119 | 120 | Widget itemBuilder(BuildContext context, int index, bool isFocus) { 121 | DemoSourceEntity sourceEntity = sourceList[index]; 122 | if (sourceEntity.type == 'video') { 123 | return DemoVideoItem( 124 | sourceEntity, 125 | isFocus: isFocus, 126 | ); 127 | } else { 128 | return DemoImageItem(sourceEntity); 129 | } 130 | } 131 | } 132 | 133 | class DemoImageItem extends StatefulWidget { 134 | final DemoSourceEntity source; 135 | 136 | DemoImageItem(this.source); 137 | 138 | @override 139 | _DemoImageItemState createState() => _DemoImageItemState(); 140 | } 141 | 142 | class _DemoImageItemState extends State { 143 | @override 144 | void initState() { 145 | super.initState(); 146 | print('initState: ${widget.source.id}'); 147 | } 148 | 149 | @override 150 | void dispose() { 151 | super.dispose(); 152 | print('dispose: ${widget.source.id}'); 153 | } 154 | 155 | @override 156 | Widget build(BuildContext context) { 157 | return GestureDetector( 158 | behavior: HitTestBehavior.opaque, 159 | onTap: () => Navigator.of(context).pop(), 160 | child: Center( 161 | child: Hero( 162 | tag: widget.source.id, 163 | child: CachedNetworkImage( 164 | imageUrl: widget.source.url, 165 | fit: BoxFit.contain, 166 | ), 167 | ), 168 | ), 169 | ); 170 | } 171 | } 172 | 173 | class DemoVideoItem extends StatefulWidget { 174 | final DemoSourceEntity source; 175 | final bool? isFocus; 176 | 177 | DemoVideoItem(this.source, {this.isFocus}); 178 | 179 | @override 180 | _DemoVideoItemState createState() => _DemoVideoItemState(); 181 | } 182 | 183 | class _DemoVideoItemState extends State { 184 | VideoPlayerController? _controller; 185 | late VoidCallback listener; 186 | String? localFileName; 187 | 188 | _DemoVideoItemState() { 189 | listener = () { 190 | if (!mounted) { 191 | return; 192 | } 193 | setState(() {}); 194 | }; 195 | } 196 | 197 | @override 198 | void initState() { 199 | super.initState(); 200 | print('initState: ${widget.source.id}'); 201 | init(); 202 | } 203 | 204 | init() async { 205 | _controller = VideoPlayerController.network(widget.source.url); 206 | // loop play 207 | _controller!.setLooping(true); 208 | await _controller!.initialize(); 209 | setState(() {}); 210 | _controller!.addListener(listener); 211 | } 212 | 213 | @override 214 | void dispose() { 215 | super.dispose(); 216 | print('dispose: ${widget.source.id}'); 217 | _controller!.removeListener(listener); 218 | _controller?.pause(); 219 | _controller?.dispose(); 220 | } 221 | 222 | @override 223 | void didUpdateWidget(covariant DemoVideoItem oldWidget) { 224 | super.didUpdateWidget(oldWidget); 225 | 226 | if (oldWidget.isFocus! && !widget.isFocus!) { 227 | // pause 228 | _controller?.pause(); 229 | } 230 | } 231 | 232 | @override 233 | Widget build(BuildContext context) { 234 | return _controller!.value.isInitialized 235 | ? Stack( 236 | alignment: Alignment.center, 237 | children: [ 238 | GestureDetector( 239 | onTap: () { 240 | setState(() { 241 | _controller!.value.isPlaying 242 | ? _controller!.pause() 243 | : _controller!.play(); 244 | }); 245 | }, 246 | child: Hero( 247 | tag: widget.source.id, 248 | child: AspectRatio( 249 | aspectRatio: _controller!.value.aspectRatio, 250 | child: VideoPlayer(_controller!), 251 | ), 252 | ), 253 | ), 254 | _controller!.value.isPlaying == true 255 | ? SizedBox() 256 | : IgnorePointer( 257 | ignoring: true, 258 | child: Icon( 259 | Icons.play_arrow, 260 | size: 100, 261 | color: Colors.white, 262 | ), 263 | ), 264 | ], 265 | ) 266 | : Theme( 267 | data: ThemeData( 268 | cupertinoOverrideTheme: 269 | CupertinoThemeData(brightness: Brightness.dark)), 270 | child: CupertinoActivityIndicator(radius: 30)); 271 | } 272 | } 273 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "3.1.2" 11 | async: 12 | dependency: transitive 13 | description: 14 | name: async 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "2.5.0" 18 | boolean_selector: 19 | dependency: transitive 20 | description: 21 | name: boolean_selector 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "2.1.0" 25 | cached_network_image: 26 | dependency: "direct main" 27 | description: 28 | name: cached_network_image 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "3.0.0-nullsafety" 32 | characters: 33 | dependency: transitive 34 | description: 35 | name: characters 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "1.1.0" 39 | charcode: 40 | dependency: transitive 41 | description: 42 | name: charcode 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "1.2.0" 46 | clock: 47 | dependency: transitive 48 | description: 49 | name: clock 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "1.1.0" 53 | collection: 54 | dependency: transitive 55 | description: 56 | name: collection 57 | url: "https://pub.flutter-io.cn" 58 | source: hosted 59 | version: "1.15.0" 60 | crypto: 61 | dependency: transitive 62 | description: 63 | name: crypto 64 | url: "https://pub.flutter-io.cn" 65 | source: hosted 66 | version: "3.0.0" 67 | cupertino_icons: 68 | dependency: "direct main" 69 | description: 70 | name: cupertino_icons 71 | url: "https://pub.flutter-io.cn" 72 | source: hosted 73 | version: "1.0.2" 74 | fake_async: 75 | dependency: transitive 76 | description: 77 | name: fake_async 78 | url: "https://pub.flutter-io.cn" 79 | source: hosted 80 | version: "1.2.0" 81 | ffi: 82 | dependency: transitive 83 | description: 84 | name: ffi 85 | url: "https://pub.flutter-io.cn" 86 | source: hosted 87 | version: "1.0.0" 88 | file: 89 | dependency: transitive 90 | description: 91 | name: file 92 | url: "https://pub.flutter-io.cn" 93 | source: hosted 94 | version: "6.1.0" 95 | flutter: 96 | dependency: "direct main" 97 | description: flutter 98 | source: sdk 99 | version: "0.0.0" 100 | flutter_blurhash: 101 | dependency: transitive 102 | description: 103 | name: flutter_blurhash 104 | url: "https://pub.flutter-io.cn" 105 | source: hosted 106 | version: "0.5.4-nullsafety.0" 107 | flutter_cache_manager: 108 | dependency: transitive 109 | description: 110 | name: flutter_cache_manager 111 | url: "https://pub.flutter-io.cn" 112 | source: hosted 113 | version: "3.0.0-nullsafety.1" 114 | flutter_test: 115 | dependency: "direct dev" 116 | description: flutter 117 | source: sdk 118 | version: "0.0.0" 119 | flutter_web_plugins: 120 | dependency: transitive 121 | description: flutter 122 | source: sdk 123 | version: "0.0.0" 124 | http: 125 | dependency: transitive 126 | description: 127 | name: http 128 | url: "https://pub.flutter-io.cn" 129 | source: hosted 130 | version: "0.13.0" 131 | http_parser: 132 | dependency: transitive 133 | description: 134 | name: http_parser 135 | url: "https://pub.flutter-io.cn" 136 | source: hosted 137 | version: "4.0.0" 138 | image: 139 | dependency: transitive 140 | description: 141 | name: image 142 | url: "https://pub.flutter-io.cn" 143 | source: hosted 144 | version: "3.0.1" 145 | interactiveviewer_gallery: 146 | dependency: "direct main" 147 | description: 148 | path: ".." 149 | relative: true 150 | source: path 151 | version: "0.6.0" 152 | js: 153 | dependency: transitive 154 | description: 155 | name: js 156 | url: "https://pub.flutter-io.cn" 157 | source: hosted 158 | version: "0.6.3" 159 | matcher: 160 | dependency: transitive 161 | description: 162 | name: matcher 163 | url: "https://pub.flutter-io.cn" 164 | source: hosted 165 | version: "0.12.10" 166 | meta: 167 | dependency: transitive 168 | description: 169 | name: meta 170 | url: "https://pub.flutter-io.cn" 171 | source: hosted 172 | version: "1.3.0" 173 | octo_image: 174 | dependency: transitive 175 | description: 176 | name: octo_image 177 | url: "https://pub.flutter-io.cn" 178 | source: hosted 179 | version: "1.0.0-nullsafety.1" 180 | path: 181 | dependency: transitive 182 | description: 183 | name: path 184 | url: "https://pub.flutter-io.cn" 185 | source: hosted 186 | version: "1.8.0" 187 | path_provider: 188 | dependency: transitive 189 | description: 190 | name: path_provider 191 | url: "https://pub.flutter-io.cn" 192 | source: hosted 193 | version: "2.0.1" 194 | path_provider_linux: 195 | dependency: transitive 196 | description: 197 | name: path_provider_linux 198 | url: "https://pub.flutter-io.cn" 199 | source: hosted 200 | version: "2.0.0" 201 | path_provider_macos: 202 | dependency: transitive 203 | description: 204 | name: path_provider_macos 205 | url: "https://pub.flutter-io.cn" 206 | source: hosted 207 | version: "2.0.0" 208 | path_provider_platform_interface: 209 | dependency: transitive 210 | description: 211 | name: path_provider_platform_interface 212 | url: "https://pub.flutter-io.cn" 213 | source: hosted 214 | version: "2.0.1" 215 | path_provider_windows: 216 | dependency: transitive 217 | description: 218 | name: path_provider_windows 219 | url: "https://pub.flutter-io.cn" 220 | source: hosted 221 | version: "2.0.0" 222 | pedantic: 223 | dependency: transitive 224 | description: 225 | name: pedantic 226 | url: "https://pub.flutter-io.cn" 227 | source: hosted 228 | version: "1.11.0" 229 | petitparser: 230 | dependency: transitive 231 | description: 232 | name: petitparser 233 | url: "https://pub.flutter-io.cn" 234 | source: hosted 235 | version: "4.0.2" 236 | platform: 237 | dependency: transitive 238 | description: 239 | name: platform 240 | url: "https://pub.flutter-io.cn" 241 | source: hosted 242 | version: "3.0.0" 243 | plugin_platform_interface: 244 | dependency: transitive 245 | description: 246 | name: plugin_platform_interface 247 | url: "https://pub.flutter-io.cn" 248 | source: hosted 249 | version: "2.0.0" 250 | process: 251 | dependency: transitive 252 | description: 253 | name: process 254 | url: "https://pub.flutter-io.cn" 255 | source: hosted 256 | version: "4.1.0" 257 | rxdart: 258 | dependency: transitive 259 | description: 260 | name: rxdart 261 | url: "https://pub.flutter-io.cn" 262 | source: hosted 263 | version: "0.26.0" 264 | sky_engine: 265 | dependency: transitive 266 | description: flutter 267 | source: sdk 268 | version: "0.0.99" 269 | source_span: 270 | dependency: transitive 271 | description: 272 | name: source_span 273 | url: "https://pub.flutter-io.cn" 274 | source: hosted 275 | version: "1.8.0" 276 | sqflite: 277 | dependency: transitive 278 | description: 279 | name: sqflite 280 | url: "https://pub.flutter-io.cn" 281 | source: hosted 282 | version: "2.0.0+2" 283 | sqflite_common: 284 | dependency: transitive 285 | description: 286 | name: sqflite_common 287 | url: "https://pub.flutter-io.cn" 288 | source: hosted 289 | version: "2.0.0+1" 290 | stack_trace: 291 | dependency: transitive 292 | description: 293 | name: stack_trace 294 | url: "https://pub.flutter-io.cn" 295 | source: hosted 296 | version: "1.10.0" 297 | stream_channel: 298 | dependency: transitive 299 | description: 300 | name: stream_channel 301 | url: "https://pub.flutter-io.cn" 302 | source: hosted 303 | version: "2.1.0" 304 | string_scanner: 305 | dependency: transitive 306 | description: 307 | name: string_scanner 308 | url: "https://pub.flutter-io.cn" 309 | source: hosted 310 | version: "1.1.0" 311 | synchronized: 312 | dependency: transitive 313 | description: 314 | name: synchronized 315 | url: "https://pub.flutter-io.cn" 316 | source: hosted 317 | version: "3.0.0" 318 | term_glyph: 319 | dependency: transitive 320 | description: 321 | name: term_glyph 322 | url: "https://pub.flutter-io.cn" 323 | source: hosted 324 | version: "1.2.0" 325 | test_api: 326 | dependency: transitive 327 | description: 328 | name: test_api 329 | url: "https://pub.flutter-io.cn" 330 | source: hosted 331 | version: "0.2.19" 332 | typed_data: 333 | dependency: transitive 334 | description: 335 | name: typed_data 336 | url: "https://pub.flutter-io.cn" 337 | source: hosted 338 | version: "1.3.0" 339 | uuid: 340 | dependency: transitive 341 | description: 342 | name: uuid 343 | url: "https://pub.flutter-io.cn" 344 | source: hosted 345 | version: "3.0.1" 346 | vector_math: 347 | dependency: transitive 348 | description: 349 | name: vector_math 350 | url: "https://pub.flutter-io.cn" 351 | source: hosted 352 | version: "2.1.0" 353 | video_player: 354 | dependency: "direct main" 355 | description: 356 | name: video_player 357 | url: "https://pub.flutter-io.cn" 358 | source: hosted 359 | version: "2.0.2" 360 | video_player_platform_interface: 361 | dependency: transitive 362 | description: 363 | name: video_player_platform_interface 364 | url: "https://pub.flutter-io.cn" 365 | source: hosted 366 | version: "4.0.0" 367 | video_player_web: 368 | dependency: transitive 369 | description: 370 | name: video_player_web 371 | url: "https://pub.flutter-io.cn" 372 | source: hosted 373 | version: "2.0.0" 374 | win32: 375 | dependency: transitive 376 | description: 377 | name: win32 378 | url: "https://pub.flutter-io.cn" 379 | source: hosted 380 | version: "2.0.1" 381 | xdg_directories: 382 | dependency: transitive 383 | description: 384 | name: xdg_directories 385 | url: "https://pub.flutter-io.cn" 386 | source: hosted 387 | version: "0.2.0" 388 | xml: 389 | dependency: transitive 390 | description: 391 | name: xml 392 | url: "https://pub.flutter-io.cn" 393 | source: hosted 394 | version: "5.0.2" 395 | sdks: 396 | dart: ">=2.12.0 <3.0.0" 397 | flutter: ">=1.24.0-10.2.pre" 398 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: interactiveviewer_gallery example 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.0.0+1 19 | 20 | environment: 21 | sdk: '>=2.12.0 <3.0.0' 22 | 23 | dependencies: 24 | flutter: 25 | sdk: flutter 26 | interactiveviewer_gallery: 27 | path: ../ 28 | cached_network_image: ^3.0.0-nullsafety 29 | cupertino_icons: ^1.0.0 30 | video_player: ^2.0.0 31 | 32 | dev_dependencies: 33 | flutter_test: 34 | sdk: flutter 35 | 36 | # For information on the generic Dart part of this file, see the 37 | # following page: https://dart.dev/tools/pub/pubspec 38 | # The following section is specific to Flutter. 39 | flutter: 40 | 41 | # The following line ensures that the Material Icons font is 42 | # included with your application, so that you can use the icons in 43 | # the material Icons class. 44 | uses-material-design: true 45 | # To add assets to your application, add an assets section, like this: 46 | # assets: 47 | # - images/a_dot_burr.jpeg 48 | # - images/a_dot_ham.jpeg 49 | # An image asset can refer to one or more resolution-specific "variants", see 50 | # https://flutter.dev/assets-and-images/#resolution-aware. 51 | # For details regarding adding assets from package dependencies, see 52 | # https://flutter.dev/assets-and-images/#from-packages 53 | # To add custom fonts to your application, add a fonts section here, 54 | # in this "flutter" section. Each entry in this list should have a 55 | # "family" key with the font family name, and a "fonts" key with a 56 | # list giving the asset and other descriptors for the font. For 57 | # example: 58 | # fonts: 59 | # - family: Schyler 60 | # fonts: 61 | # - asset: fonts/Schyler-Regular.ttf 62 | # - asset: fonts/Schyler-Italic.ttf 63 | # style: italic 64 | # - family: Trajan Pro 65 | # fonts: 66 | # - asset: fonts/TrajanPro.ttf 67 | # - asset: fonts/TrajanPro_Bold.ttf 68 | # weight: 700 69 | # 70 | # For details regarding fonts from package dependencies, 71 | # see https://flutter.dev/custom-fonts/#from-packages 72 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /lib/custom_dismissible.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /// A widget used to dismiss its [child]. 4 | /// 5 | /// Similar to [Dismissible] with some adjustments. 6 | class CustomDismissible extends StatefulWidget { 7 | const CustomDismissible({ 8 | required this.child, 9 | this.onDismissed, 10 | this.dismissThreshold = 0.2, 11 | this.enabled = true, 12 | }); 13 | 14 | final Widget child; 15 | final double dismissThreshold; 16 | final VoidCallback? onDismissed; 17 | final bool enabled; 18 | 19 | @override 20 | _CustomDismissibleState createState() => _CustomDismissibleState(); 21 | } 22 | 23 | class _CustomDismissibleState extends State with SingleTickerProviderStateMixin { 24 | late AnimationController _animateController; 25 | late Animation _moveAnimation; 26 | late Animation _scaleAnimation; 27 | late Animation _opacityAnimation; 28 | 29 | double _dragExtent = 0; 30 | bool _dragUnderway = false; 31 | 32 | bool get _isActive => _dragUnderway || _animateController.isAnimating; 33 | 34 | @override 35 | void initState() { 36 | super.initState(); 37 | 38 | _animateController = AnimationController( 39 | duration: Duration(milliseconds: 300), 40 | vsync: this, 41 | ); 42 | 43 | _updateMoveAnimation(); 44 | } 45 | 46 | @override 47 | void dispose() { 48 | _animateController.dispose(); 49 | 50 | super.dispose(); 51 | } 52 | 53 | void _updateMoveAnimation() { 54 | final double end = _dragExtent.sign; 55 | 56 | _moveAnimation = _animateController.drive( 57 | Tween( 58 | begin: Offset.zero, 59 | end: Offset(0, end), 60 | ), 61 | ); 62 | 63 | _scaleAnimation = _animateController.drive(Tween( 64 | begin: 1, 65 | end: 0.5, 66 | )); 67 | 68 | 69 | _opacityAnimation = DecorationTween( 70 | begin: BoxDecoration( 71 | color: const Color(0xFF000000), 72 | ), 73 | end: BoxDecoration( 74 | color: const Color(0x00000000), 75 | ), 76 | ).animate(_animateController); 77 | 78 | } 79 | 80 | void _handleDragStart(DragStartDetails details) { 81 | _dragUnderway = true; 82 | 83 | if (_animateController.isAnimating) { 84 | _dragExtent = _animateController.value * context.size!.height * _dragExtent.sign; 85 | _animateController.stop(); 86 | } else { 87 | _dragExtent = 0.0; 88 | _animateController.value = 0.0; 89 | } 90 | setState(_updateMoveAnimation); 91 | } 92 | 93 | void _handleDragUpdate(DragUpdateDetails details) { 94 | if (!_isActive || _animateController.isAnimating) { 95 | return; 96 | } 97 | 98 | final double delta = details.primaryDelta!; 99 | final double oldDragExtent = _dragExtent; 100 | 101 | if (_dragExtent + delta < 0) { 102 | _dragExtent += delta; 103 | } else if (_dragExtent + delta > 0) { 104 | _dragExtent += delta; 105 | } 106 | 107 | if (oldDragExtent.sign != _dragExtent.sign) { 108 | setState(_updateMoveAnimation); 109 | } 110 | 111 | if (!_animateController.isAnimating) { 112 | _animateController.value = _dragExtent.abs() / context.size!.height; 113 | } 114 | } 115 | 116 | void _handleDragEnd(DragEndDetails details) { 117 | if (!_isActive || _animateController.isAnimating) { 118 | return; 119 | } 120 | 121 | _dragUnderway = false; 122 | 123 | if (_animateController.isCompleted) { 124 | return; 125 | } 126 | 127 | if (!_animateController.isDismissed) { 128 | // if the dragged value exceeded the dismissThreshold, call onDismissed 129 | // else animate back to initial position. 130 | if (_animateController.value > widget.dismissThreshold) { 131 | widget.onDismissed?.call(); 132 | } else { 133 | _animateController.reverse(); 134 | } 135 | } 136 | } 137 | 138 | @override 139 | Widget build(BuildContext context) { 140 | final Widget content = DecoratedBoxTransition( 141 | decoration: _opacityAnimation, 142 | child: SlideTransition( 143 | position: _moveAnimation, 144 | child: ScaleTransition( 145 | scale: _scaleAnimation, 146 | child: widget.child, 147 | ), 148 | ), 149 | ); 150 | 151 | return GestureDetector( 152 | behavior: HitTestBehavior.translucent, 153 | onVerticalDragStart: widget.enabled ? _handleDragStart : null, 154 | onVerticalDragUpdate: widget.enabled ? _handleDragUpdate : null, 155 | onVerticalDragEnd: widget.enabled ? _handleDragEnd : null, 156 | child: content, 157 | ); 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /lib/hero_dialog_route.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | /// A [PageRoute] with a semi transparent background. 6 | /// 7 | /// Similar to calling [showDialog] except it can be used with a [Navigator] to 8 | /// show a [Hero] animation. 9 | class HeroDialogRoute extends PageRoute { 10 | HeroDialogRoute({ 11 | required this.builder, 12 | this.onBackgroundTap, 13 | }) : super(); 14 | 15 | final WidgetBuilder builder; 16 | 17 | /// Called when the background is tapped. 18 | final VoidCallback? onBackgroundTap; 19 | 20 | @override 21 | bool get opaque => false; 22 | 23 | @override 24 | bool get barrierDismissible => true; 25 | 26 | @override 27 | String? get barrierLabel => null; 28 | 29 | @override 30 | Duration get transitionDuration => const Duration(milliseconds: 300); 31 | 32 | @override 33 | bool get maintainState => true; 34 | 35 | @override 36 | Color? get barrierColor => null; 37 | 38 | @override 39 | Widget buildTransitions( 40 | BuildContext context, 41 | Animation animation, 42 | Animation secondaryAnimation, 43 | Widget child, 44 | ) { 45 | return FadeTransition( 46 | opacity: CurvedAnimation(parent: animation, curve: Curves.easeOut), 47 | child: child, 48 | ); 49 | } 50 | 51 | @override 52 | Widget buildPage( 53 | BuildContext context, 54 | Animation animation, 55 | Animation secondaryAnimation, 56 | ) { 57 | final Widget child = builder(context); 58 | final Widget result = Semantics( 59 | scopesRoute: true, 60 | explicitChildNodes: true, 61 | child: child, 62 | ); 63 | return result; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /lib/interactive_viewer_boundary.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /// A callback for the [InteractiveViewerBoundary] that is called when the scale 4 | /// changed. 5 | typedef ScaleChanged = void Function(double scale); 6 | 7 | /// Builds an [InteractiveViewer] and provides callbacks that are called when a 8 | /// horizontal boundary has been hit. 9 | /// 10 | /// The callbacks are called when an interaction ends by listening to the 11 | /// [InteractiveViewer.onInteractionEnd] callback. 12 | class InteractiveViewerBoundary extends StatefulWidget { 13 | const InteractiveViewerBoundary({ 14 | required this.child, 15 | required this.boundaryWidth, 16 | this.controller, 17 | this.onScaleChanged, 18 | this.onLeftBoundaryHit, 19 | this.onRightBoundaryHit, 20 | this.onNoBoundaryHit, 21 | this.maxScale, 22 | this.minScale, 23 | }); 24 | 25 | final Widget child; 26 | 27 | /// The max width this widget can have. 28 | /// 29 | /// If the [InteractiveViewer] can take up the entire screen width, this 30 | /// should be set to `MediaQuery.of(context).size.width`. 31 | final double boundaryWidth; 32 | 33 | /// The [TransformationController] for the [InteractiveViewer]. 34 | final TransformationController? controller; 35 | 36 | /// Called when the scale changed after an interaction ended. 37 | final ScaleChanged? onScaleChanged; 38 | 39 | /// Called when the left boundary has been hit after an interaction ended. 40 | final VoidCallback? onLeftBoundaryHit; 41 | 42 | /// Called when the right boundary has been hit after an interaction ended. 43 | final VoidCallback? onRightBoundaryHit; 44 | 45 | /// Called when no boundary has been hit after an interaction ended. 46 | final VoidCallback? onNoBoundaryHit; 47 | 48 | final double? maxScale; 49 | 50 | final double? minScale; 51 | 52 | @override 53 | InteractiveViewerBoundaryState createState() => 54 | InteractiveViewerBoundaryState(); 55 | } 56 | 57 | class InteractiveViewerBoundaryState extends State { 58 | TransformationController? _controller; 59 | 60 | double? _scale; 61 | 62 | @override 63 | void initState() { 64 | super.initState(); 65 | 66 | _controller = widget.controller ?? TransformationController(); 67 | } 68 | 69 | @override 70 | void dispose() { 71 | _controller!.dispose(); 72 | 73 | super.dispose(); 74 | } 75 | 76 | void _updateBoundaryDetection() { 77 | 78 | final double scale = _controller!.value.row0[0]; 79 | 80 | if (_scale != scale) { 81 | // the scale changed 82 | _scale = scale; 83 | widget.onScaleChanged?.call(scale); 84 | } 85 | 86 | if (scale <= 1.01) { 87 | // cant hit any boundaries when the child is not scaled 88 | return; 89 | } 90 | 91 | final double xOffset = _controller!.value.row0[3]; 92 | final double boundaryWidth = widget.boundaryWidth; 93 | final double boundaryEnd = boundaryWidth * scale; 94 | final double xPos = boundaryEnd + xOffset; 95 | 96 | if (boundaryEnd.round() == xPos.round()) { 97 | // left boundary hit 98 | widget.onLeftBoundaryHit?.call(); 99 | } else if (boundaryWidth.round() == xPos.round()) { 100 | // right boundary hit 101 | widget.onRightBoundaryHit?.call(); 102 | } else { 103 | widget.onNoBoundaryHit?.call(); 104 | } 105 | } 106 | 107 | @override 108 | Widget build(BuildContext context) { 109 | return InteractiveViewer( 110 | maxScale: widget.maxScale!, 111 | minScale: widget.minScale!, 112 | transformationController: _controller, 113 | onInteractionEnd: (_) => _updateBoundaryDetection(), 114 | child: widget.child, 115 | ); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /lib/interactiveviewer_gallery.dart: -------------------------------------------------------------------------------- 1 | library interactiveviewer_gallery; 2 | import 'package:flutter/material.dart'; 3 | import './custom_dismissible.dart'; 4 | import './interactive_viewer_boundary.dart'; 5 | 6 | /// Builds a carousel controlled by a [PageView] for the tweet media sources. 7 | /// 8 | /// Used for showing a full screen view of the [TweetMedia] sources. 9 | /// 10 | /// The sources can be panned and zoomed interactively using an 11 | /// [InteractiveViewer]. 12 | /// An [InteractiveViewerBoundary] is used to detect when the boundary of the 13 | /// source is hit after zooming in to disable or enable the swiping gesture of 14 | /// the [PageView]. 15 | /// 16 | typedef IndexedFocusedWidgetBuilder = Widget Function(BuildContext context, int index, bool isFocus); 17 | 18 | typedef IndexedTagStringBuilder = String Function(int index); 19 | 20 | class InteractiveviewerGallery extends StatefulWidget { 21 | const InteractiveviewerGallery({ 22 | required this.sources, 23 | required this.initIndex, 24 | required this.itemBuilder, 25 | this.maxScale = 2.5, 26 | this.minScale = 1.0, 27 | this.onPageChanged, 28 | }); 29 | 30 | /// The sources to show. 31 | final List sources; 32 | 33 | /// The index of the first source in [sources] to show. 34 | final int initIndex; 35 | 36 | /// The item content 37 | final IndexedFocusedWidgetBuilder itemBuilder; 38 | 39 | final double maxScale; 40 | 41 | final double minScale; 42 | 43 | final ValueChanged? onPageChanged; 44 | 45 | 46 | @override 47 | _TweetSourceGalleryState createState() => _TweetSourceGalleryState(); 48 | } 49 | 50 | class _TweetSourceGalleryState extends State with SingleTickerProviderStateMixin { 51 | PageController? _pageController; 52 | TransformationController? _transformationController; 53 | 54 | /// The controller to animate the transformation value of the 55 | /// [InteractiveViewer] when it should reset. 56 | late AnimationController _animationController; 57 | Animation? _animation; 58 | 59 | /// `true` when an source is zoomed in and not at the at a horizontal boundary 60 | /// to disable the [PageView]. 61 | bool _enablePageView = true; 62 | 63 | /// `true` when an source is zoomed in to disable the [CustomDismissible]. 64 | bool _enableDismiss = true; 65 | 66 | late Offset _doubleTapLocalPosition; 67 | 68 | int? currentIndex; 69 | 70 | @override 71 | void initState() { 72 | super.initState(); 73 | 74 | _pageController = PageController(initialPage: widget.initIndex); 75 | 76 | _transformationController = TransformationController(); 77 | 78 | _animationController = AnimationController( 79 | vsync: this, 80 | duration: Duration(milliseconds: 300), 81 | ) 82 | ..addListener(() { 83 | _transformationController!.value = _animation?.value ?? Matrix4.identity(); 84 | }) 85 | ..addStatusListener((AnimationStatus status) { 86 | if (status == AnimationStatus.completed && !_enableDismiss) { 87 | setState(() { 88 | _enableDismiss = true; 89 | }); 90 | } 91 | }); 92 | 93 | currentIndex = widget.initIndex; 94 | } 95 | 96 | @override 97 | void dispose() { 98 | _pageController!.dispose(); 99 | _animationController.dispose(); 100 | 101 | super.dispose(); 102 | } 103 | 104 | /// When the source gets scaled up, the swipe up / down to dismiss gets 105 | /// disabled. 106 | /// 107 | /// When the scale resets, the dismiss and the page view swiping gets enabled. 108 | void _onScaleChanged(double scale) { 109 | final bool initialScale = scale <= widget.minScale; 110 | 111 | if (initialScale) { 112 | if (!_enableDismiss) { 113 | setState(() { 114 | _enableDismiss = true; 115 | }); 116 | } 117 | 118 | if (!_enablePageView) { 119 | setState(() { 120 | _enablePageView = true; 121 | }); 122 | } 123 | } else { 124 | if (_enableDismiss) { 125 | setState(() { 126 | _enableDismiss = false; 127 | }); 128 | } 129 | 130 | if (_enablePageView) { 131 | setState(() { 132 | _enablePageView = false; 133 | }); 134 | } 135 | } 136 | } 137 | 138 | /// When the left boundary has been hit after scaling up the source, the page 139 | /// view swiping gets enabled if it has a page to swipe to. 140 | void _onLeftBoundaryHit() { 141 | if (!_enablePageView && _pageController!.page!.floor() > 0) { 142 | setState(() { 143 | _enablePageView = true; 144 | }); 145 | } 146 | } 147 | 148 | /// When the right boundary has been hit after scaling up the source, the page 149 | /// view swiping gets enabled if it has a page to swipe to. 150 | void _onRightBoundaryHit() { 151 | if (!_enablePageView && _pageController!.page!.floor() < widget.sources.length - 1) { 152 | setState(() { 153 | _enablePageView = true; 154 | }); 155 | } 156 | } 157 | 158 | /// When the source has been scaled up and no horizontal boundary has been hit, 159 | /// the page view swiping gets disabled. 160 | void _onNoBoundaryHit() { 161 | if (_enablePageView) { 162 | setState(() { 163 | _enablePageView = false; 164 | }); 165 | } 166 | } 167 | 168 | /// When the page view changed its page, the source will animate back into the 169 | /// original scale if it was scaled up. 170 | /// 171 | /// Additionally the swipe up / down to dismiss gets enabled. 172 | void _onPageChanged(int page) { 173 | setState(() { 174 | currentIndex = page; 175 | }); 176 | widget.onPageChanged?.call(page); 177 | if (_transformationController!.value != Matrix4.identity()) { 178 | // animate the reset for the transformation of the interactive viewer 179 | 180 | _animation = Matrix4Tween( 181 | begin: _transformationController!.value, 182 | end: Matrix4.identity(), 183 | ).animate( 184 | CurveTween(curve: Curves.easeOut).animate(_animationController), 185 | ); 186 | 187 | _animationController.forward(from: 0); 188 | } 189 | } 190 | 191 | @override 192 | Widget build(BuildContext context) { 193 | return InteractiveViewerBoundary( 194 | controller: _transformationController, 195 | boundaryWidth: MediaQuery.of(context).size.width, 196 | onScaleChanged: _onScaleChanged, 197 | onLeftBoundaryHit: _onLeftBoundaryHit, 198 | onRightBoundaryHit: _onRightBoundaryHit, 199 | onNoBoundaryHit: _onNoBoundaryHit, 200 | maxScale: widget.maxScale, 201 | minScale: widget.minScale, 202 | child: CustomDismissible( 203 | onDismissed: () => Navigator.of(context).pop(), 204 | enabled: _enableDismiss, 205 | child: PageView.builder( 206 | onPageChanged: _onPageChanged, 207 | controller: _pageController, 208 | physics: _enablePageView ? null : const NeverScrollableScrollPhysics(), 209 | itemCount: widget.sources.length, 210 | itemBuilder: (BuildContext context, int index) { 211 | return GestureDetector( 212 | onDoubleTapDown: (TapDownDetails details) { 213 | _doubleTapLocalPosition = details.localPosition; 214 | }, 215 | onDoubleTap: onDoubleTap, 216 | child: widget.itemBuilder(context, index, index == currentIndex), 217 | ); 218 | }, 219 | ), 220 | ), 221 | ); 222 | } 223 | 224 | onDoubleTap() { 225 | Matrix4 matrix = _transformationController!.value.clone(); 226 | double currentScale = matrix.row0.x; 227 | 228 | double targetScale = widget.minScale; 229 | 230 | if (currentScale <= widget.minScale) { 231 | targetScale = widget.maxScale * 0.7; 232 | } 233 | 234 | double offSetX = targetScale == 1.0 ? 0.0 : - _doubleTapLocalPosition.dx * (targetScale - 1); 235 | double offSetY = targetScale == 1.0 ? 0.0 : - _doubleTapLocalPosition.dy * (targetScale - 1); 236 | 237 | matrix = Matrix4.fromList([targetScale, matrix.row1.x, matrix.row2.x, matrix.row3.x, matrix.row0.y, targetScale, matrix.row2.y, matrix.row3.y, matrix.row0.z, matrix.row1.z, targetScale, matrix.row3.z, offSetX, offSetY, matrix.row2.w, matrix.row3.w]); 238 | 239 | _animation = Matrix4Tween( 240 | begin: _transformationController!.value, 241 | end: matrix, 242 | ).animate( 243 | CurveTween(curve: Curves.easeOut).animate(_animationController), 244 | ); 245 | _animationController.forward(from: 0).whenComplete(() => _onScaleChanged(targetScale)); 246 | } 247 | } 248 | 249 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "2.5.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.1.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "1.2.0" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "1.15.0" 46 | fake_async: 47 | dependency: transitive 48 | description: 49 | name: fake_async 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "1.2.0" 53 | flutter: 54 | dependency: "direct main" 55 | description: flutter 56 | source: sdk 57 | version: "0.0.0" 58 | flutter_test: 59 | dependency: "direct dev" 60 | description: flutter 61 | source: sdk 62 | version: "0.0.0" 63 | matcher: 64 | dependency: transitive 65 | description: 66 | name: matcher 67 | url: "https://pub.flutter-io.cn" 68 | source: hosted 69 | version: "0.12.10" 70 | meta: 71 | dependency: transitive 72 | description: 73 | name: meta 74 | url: "https://pub.flutter-io.cn" 75 | source: hosted 76 | version: "1.3.0" 77 | path: 78 | dependency: transitive 79 | description: 80 | name: path 81 | url: "https://pub.flutter-io.cn" 82 | source: hosted 83 | version: "1.8.0" 84 | sky_engine: 85 | dependency: transitive 86 | description: flutter 87 | source: sdk 88 | version: "0.0.99" 89 | source_span: 90 | dependency: transitive 91 | description: 92 | name: source_span 93 | url: "https://pub.flutter-io.cn" 94 | source: hosted 95 | version: "1.8.0" 96 | stack_trace: 97 | dependency: transitive 98 | description: 99 | name: stack_trace 100 | url: "https://pub.flutter-io.cn" 101 | source: hosted 102 | version: "1.10.0" 103 | stream_channel: 104 | dependency: transitive 105 | description: 106 | name: stream_channel 107 | url: "https://pub.flutter-io.cn" 108 | source: hosted 109 | version: "2.1.0" 110 | string_scanner: 111 | dependency: transitive 112 | description: 113 | name: string_scanner 114 | url: "https://pub.flutter-io.cn" 115 | source: hosted 116 | version: "1.1.0" 117 | term_glyph: 118 | dependency: transitive 119 | description: 120 | name: term_glyph 121 | url: "https://pub.flutter-io.cn" 122 | source: hosted 123 | version: "1.2.0" 124 | test_api: 125 | dependency: transitive 126 | description: 127 | name: test_api 128 | url: "https://pub.flutter-io.cn" 129 | source: hosted 130 | version: "0.2.19" 131 | typed_data: 132 | dependency: transitive 133 | description: 134 | name: typed_data 135 | url: "https://pub.flutter-io.cn" 136 | source: hosted 137 | version: "1.3.0" 138 | vector_math: 139 | dependency: transitive 140 | description: 141 | name: vector_math 142 | url: "https://pub.flutter-io.cn" 143 | source: hosted 144 | version: "2.1.0" 145 | sdks: 146 | dart: ">=2.12.0 <3.0.0" 147 | flutter: ">=1.20.0" 148 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: interactiveviewer_gallery 2 | description: Image and video preview component that supports zoom and drag 3 | version: 0.6.0 4 | author: qq326646683<326646683@qq.com> 5 | homepage: https://github.com/qq326646683/interactiveviewer_gallery 6 | 7 | environment: 8 | sdk: '>=2.12.0 <3.0.0' 9 | flutter: ">=1.20.0 <3.0.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | 15 | dev_dependencies: 16 | flutter_test: 17 | sdk: flutter 18 | 19 | # For information on the generic Dart part of this file, see the 20 | # following page: https://dart.dev/tools/pub/pubspec 21 | 22 | # The following section is specific to Flutter. 23 | flutter: 24 | 25 | # To add assets to your package, add an assets section, like this: 26 | # assets: 27 | # - images/a_dot_burr.jpeg 28 | # - images/a_dot_ham.jpeg 29 | # 30 | # For details regarding assets in packages, see 31 | # https://flutter.dev/assets-and-images/#from-packages 32 | # 33 | # An image asset can refer to one or more resolution-specific "variants", see 34 | # https://flutter.dev/assets-and-images/#resolution-aware. 35 | 36 | # To add custom fonts to your package, add a fonts section here, 37 | # in this "flutter" section. Each entry in this list should have a 38 | # "family" key with the font family name, and a "fonts" key with a 39 | # list giving the asset and other descriptors for the font. For 40 | # example: 41 | # fonts: 42 | # - family: Schyler 43 | # fonts: 44 | # - asset: fonts/Schyler-Regular.ttf 45 | # - asset: fonts/Schyler-Italic.ttf 46 | # style: italic 47 | # - family: Trajan Pro 48 | # fonts: 49 | # - asset: fonts/TrajanPro.ttf 50 | # - asset: fonts/TrajanPro_Bold.ttf 51 | # weight: 700 52 | # 53 | # For details regarding fonts in packages, see 54 | # https://flutter.dev/custom-fonts/#from-packages 55 | --------------------------------------------------------------------------------