diff --git a/example/example.dart b/example/example.dart deleted file mode 100644 index 7fd56d1b..00000000 --- a/example/example.dart +++ /dev/null @@ -1,229 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:story_view/story_view.dart'; - -void main() => runApp(MyApp()); - -class MyApp extends StatelessWidget { - // This widget is the root of your application. - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'Story View Example', - debugShowCheckedModeBanner: false, - theme: ThemeData( - primarySwatch: Colors.green, - ), - home: Home()); - } -} - -class Home extends StatelessWidget { - final StoryController controller = StoryController(); - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text("Delicious Ghanaian Meals"), - ), - body: Container( - margin: EdgeInsets.all( - 8, - ), - child: ListView( - children: [ - Container( - height: 300, - child: StoryView( - controller: controller, - storyItems: [ - StoryItem.text( - title: - "Hello world!\nHave a look at some great Ghanaian delicacies. I'm sorry if your mouth waters. \n\nTap!", - backgroundColor: Colors.orange, - roundedTop: true, - ), - // StoryItem.inlineImage( - // NetworkImage( - // "https://image.ibb.co/gCZFbx/Banku-and-tilapia.jpg"), - // caption: Text( - // "Banku & Tilapia. The food to keep you charged whole day.\n#1 Local food.", - // style: TextStyle( - // color: Colors.white, - // backgroundColor: Colors.black54, - // fontSize: 17, - // ), - // ), - // ), - StoryItem.inlineImage( - url: - "https://image.ibb.co/cU4WGx/Omotuo-Groundnut-Soup-braperucci-com-1.jpg", - controller: controller, - caption: Text( - "Omotuo & Nkatekwan; You will love this meal if taken as supper.", - style: TextStyle( - color: Colors.white, - backgroundColor: Colors.black54, - fontSize: 17, - ), - ), - ), - StoryItem.inlineImage( - url: - "https://media.giphy.com/media/5GoVLqeAOo6PK/giphy.gif", - controller: controller, - caption: Text( - "Hektas, sektas and skatad", - style: TextStyle( - color: Colors.white, - backgroundColor: Colors.black54, - fontSize: 17, - ), - ), - ) - ], - onStoryShow: (storyItem, index) { - print("Showing a story"); - }, - onComplete: () { - print("Completed a cycle"); - }, - progressPosition: ProgressPosition.bottom, - repeat: false, - inline: true, - ), - ), - Material( - child: InkWell( - onTap: () { - Navigator.of(context).push( - MaterialPageRoute(builder: (context) => MoreStories())); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.black54, - borderRadius: - BorderRadius.vertical(bottom: Radius.circular(8))), - padding: EdgeInsets.symmetric(vertical: 8), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.arrow_forward, - color: Colors.white, - ), - SizedBox( - width: 16, - ), - Text( - "View more stories", - style: TextStyle(fontSize: 16, color: Colors.white), - ), - ], - ), - ), - ), - ), - ], - ), - ), - ); - } -} - -class MoreStories extends StatefulWidget { - @override - _MoreStoriesState createState() => _MoreStoriesState(); -} - -class _MoreStoriesState extends State { - final storyController = StoryController(); - - @override - void dispose() { - storyController.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text("More"), - ), - body: StoryView( - storyItems: [ - StoryItem.text( - title: "I guess you'd love to see more of our food. That's great.", - backgroundColor: Colors.blue, - ), - StoryItem.text( - title: "Nice!\n\nTap to continue.", - backgroundColor: Colors.red, - textStyle: TextStyle( - fontFamily: 'Dancing', - fontSize: 40, - ), - ), - StoryItem.pageImage( - url: - "https://image.ibb.co/cU4WGx/Omotuo-Groundnut-Soup-braperucci-com-1.jpg", - caption: Text( - "Still sampling", - style: TextStyle( - fontSize: 15, - color: Colors.white, - ), - textAlign: TextAlign.center, - ), - controller: storyController, - ), - StoryItem.pageImage( - url: "https://media.giphy.com/media/5GoVLqeAOo6PK/giphy.gif", - caption: Text( - "Working with gifs", - style: TextStyle( - fontSize: 15, - color: Colors.white, - ), - textAlign: TextAlign.center, - ), - controller: storyController), - StoryItem.pageImage( - url: "https://media.giphy.com/media/XcA8krYsrEAYXKf4UQ/giphy.gif", - caption: Text( - "Hello, from the other side", - style: TextStyle( - fontSize: 15, - color: Colors.white, - ), - textAlign: TextAlign.center, - ), - controller: storyController, - ), - StoryItem.pageImage( - url: "https://media.giphy.com/media/XcA8krYsrEAYXKf4UQ/giphy.gif", - caption: Text( - "Hello, from the other side2", - style: TextStyle( - fontSize: 15, - color: Colors.white, - ), - textAlign: TextAlign.center, - ), - controller: storyController, - ), - ], - onStoryShow: (storyItem, index) { - print("Showing a story"); - }, - onComplete: () { - print("Completed a cycle"); - }, - progressPosition: ProgressPosition.top, - repeat: false, - controller: storyController, - ), - ); - } -} diff --git a/example/story_view_example/.gitignore b/example/story_view_example/.gitignore new file mode 100644 index 00000000..3820a95c --- /dev/null +++ b/example/story_view_example/.gitignore @@ -0,0 +1,45 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ +/coverage/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/example/story_view_example/.metadata b/example/story_view_example/.metadata new file mode 100644 index 00000000..05a8ab44 --- /dev/null +++ b/example/story_view_example/.metadata @@ -0,0 +1,45 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "05db9689081f091050f01aed79f04dce0c750154" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 05db9689081f091050f01aed79f04dce0c750154 + base_revision: 05db9689081f091050f01aed79f04dce0c750154 + - platform: android + create_revision: 05db9689081f091050f01aed79f04dce0c750154 + base_revision: 05db9689081f091050f01aed79f04dce0c750154 + - platform: ios + create_revision: 05db9689081f091050f01aed79f04dce0c750154 + base_revision: 05db9689081f091050f01aed79f04dce0c750154 + - platform: linux + create_revision: 05db9689081f091050f01aed79f04dce0c750154 + base_revision: 05db9689081f091050f01aed79f04dce0c750154 + - platform: macos + create_revision: 05db9689081f091050f01aed79f04dce0c750154 + base_revision: 05db9689081f091050f01aed79f04dce0c750154 + - platform: web + create_revision: 05db9689081f091050f01aed79f04dce0c750154 + base_revision: 05db9689081f091050f01aed79f04dce0c750154 + - platform: windows + create_revision: 05db9689081f091050f01aed79f04dce0c750154 + base_revision: 05db9689081f091050f01aed79f04dce0c750154 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/example/story_view_example/README.md b/example/story_view_example/README.md new file mode 100644 index 00000000..256d7559 --- /dev/null +++ b/example/story_view_example/README.md @@ -0,0 +1,16 @@ +# story_view_example + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/example/story_view_example/analysis_options.yaml b/example/story_view_example/analysis_options.yaml new file mode 100644 index 00000000..0d290213 --- /dev/null +++ b/example/story_view_example/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/example/story_view_example/android/.gitignore b/example/story_view_example/android/.gitignore new file mode 100644 index 00000000..be3943c9 --- /dev/null +++ b/example/story_view_example/android/.gitignore @@ -0,0 +1,14 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java +.cxx/ + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/example/story_view_example/android/app/build.gradle.kts b/example/story_view_example/android/app/build.gradle.kts new file mode 100644 index 00000000..cbd94eb7 --- /dev/null +++ b/example/story_view_example/android/app/build.gradle.kts @@ -0,0 +1,44 @@ +plugins { + id("com.android.application") + id("kotlin-android") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.example.story_view_example" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.toString() + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.example.story_view_example" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/example/story_view_example/android/app/src/debug/AndroidManifest.xml b/example/story_view_example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 00000000..399f6981 --- /dev/null +++ b/example/story_view_example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/example/story_view_example/android/app/src/main/AndroidManifest.xml b/example/story_view_example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..5f768c45 --- /dev/null +++ b/example/story_view_example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/example/story_view_example/android/app/src/main/kotlin/com/example/story_view_example/MainActivity.kt b/example/story_view_example/android/app/src/main/kotlin/com/example/story_view_example/MainActivity.kt new file mode 100644 index 00000000..7b35e9ba --- /dev/null +++ b/example/story_view_example/android/app/src/main/kotlin/com/example/story_view_example/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.story_view_example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : FlutterActivity() diff --git a/example/story_view_example/android/app/src/main/res/drawable-v21/launch_background.xml b/example/story_view_example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 00000000..f74085f3 --- /dev/null +++ b/example/story_view_example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/story_view_example/android/app/src/main/res/drawable/launch_background.xml b/example/story_view_example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 00000000..304732f8 --- /dev/null +++ b/example/story_view_example/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/story_view_example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/example/story_view_example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000..db77bb4b Binary files /dev/null and b/example/story_view_example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/example/story_view_example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/example/story_view_example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000..17987b79 Binary files /dev/null and b/example/story_view_example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/example/story_view_example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/example/story_view_example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000..09d43914 Binary files /dev/null and b/example/story_view_example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/example/story_view_example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/example/story_view_example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..d5f1c8d3 Binary files /dev/null and b/example/story_view_example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/example/story_view_example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/example/story_view_example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000..4d6372ee Binary files /dev/null and b/example/story_view_example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/example/story_view_example/android/app/src/main/res/values-night/styles.xml b/example/story_view_example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 00000000..06952be7 --- /dev/null +++ b/example/story_view_example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/story_view_example/android/app/src/main/res/values/styles.xml b/example/story_view_example/android/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..cb1ef880 --- /dev/null +++ b/example/story_view_example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/story_view_example/android/app/src/profile/AndroidManifest.xml b/example/story_view_example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 00000000..399f6981 --- /dev/null +++ b/example/story_view_example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/example/story_view_example/android/build.gradle.kts b/example/story_view_example/android/build.gradle.kts new file mode 100644 index 00000000..dbee657b --- /dev/null +++ b/example/story_view_example/android/build.gradle.kts @@ -0,0 +1,24 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/example/story_view_example/android/gradle.properties b/example/story_view_example/android/gradle.properties new file mode 100644 index 00000000..f018a618 --- /dev/null +++ b/example/story_view_example/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true +android.enableJetifier=true diff --git a/example/story_view_example/android/gradle/wrapper/gradle-wrapper.properties b/example/story_view_example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..ac3b4792 --- /dev/null +++ b/example/story_view_example/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip diff --git a/example/story_view_example/android/settings.gradle.kts b/example/story_view_example/android/settings.gradle.kts new file mode 100644 index 00000000..fb605bc8 --- /dev/null +++ b/example/story_view_example/android/settings.gradle.kts @@ -0,0 +1,26 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.9.1" apply false + id("org.jetbrains.kotlin.android") version "2.1.0" apply false +} + +include(":app") diff --git a/example/story_view_example/ios/.gitignore b/example/story_view_example/ios/.gitignore new file mode 100644 index 00000000..7a7f9873 --- /dev/null +++ b/example/story_view_example/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/example/story_view_example/ios/Flutter/AppFrameworkInfo.plist b/example/story_view_example/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 00000000..1dc6cf76 --- /dev/null +++ b/example/story_view_example/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 13.0 + + diff --git a/example/story_view_example/ios/Flutter/Debug.xcconfig b/example/story_view_example/ios/Flutter/Debug.xcconfig new file mode 100644 index 00000000..ec97fc6f --- /dev/null +++ b/example/story_view_example/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/example/story_view_example/ios/Flutter/Release.xcconfig b/example/story_view_example/ios/Flutter/Release.xcconfig new file mode 100644 index 00000000..c4855bfe --- /dev/null +++ b/example/story_view_example/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/example/story_view_example/ios/Podfile b/example/story_view_example/ios/Podfile new file mode 100644 index 00000000..620e46eb --- /dev/null +++ b/example/story_view_example/ios/Podfile @@ -0,0 +1,43 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '13.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/example/story_view_example/ios/Runner.xcodeproj/project.pbxproj b/example/story_view_example/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 00000000..32c4ba87 --- /dev/null +++ b/example/story_view_example/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,616 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.storyViewExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.storyViewExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.storyViewExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.storyViewExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.storyViewExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.storyViewExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/example/story_view_example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/story_view_example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/example/story_view_example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/example/story_view_example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/story_view_example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/example/story_view_example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/story_view_example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/story_view_example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..f9b0d7c5 --- /dev/null +++ b/example/story_view_example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/story_view_example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/story_view_example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 00000000..e3773d42 --- /dev/null +++ b/example/story_view_example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/story_view_example/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/story_view_example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..1d526a16 --- /dev/null +++ b/example/story_view_example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/example/story_view_example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/story_view_example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/example/story_view_example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/story_view_example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/story_view_example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..f9b0d7c5 --- /dev/null +++ b/example/story_view_example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/story_view_example/ios/Runner/AppDelegate.swift b/example/story_view_example/ios/Runner/AppDelegate.swift new file mode 100644 index 00000000..62666446 --- /dev/null +++ b/example/story_view_example/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import Flutter +import UIKit + +@main +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d36b1fab --- /dev/null +++ b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 00000000..dc9ada47 Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 00000000..7353c41e Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 00000000..797d452e Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 00000000..6ed2d933 Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 00000000..4cd7b009 Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 00000000..fe730945 Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 00000000..321773cd Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 00000000..797d452e Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 00000000..502f463a Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 00000000..0ec30343 Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 00000000..0ec30343 Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 00000000..e9f5fea2 Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 00000000..84ac32ae Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 00000000..8953cba0 Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 00000000..0467bf12 Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/example/story_view_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 00000000..0bedcf2f --- /dev/null +++ b/example/story_view_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/example/story_view_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/example/story_view_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/example/story_view_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/example/story_view_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/example/story_view_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/example/story_view_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 00000000..89c2725b --- /dev/null +++ b/example/story_view_example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +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. \ No newline at end of file diff --git a/example/story_view_example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/example/story_view_example/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..f2e259c7 --- /dev/null +++ b/example/story_view_example/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/story_view_example/ios/Runner/Base.lproj/Main.storyboard b/example/story_view_example/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 00000000..f3c28516 --- /dev/null +++ b/example/story_view_example/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/story_view_example/ios/Runner/Info.plist b/example/story_view_example/ios/Runner/Info.plist new file mode 100644 index 00000000..fde22a1f --- /dev/null +++ b/example/story_view_example/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Story View Example + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + story_view_example + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + + + diff --git a/example/story_view_example/ios/Runner/Runner-Bridging-Header.h b/example/story_view_example/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 00000000..308a2a56 --- /dev/null +++ b/example/story_view_example/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/example/story_view_example/ios/RunnerTests/RunnerTests.swift b/example/story_view_example/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 00000000..86a7c3b1 --- /dev/null +++ b/example/story_view_example/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/example/story_view_example/lib/stories_page.dart b/example/story_view_example/lib/stories_page.dart new file mode 100644 index 00000000..f840262c --- /dev/null +++ b/example/story_view_example/lib/stories_page.dart @@ -0,0 +1,57 @@ +import 'package:flutter/material.dart'; +import 'package:story_view/story_view.dart'; + +void main() { + runApp(const StoriesPage()); +} + +class StoriesPage extends StatefulWidget { + const StoriesPage({super.key}); + + @override + State createState() => _StoriesPageState(); +} + +class _StoriesPageState extends State { + final StoryController _storyController = StoryController(); + + @override + void dispose() { + _storyController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return MaterialApp( + home: Scaffold( + backgroundColor: Colors.black, + body: StoryView( + storyItems: [ + StoryItem.pageImage( + url: + 'https://img.freepik.com/free-photo/closeup-scarlet-macaw-from-side-view-scarlet-macaw-closeup-head_488145-3540.jpg?semt=ais_incoming&w=740&q=80', + controller: _storyController, + ), + StoryItem.pageImage( + url: + 'https://raw.githubusercontent.com/Comfy-Org/example_workflows/refs/heads/main/image_to_image/workflow.png', + controller: _storyController, + ), + StoryItem.pageImage( + url: + 'https://img.freepik.com/free-photo/closeup-scarlet-macaw-from-side-view-scarlet-macaw-closeup-head_488145-3540.jpg?semt=ais_incoming&w=740&q=80', + controller: _storyController, + ), + StoryItem.pageImage( + url: + 'https://raw.githubusercontent.com/Comfy-Org/example_workflows/refs/heads/main/image_to_image/workflow.png', + controller: _storyController, + ), + ], + controller: _storyController, + ), + ), + ); + } +} diff --git a/example/story_view_example/pubspec.lock b/example/story_view_example/pubspec.lock new file mode 100644 index 00000000..b7ea921b --- /dev/null +++ b/example/story_view_example/pubspec.lock @@ -0,0 +1,574 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + url: "https://pub.dev" + source: hosted + version: "2.13.0" + better_player_plus: + dependency: transitive + description: + name: better_player_plus + sha256: "8670ccf8fead5572bfcd1568c008f72f3202593ef07fc90921e2cbcaac77852b" + url: "https://pub.dev" + source: hosted + version: "1.1.5" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + characters: + dependency: transitive + description: + name: characters + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + url: "https://pub.dev" + source: hosted + version: "3.0.6" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + dbus: + dependency: transitive + description: + name: dbus + sha256: "79e0c23480ff85dc68de79e2cd6334add97e48f7f4865d17686dd6ea81a47e8c" + url: "https://pub.dev" + source: hosted + version: "0.7.11" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + ffi: + dependency: transitive + description: + name: ffi + sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_cache_manager: + dependency: transitive + description: + name: flutter_cache_manager + sha256: "400b6592f16a4409a7f2bb929a9a7e38c72cceb8ffb99ee57bbf2cb2cecf8386" + url: "https://pub.dev" + source: hosted + version: "3.4.1" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" + source: hosted + version: "5.0.0" + flutter_localizations: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + flutter_widget_from_html_core: + dependency: transitive + description: + name: flutter_widget_from_html_core + sha256: "1120ee6ed3509ceff2d55aa6c6cbc7b6b1291434422de2411b5a59364dd6ff03" + url: "https://pub.dev" + source: hosted + version: "0.17.0" + html: + dependency: transitive + description: + name: html + sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602" + url: "https://pub.dev" + source: hosted + version: "0.15.6" + http: + dependency: transitive + description: + name: http + sha256: bb2ce4590bc2667c96f318d68cac1b5a7987ec819351d32b1c987239a815e007 + url: "https://pub.dev" + source: hosted + version: "1.5.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + intl: + dependency: transitive + description: + name: intl + sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" + url: "https://pub.dev" + source: hosted + version: "0.20.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 + url: "https://pub.dev" + source: hosted + version: "5.1.1" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" + source: hosted + version: "0.12.17" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" + url: "https://pub.dev" + source: hosted + version: "1.17.0" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + sha256: f69da0d3189a4b4ceaeb1a3defb0f329b3b352517f52bed4290f83d4f06bc08d + url: "https://pub.dev" + source: hosted + version: "9.0.0" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: "202a487f08836a592a6bd4f901ac69b3a8f146af552bbd14407b6b41e1c3f086" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "993381400e94d18469750e5b9dcb8206f15bc09f9da86b9e44a9b0092a0066db" + url: "https://pub.dev" + source: hosted + version: "2.2.18" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "16eef174aacb07e09c351502740fa6254c165757638eba1e9116b0a781201bbd" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "1a97266a94f7350d30ae522c0af07890c70b8e62c71e8e3920d1db4d23c057d1" + url: "https://pub.dev" + source: hosted + version: "7.0.1" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + rxdart: + dependency: transitive + description: + name: rxdart + sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962" + url: "https://pub.dev" + source: hosted + version: "0.28.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" + source: hosted + version: "1.10.1" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + sqflite: + dependency: transitive + description: + name: sqflite + sha256: e2297b1da52f127bc7a3da11439985d9b536f75070f3325e62ada69a5c585d03 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + sqflite_android: + dependency: transitive + description: + name: sqflite_android + sha256: ecd684501ebc2ae9a83536e8b15731642b9570dc8623e0073d227d0ee2bfea88 + url: "https://pub.dev" + source: hosted + version: "2.4.2+2" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + sha256: "6ef422a4525ecc601db6c0a2233ff448c731307906e92cabc9ba292afaae16a6" + url: "https://pub.dev" + source: hosted + version: "2.5.6" + sqflite_darwin: + dependency: transitive + description: + name: sqflite_darwin + sha256: "279832e5cde3fe99e8571879498c9211f3ca6391b0d818df4e17d9fff5c6ccb3" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + sqflite_platform_interface: + dependency: transitive + description: + name: sqflite_platform_interface + sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920" + url: "https://pub.dev" + source: hosted + version: "2.4.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + story_view: + dependency: "direct main" + description: + path: "../.." + relative: true + source: path + version: "0.17.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: c254ade258ec8282947a0acbbc90b9575b4f19673533ee46f2f6e9b3aeefd7c0 + url: "https://pub.dev" + source: hosted + version: "3.4.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 + url: "https://pub.dev" + source: hosted + version: "0.7.7" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + uuid: + dependency: transitive + description: + name: uuid + sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff + url: "https://pub.dev" + source: hosted + version: "4.5.1" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b + url: "https://pub.dev" + source: hosted + version: "2.2.0" + visibility_detector: + dependency: transitive + description: + name: visibility_detector + sha256: dd5cc11e13494f432d15939c3aa8ae76844c42b723398643ce9addb88a5ed420 + url: "https://pub.dev" + source: hosted + version: "0.4.0+2" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" + url: "https://pub.dev" + source: hosted + version: "15.0.2" + wakelock_plus: + dependency: transitive + description: + name: wakelock_plus + sha256: "9296d40c9adbedaba95d1e704f4e0b434be446e2792948d0e4aa977048104228" + url: "https://pub.dev" + source: hosted + version: "1.4.0" + wakelock_plus_platform_interface: + dependency: transitive + description: + name: wakelock_plus_platform_interface + sha256: "036deb14cd62f558ca3b73006d52ce049fabcdcb2eddfe0bf0fe4e8a943b5cf2" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + win32: + dependency: transitive + description: + name: win32 + sha256: "66814138c3562338d05613a6e368ed8cfb237ad6d64a9e9334be3f309acfca03" + url: "https://pub.dev" + source: hosted + version: "5.14.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025" + url: "https://pub.dev" + source: hosted + version: "6.6.1" +sdks: + dart: ">=3.9.0 <4.0.0" + flutter: ">=3.35.0" diff --git a/example/story_view_example/pubspec.yaml b/example/story_view_example/pubspec.yaml new file mode 100644 index 00000000..a90c10ae --- /dev/null +++ b/example/story_view_example/pubspec.yaml @@ -0,0 +1,91 @@ +name: story_view_example +description: "A new Flutter project." +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: ^3.9.0 + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + story_view: + path: ../../ + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^5.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package diff --git a/lib/controller/story_controller.dart b/lib/controller/story_controller.dart index 9636aa75..28679dfa 100644 --- a/lib/controller/story_controller.dart +++ b/lib/controller/story_controller.dart @@ -1,6 +1,6 @@ import 'package:rxdart/rxdart.dart'; -enum PlaybackState { pause, play, next, previous } +import '../utils/enum.dart'; /// Controller to sync playback between animated child (story) views. This /// helps make sure when stories are paused, the animation (gifs/slides) are diff --git a/lib/story_view.dart b/lib/story_view.dart index bf32c248..fb67c379 100644 --- a/lib/story_view.dart +++ b/lib/story_view.dart @@ -1,5 +1,10 @@ -export 'widgets/story_image.dart'; -export 'widgets/story_video.dart'; +export 'widgets/image/story_image.dart'; +export 'widgets/video/story_video.dart'; export 'widgets/story_view.dart'; export 'controller/story_controller.dart'; -export 'utils.dart'; +export 'utils/utils.dart'; +export 'utils/enum.dart'; +export 'utils/video_loader.dart'; +export 'utils/page_data.dart'; +export 'widgets/page_bar.dart'; +export 'widgets/story_item.dart'; diff --git a/lib/utils/enum.dart b/lib/utils/enum.dart new file mode 100644 index 00000000..b24cd74c --- /dev/null +++ b/lib/utils/enum.dart @@ -0,0 +1,9 @@ +enum PlaybackState { pause, play, next, previous } + +enum ProgressPosition { top, bottom, none } + +enum LoadState { loading, success, failure } + +enum Direction { up, down, left, right } + +enum StoryItemType { text, image, video } diff --git a/lib/utils/image_loader.dart b/lib/utils/image_loader.dart new file mode 100644 index 00000000..1644df95 --- /dev/null +++ b/lib/utils/image_loader.dart @@ -0,0 +1,78 @@ +import 'dart:async'; +import 'dart:ui' as ui; + +import 'package:flutter/material.dart'; +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; + +import '../utils/enum.dart'; + +/// Utility to load image (gif, png, jpg, etc) media just once. Resource is +/// cached to disk with default configurations of [DefaultCacheManager]. +class ImageLoader { + final String url; + final Map? requestHeaders; + + ui.Codec? frames; + LoadState state = LoadState.loading; + StreamSubscription? _subscription; + + ImageLoader(this.url, {this.requestHeaders}); + + /// Load image from disk cache first, if not found then load from network. + /// `onComplete` is called when [imageBytes] become available. + void loadImage(VoidCallback onComplete) { + // 1. Check if already loaded to avoid redundant work + if (this.frames != null) { + this.state = LoadState.success; + onComplete(); + return; // Important: Stop execution here + } + + this.state = LoadState.loading; + + // 2. Cancel previous subscription if exists + _subscription?.cancel(); + + final stream = DefaultCacheManager().getFileStream( + this.url, + headers: this.requestHeaders, + ); + + _subscription = stream.listen( + (fileResponse) async { + if (fileResponse is! FileInfo) return; + + // Prevent reloading if frames were populated by a previous event + if (this.frames != null) return; + + try { + // 3. Use Async read to prevent UI thread freeze + final imageBytes = await fileResponse.file.readAsBytes(); + + final codec = await ui.instantiateImageCodec(imageBytes); + + this.frames = codec; + this.state = LoadState.success; + onComplete(); + } catch (e) { + _handleError(onComplete); + } + }, + onError: (error) { + _handleError(onComplete); + }, + ); + } + + void _handleError(VoidCallback onComplete) { + this.state = LoadState.failure; + onComplete(); + } + + /// Clean up resources to prevent memory leaks + void dispose() { + _subscription?.cancel(); + frames?.dispose(); + frames = null; + } +} \ No newline at end of file diff --git a/lib/utils/page_data.dart b/lib/utils/page_data.dart new file mode 100644 index 00000000..ab7cb747 --- /dev/null +++ b/lib/utils/page_data.dart @@ -0,0 +1,6 @@ +class PageData { + Duration duration; + bool shown; + + PageData(this.duration, this.shown); +} diff --git a/lib/utils.dart b/lib/utils/utils.dart similarity index 81% rename from lib/utils.dart rename to lib/utils/utils.dart index 54a37b38..3edf4f8f 100644 --- a/lib/utils.dart +++ b/lib/utils/utils.dart @@ -1,6 +1,4 @@ -enum LoadState { loading, success, failure } - -enum Direction { up, down, left, right } +import 'enum.dart'; class VerticalDragInfo { bool cancel = false; diff --git a/lib/utils/video_loader.dart b/lib/utils/video_loader.dart new file mode 100644 index 00000000..70ab7521 --- /dev/null +++ b/lib/utils/video_loader.dart @@ -0,0 +1,70 @@ +import 'dart:async'; +import 'dart:io'; +import 'dart:ui'; + +import 'package:flutter_cache_manager/flutter_cache_manager.dart'; + +import '../utils/enum.dart'; + +class VideoLoader { + final String url; + final Map? requestHeaders; + + File? videoFile; + LoadState state = LoadState.loading; + + StreamSubscription? _subscription; + + VideoLoader(this.url, {this.requestHeaders}); + + void loadVideo(VoidCallback onComplete, {VoidCallback? onLoading}) { + // 1. Notify loading state + onLoading?.call(); + this.state = LoadState.loading; + + // 2. Check if already loaded + if (this.videoFile != null) { + this.state = LoadState.success; + onComplete(); + return; // Important: Stop execution here if already loaded + } + + // 3. Start stream + try { + _subscription?.cancel(); + + final Stream stream = DefaultCacheManager().getFileStream( + this.url, + headers: this.requestHeaders, + ); + + _subscription = stream.listen( + (fileResponse) { + if (fileResponse is FileInfo) { + if (this.videoFile == null) { + this.videoFile = fileResponse.file; + this.state = LoadState.success; + onComplete(); + } + } + }, + onError: (error) { + this.state = LoadState.failure; + // You might want to add an onError callback parameter to loadVideo + // to notify the UI of the failure. + }, + ); + } catch (e) { + this.state = LoadState.failure; + } + } + + void showLoading() { + this.state = LoadState.loading; + } + + /// Cancel active downloads/listeners to prevent memory leaks + void dispose() { + _subscription?.cancel(); + } +} diff --git a/lib/widgets/image/image_content_view.dart b/lib/widgets/image/image_content_view.dart new file mode 100644 index 00000000..02c77026 --- /dev/null +++ b/lib/widgets/image/image_content_view.dart @@ -0,0 +1,53 @@ +import 'dart:ui' as ui; + +import 'package:flutter/material.dart'; + +import '../../utils/enum.dart'; +import '../../utils/image_loader.dart'; + +class ImageContentView extends StatelessWidget { + final ImageLoader imageLoader; + final BoxFit? fit; + final ui.Image? currentFrame; + final Widget? loadingWidget; + final Widget? errorWidget; + + const ImageContentView({ + Key? key, + required this.imageLoader, + required this.fit, + required this.currentFrame, + this.loadingWidget, + this.errorWidget, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + switch (imageLoader.state) { + case LoadState.success: + return RawImage(image: currentFrame, fit: fit); + case LoadState.failure: + return Center( + child: + errorWidget ?? + const Text( + "Image failed to load.", + style: TextStyle(color: Colors.white), + ), + ); + default: + return Center( + child: + loadingWidget ?? + const SizedBox( + width: 70, + height: 70, + child: CircularProgressIndicator( + valueColor: AlwaysStoppedAnimation(Colors.white), + strokeWidth: 3, + ), + ), + ); + } + } +} diff --git a/lib/widgets/image/story_image.dart b/lib/widgets/image/story_image.dart new file mode 100644 index 00000000..3d5ec9d4 --- /dev/null +++ b/lib/widgets/image/story_image.dart @@ -0,0 +1,145 @@ +import 'dart:async'; +import 'dart:ui' as ui; + +import 'package:flutter/material.dart'; + +import '../../controller/story_controller.dart'; +import '../../utils/enum.dart'; +import '../../utils/image_loader.dart'; +import 'image_content_view.dart'; + +/// Widget to display animated gifs or still images. Shows a loader while image +/// is being loaded. Listens to playback states from [controller] to pause and +/// forward animated media. +class StoryImage extends StatefulWidget { + final ImageLoader imageLoader; + final BoxFit? fit; + final StoryController? controller; + final Widget? loadingWidget; + final Widget? errorWidget; + + const StoryImage( + this.imageLoader, { + super.key, + this.controller, + this.fit, + this.loadingWidget, + this.errorWidget, + }); + + /// Use this shorthand to fetch images/gifs from the provided [url] + factory StoryImage.url( + String url, { + StoryController? controller, + Map? requestHeaders, + BoxFit fit = BoxFit.fitWidth, + Widget? loadingWidget, + Widget? errorWidget, + Key? key, + }) { + return StoryImage( + ImageLoader(url, requestHeaders: requestHeaders), + controller: controller, + fit: fit, + loadingWidget: loadingWidget, + errorWidget: errorWidget, + key: key, + ); + } + + @override + State createState() => _StoryImageState(); +} + +class _StoryImageState extends State { + ui.Image? _currentFrame; + Timer? _frameTimer; + StreamSubscription? _streamSubscription; + + // Track local state to avoid accessing stream.value directly + PlaybackState _currentPlaybackState = PlaybackState.play; + + @override + void initState() { + super.initState(); + _setupControllerListener(); + _loadImage(); + } + + @override + void dispose() { + widget.imageLoader.dispose(); + _frameTimer?.cancel(); + _streamSubscription?.cancel(); + super.dispose(); + } + + void _setupControllerListener() { + if (widget.controller == null) return; + + // Initially pause until loaded + widget.controller!.pause(); + + _streamSubscription = widget.controller!.playbackNotifier.listen((status) { + _currentPlaybackState = status; + + // If it's a static image (no frames), we don't need animation logic + if (widget.imageLoader.frames == null) return; + + if (status == PlaybackState.pause) { + _frameTimer?.cancel(); + } else { + _animate(); + } + }); + } + + void _loadImage() { + widget.imageLoader.loadImage(() async { + if (!mounted) return; + + if (widget.imageLoader.state == LoadState.success) { + widget.controller?.play(); + _animate(); + } else { + // Refresh to show errorWidget + setState(() {}); + } + }); + } + + Future _animate() async { + _frameTimer?.cancel(); + + // Don't animate if paused or if there are no frames to animate + if (_currentPlaybackState == PlaybackState.pause || + widget.imageLoader.frames == null) { + return; + } + + final nextFrame = await widget.imageLoader.frames!.getNextFrame(); + + if (!mounted) return; + + setState(() { + _currentFrame = nextFrame.image; + }); + + if (nextFrame.duration > Duration.zero) { + _frameTimer = Timer(nextFrame.duration, _animate); + } + } + + @override + Widget build(BuildContext context) { + return SizedBox.expand( + child: ImageContentView( + imageLoader: widget.imageLoader, + fit: widget.fit, + currentFrame: _currentFrame, + loadingWidget: widget.loadingWidget, + errorWidget: widget.errorWidget, + ), + ); + } +} diff --git a/lib/widgets/page_bar.dart b/lib/widgets/page_bar.dart new file mode 100644 index 00000000..150011e3 --- /dev/null +++ b/lib/widgets/page_bar.dart @@ -0,0 +1,81 @@ +import 'package:flutter/material.dart'; +import '../utils/page_data.dart'; +import 'story_progress_indicator.dart'; + +/// Horizontal bar displaying a row of [StoryProgressIndicator] based on the +/// [pages] provided. +class PageBar extends StatelessWidget { + final List pages; + final Animation? animation; + final double indicatorHeight; + final Color? indicatorColor; + final Color? indicatorForegroundColor; + final bool isRtl; + + const PageBar( + this.pages, + this.animation, { + super.key, + this.isRtl = false, // Added default + this.indicatorHeight = 5, + this.indicatorColor, + this.indicatorForegroundColor, + }); + + double _getSpacing(int count) { + if (count > 15) return 2.0; + if (count > 10) return 3.0; + return 4.0; + } + + @override + Widget build(BuildContext context) { + final spacing = _getSpacing(pages.length); + + // Find the index of the first page that hasn't been shown yet. + // If all are shown, -1 indicates the story is complete. + final activeIndex = pages.indexWhere((it) => !it.shown); + + return AnimatedBuilder( + animation: animation ?? const AlwaysStoppedAnimation(0), + builder: (context, child) { + return Row( + children: List.generate(pages.length, (index) { + return Expanded( + child: Padding( + // Only add padding to the start of items after the first one + padding: EdgeInsetsDirectional.only( + start: index == 0 ? 0 : spacing, + ), + child: StoryProgressIndicator( + _getIndicatorValue(index, activeIndex), + indicatorHeight: indicatorHeight, + indicatorColor: indicatorColor, + indicatorForegroundColor: indicatorForegroundColor, + isRtl: isRtl, + ), + ), + ); + }), + ); + }, + ); + } + + double _getIndicatorValue(int index, int activeIndex) { + // If the activeIndex is -1, it means all pages are shown (progress 1.0) + // OR no pages are found. Assuming valid list: + if (activeIndex == -1) return 1.0; + + if (index < activeIndex) { + // Page already shown + return 1.0; + } else if (index == activeIndex) { + // Currently playing page + return animation?.value ?? 0.0; + } else { + // Future page + return 0.0; + } + } +} \ No newline at end of file diff --git a/lib/widgets/story_image.dart b/lib/widgets/story_image.dart deleted file mode 100644 index 0d50f489..00000000 --- a/lib/widgets/story_image.dart +++ /dev/null @@ -1,256 +0,0 @@ -import 'dart:async'; -import 'dart:ui' as ui; - -import 'package:flutter/material.dart'; -import 'package:flutter_cache_manager/flutter_cache_manager.dart'; - -import '../utils.dart'; -import '../controller/story_controller.dart'; - -/// Utitlity to load image (gif, png, jpg, etc) media just once. Resource is -/// cached to disk with default configurations of [DefaultCacheManager]. -class ImageLoader { - ui.Codec? frames; - - String url; - - Map? requestHeaders; - - LoadState state = LoadState.loading; // by default - - ImageLoader(this.url, {this.requestHeaders}); - - /// Load image from disk cache first, if not found then load from network. - /// `onComplete` is called when [imageBytes] become available. - void loadImage(VoidCallback onComplete) { - if (this.frames != null) { - this.state = LoadState.success; - onComplete(); - } - - final fileStream = DefaultCacheManager().getFileStream(this.url, - headers: this.requestHeaders as Map?); - - fileStream.listen( - (fileResponse) { - if (!(fileResponse is FileInfo)) return; - // the reason for this is that, when the cache manager fetches - // the image again from network, the provided `onComplete` should - // not be called again - if (this.frames != null) { - return; - } - - final imageBytes = fileResponse.file.readAsBytesSync(); - - this.state = LoadState.success; - - ui.instantiateImageCodec(imageBytes).then((codec) { - this.frames = codec; - onComplete(); - }, onError: (error) { - this.state = LoadState.failure; - onComplete(); - }); - }, - onError: (error) { - this.state = LoadState.failure; - onComplete(); - }, - ); - } -} - -/// Widget to display animated gifs or still images. Shows a loader while image -/// is being loaded. Listens to playback states from [controller] to pause and -/// forward animated media. -class StoryImage extends StatefulWidget { - final ImageLoader imageLoader; - - final BoxFit? fit; - - final StoryController? controller; - final Widget? loadingWidget; - final Widget? errorWidget; - - StoryImage( - this.imageLoader, { - Key? key, - this.controller, - this.fit, - this.loadingWidget, - this.errorWidget, - }) : super(key: key ?? UniqueKey()); - - /// Use this shorthand to fetch images/gifs from the provided [url] - factory StoryImage.url( - String url, { - StoryController? controller, - Map? requestHeaders, - BoxFit fit = BoxFit.fitWidth, - Widget? loadingWidget, - Widget? errorWidget, - Key? key, - }) { - return StoryImage( - ImageLoader( - url, - requestHeaders: requestHeaders, - ), - controller: controller, - fit: fit, - loadingWidget: loadingWidget, - errorWidget: errorWidget, - key: key, - ); - } - - @override - State createState() => StoryImageState(); -} - -class StoryImageState extends State { - ui.Image? currentFrame; - - Timer? _timer; - - StreamSubscription? _streamSubscription; - - @override - void initState() { - super.initState(); - - if (widget.controller != null) { - this._streamSubscription = - widget.controller!.playbackNotifier.listen((playbackState) { - // for the case of gifs we need to pause/play - if (widget.imageLoader.frames == null) { - return; - } - - if (playbackState == PlaybackState.pause) { - this._timer?.cancel(); - } else { - forward(); - } - }); - } - - widget.controller?.pause(); - - widget.imageLoader.loadImage(() async { - if (mounted) { - if (widget.imageLoader.state == LoadState.success) { - widget.controller?.play(); - forward(); - } else { - // refresh to show error - setState(() {}); - } - } - }); - } - - @override - void dispose() { - _timer?.cancel(); - _streamSubscription?.cancel(); - - super.dispose(); - } - - @override - void setState(fn) { - if (mounted) { - super.setState(fn); - } - } - - void forward() async { - this._timer?.cancel(); - - if (widget.controller != null && - widget.controller!.playbackNotifier.stream.value == - PlaybackState.pause) { - return; - } - - final nextFrame = await widget.imageLoader.frames!.getNextFrame(); - - this.currentFrame = nextFrame.image; - - if (nextFrame.duration > Duration(milliseconds: 0)) { - this._timer = Timer(nextFrame.duration, forward); - } - - setState(() {}); - } - - @override - Widget build(BuildContext context) { - return Container( - width: double.infinity, - height: double.infinity, - child: ImageContentView( - imageLoader: widget.imageLoader, - fit: widget.fit, - currentFrame: this.currentFrame, - loadingWidget: widget.loadingWidget, - errorWidget: widget.errorWidget, - ), - ); - } -} - -/** - * @name ImageContentView - * @description Stateless widget that displays an image based on loading state: success, failure, or loading. - */ -class ImageContentView extends StatelessWidget { - final ImageLoader imageLoader; - final BoxFit? fit; - final ui.Image? currentFrame; - final Widget? loadingWidget; - final Widget? errorWidget; - - const ImageContentView({ - Key? key, - required this.imageLoader, - required this.fit, - required this.currentFrame, - this.loadingWidget, - this.errorWidget, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - switch (imageLoader.state) { - case LoadState.success: - return RawImage( - image: currentFrame, - fit: fit, - ); - case LoadState.failure: - return Center( - child: errorWidget ?? - const Text( - "Image failed to load.", - style: TextStyle(color: Colors.white), - ), - ); - default: - return Center( - child: loadingWidget ?? - const SizedBox( - width: 70, - height: 70, - child: CircularProgressIndicator( - valueColor: AlwaysStoppedAnimation(Colors.white), - strokeWidth: 3, - ), - ), - ); - } - } -} - diff --git a/lib/widgets/story_item.dart b/lib/widgets/story_item.dart new file mode 100644 index 00000000..24358d55 --- /dev/null +++ b/lib/widgets/story_item.dart @@ -0,0 +1,152 @@ +import 'package:flutter/material.dart'; + +import '../story_view.dart'; + +class StoryItem { + final Duration storyDuration; + bool isSeenBefore; + final Widget view; + final StoryItemType type; + final String url; + + StoryItem( + this.view, { + required this.storyDuration, + required this.type, + required this.url, + this.isSeenBefore = false, + }); + + factory StoryItem.text({ + required String title, + required Color backgroundColor, + Key? key, + TextStyle? textStyle, + bool isSeenBefore = false, + bool roundedTop = false, + bool roundedBottom = false, + EdgeInsetsGeometry? textOuterPadding, + Duration? storyDuration, + }) { + final bool isDark = backgroundColor.computeLuminance() < 0.5; + final Color textColor = isDark ? Colors.white : Colors.black; + + return StoryItem( + Container( + key: key, + decoration: BoxDecoration( + color: backgroundColor, + borderRadius: BorderRadius.vertical( + top: Radius.circular(roundedTop ? 8 : 0), + bottom: Radius.circular(roundedBottom ? 8 : 0), + ), + ), + padding: + textOuterPadding ?? + const EdgeInsets.symmetric(horizontal: 24, vertical: 16), + child: Center( + child: Text( + title, + textAlign: TextAlign.center, + style: + textStyle?.copyWith(color: textColor) ?? + TextStyle(color: textColor, fontSize: 18), + ), + ), + ), + isSeenBefore: isSeenBefore, + storyDuration: storyDuration ?? const Duration(seconds: 3), + type: StoryItemType.text, + url: title, + ); + } + + factory StoryItem.pageImage({ + required String url, + required StoryController controller, + Key? key, + BoxFit imageFit = BoxFit.fitWidth, + Widget? caption, + Widget? header, + bool isSeenBefore = false, + Map? requestHeaders, + Widget? loadingWidget, + Widget? errorWidget, + Duration? storyDuration, + }) { + return StoryItem( + _buildStoryView( + caption: caption, + header: header, + child: StoryImage.url( + url, + key: key, + controller: controller, + fit: imageFit, + requestHeaders: requestHeaders, + loadingWidget: loadingWidget, + errorWidget: errorWidget, + ), + ), + isSeenBefore: isSeenBefore, + storyDuration: storyDuration ?? const Duration(seconds: 3), + type: StoryItemType.image, + url: url, + ); + } + + factory StoryItem.pageVideo( + String url, { + required StoryController controller, + required Duration storyDuration, + Key? key, + Widget? caption, + Widget? header, + bool isSeenBefore = false, + Map? requestHeaders, + Widget? loadingWidget, + Widget? errorWidget, + }) { + return StoryItem( + _buildStoryView( + caption: caption, + header: header, + child: StoryVideo.url( + url, + key: key, + controller: controller, + requestHeaders: requestHeaders, + loadingWidget: loadingWidget, + errorWidget: errorWidget, + ), + ), + isSeenBefore: isSeenBefore, + storyDuration: storyDuration, + type: StoryItemType.video, + url: url, + ); + } + + static Widget _buildStoryView({ + required Widget child, + Widget? caption, + Widget? header, + }) { + return Container( + color: Colors.black, + child: Stack( + children: [ + child, + if (header != null) + SafeArea( + child: Align(alignment: Alignment.topCenter, child: header), + ), + if (caption != null) + SafeArea( + child: Align(alignment: Alignment.bottomCenter, child: caption), + ), + ], + ), + ); + } +} diff --git a/lib/widgets/story_progress_indicator.dart b/lib/widgets/story_progress_indicator.dart new file mode 100644 index 00000000..8186859e --- /dev/null +++ b/lib/widgets/story_progress_indicator.dart @@ -0,0 +1,69 @@ +import 'package:flutter/material.dart'; + +/// Custom progress bar. Supposed to be lighter than the +/// original [ProgressIndicator], and rounded at the sides. +class StoryProgressIndicator extends StatelessWidget { + /// From `0.0` to `1.0`, determines the progress of the indicator + final double value; + final double indicatorHeight; + final Color? indicatorColor; + final Color? indicatorForegroundColor; + final bool isRtl; + + StoryProgressIndicator( + this.value, { + required this.isRtl, + this.indicatorHeight = 5, + this.indicatorColor, + this.indicatorForegroundColor, + }); + + @override + Widget build(BuildContext context) { + return CustomPaint( + size: Size.fromHeight(this.indicatorHeight), + foregroundPainter: IndicatorOval( + color: + this.indicatorForegroundColor ?? + Colors.white.withValues(alpha: 0.8), + widthFactor: this.value, + isRtl: isRtl, + ), + painter: IndicatorOval( + color: this.indicatorColor ?? Colors.white.withValues(alpha: 0.4), + widthFactor: 1.0, + isRtl: isRtl, + ), + ); + } +} + +class IndicatorOval extends CustomPainter { + final Color color; + final double widthFactor; + final bool isRtl; + + IndicatorOval({ + required this.color, + required this.widthFactor, + required this.isRtl, + }); + + @override + void paint(Canvas canvas, Size size) { + final paint = Paint()..color = this.color; + final double dx = isRtl ? size.width * (1 - widthFactor) : 0.0; + canvas.drawRRect( + RRect.fromRectAndRadius( + Rect.fromLTWH(dx, 0, size.width * this.widthFactor, size.height), + Radius.circular(3), + ), + paint, + ); + } + + @override + bool shouldRepaint(CustomPainter oldDelegate) { + return true; + } +} diff --git a/lib/widgets/story_video.dart b/lib/widgets/story_video.dart deleted file mode 100644 index ca66335b..00000000 --- a/lib/widgets/story_video.dart +++ /dev/null @@ -1,193 +0,0 @@ -import 'dart:async'; -import 'dart:io'; - -import 'package:flutter/material.dart'; -import 'package:flutter_cache_manager/flutter_cache_manager.dart'; -import 'package:video_player/video_player.dart'; - -import '../utils.dart'; -import '../controller/story_controller.dart'; - -class VideoLoader { - String url; - - File? videoFile; - - Map? requestHeaders; - - LoadState state = LoadState.loading; - - VideoLoader(this.url, {this.requestHeaders}); - - void loadVideo(VoidCallback onComplete) { - if (this.videoFile != null) { - this.state = LoadState.success; - onComplete(); - } - - final fileStream = DefaultCacheManager() - .getFileStream(this.url, headers: this.requestHeaders as Map?); - - fileStream.listen((fileResponse) { - if (fileResponse is FileInfo) { - if (this.videoFile == null) { - this.state = LoadState.success; - this.videoFile = fileResponse.file; - onComplete(); - } - } - }); - } -} - -class StoryVideo extends StatefulWidget { - final StoryController? storyController; - final VideoLoader videoLoader; - final Widget? loadingWidget; - final Widget? errorWidget; - - StoryVideo(this.videoLoader, { - Key? key, - this.storyController, - this.loadingWidget, - this.errorWidget, - }) : super(key: key ?? UniqueKey()); - - static StoryVideo url(String url, { - StoryController? controller, - Map? requestHeaders, - Key? key, - Widget? loadingWidget, - Widget? errorWidget, - }) { - return StoryVideo( - VideoLoader(url, requestHeaders: requestHeaders), - storyController: controller, - key: key, - loadingWidget: loadingWidget, - errorWidget: errorWidget, - ); - } - - @override - State createState() { - return StoryVideoState(); - } -} - -class StoryVideoState extends State { - Future? playerLoader; - - StreamSubscription? _streamSubscription; - - VideoPlayerController? playerController; - - @override - void initState() { - super.initState(); - - widget.storyController!.pause(); - - widget.videoLoader.loadVideo(() { - if (widget.videoLoader.state == LoadState.success) { - this.playerController = - VideoPlayerController.file(widget.videoLoader.videoFile!); - - playerController!.initialize().then((v) { - setState(() {}); - widget.storyController!.play(); - }); - - if (widget.storyController != null) { - _streamSubscription = - widget.storyController!.playbackNotifier.listen((playbackState) { - if (playbackState == PlaybackState.pause) { - playerController!.pause(); - } else { - playerController!.play(); - } - }); - } - } else { - setState(() {}); - } - }); - } - - @override - Widget build(BuildContext context) { - return Container( - color: Colors.black, - height: double.infinity, - width: double.infinity, - child: VideoContentView( - videoLoadState: widget.videoLoader.state, - playerController: playerController, - loadingWidget: widget.loadingWidget, - errorWidget: widget.errorWidget, - ), - ); - } - - @override - void dispose() { - playerController?.dispose(); - _streamSubscription?.cancel(); - super.dispose(); - } -} - -/** - * @name VideoContentView - * @description Stateless widget that shows a video player or loading/error widgets based on video loading state. - */ -class VideoContentView extends StatelessWidget { - final LoadState videoLoadState; - final VideoPlayerController? playerController; - final Widget? loadingWidget; - final Widget? errorWidget; - - const VideoContentView({ - Key? key, - required this.videoLoadState, - required this.playerController, - this.loadingWidget, - this.errorWidget, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - if (videoLoadState == LoadState.success && - playerController != null && - playerController!.value.isInitialized) { - return Center( - child: AspectRatio( - aspectRatio: playerController!.value.aspectRatio, - child: VideoPlayer(playerController!), - ), - ); - } - - if (videoLoadState == LoadState.loading) { - return Center( - child: loadingWidget ?? - const SizedBox( - width: 70, - height: 70, - child: CircularProgressIndicator( - valueColor: AlwaysStoppedAnimation(Colors.white), - strokeWidth: 3, - ), - ), - ); - } - - return Center( - child: errorWidget ?? - const Text( - "Media failed to load.", - style: TextStyle(color: Colors.white), - ), - ); - } -} diff --git a/lib/widgets/story_view.dart b/lib/widgets/story_view.dart index b7f6f1fe..b4c38d4a 100644 --- a/lib/widgets/story_view.dart +++ b/lib/widgets/story_view.dart @@ -1,884 +1,353 @@ import 'dart:async'; -import 'dart:math'; -import 'package:collection/collection.dart' show IterableExtension; import 'package:flutter/material.dart'; +import 'package:wakelock_plus/wakelock_plus.dart'; import '../controller/story_controller.dart'; -import '../utils.dart'; -import 'story_image.dart'; -import 'story_video.dart'; - -/// Indicates where the progress indicators should be placed. -enum ProgressPosition { top, bottom, none } - -/// This is used to specify the height of the progress indicator. Inline stories -/// should use [small] -enum IndicatorHeight { small, medium, large } - -/// This is a representation of a story item (or page). -class StoryItem { - /// Specifies how long the page should be displayed. It should be a reasonable - /// amount of time greater than 0 milliseconds. - final Duration duration; - - /// Has this page been shown already? This is used to indicate that the page - /// has been displayed. If some pages are supposed to be skipped in a story, - /// mark them as shown `shown = true`. - /// - /// However, during initialization of the story view, all pages after the - /// last unshown page will have their `shown` attribute altered to false. This - /// is because the next item to be displayed is taken by the last unshown - /// story item. - bool shown; - - /// The page content - final Widget view; - StoryItem( - this.view, { - required this.duration, - this.shown = false, - }); - - /// Short hand to create text-only page. - /// - /// [title] is the text to be displayed on [backgroundColor]. The text color - /// alternates between [Colors.black] and [Colors.white] depending on the - /// calculated contrast. This is to ensure readability of text. - /// - /// Works for inline and full-page stories. See [StoryView.inline] for more on - /// what inline/full-page means. - static StoryItem text({ - required String title, - required Color backgroundColor, - Key? key, - TextStyle? textStyle, - bool shown = false, - bool roundedTop = false, - bool roundedBottom = false, - EdgeInsetsGeometry? textOuterPadding, - Duration? duration, - }) { - double contrast = ContrastHelper.contrast([ - backgroundColor.r, - backgroundColor.g, - backgroundColor.b, - ], [ - 255.0, - 255.0, - 255.0 - ] /** white text */); - - return StoryItem( - Container( - key: key, - decoration: BoxDecoration( - color: backgroundColor, - borderRadius: BorderRadius.vertical( - top: Radius.circular(roundedTop ? 8 : 0), - bottom: Radius.circular(roundedBottom ? 8 : 0), - ), - ), - padding: textOuterPadding?? EdgeInsets.symmetric( - horizontal: 24, - vertical: 16, - ), - child: Center( - child: Text( - title, - style: textStyle?.copyWith( - color: contrast > 1.8 ? Colors.white : Colors.black, - ) ?? - TextStyle( - color: contrast > 1.8 ? Colors.white : Colors.black, - fontSize: 18, - ), - textAlign: TextAlign.center, - ), - ), - //color: backgroundColor, - ), - shown: shown, - duration: duration ?? Duration(seconds: 3), - ); - } - - /// Factory constructor for page images. [controller] should be same instance as - /// one passed to the `StoryView` - factory StoryItem.pageImage({ - required String url, - required StoryController controller, - Key? key, - BoxFit imageFit = BoxFit.fitWidth, - Text? caption, - bool shown = false, - Map? requestHeaders, - Widget? loadingWidget, - Widget? errorWidget, - EdgeInsetsGeometry? captionOuterPadding, - Duration? duration, - }) { - return StoryItem( - Container( - key: key, - color: Colors.black, - child: Stack( - children: [ - StoryImage.url( - url, - controller: controller, - fit: imageFit, - requestHeaders: requestHeaders, - loadingWidget: loadingWidget, - errorWidget: errorWidget, - ), - SafeArea( - child: Align( - alignment: Alignment.bottomCenter, - child: Container( - width: double.infinity, - margin: EdgeInsets.only( - bottom: 24, - ), - padding: captionOuterPadding?? EdgeInsets.symmetric( - horizontal: 24, - vertical: 8, - ), - color: caption != null ? Colors.black54 : Colors.transparent, - child: caption?? const SizedBox.shrink(), - ), - ), - ) - ], - ), - ), - shown: shown, - duration: duration ?? Duration(seconds: 3), - ); - } - - /// Shorthand for creating inline image. [controller] should be same instance as - /// one passed to the `StoryView` - factory StoryItem.inlineImage({ - required String url, - Text? caption, - required StoryController controller, - Key? key, - BoxFit imageFit = BoxFit.cover, - Map? requestHeaders, - bool shown = false, - bool roundedTop = true, - bool roundedBottom = false, - Widget? loadingWidget, - Widget? errorWidget, - EdgeInsetsGeometry? captionOuterPadding, - Duration? duration, - }) { - return StoryItem( - ClipRRect( - key: key, - child: Container( - color: Colors.grey[100], - child: Container( - color: Colors.black, - child: Stack( - children: [ - StoryImage.url( - url, - controller: controller, - fit: imageFit, - requestHeaders: requestHeaders, - loadingWidget: loadingWidget, - errorWidget: errorWidget, - ), - Container( - margin: EdgeInsets.only(bottom: 16), - padding: captionOuterPadding?? EdgeInsets.symmetric(horizontal: 24, vertical: 8), - child: Align( - alignment: Alignment.bottomLeft, - child: Container( - child: caption?? const SizedBox.shrink(), - width: double.infinity, - ), - ), - ), - ], - ), - ), - ), - borderRadius: BorderRadius.vertical( - top: Radius.circular(roundedTop ? 8 : 0), - bottom: Radius.circular(roundedBottom ? 8 : 0), - ), - ), - shown: shown, - duration: duration ?? Duration(seconds: 3), - ); - } - - /// Shorthand for creating page video. [controller] should be same instance as - /// one passed to the `StoryView` - factory StoryItem.pageVideo( - String url, { - required StoryController controller, - Key? key, - Duration? duration, - BoxFit imageFit = BoxFit.fitWidth, - Widget? caption, - bool shown = false, - Map? requestHeaders, - Widget? loadingWidget, - Widget? errorWidget, - }) { - return StoryItem( - Container( - key: key, - color: Colors.black, - child: Stack( - children: [ - StoryVideo.url( - url, - controller: controller, - requestHeaders: requestHeaders, - loadingWidget: loadingWidget, - errorWidget: errorWidget, - ), - SafeArea( - child: Align( - alignment: Alignment.bottomCenter, - child: Container( - width: double.infinity, - margin: EdgeInsets.only(bottom: 24), - padding: EdgeInsets.symmetric(horizontal: 24, vertical: 8), - color: - caption != null ? Colors.black54 : Colors.transparent, - child: caption?? const SizedBox.shrink(), - ), - ), - ) - ], - ), - ), - shown: shown, - duration: duration ?? Duration(seconds: 10)); - } - - /// Shorthand for creating a story item from an image provider such as `AssetImage` - /// or `NetworkImage`. However, the story continues to play while the image loads - /// up. - factory StoryItem.pageProviderImage( - ImageProvider image, { - Key? key, - BoxFit imageFit = BoxFit.fitWidth, - String? caption, - bool shown = false, - Duration? duration, - }) { - return StoryItem( - Container( - key: key, - color: Colors.black, - child: Stack( - children: [ - Center( - child: Image( - image: image, - height: double.infinity, - width: double.infinity, - fit: imageFit, - ), - ), - SafeArea( - child: Align( - alignment: Alignment.bottomCenter, - child: Container( - width: double.infinity, - margin: EdgeInsets.only( - bottom: 24, - ), - padding: EdgeInsets.symmetric( - horizontal: 24, - vertical: 8, - ), - color: - caption != null ? Colors.black54 : Colors.transparent, - child: caption != null - ? Text( - caption, - style: TextStyle( - fontSize: 15, - color: Colors.white, - ), - textAlign: TextAlign.center, - ) - : SizedBox.shrink(), - ), - ), - ) - ], - ), - ), - shown: shown, - duration: duration ?? Duration(seconds: 3)); - } - - /// Shorthand for creating an inline story item from an image provider such as `AssetImage` - /// or `NetworkImage`. However, the story continues to play while the image loads - /// up. - factory StoryItem.inlineProviderImage( - ImageProvider image, { - Key? key, - Text? caption, - bool shown = false, - bool roundedTop = true, - bool roundedBottom = false, - Duration? duration, - }) { - return StoryItem( - Container( - key: key, - decoration: BoxDecoration( - color: Colors.grey[100], - borderRadius: BorderRadius.vertical( - top: Radius.circular(roundedTop ? 8 : 0), - bottom: Radius.circular(roundedBottom ? 8 : 0), - ), - image: DecorationImage( - image: image, - fit: BoxFit.cover, - )), - child: Container( - margin: EdgeInsets.only( - bottom: 16, - ), - padding: EdgeInsets.symmetric( - horizontal: 24, - vertical: 8, - ), - child: Align( - alignment: Alignment.bottomLeft, - child: Container( - child: caption == null ? SizedBox() : caption, - width: double.infinity, - ), - ), - ), - ), - shown: shown, - duration: duration ?? Duration(seconds: 3), - ); - } -} +import '../utils/enum.dart'; +import '../utils/page_data.dart'; +import '../utils/utils.dart'; +import 'page_bar.dart'; +import 'story_item.dart'; -/// Widget to display stories just like Whatsapp and Instagram. Can also be used -/// inline/inside [ListView] or [Column] just like Google News app. Comes with -/// gestures to pause, forward and go to previous page. class StoryView extends StatefulWidget { - /// The pages to displayed. - final List storyItems; - - /// Callback for when a full cycle of story is shown. This will be called - /// each time the full story completes when [repeat] is set to `true`. + final List storyItems; + final StoryController controller; final VoidCallback? onComplete; - - /// Callback for when a vertical swipe gesture is detected. If you do not - /// want to listen to such event, do not provide it. For instance, - /// for inline stories inside ListViews, it is preferrable to not to - /// provide this callback so as to enable scroll events on the list view. final Function(Direction?)? onVerticalSwipeComplete; - - /// Callback for when a story and it index is currently being shown. final void Function(StoryItem storyItem, int index)? onStoryShow; - - /// Where the progress indicator should be placed. final ProgressPosition progressPosition; - - /// Should the story be repeated forever? final bool repeat; - - /// If you would like to display the story as full-page, then set this to - /// `false`. But in case you would display this as part of a page (eg. in - /// a [ListView] or [Column]) then set this to `true`. final bool inline; - - /// Controls the playback of the stories - final StoryController controller; - - /// Indicator Color final Color? indicatorColor; - /// Indicator Foreground Color final Color? indicatorForegroundColor; - - /// Determine the height of the indicator - final IndicatorHeight indicatorHeight; - - /// Use this if you want to give outer padding to the indicator - final EdgeInsetsGeometry indicatorOuterPadding; - - StoryView({ + final double indicatorHeight; + final EdgeInsetsGeometry indicatorMargin; + final bool isRtl; + final EdgeInsetsGeometry buttonPadding; + final VoidCallback? onMoveToPreviousPage; + final VoidCallback? onDoubleTap; + + const StoryView({ + super.key, required this.storyItems, required this.controller, this.onComplete, this.onStoryShow, + this.onVerticalSwipeComplete, + this.onMoveToPreviousPage, + this.onDoubleTap, this.progressPosition = ProgressPosition.top, this.repeat = false, this.inline = false, - this.onVerticalSwipeComplete, + this.isRtl = false, this.indicatorColor, this.indicatorForegroundColor, - this.indicatorHeight = IndicatorHeight.large, - this.indicatorOuterPadding = const EdgeInsets.symmetric(horizontal: 16, vertical: 8,), + this.indicatorHeight = 5, + this.buttonPadding = EdgeInsets.zero, + this.indicatorMargin = const EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, + ), }); @override - State createState() { - return StoryViewState(); - } + State createState() => _StoryViewState(); } -class StoryViewState extends State with TickerProviderStateMixin { +class _StoryViewState extends State with TickerProviderStateMixin { AnimationController? _animationController; Animation? _currentAnimation; - Timer? _nextDebouncer; - + Timer? _debounceTimer; StreamSubscription? _playbackSubscription; + VerticalDragInfo? _verticalDragInfo; - VerticalDragInfo? verticalDragInfo; - - StoryItem? get _currentStory { - return widget.storyItems.firstWhereOrNull((it) => !it!.shown); - } + int _currentIndex = 0; - Widget get _currentView { - var item = widget.storyItems.firstWhereOrNull((it) => !it!.shown); - item ??= widget.storyItems.last; - return item?.view ?? Container(); - } + StoryItem get _currentStoryItem => widget.storyItems[_currentIndex]; @override void initState() { super.initState(); + if (widget.storyItems.isEmpty) return; + WakelockPlus.enable(); + // Find the first story that hasn't been seen yet + final firstUnseenIndex = widget.storyItems.indexWhere( + (it) => !it.isSeenBefore, + ); - // All pages after the first unshown page should have their shown value as - // false - final firstPage = widget.storyItems.firstWhereOrNull((it) => !it!.shown); - if (firstPage == null) { - widget.storyItems.forEach((it2) { - it2!.shown = false; - }); + if (firstUnseenIndex == -1) { + // All seen, start from 0 and reset flags + _currentIndex = 0; + for (var item in widget.storyItems) { + item.isSeenBefore = false; + } } else { - final lastShownPos = widget.storyItems.indexOf(firstPage); - widget.storyItems.sublist(lastShownPos).forEach((it) { - it!.shown = false; - }); + _currentIndex = firstUnseenIndex; + // Mark all previous as seen, all future as unseen (safety check) + for (int i = 0; i < widget.storyItems.length; i++) { + widget.storyItems[i].isSeenBefore = i < _currentIndex; + } } - this._playbackSubscription = - widget.controller.playbackNotifier.listen((playbackStatus) { - switch (playbackStatus) { + _subscribeToController(); + _play(); + } + + void _subscribeToController() { + _playbackSubscription = widget.controller.playbackNotifier.listen((status) { + switch (status) { case PlaybackState.play: - _removeNextHold(); - this._animationController?.forward(); + _cancelDebouncer(); + _animationController?.forward(); break; - case PlaybackState.pause: - _holdNext(); // then pause animation - this._animationController?.stop(canceled: false); + _startDebouncer(); + _animationController?.stop(canceled: false); break; - case PlaybackState.next: - _removeNextHold(); + _cancelDebouncer(); _goForward(); break; - case PlaybackState.previous: - _removeNextHold(); + _cancelDebouncer(); _goBack(); break; } }); - - _play(); } @override void dispose() { - _clearDebouncer(); - + WakelockPlus.disable(); + _cancelDebouncer(); _animationController?.dispose(); _playbackSubscription?.cancel(); - super.dispose(); } - @override - void setState(fn) { - if (mounted) { - super.setState(fn); - } - } + // --- Playback Logic --- void _play() { _animationController?.dispose(); - // get the next playing page - final storyItem = widget.storyItems.firstWhere((it) { - return !it!.shown; - })!; - final storyItemIndex = widget.storyItems.indexOf(storyItem); + final storyItem = _currentStoryItem; - if (widget.onStoryShow != null) { - widget.onStoryShow!(storyItem, storyItemIndex); - } + widget.onStoryShow?.call(storyItem, _currentIndex); - _animationController = - AnimationController(duration: storyItem.duration, vsync: this); + _animationController = AnimationController( + duration: storyItem.storyDuration, + vsync: this, + ); _animationController!.addStatusListener((status) { if (status == AnimationStatus.completed) { - storyItem.shown = true; - if (widget.storyItems.last != storyItem) { - _beginPlay(); - } else { - // done playing - _onComplete(); - } + storyItem.isSeenBefore = true; + _goForward(); } }); - _currentAnimation = - Tween(begin: 0.0, end: 1.0).animate(_animationController!); + _currentAnimation = Tween( + begin: 0.0, + end: 1.0, + ).animate(_animationController!); + // Notify controller we are playing widget.controller.play(); } - void _beginPlay() { - setState(() {}); - _play(); - } - - void _onComplete() { - if (widget.onComplete != null) { - widget.controller.pause(); - widget.onComplete!(); - } + void _goForward() { + if (_currentIndex != widget.storyItems.length - 1) { + _animationController?.stop(); + // Mark current as seen before moving + _currentStoryItem.isSeenBefore = true; - if (widget.repeat) { - widget.storyItems.forEach((it) { - it!.shown = false; + setState(() { + _currentIndex++; }); - - _beginPlay(); + _play(); + } else { + // Last item completed + _currentStoryItem.isSeenBefore = true; + _animationController?.animateTo( + 1.0, + duration: const Duration(milliseconds: 10), + ); + _onComplete(); } } void _goBack() { - _animationController!.stop(); - - if (this._currentStory == null) { - widget.storyItems.last!.shown = false; - } - - if (this._currentStory == widget.storyItems.first) { - _beginPlay(); + _animationController?.stop(); + + if (_currentIndex == 0) { + // If at first page, try to delegate to parent or restart + if (widget.onMoveToPreviousPage != null) { + widget.onMoveToPreviousPage!(); + } else { + // Restart current story + _currentStoryItem.isSeenBefore = false; + _play(); + } } else { - this._currentStory!.shown = false; - int lastPos = widget.storyItems.indexOf(this._currentStory); - final previous = widget.storyItems[lastPos - 1]!; - - previous.shown = false; - - _beginPlay(); + // Move to previous + _currentStoryItem.isSeenBefore = false; + setState(() { + _currentIndex--; + _currentStoryItem.isSeenBefore = false; + }); + _play(); } } - void _goForward() { - if (this._currentStory != widget.storyItems.last) { - _animationController!.stop(); - - // get last showing - final _last = this._currentStory; + void _onComplete() { + widget.controller.pause(); + widget.onComplete?.call(); - if (_last != null) { - _last.shown = true; - if (_last != widget.storyItems.last) { - _beginPlay(); - } + if (widget.repeat) { + for (var it in widget.storyItems) { + it.isSeenBefore = false; } - } else { - // this is the last page, progress animation should skip to end - _animationController! - .animateTo(1.0, duration: Duration(milliseconds: 10)); + setState(() { + _currentIndex = 0; + }); + _play(); } } - void _clearDebouncer() { - _nextDebouncer?.cancel(); - _nextDebouncer = null; - } - - void _removeNextHold() { - _nextDebouncer?.cancel(); - _nextDebouncer = null; - } - - void _holdNext() { - _nextDebouncer?.cancel(); - _nextDebouncer = Timer(Duration(milliseconds: 500), () {}); - } + // --- Debouncer Logic (for long press/pause) --- - @override - Widget build(BuildContext context) { - return Container( - color: Colors.white, - child: Stack( - children: [ - _currentView, - Visibility( - visible: widget.progressPosition != ProgressPosition.none, - child: Align( - alignment: widget.progressPosition == ProgressPosition.top - ? Alignment.topCenter - : Alignment.bottomCenter, - child: SafeArea( - bottom: widget.inline ? false : true, - // we use SafeArea here for notched and bezeles phones - child: Container( - padding: widget.indicatorOuterPadding, - child: PageBar( - widget.storyItems - .map((it) => PageData(it!.duration, it.shown)) - .toList(), - this._currentAnimation, - key: UniqueKey(), - indicatorHeight: widget.indicatorHeight, - indicatorColor: widget.indicatorColor, - indicatorForegroundColor: widget.indicatorForegroundColor, - ), - ), - ), - ), - ), - Align( - alignment: Alignment.centerRight, - heightFactor: 1, - child: GestureDetector( - onTapDown: (details) { - widget.controller.pause(); - }, - onTapCancel: () { - widget.controller.play(); - }, - onTapUp: (details) { - // if debounce timed out (not active) then continue anim - if (_nextDebouncer?.isActive == false) { - widget.controller.play(); - } else { - widget.controller.next(); - } - }, - onVerticalDragStart: widget.onVerticalSwipeComplete == null - ? null - : (details) { - widget.controller.pause(); - }, - onVerticalDragCancel: widget.onVerticalSwipeComplete == null - ? null - : () { - widget.controller.play(); - }, - onVerticalDragUpdate: widget.onVerticalSwipeComplete == null - ? null - : (details) { - if (verticalDragInfo == null) { - verticalDragInfo = VerticalDragInfo(); - } - - verticalDragInfo!.update(details.primaryDelta!); - - // TODO: provide callback interface for animation purposes - }, - onVerticalDragEnd: widget.onVerticalSwipeComplete == null - ? null - : (details) { - widget.controller.play(); - // finish up drag cycle - if (!verticalDragInfo!.cancel && - widget.onVerticalSwipeComplete != null) { - widget.onVerticalSwipeComplete!( - verticalDragInfo!.direction); - } - - verticalDragInfo = null; - }, - )), - Align( - alignment: Alignment.centerLeft, - heightFactor: 1, - child: SizedBox( - child: GestureDetector(onTap: () { - widget.controller.previous(); - }), - width: 70), - ), - ], - ), - ); + void _cancelDebouncer() { + _debounceTimer?.cancel(); + _debounceTimer = null; } -} -/// Capsule holding the duration and shown property of each story. Passed down -/// to the pages bar to render the page indicators. -class PageData { - Duration duration; - bool shown; - - PageData(this.duration, this.shown); -} - -/// Horizontal bar displaying a row of [StoryProgressIndicator] based on the -/// [pages] provided. -class PageBar extends StatefulWidget { - final List pages; - final Animation? animation; - final IndicatorHeight indicatorHeight; - final Color? indicatorColor; - final Color? indicatorForegroundColor; - - PageBar( - this.pages, - this.animation, { - this.indicatorHeight = IndicatorHeight.large, - this.indicatorColor, - this.indicatorForegroundColor, - Key? key, - }) : super(key: key); - - @override - State createState() { - return PageBarState(); + void _startDebouncer() { + _debounceTimer?.cancel(); + _debounceTimer = Timer(const Duration(milliseconds: 500), () => null); } -} -class PageBarState extends State { - double spacing = 4; + // --- UI Building --- @override - void initState() { - super.initState(); + Widget build(BuildContext context) { + if (widget.storyItems.isEmpty) return const SizedBox.shrink(); - int count = widget.pages.length; - spacing = (count > 15) ? 2 : ((count > 10) ? 3 : 4); + return Stack( + children: [ + // 1. The Story Content + _buildStoryView(), - widget.animation!.addListener(() { - setState(() {}); - }); - } + // 2. The Progress Bars + if (widget.progressPosition != ProgressPosition.none) + _buildIndicators(), - @override - void setState(fn) { - if (mounted) { - super.setState(fn); - } + // 3. Gesture Detectors (Overlay) + _wrapWithVerticalSwipe(child: _buildGestures()), + ], + ); } - bool isPlaying(PageData page) { - return widget.pages.firstWhereOrNull((it) => !it.shown) == page; + Widget _buildStoryView() { + return KeyedSubtree( + key: ValueKey(_currentIndex), + child: _currentStoryItem.view, + ); } - @override - Widget build(BuildContext context) { - return Row( - children: widget.pages.map((it) { - return Expanded( - child: Container( - padding: EdgeInsets.only( - right: widget.pages.last == it ? 0 : this.spacing), - child: StoryProgressIndicator( - isPlaying(it) ? widget.animation!.value : (it.shown ? 1 : 0), - indicatorHeight: - widget.indicatorHeight == IndicatorHeight.large ? 5 : widget.indicatorHeight == IndicatorHeight.medium ? 3 : 2, - indicatorColor: widget.indicatorColor, - indicatorForegroundColor: widget.indicatorForegroundColor, - ), + Widget _buildIndicators() { + return Align( + alignment: widget.progressPosition == ProgressPosition.top + ? Alignment.topCenter + : Alignment.bottomCenter, + child: SafeArea( + bottom: widget.inline ? false : true, + child: Container( + padding: widget.indicatorMargin, + child: PageBar( + widget.storyItems + .map((it) => PageData(it.storyDuration, it.isSeenBefore)) + .toList(), + _currentAnimation, + indicatorHeight: widget.indicatorHeight, + indicatorColor: widget.indicatorColor, + indicatorForegroundColor: widget.indicatorForegroundColor, + isRtl: widget.isRtl, ), - ); - }).toList(), + ), + ), ); } -} -/// Custom progress bar. Supposed to be lighter than the -/// original [ProgressIndicator], and rounded at the sides. -class StoryProgressIndicator extends StatelessWidget { - /// From `0.0` to `1.0`, determines the progress of the indicator - final double value; - final double indicatorHeight; - final Color? indicatorColor; - final Color? indicatorForegroundColor; - - StoryProgressIndicator( - this.value, { - this.indicatorHeight = 5, - this.indicatorColor, - this.indicatorForegroundColor, - }); - - @override - Widget build(BuildContext context) { - return CustomPaint( - size: Size.fromHeight( - this.indicatorHeight, - ), - foregroundPainter: IndicatorOval( - this.indicatorForegroundColor?? Colors.white.withValues(alpha: 0.8), - this.value, - ), - painter: IndicatorOval( - this.indicatorColor?? Colors.white.withValues(alpha: 0.4), - 1.0, + Widget _buildGestures() { + return Padding( + padding: widget.buttonPadding, + child: Column( + children: [ + Expanded( + child: Row( + children: [ + // Previous / Left Side + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.translucent, + onDoubleTap: widget.onDoubleTap, + onTapDown: (_) => widget.controller.pause(), + onTapCancel: () => widget.controller.play(), + onTapUp: (_) { + if (_debounceTimer?.isActive == false) { + widget.controller.play(); + } else { + widget.controller.previous(); + } + }, + ), + ), + // Next / Right Side + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.translucent, + onDoubleTap: widget.onDoubleTap, + onTapDown: (_) => widget.controller.pause(), + onTapCancel: () => widget.controller.play(), + onTapUp: (_) { + if (_debounceTimer?.isActive == false) { + widget.controller.play(); + } else { + widget.controller.next(); + } + }, + ), + ), + ], + ), + ), + ], ), ); - } -} - -class IndicatorOval extends CustomPainter { - final Color color; - final double widthFactor; - - IndicatorOval(this.color, this.widthFactor); - - @override - void paint(Canvas canvas, Size size) { - final paint = Paint()..color = this.color; - canvas.drawRRect( - RRect.fromRectAndRadius( - Rect.fromLTWH(0, 0, size.width * this.widthFactor, size.height), - Radius.circular(3)), - paint); + // Note: Swiping logic was removed from the simplified Row above for clarity. + // If vertical swipe is strictly needed alongside taps, wrap the whole Row + // in the Vertical Swipe Gesture Detector below. } - @override - bool shouldRepaint(CustomPainter oldDelegate) { - return true; - } -} - -/// Concept source: https://stackoverflow.com/a/9733420 -class ContrastHelper { - static double luminance(double? r, double? g, double? b) { - final a = [r, g, b].map((it) { - double value = it!.toDouble() / 255.0; - return value <= 0.03928 - ? value / 12.92 - : pow((value + 0.055) / 1.055, 2.4); - }).toList(); - - return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722; - } - - static double contrast(rgb1, rgb2) { - return luminance(rgb2[0], rgb2[1], rgb2[2]) / - luminance(rgb1[0], rgb1[1], rgb1[2]); + Widget _wrapWithVerticalSwipe({Widget? child}) { + if (widget.onVerticalSwipeComplete == null) return SizedBox.shrink(); + + return GestureDetector( + onVerticalDragStart: (_) => widget.controller.pause(), + onVerticalDragCancel: () => widget.controller.play(), + onVerticalDragUpdate: (details) { + _verticalDragInfo ??= VerticalDragInfo(); + _verticalDragInfo!.update(details.primaryDelta!); + }, + onVerticalDragEnd: (_) { + widget.controller.play(); + if (_verticalDragInfo != null && !(_verticalDragInfo!.cancel)) { + widget.onVerticalSwipeComplete!(_verticalDragInfo!.direction); + } + _verticalDragInfo = null; + }, + child: child, + ); } } diff --git a/lib/widgets/video/story_video.dart b/lib/widgets/video/story_video.dart new file mode 100644 index 00000000..cc13d71a --- /dev/null +++ b/lib/widgets/video/story_video.dart @@ -0,0 +1,166 @@ +import 'dart:async'; + +import 'package:better_player_plus/better_player_plus.dart'; +import 'package:flutter/material.dart'; + +import '../../controller/story_controller.dart'; +import '../../utils/enum.dart'; +import '../../utils/video_loader.dart'; +import 'video_content_view.dart'; + +class StoryVideo extends StatefulWidget { + final StoryController? storyController; + final VideoLoader videoLoader; + final Widget? loadingWidget; + final Widget? errorWidget; + + const StoryVideo( + this.videoLoader, { + super.key, + this.storyController, + this.loadingWidget, + this.errorWidget, + }); + + factory StoryVideo.url( + String url, { + StoryController? controller, + Map? requestHeaders, + Key? key, + Widget? loadingWidget, + Widget? errorWidget, + }) { + return StoryVideo( + VideoLoader(url, requestHeaders: requestHeaders), + storyController: controller, + key: key, + loadingWidget: loadingWidget, + errorWidget: errorWidget, + ); + } + + @override + State createState() => _StoryVideoState(); +} + +class _StoryVideoState extends State { + StreamSubscription? _streamSubscription; + BetterPlayerController? _videoPlayerController; + + @override + void initState() { + super.initState(); + widget.storyController?.pause(); + _loadVideo(); + } + + @override + void dispose() { + widget.videoLoader.dispose(); + _streamSubscription?.cancel(); + _videoPlayerController?.pause(); + _videoPlayerController?.dispose(); + super.dispose(); + } + + void _loadVideo() { + widget.videoLoader.loadVideo(_onLoadSuccess, onLoading: _onLoading); + } + + void _onLoading() { + if (mounted) { + setState(() { + widget.videoLoader.showLoading(); + }); + } + } + + void _onLoadSuccess() { + if (!mounted) return; + + if (widget.videoLoader.state == LoadState.success) { + initializeVideo(); + // Setup Story Controller Listener + _setupStoryListener(); + } else { + setState(() {}); + } + } + + Future initializeVideo() async { + if (widget.videoLoader.state != LoadState.success) return; + final file = widget.videoLoader.videoFile; + + if (file == null) { + setState(() {}); + return; + } + + BetterPlayerConfiguration betterPlayerConfiguration = + const BetterPlayerConfiguration( + autoPlay: false, + autoDispose: false, + fit: BoxFit.contain, + aspectRatio: 0.1, + controlsConfiguration: BetterPlayerControlsConfiguration( + showControls: false, + ), + ); + + BetterPlayerDataSource dataSource = BetterPlayerDataSource( + BetterPlayerDataSourceType.file, + file.path, + ); + + _videoPlayerController = BetterPlayerController(betterPlayerConfiguration); + + await _videoPlayerController!.setupDataSource(dataSource); + + if (mounted) { + setState(() {}); + widget.storyController?.play(); + _videoPlayerController!.play(); + } + } + + void _setupStoryListener() { + if (widget.storyController == null) return; + + _streamSubscription = widget.storyController!.playbackNotifier.listen(( + playbackState, + ) { + if (_videoPlayerController == null) return; + + if (playbackState == PlaybackState.pause) { + _videoPlayerController!.pause(); + } else if (playbackState == PlaybackState.play) { + _videoPlayerController!.play(); + } + }); + } + + @override + Widget build(BuildContext context) { + return SizedBox.expand( + child: _videoPlayerController == null + ? widget.loadingWidget ?? + const SizedBox( + width: 70, + height: 70, + child: CircularProgressIndicator( + valueColor: AlwaysStoppedAnimation(Colors.white), + strokeWidth: 3, + ), + ) + : ColoredBox( + color: Colors.black, + child: VideoContentView( + videoLoadState: widget.videoLoader.state, + playerController: _videoPlayerController!, + loadingWidget: widget.loadingWidget, + errorWidget: widget.errorWidget, + ), + ), + ); + } +} diff --git a/lib/widgets/video/video_content_view.dart b/lib/widgets/video/video_content_view.dart new file mode 100644 index 00000000..f976bd52 --- /dev/null +++ b/lib/widgets/video/video_content_view.dart @@ -0,0 +1,57 @@ +import 'package:better_player_plus/better_player_plus.dart'; +import 'package:flutter/material.dart'; + +import '../../utils/enum.dart'; + +class VideoContentView extends StatelessWidget { + final LoadState videoLoadState; + final BetterPlayerController playerController; + final Widget? loadingWidget; + final Widget? errorWidget; + + const VideoContentView({ + Key? key, + required this.videoLoadState, + required this.playerController, + this.loadingWidget, + this.errorWidget, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + print('VideoContentView: $videoLoadState'); + if (videoLoadState == LoadState.success && + playerController.videoPlayerController!.value.initialized) { + return Center( + child: AspectRatio( + aspectRatio: + playerController.videoPlayerController!.value.aspectRatio, + child: BetterPlayer(controller: playerController), + ), + ); + } else if (videoLoadState == LoadState.loading) { + return Center( + child: + loadingWidget ?? + const SizedBox( + width: 70, + height: 70, + child: CircularProgressIndicator( + valueColor: AlwaysStoppedAnimation(Colors.white), + strokeWidth: 3, + ), + ), + ); + } else if (videoLoadState == LoadState.failure) { + return Center( + child: + errorWidget ?? + const Text( + "Media failed to load.", + style: TextStyle(color: Colors.white), + ), + ); + } + return const SizedBox.shrink(); + } +} diff --git a/pubspec.lock b/pubspec.lock index 2df744d0..a96d2204 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,14 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" async: dependency: transitive description: @@ -9,6 +17,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.13.0" + better_player_plus: + dependency: "direct main" + description: + name: better_player_plus + sha256: "8670ccf8fead5572bfcd1568c008f72f3202593ef07fc90921e2cbcaac77852b" + url: "https://pub.dev" + source: hosted + version: "1.1.5" characters: dependency: transitive description: @@ -37,10 +53,10 @@ packages: dependency: transitive description: name: crypto - sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf url: "https://pub.dev" source: hosted - version: "3.0.6" + version: "3.0.7" csslib: dependency: transitive description: @@ -49,6 +65,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.2" + dbus: + dependency: transitive + description: + name: dbus + sha256: "79e0c23480ff85dc68de79e2cd6334add97e48f7f4865d17686dd6ea81a47e8c" + url: "https://pub.dev" + source: hosted + version: "0.7.11" ffi: dependency: transitive description: @@ -86,11 +110,24 @@ packages: url: "https://pub.dev" source: hosted version: "3.4.1" + flutter_localizations: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" flutter_web_plugins: dependency: transitive description: flutter source: sdk version: "0.0.0" + flutter_widget_from_html_core: + dependency: transitive + description: + name: flutter_widget_from_html_core + sha256: "1120ee6ed3509ceff2d55aa6c6cbc7b6b1291434422de2411b5a59364dd6ff03" + url: "https://pub.dev" + source: hosted + version: "0.17.0" html: dependency: transitive description: @@ -103,10 +140,10 @@ packages: dependency: transitive description: name: http - sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b" + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.6.0" http_parser: dependency: transitive description: @@ -115,6 +152,22 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.2" + intl: + dependency: transitive + description: + name: intl + sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" + url: "https://pub.dev" + source: hosted + version: "0.20.2" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" material_color_utilities: dependency: transitive description: @@ -127,10 +180,34 @@ packages: dependency: transitive description: name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" + url: "https://pub.dev" + source: hosted + version: "1.17.0" + objective_c: + dependency: transitive + description: + name: objective_c + sha256: "1f81ed9e41909d44162d7ec8663b2c647c202317cc0b56d3d56f6a13146a0b64" + url: "https://pub.dev" + source: hosted + version: "9.1.0" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + sha256: f69da0d3189a4b4ceaeb1a3defb0f329b3b352517f52bed4290f83d4f06bc08d url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "9.0.0" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: "202a487f08836a592a6bd4f901ac69b3a8f146af552bbd14407b6b41e1c3f086" + url: "https://pub.dev" + source: hosted + version: "3.2.1" path: dependency: transitive description: @@ -151,18 +228,18 @@ packages: dependency: transitive description: name: path_provider_android - sha256: d0d310befe2c8ab9e7f393288ccbb11b60c019c6b5afc21973eeee4dda2b35e9 + sha256: f2c65e21139ce2c3dad46922be8272bb5963516045659e71bb16e151c93b580e url: "https://pub.dev" source: hosted - version: "2.2.17" + version: "2.2.22" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: "4843174df4d288f5e29185bd6e72a6fbdf5a4a4602717eed565497429f179942" + sha256: "6192e477f34018ef1ea790c56fffc7302e3bc3efede9e798b934c252c8c105ba" url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.5.0" path_provider_linux: dependency: transitive description: @@ -187,6 +264,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "1a97266a94f7350d30ae522c0af07890c70b8e62c71e8e3920d1db4d23c057d1" + url: "https://pub.dev" + source: hosted + version: "7.0.1" platform: dependency: transitive description: @@ -203,6 +288,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" + url: "https://pub.dev" + source: hosted + version: "2.2.0" rxdart: dependency: "direct main" description: @@ -224,14 +317,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.1" - sprintf: - dependency: transitive - description: - name: sprintf - sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" - url: "https://pub.dev" - source: hosted - version: "7.0.0" sqflite: dependency: transitive description: @@ -244,18 +329,18 @@ packages: dependency: transitive description: name: sqflite_android - sha256: "2b3070c5fa881839f8b402ee4a39c1b4d561704d4ebbbcfb808a119bc2a1701b" + sha256: ecd684501ebc2ae9a83536e8b15731642b9570dc8623e0073d227d0ee2bfea88 url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.4.2+2" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "84731e8bfd8303a3389903e01fb2141b6e59b5973cacbb0929021df08dddbe8b" + sha256: "6ef422a4525ecc601db6c0a2233ff448c731307906e92cabc9ba292afaae16a6" url: "https://pub.dev" source: hosted - version: "2.5.5" + version: "2.5.6" sqflite_darwin: dependency: transitive description: @@ -308,58 +393,42 @@ packages: dependency: transitive description: name: uuid - sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff + sha256: a11b666489b1954e01d992f3d601b1804a33937b5a8fe677bd26b8a9f96f96e8 url: "https://pub.dev" source: hosted - version: "4.5.1" + version: "4.5.2" vector_math: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b url: "https://pub.dev" source: hosted - version: "2.1.4" - video_player: - dependency: "direct main" - description: - name: video_player - sha256: "0d55b1f1a31e5ad4c4967bfaa8ade0240b07d20ee4af1dfef5f531056512961a" - url: "https://pub.dev" - source: hosted - version: "2.10.0" - video_player_android: + version: "2.2.0" + visibility_detector: dependency: transitive description: - name: video_player_android - sha256: "4a5135754a62dbc827a64a42ef1f8ed72c962e191c97e2d48744225c2b9ebb73" + name: visibility_detector + sha256: dd5cc11e13494f432d15939c3aa8ae76844c42b723398643ce9addb88a5ed420 url: "https://pub.dev" source: hosted - version: "2.8.7" - video_player_avfoundation: - dependency: transitive - description: - name: video_player_avfoundation - sha256: "9ee764e5cd2fc1e10911ae8ad588e1a19db3b6aa9a6eb53c127c42d3a3c3f22f" - url: "https://pub.dev" - source: hosted - version: "2.7.1" - video_player_platform_interface: - dependency: transitive + version: "0.4.0+2" + wakelock_plus: + dependency: "direct main" description: - name: video_player_platform_interface - sha256: df534476c341ab2c6a835078066fc681b8265048addd853a1e3c78740316a844 + name: wakelock_plus + sha256: "9296d40c9adbedaba95d1e704f4e0b434be446e2792948d0e4aa977048104228" url: "https://pub.dev" source: hosted - version: "6.3.0" - video_player_web: + version: "1.4.0" + wakelock_plus_platform_interface: dependency: transitive description: - name: video_player_web - sha256: e8bba2e5d1e159d5048c9a491bb2a7b29c535c612bb7d10c1e21107f5bd365ba + name: wakelock_plus_platform_interface + sha256: "036deb14cd62f558ca3b73006d52ce049fabcdcb2eddfe0bf0fe4e8a943b5cf2" url: "https://pub.dev" source: hosted - version: "2.3.5" + version: "1.3.0" web: dependency: transitive description: @@ -368,6 +437,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.1" + win32: + dependency: transitive + description: + name: win32 + sha256: d7cb55e04cd34096cd3a79b3330245f54cb96a370a1c27adb3c84b917de8b08e + url: "https://pub.dev" + source: hosted + version: "5.15.0" xdg_directories: dependency: transitive description: @@ -376,6 +453,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025" + url: "https://pub.dev" + source: hosted + version: "6.6.1" sdks: - dart: ">=3.8.0 <4.0.0" - flutter: ">=3.29.0" + dart: ">=3.9.0 <4.0.0" + flutter: ">=3.35.0" diff --git a/pubspec.yaml b/pubspec.yaml index 88d3c679..a3dea1ea 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,15 +1,18 @@ name: story_view description: Display stories just like Whatsapp & Instagram. Can be used inline/inside ListView or Column just like Google News app. Comes with gestures to pause, forward & go to previous page. -version: 0.16.6 +version: 0.17.0 homepage: https://github.com/blackmann/story_view environment: - sdk: '>=3.4.0 <4.0.0' + sdk: ^3.9.0 dependencies: flutter: sdk: flutter flutter_cache_manager: ^3.4.1 rxdart: ^0.28.0 - video_player: ^2.10.0 collection: ^1.19.1 + better_player_plus: ^1.1.5 + wakelock_plus: ^1.4.0 + +