├── example ├── ios │ ├── Flutter │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── AppFrameworkInfo.plist │ ├── Runner │ │ ├── Runner-Bridging-Header.h │ │ ├── Assets.xcassets │ │ │ ├── LaunchImage.imageset │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ ├── README.md │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ │ └── Contents.json │ │ ├── AppDelegate.swift │ │ ├── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.storyboard │ │ └── Info.plist │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ ├── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ └── project.pbxproj │ └── .gitignore ├── android │ ├── gradle.properties │ ├── .gitignore │ ├── app │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ └── values │ │ │ │ │ │ └── styles.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ └── build.gradle ├── .metadata ├── README.md ├── .gitignore ├── test │ └── widget_test.dart ├── pubspec.yaml ├── lib │ └── main.dart └── pubspec.lock ├── lib ├── src │ ├── blocs │ │ ├── screen │ │ │ ├── bloc.dart │ │ │ ├── screen_event.dart │ │ │ ├── screen_state.dart │ │ │ └── screen_bloc.dart │ │ ├── subtitle │ │ │ ├── bloc.dart │ │ │ ├── subtitle_event.dart │ │ │ ├── subtitle_state.dart │ │ │ └── subtitle_bloc.dart │ │ └── player │ │ │ ├── player_state.dart │ │ │ ├── player_event.dart │ │ │ └── player_bloc.dart │ ├── utils │ │ ├── public_type.dart │ │ ├── iqtheme.dart │ │ ├── subtitle_provider.dart │ │ └── subtitle_controller.dart │ ├── models │ │ └── subtitle.dart │ ├── repositories │ │ └── subtitle_repository.dart │ └── ui │ │ ├── iqparser.dart │ │ ├── iqscreen.dart │ │ └── screen_controllers.dart └── iqplayer.dart ├── .metadata ├── .vscode └── launch.json ├── CHANGELOG.md ├── LICENSE ├── pubspec.yaml ├── .gitignore ├── README.md └── pubspec.lock /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/src/blocs/screen/bloc.dart: -------------------------------------------------------------------------------- 1 | export 'screen_bloc.dart'; 2 | export 'screen_event.dart'; 3 | export 'screen_state.dart'; 4 | -------------------------------------------------------------------------------- /lib/src/blocs/subtitle/bloc.dart: -------------------------------------------------------------------------------- 1 | export 'subtitle_bloc.dart'; 2 | export 'subtitle_event.dart'; 3 | export 'subtitle_state.dart'; 4 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MuhmdHsn313/IQPlayer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip 7 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/iqplayer.dart: -------------------------------------------------------------------------------- 1 | library iqplayer; 2 | 3 | export 'src/ui/iqscreen.dart'; 4 | export 'src/utils/subtitle_provider.dart'; 5 | export 'src/ui/iqparser.dart'; 6 | export 'package:video_player/video_player.dart' 7 | show VideoPlayerController, VideoPlayerValue; 8 | export 'src/utils/iqtheme.dart'; 9 | export 'src/utils/public_type.dart'; 10 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 85664beb900ae200aa1a3184d5ed63a479a9a329 8 | channel: master 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 85664beb900ae200aa1a3184d5ed63a479a9a329 8 | channel: master 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Flutter", 9 | "request": "launch", 10 | "type": "dart" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /lib/src/utils/public_type.dart: -------------------------------------------------------------------------------- 1 | library iqplayer.util; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | 5 | /// This is provide a method you can use to make your customization. 6 | 7 | /// Call when handle error. 8 | typedef IQErrorBuilder = Widget Function(BuildContext context, dynamic error); 9 | 10 | /// Call when [playButton] build. 11 | typedef IQPlayButtonBuilder = Widget Function( 12 | BuildContext context, bool isPlay, AnimationController animationController); 13 | 14 | /// Call when [lockButton] build. 15 | typedef IQLockButtonBuilder = Widget Function( 16 | BuildContext context, bool isLock, AnimationController animationController); 17 | -------------------------------------------------------------------------------- /lib/src/blocs/subtitle/subtitle_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | ///! The user have not to use this class. 4 | /// This class provide the event of subtitles! 5 | abstract class SubtitleEvent extends Equatable { 6 | const SubtitleEvent(); 7 | 8 | @override 9 | List get props => []; 10 | } 11 | 12 | class FetchSubtitles extends SubtitleEvent {} 13 | 14 | class UpdateSubtitle extends SubtitleEvent { 15 | final Duration position; 16 | 17 | const UpdateSubtitle(this.position); 18 | 19 | @override 20 | List get props => [position]; 21 | 22 | @override 23 | String toString() => "Position { duration: $position }"; 24 | } 25 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /lib/src/blocs/subtitle/subtitle_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | import '../../models/subtitle.dart'; 4 | 5 | ///! The user have not to use this class. 6 | /// This class provide the state of subtitles! 7 | class SubtitleState extends Equatable { 8 | final String data; 9 | 10 | const SubtitleState(this.data); 11 | 12 | factory SubtitleState.initial() => SubtitleState(''); 13 | 14 | SubtitleState copyWith({ 15 | Subtitle? subtitle, 16 | }) { 17 | if (subtitle != null) return SubtitleState(subtitle.data); 18 | return SubtitleState(this.data); 19 | } 20 | 21 | @override 22 | List get props => [data]; 23 | 24 | @override 25 | String toString() => "SubtitleState { date: $data }"; 26 | } 27 | -------------------------------------------------------------------------------- /lib/src/blocs/screen/screen_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | 4 | ///! The user have not to use this class. 5 | /// This class provide the event of ui not the player! 6 | abstract class ScreenEvent extends Equatable { 7 | const ScreenEvent(); 8 | 9 | @override 10 | List get props => []; 11 | } 12 | 13 | class ShowControls extends ScreenEvent {} 14 | 15 | class HideControls extends ScreenEvent {} 16 | 17 | class LockRotation extends ScreenEvent { 18 | final Orientation orientation; 19 | 20 | const LockRotation(this.orientation); 21 | 22 | @override 23 | List get props => [orientation]; 24 | } 25 | 26 | class UnlockRotation extends ScreenEvent {} 27 | 28 | class LockScreen extends ScreenEvent {} 29 | 30 | class UnlockScreen extends ScreenEvent {} 31 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [0.4.1] - Permanence. 2 | 3 | * Support null safety. 4 | * Enhance codes. 5 | * Remove unneeded packages. 6 | 7 | ## [0.4.0] - Permanence. 8 | 9 | * Support `Html` & `Css` styles. 10 | * Fixed player bugs. 11 | * Enhance code logic. 12 | * Provide a dartdoc comments for all package. 13 | 14 | ## [0.3.0-beta.1] - Frost. 15 | 16 | * Added `IQTheme` to customization your ui. 17 | * Fixed bugs with forward & backward. 18 | * Enhance code logic. 19 | 20 | ## [0.2.1] - Storm. 21 | 22 | * Edit Readme file. 23 | 24 | ## [0.2.0] - Storm. 25 | 26 | * Added `SubtitleProvider` class that enable user to use a subtitle from files, assets, network, string. 27 | * Added `IQParser` class to display subtitle data. 28 | * Added `SubtitleBloc` class to use with `IQParser`. 29 | 30 | ## [0.1.0] - Spring. 31 | 32 | * Added `IQScreen` class that enable user to use a plyer as a screen. 33 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | # Symbolication related 37 | app.*.symbols 38 | 39 | # Obfuscation related 40 | app.*.map.json 41 | 42 | # Exceptions to above rules. 43 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 44 | -------------------------------------------------------------------------------- /lib/src/models/subtitle.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | ///! The user have not to use this class. 4 | /// This model class contorl the subtitle data. 5 | class Subtitle extends Equatable { 6 | final Duration start; 7 | final Duration end; 8 | final String data; 9 | 10 | const Subtitle({ 11 | required this.start, 12 | required this.end, 13 | required this.data, 14 | }); 15 | 16 | bool operator >(Subtitle other) => this.start > other.start; 17 | 18 | bool operator <(Subtitle other) => this.start < other.start; 19 | 20 | bool operator <=(Subtitle other) => this.start <= other.start; 21 | 22 | bool operator >=(Subtitle other) => this.start >= other.start; 23 | 24 | int compareTo(Subtitle other) => 25 | this.start.inMilliseconds.compareTo(other.start.inMilliseconds); 26 | 27 | @override 28 | List get props => [start, end, data]; 29 | } 30 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/src/repositories/subtitle_repository.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:io'; 3 | 4 | import 'package:flutter/services.dart'; 5 | import 'package:http/http.dart'; 6 | 7 | ///! The user have not to use this class. 8 | /// Created to load the subtitles as a string from with value need to use futrue. 9 | class SubtitleRepository { 10 | /// Load the subtitles from network by provide the file url. 11 | Future fetchFromNetwork(String url) async { 12 | final response = await get(Uri.http(url, '')); 13 | if (response.statusCode == 200) return utf8.decode(response.bodyBytes); 14 | throw 'ERROR_FETCH_SUBTITLE(${response.statusCode})'; 15 | } 16 | 17 | /// Load the subtitles from specific file. 18 | Future fetchFromFile(File file) { 19 | return file.readAsString(); 20 | } 21 | 22 | /// Load the subtitles from specific file in assets. 23 | Future fetchFromAssets(String path) async { 24 | return rootBundle.loadString(path); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /lib/src/blocs/player/player_state.dart: -------------------------------------------------------------------------------- 1 | part of 'player_bloc.dart'; 2 | 3 | ///! The user have not to use this class. 4 | /// This class provide the state of player not the ui! 5 | abstract class PlayerState extends Equatable { 6 | const PlayerState(); 7 | 8 | @override 9 | List get props => []; 10 | } 11 | 12 | class LoadingState extends PlayerState {} 13 | 14 | class PlayingState extends PlayerState { 15 | final bool isPlay; 16 | final Duration duration; 17 | final Duration position; 18 | 19 | const PlayingState({ 20 | required this.isPlay, 21 | required this.duration, 22 | required this.position, 23 | }); 24 | 25 | @override 26 | List get props => [isPlay, position, duration]; 27 | } 28 | 29 | class FinishState extends PlayerState {} 30 | 31 | class ErrorState extends PlayerState { 32 | final dynamic error; 33 | 34 | const ErrorState(this.error); 35 | 36 | @override 37 | List get props => [error]; 38 | 39 | @override 40 | String toString() => "ErrorState { error: $error }"; 41 | } 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Muhammad Hasan Alasady 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/blocs/screen/screen_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | ///! The user have not to use this class. 4 | /// This class provide the state of ui not the player! 5 | class ScreenState extends Equatable { 6 | final bool lockScreen; 7 | final bool showControls; 8 | final bool lockRotation; 9 | 10 | const ScreenState({ 11 | required this.lockScreen, 12 | required this.showControls, 13 | required this.lockRotation, 14 | }); 15 | 16 | factory ScreenState.showControls({ 17 | bool? lockScreen, 18 | bool? lockRotation, 19 | }) { 20 | return ScreenState( 21 | lockScreen: lockScreen ?? false, 22 | showControls: true, 23 | lockRotation: lockRotation ?? false, 24 | ); 25 | } 26 | 27 | ScreenState copyWith({ 28 | bool? lockScreen, 29 | bool? lockRotation, 30 | bool? showControls, 31 | }) { 32 | return ScreenState( 33 | lockScreen: lockScreen ?? this.lockScreen, 34 | showControls: showControls ?? this.showControls, 35 | lockRotation: lockRotation ?? this.lockRotation, 36 | ); 37 | } 38 | 39 | @override 40 | List get props => [lockScreen, showControls, lockRotation]; 41 | } 42 | -------------------------------------------------------------------------------- /lib/src/blocs/subtitle/subtitle_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:bloc/bloc.dart'; 4 | 5 | import './bloc.dart'; 6 | import '../../models/subtitle.dart'; 7 | import '../../utils/subtitle_controller.dart'; 8 | import '../../utils/subtitle_provider.dart'; 9 | 10 | ///! The user have not to use this class. 11 | /// This class manage the state of subtitles! 12 | class SubtitleBloc extends Bloc { 13 | final SubtitleProvider _subtitleProvider; 14 | final SubtitleController _subtitleController; 15 | 16 | List subtitles; 17 | 18 | SubtitleBloc(this._subtitleProvider) 19 | : subtitles = [], 20 | _subtitleController = new SubtitleController(), 21 | super(SubtitleState.initial()); 22 | 23 | @override 24 | Stream mapEventToState( 25 | SubtitleEvent event, 26 | ) async* { 27 | if (event is FetchSubtitles) { 28 | subtitles = await _subtitleController.fetchList(_subtitleProvider.data); 29 | } 30 | 31 | if (event is UpdateSubtitle) { 32 | for (Subtitle subtitle in subtitles) { 33 | if (event.position >= subtitle.start && 34 | event.position <= subtitle.end) { 35 | yield SubtitleState(subtitle.data); 36 | break; 37 | } else { 38 | yield SubtitleState.initial(); 39 | } 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/src/utils/iqtheme.dart: -------------------------------------------------------------------------------- 1 | library iqplayer.util; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | 5 | import 'public_type.dart'; 6 | 7 | /// This class contorl theme of player, give this class the 8 | /// value you need to change, else you can let it null! 9 | class IQTheme { 10 | final Color? loadingProgressColor; 11 | final Color? playButtonColor; 12 | final Color? backgroundProgressColor; 13 | final Color? videoPlayedColor; 14 | final Color? lockScreenColor; 15 | final Color? lockRotationColor; 16 | 17 | final TextStyle? titleStyle; 18 | final TextStyle? descriptionStyle; 19 | final TextStyle? subtitleStyle; 20 | final TextStyle? durationStyle; 21 | 22 | final Widget? forwardIconButton; 23 | final Widget? backwardIconButton; 24 | final Widget? replayButton; 25 | final Widget? loadingProgress; 26 | 27 | final IQErrorBuilder? errorWidget; 28 | final IQPlayButtonBuilder? playButton; 29 | final IQLockButtonBuilder? lockScreen; 30 | final IQLockButtonBuilder? lockRotation; 31 | 32 | const IQTheme({ 33 | this.loadingProgressColor, 34 | this.playButtonColor, 35 | this.backgroundProgressColor, 36 | this.videoPlayedColor, 37 | this.lockScreenColor, 38 | this.lockRotationColor, 39 | this.titleStyle, 40 | this.descriptionStyle, 41 | this.subtitleStyle, 42 | this.durationStyle, 43 | this.forwardIconButton, 44 | this.backwardIconButton, 45 | this.playButton, 46 | this.replayButton, 47 | this.errorWidget, 48 | this.loadingProgress, 49 | this.lockScreen, 50 | this.lockRotation, 51 | }); 52 | } 53 | -------------------------------------------------------------------------------- /lib/src/blocs/player/player_event.dart: -------------------------------------------------------------------------------- 1 | part of 'player_bloc.dart'; 2 | 3 | ///! The user have not to use this class. 4 | /// This class provide the event of player not the ui! 5 | abstract class PlayerEvent extends Equatable { 6 | const PlayerEvent(); 7 | 8 | @override 9 | List get props => []; 10 | } 11 | 12 | class FetchData extends PlayerEvent {} 13 | 14 | class UpdateData extends PlayerEvent { 15 | final Duration position; 16 | final Duration duration; 17 | final bool loading; 18 | 19 | const UpdateData(this.position, this.duration, [this.loading = false]); 20 | 21 | @override 22 | List get props => [position, duration, loading]; 23 | 24 | @override 25 | String toString() => 26 | "position: $position, duration: $duration, loading: $loading"; 27 | } 28 | 29 | class PlayVideo extends PlayerEvent {} 30 | 31 | class PauseVideo extends PlayerEvent {} 32 | 33 | class ReplayVideo extends PlayerEvent {} 34 | 35 | class ChangeTimeTo extends PlayerEvent { 36 | final Duration duration; 37 | 38 | const ChangeTimeTo(this.duration); 39 | 40 | @override 41 | List get props => [duration]; 42 | 43 | @override 44 | String toString() => "ChangeTimeTo { duration: $duration }"; 45 | } 46 | 47 | class Forward extends ChangeTimeTo { 48 | const Forward([ 49 | Duration duration = const Duration(seconds: 10), 50 | ]) : super(duration); 51 | @override 52 | String toString() => "Forward { duration: $duration }"; 53 | } 54 | 55 | class Backward extends ChangeTimeTo { 56 | const Backward([ 57 | Duration duration = const Duration(seconds: 5), 58 | ]) : super(duration); 59 | @override 60 | String toString() => "Backward { duration: $duration }"; 61 | } 62 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: iqplayer 2 | description: Simple awesome video player with subtitle (you can load from assets, file, network, string). 3 | version: 0.4.1 4 | homepage: https://github.com/MuhmdHsn313/IQPlayer 5 | 6 | environment: 7 | sdk: ">=2.12.2 <3.0.0" 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | flutter_bloc: ">=7.0.0 <8.0.0" 13 | equatable: ">=2.0.0 <2.1.0" 14 | video_player: ">=2.1.1 <2.2.0" 15 | http: ">=0.13.3 <0.14.0" 16 | simple_html_css: ">=3.0.1 <3.1.0" 17 | bloc: ">=7.0.0 <8.0.0" 18 | 19 | dev_dependencies: 20 | flutter_test: 21 | sdk: flutter 22 | bloc_test: ">=8.0.0" 23 | 24 | flutter: 25 | 26 | # To add assets to your package, add an assets section, like this: 27 | # assets: 28 | # - images/a_dot_burr.jpeg 29 | # - images/a_dot_ham.jpeg 30 | # 31 | # For details regarding assets in packages, see 32 | # https://flutter.dev/assets-and-images/#from-packages 33 | # 34 | # An image asset can refer to one or more resolution-specific "variants", see 35 | # https://flutter.dev/assets-and-images/#resolution-aware. 36 | 37 | # To add custom fonts to your package, add a fonts section here, 38 | # in this "flutter" section. Each entry in this list should have a 39 | # "family" key with the font family name, and a "fonts" key with a 40 | # list giving the asset and other descriptors for the font. For 41 | # example: 42 | # fonts: 43 | # - family: Schyler 44 | # fonts: 45 | # - asset: fonts/Schyler-Regular.ttf 46 | # - asset: fonts/Schyler-Italic.ttf 47 | # style: italic 48 | # - family: Trajan Pro 49 | # fonts: 50 | # - asset: fonts/TrajanPro.ttf 51 | # - asset: fonts/TrajanPro_Bold.ttf 52 | # weight: 700 53 | # 54 | # For details regarding fonts in packages, see 55 | # https://flutter.dev/custom-fonts/#from-packages 56 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | build/ 32 | 33 | # Android related 34 | **/android/**/gradle-wrapper.jar 35 | **/android/.gradle 36 | **/android/captures/ 37 | **/android/gradlew 38 | **/android/gradlew.bat 39 | **/android/local.properties 40 | **/android/**/GeneratedPluginRegistrant.java 41 | 42 | # iOS/XCode related 43 | **/ios/**/*.mode1v3 44 | **/ios/**/*.mode2v3 45 | **/ios/**/*.moved-aside 46 | **/ios/**/*.pbxuser 47 | **/ios/**/*.perspectivev3 48 | **/ios/**/*sync/ 49 | **/ios/**/.sconsign.dblite 50 | **/ios/**/.tags* 51 | **/ios/**/.vagrant/ 52 | **/ios/**/DerivedData/ 53 | **/ios/**/Icon? 54 | **/ios/**/Pods/ 55 | **/ios/**/.symlinks/ 56 | **/ios/**/profile 57 | **/ios/**/xcuserdata 58 | **/ios/.generated/ 59 | **/ios/Flutter/App.framework 60 | **/ios/Flutter/Flutter.framework 61 | **/ios/Flutter/Flutter.podspec 62 | **/ios/Flutter/Generated.xcconfig 63 | **/ios/Flutter/app.flx 64 | **/ios/Flutter/app.zip 65 | **/ios/Flutter/flutter_assets/ 66 | **/ios/Flutter/flutter_export_environment.sh 67 | **/ios/ServiceDefinitions.json 68 | **/ios/Runner/GeneratedPluginRegistrant.* 69 | 70 | # Exceptions to above rules. 71 | !**/ios/**/default.mode1v3 72 | !**/ios/**/default.mode2v3 73 | !**/ios/**/default.pbxuser 74 | !**/ios/**/default.perspectivev3 75 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 76 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.example.example" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | } 47 | 48 | buildTypes { 49 | release { 50 | // TODO: Add your own signing config for the release build. 51 | // Signing with the debug keys for now, so `flutter run --release` works. 52 | signingConfig signingConfigs.debug 53 | } 54 | } 55 | } 56 | 57 | flutter { 58 | source '../..' 59 | } 60 | 61 | dependencies { 62 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 63 | } 64 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: IQPlayer Example 3 | 4 | environment: 5 | sdk: ">=2.7.0 <3.0.0" 6 | 7 | dependencies: 8 | flutter: 9 | sdk: flutter 10 | iqplayer: 11 | git: 12 | url: https://github.com/MuhmdHsn313/IQPlayer.git 13 | ref: hotfix 14 | 15 | flutter_spinkit: ^4.1.2+1 16 | # The following adds the Cupertino Icons font to your application. 17 | # Use with the CupertinoIcons class for iOS style icons. 18 | cupertino_icons: ^0.1.3 19 | 20 | dev_dependencies: 21 | flutter_test: 22 | sdk: flutter 23 | 24 | # For information on the generic Dart part of this file, see the 25 | # following page: https://dart.dev/tools/pub/pubspec 26 | 27 | # The following section is specific to Flutter. 28 | flutter: 29 | 30 | # The following line ensures that the Material Icons font is 31 | # included with your application, so that you can use the icons in 32 | # the material Icons class. 33 | uses-material-design: true 34 | 35 | # To add assets to your application, add an assets section, like this: 36 | # assets: 37 | # - images/a_dot_burr.jpeg 38 | # - images/a_dot_ham.jpeg 39 | 40 | # An image asset can refer to one or more resolution-specific "variants", see 41 | # https://flutter.dev/assets-and-images/#resolution-aware. 42 | 43 | # For details regarding adding assets from package dependencies, see 44 | # https://flutter.dev/assets-and-images/#from-packages 45 | 46 | # To add custom fonts to your application, add a fonts section here, 47 | # in this "flutter" section. Each entry in this list should have a 48 | # "family" key with the font family name, and a "fonts" key with a 49 | # list giving the asset and other descriptors for the font. For 50 | # example: 51 | # fonts: 52 | # - family: Schyler 53 | # fonts: 54 | # - asset: fonts/Schyler-Regular.ttf 55 | # - asset: fonts/Schyler-Italic.ttf 56 | # style: italic 57 | # - family: Trajan Pro 58 | # fonts: 59 | # - asset: fonts/TrajanPro.ttf 60 | # - asset: fonts/TrajanPro_Bold.ttf 61 | # weight: 700 62 | # 63 | # For details regarding fonts from package dependencies, 64 | # see https://flutter.dev/custom-fonts/#from-packages 65 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 10 | 17 | 21 | 25 | 30 | 34 | 35 | 36 | 37 | 38 | 39 | 41 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /lib/src/blocs/screen/screen_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:bloc/bloc.dart'; 3 | import 'package:flutter/services.dart'; 4 | import 'package:flutter/widgets.dart'; 5 | import './bloc.dart'; 6 | 7 | ///! The user have not to use this class. 8 | /// This class manage the state of ui not the player! 9 | class ScreenBloc extends Bloc { 10 | final String title; 11 | final String description; 12 | 13 | ScreenBloc({ 14 | required this.title, 15 | required this.description, 16 | }) : super(ScreenState.showControls()) { 17 | _hideStateBar(); 18 | _enableRotation(); 19 | } 20 | 21 | @override 22 | Stream mapEventToState( 23 | ScreenEvent event, 24 | ) async* { 25 | if (event is ShowControls) { 26 | yield state.copyWith(showControls: true); 27 | } 28 | if (event is HideControls) { 29 | yield state.copyWith(showControls: false); 30 | } 31 | if (event is LockRotation) { 32 | _selectRotation(event.orientation); 33 | yield state.copyWith(lockRotation: true); 34 | } 35 | if (event is UnlockRotation) { 36 | _enableRotation(); 37 | yield state.copyWith(lockRotation: false); 38 | } 39 | if (event is LockScreen) { 40 | yield state.copyWith(lockScreen: true); 41 | } 42 | if (event is UnlockScreen) { 43 | yield state.copyWith(lockScreen: false); 44 | } 45 | } 46 | 47 | void _enableRotation() { 48 | SystemChrome.setPreferredOrientations([ 49 | DeviceOrientation.landscapeRight, 50 | DeviceOrientation.landscapeLeft, 51 | DeviceOrientation.portraitUp, 52 | DeviceOrientation.portraitDown, 53 | ]); 54 | } 55 | 56 | void _selectRotation(Orientation orientation) { 57 | if (orientation == Orientation.portrait) 58 | SystemChrome.setPreferredOrientations([ 59 | DeviceOrientation.portraitUp, 60 | DeviceOrientation.portraitDown, 61 | ]); 62 | else 63 | SystemChrome.setPreferredOrientations([ 64 | DeviceOrientation.landscapeLeft, 65 | DeviceOrientation.landscapeRight, 66 | ]); 67 | } 68 | 69 | void _hideStateBar() async { 70 | SystemChrome.setEnabledSystemUIOverlays([]); 71 | } 72 | 73 | void _showStateBar() async { 74 | SystemChrome.setEnabledSystemUIOverlays([ 75 | SystemUiOverlay.top, 76 | SystemUiOverlay.bottom, 77 | ]); 78 | } 79 | 80 | @override 81 | Future close() { 82 | _showStateBar(); 83 | _enableRotation(); 84 | return super.close(); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /lib/src/ui/iqparser.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:simple_html_css/simple_html_css.dart'; 4 | 5 | import '../blocs/player/player_bloc.dart'; 6 | import '../blocs/subtitle/bloc.dart'; 7 | 8 | /// This widget for display subtitle, you can use only with bloc: 9 | /// ```dart 10 | /// // In Your widget 11 | /// BlocProvider( 12 | /// create: (context) => 13 | /// SubtitleBloc( 14 | /// SubtitleProvider.fromNetwork(""), 15 | /// )..add(FetchSubtitles()), 16 | /// child: MyParser(), 17 | /// ); 18 | /// //new parser class, you can exclude `MyParser` 19 | /// class MyParser extends StatelessWidget { 20 | /// @override 21 | /// Widget build(BuildContext context) { 22 | /// return IQParser(); 23 | /// } 24 | /// } 25 | /// ``` 26 | class IQParser extends StatelessWidget { 27 | /// To customization your text style of subtitle. 28 | final TextStyle? subtitleDefaultTextStyle; 29 | 30 | const IQParser({ 31 | Key? key, 32 | this.subtitleDefaultTextStyle, 33 | }) : super(key: key); 34 | 35 | @override 36 | Widget build(BuildContext context) { 37 | try { 38 | return BlocListener( 39 | bloc: BlocProvider.of(context), 40 | listener: (context, state) { 41 | if (state is PlayingState) 42 | BlocProvider.of(context).add( 43 | UpdateSubtitle(state.position), 44 | ); 45 | }, 46 | child: BlocBuilder( 47 | bloc: BlocProvider.of(context), 48 | builder: (context, state) => Container( 49 | child: Builder( 50 | builder: (context) { 51 | return HTML.toRichText( 52 | context, 53 | '

${state.data}

', 54 | defaultTextStyle: subtitleDefaultTextStyle ?? 55 | TextStyle( 56 | fontSize: 20, 57 | color: Colors.white, 58 | shadows: [ 59 | Shadow( 60 | color: Colors.black, 61 | offset: Offset(1, 1), 62 | blurRadius: 2.5, 63 | ) 64 | ], 65 | ), 66 | ); 67 | }, 68 | ), 69 | ), 70 | ), 71 | ); 72 | } catch (_) { 73 | return Container(); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /lib/src/utils/subtitle_provider.dart: -------------------------------------------------------------------------------- 1 | library iqplayer.util; 2 | 3 | import 'dart:async'; 4 | import 'dart:io'; 5 | 6 | import '../repositories/subtitle_repository.dart'; 7 | 8 | /// Use it for provide the subtitle from: 9 | class SubtitleProvider { 10 | final FutureOr data; 11 | 12 | const SubtitleProvider._(this.data); 13 | 14 | /// Network: use [SubtitleProvider.fromNetwork()] and give it a url, for example: 15 | /// ```dart 16 | /// IQScreen( 17 | /// subtitleProvider: SubtitleProvider.fromNetwork( 18 | /// 'https://duoidi6ujfbv.cloudfront.net/media/0/subtitles/5675420c9d9a3.vtt', 19 | /// ), 20 | /// ... 21 | /// ), 22 | /// ``` 23 | /// 24 | factory SubtitleProvider.fromNetwork(String url) { 25 | final SubtitleRepository _repository = SubtitleRepository(); 26 | return SubtitleProvider._( 27 | _repository.fetchFromNetwork(url), 28 | ); 29 | } 30 | 31 | /// File: use it [SubtitleProvider.fromFile()] by provide the file to load subtitles, for example: 32 | /// ```dart 33 | /// File subtitle = new File('') 34 | /// IQScreen( 35 | /// subtitleProvider: SubtitleProvider.fromFile(subtitle), 36 | /// ... 37 | /// ), 38 | /// ``` 39 | factory SubtitleProvider.fromFile(File file) { 40 | final SubtitleRepository _repository = SubtitleRepository(); 41 | return SubtitleProvider._( 42 | _repository.fetchFromFile(file), 43 | ); 44 | } 45 | 46 | /// Assets: use it [SubtitleProvider.fromAssets()] to provide the assets file, for example: 47 | /// ```dart 48 | /// IQScreen( 49 | /// subtitleProvider: SubtitleProvider.fromAssets(''), 50 | /// ... 51 | /// ), 52 | /// ``` 53 | factory SubtitleProvider.fromAssets(String path) { 54 | final SubtitleRepository _repository = SubtitleRepository(); 55 | return SubtitleProvider._( 56 | _repository.fetchFromAssets(path), 57 | ); 58 | } 59 | 60 | /// String: use it to provide a string for generate a subtitles, for example: 61 | /// ```dart 62 | /// IQScreen( 63 | /// subtitleProvider: SubtitleProvider.fromString( 64 | /// """WEBVTT 65 | /// 66 | /// 00:00:00.650 --> 00:00:03.000 67 | ///

Hello World

68 | /// 69 | /// 00:00:03.024 --> 00:00:07.524 70 | /// Mindmarker je krátká zpráva formou 71 | /// videa, souborů PDF... 72 | /// 73 | /// 00:00:07.548 --> 00:00:12.448 74 | /// colorful 75 | /// 76 | /// 00:00:12.472 --> 00:00:16.072 77 | /// Mindmarker budeš obdržovat 78 | /// ve specifický chvílích... 79 | /// 80 | /// 00:00:16.100 --> 00:00:20.100 81 | /// abychom lépe utužili tvé znalosti.""", 82 | /// ), 83 | /// ... 84 | /// ), 85 | /// ``` 86 | factory SubtitleProvider.fromString(String data) => SubtitleProvider._(data); 87 | } 88 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /lib/src/utils/subtitle_controller.dart: -------------------------------------------------------------------------------- 1 | library iqplayer.util; 2 | 3 | import 'dart:async'; 4 | 5 | import '../models/subtitle.dart'; 6 | 7 | ///! The user have not to use this class. 8 | /// This decode subtitles after fetched by [SubtitleRepository]. 9 | /// The decode with [RegExp]. 10 | class SubtitleController { 11 | /// This method that decode the subtitles by provide a [FutureOr]. 12 | Future> fetchList(FutureOr data) async { 13 | RegExp regExp = new RegExp( 14 | r"(\d{1,2}):(\d{2}):(\d{2})\.(\d+) --> (\d{1,2}):(\d{2}):(\d{2})\.(\d+)(?:.*)(\D*)", 15 | caseSensitive: false, 16 | multiLine: true, 17 | ); 18 | 19 | RegExp missHourMi = new RegExp( 20 | r"^(\d{1,2}):(\d{2})\.(\d+) --> (\d{1,2}):(\d{2}):(\d{2})\.(\d+)(?:.*)(\D*)", 21 | caseSensitive: true, 22 | multiLine: false, 23 | ); 24 | 25 | RegExp missHour = new RegExp( 26 | r"(\d{1,2}):(\d{2})\.(\d+) --> (\d{2}):(\d{2})\.(\d+)(?:.*)(\D*)", 27 | caseSensitive: false, 28 | multiLine: true, 29 | ); 30 | 31 | String content = await data; 32 | 33 | List subList = content.split('\n'); 34 | 35 | for (int i = 0; i < subList.length; i++) { 36 | if (missHour.hasMatch(subList[i])) { 37 | subList[i] = subList[i].replaceAllMapped(missHour, (m) { 38 | return "00:${m[1]}:${m[2]}.${m[3]} --> 00:${m[4]}:${m[5]}.${m[6]}"; 39 | }); 40 | } else if (missHourMi.hasMatch(subList[i])) { 41 | subList[i] = subList[i].replaceAllMapped(missHourMi, (m) { 42 | return "00:${m[1]}:${m[2]}.${m[3]} --> ${m[4]}:${m[5]}:${m[6]}.${m[7]}"; 43 | }); 44 | } 45 | } 46 | 47 | content = subList.join('\n'); 48 | 49 | List matches = regExp.allMatches(content).toList(); 50 | List subtitleList = []; 51 | 52 | matches.forEach( 53 | (RegExpMatch regExpMatch) { 54 | int startTimeHours = int.parse(regExpMatch.group(1)!); 55 | int startTimeMinutes = int.parse(regExpMatch.group(2)!); 56 | int startTimeSeconds = int.parse(regExpMatch.group(3)!); 57 | int startTimeMilliseconds = int.parse(regExpMatch.group(4)!); 58 | 59 | int endTimeHours = int.parse(regExpMatch.group(5)!); 60 | int endTimeMinutes = int.parse(regExpMatch.group(6)!); 61 | int endTimeSeconds = int.parse(regExpMatch.group(7)!); 62 | int endTimeMilliseconds = int.parse(regExpMatch.group(8)!); 63 | String text = regExpMatch.group(9)!; 64 | 65 | Duration startTime = Duration( 66 | hours: startTimeHours, 67 | minutes: startTimeMinutes, 68 | seconds: startTimeSeconds, 69 | milliseconds: startTimeMilliseconds); 70 | Duration endTime = Duration( 71 | hours: endTimeHours, 72 | minutes: endTimeMinutes, 73 | seconds: endTimeSeconds, 74 | milliseconds: endTimeMilliseconds); 75 | 76 | subtitleList.add( 77 | Subtitle( 78 | start: startTime, 79 | end: endTime, 80 | data: text.trim(), 81 | ), 82 | ); 83 | }, 84 | ); 85 | 86 | return subtitleList; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /lib/src/blocs/player/player_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:bloc/bloc.dart'; 4 | import 'package:equatable/equatable.dart'; 5 | import 'package:video_player/video_player.dart'; 6 | 7 | import '../../../iqplayer.dart'; 8 | 9 | part 'player_event.dart'; 10 | part 'player_state.dart'; 11 | 12 | ///! The user have not to use this class. 13 | /// This class manage the state of player not the ui! 14 | class PlayerBloc extends Bloc { 15 | final VideoPlayerController controller; 16 | 17 | PlayerBloc(this.controller) : super(LoadingState()) { 18 | controller.addListener(_listener); 19 | } 20 | 21 | VideoPlayerValue? value; 22 | 23 | @override 24 | Stream mapEventToState( 25 | PlayerEvent event, 26 | ) async* { 27 | if (event is FetchData) { 28 | yield LoadingState(); 29 | if (value != null) { 30 | controller.initialize(); 31 | } 32 | add(PlayVideo()); 33 | } 34 | 35 | if (event is UpdateData) { 36 | if (value!.duration == value!.position) 37 | yield FinishState(); 38 | else if (event.loading) { 39 | yield LoadingState(); 40 | } else 41 | yield PlayingState( 42 | isPlay: value!.isPlaying, 43 | duration: value!.duration, 44 | position: value!.position, 45 | ); 46 | } 47 | 48 | if (event is PlayVideo) { 49 | controller.play(); 50 | yield PlayingState( 51 | isPlay: true, 52 | duration: value!.duration, 53 | position: value!.position, 54 | ); 55 | } 56 | 57 | if (event is PauseVideo) { 58 | controller.pause(); 59 | yield PlayingState( 60 | isPlay: false, 61 | duration: value!.duration, 62 | position: value!.position, 63 | ); 64 | } 65 | if (event is Forward) { 66 | Duration newPosition = value!.position + event.duration; 67 | if (value!.duration > newPosition) { 68 | controller.seekTo(newPosition); 69 | yield PlayingState( 70 | isPlay: value!.isPlaying, 71 | duration: value!.duration, 72 | position: newPosition, 73 | ); 74 | } 75 | } 76 | if (event is Backward) { 77 | Duration newPosition = value!.position - event.duration; 78 | if (value!.position > Duration(seconds: 6)) { 79 | controller.seekTo(newPosition); 80 | yield PlayingState( 81 | isPlay: value!.isPlaying, 82 | duration: value!.duration, 83 | position: newPosition, 84 | ); 85 | } 86 | } 87 | if (event is ChangeTimeTo) { 88 | if (event.duration >= Duration.zero && 89 | event.duration <= value!.duration) { 90 | controller.seekTo(event.duration); 91 | yield PlayingState( 92 | isPlay: value!.isPlaying, 93 | duration: value!.duration, 94 | position: value!.position, 95 | ); 96 | } 97 | } 98 | 99 | if (event is ReplayVideo) { 100 | controller.seekTo(Duration.zero).then((value) => controller.play()); 101 | yield PlayingState( 102 | isPlay: true, 103 | duration: value!.duration, 104 | position: value!.position, 105 | ); 106 | } 107 | } 108 | 109 | void _listener() { 110 | value = controller.value; 111 | DurationRange buffer = DurationRange(Duration.zero, Duration.zero); 112 | 113 | if (value!.buffered.isNotEmpty) buffer = value!.buffered.last; 114 | 115 | if (buffer.end == value!.position && value!.position != value!.duration) 116 | return add(UpdateData(value!.position, value!.duration, true)); 117 | 118 | return add(UpdateData( 119 | value!.position, 120 | value!.duration, 121 | )); 122 | } 123 | 124 | @override 125 | Future close() { 126 | controller.removeListener(_listener); 127 | return super.close(); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_spinkit/flutter_spinkit.dart'; 3 | import 'package:iqplayer/iqplayer.dart'; 4 | 5 | void main() { 6 | runApp(MyApp()); 7 | } 8 | 9 | class MyApp extends StatelessWidget { 10 | @override 11 | Widget build(BuildContext context) { 12 | return MaterialApp( 13 | title: 'IQPlayer Demo', 14 | theme: ThemeData( 15 | primarySwatch: Colors.blue, 16 | visualDensity: VisualDensity.adaptivePlatformDensity, 17 | ), 18 | home: MyHomePage(title: 'IQPlayer Demo'), 19 | ); 20 | } 21 | } 22 | 23 | class MyHomePage extends StatelessWidget { 24 | MyHomePage({Key key, this.title}) : super(key: key); 25 | 26 | final String title; 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | appBar: AppBar( 32 | title: Text(title), 33 | ), 34 | body: Center( 35 | child: Column( 36 | children: [ 37 | ElevatedButton( 38 | child: Text('Open IQPlayer'), 39 | onPressed: () { 40 | Navigator.push( 41 | context, 42 | MaterialPageRoute( 43 | builder: (BuildContext context) => IQScreen( 44 | title: title, 45 | description: 'Simple video as a demo video', 46 | videoPlayerController: VideoPlayerController.network( 47 | 'https://d11b76aq44vj33.cloudfront.net/media/720/video/5def7824adbbc.mp4', 48 | ), 49 | subtitleProvider: SubtitleProvider.fromString( 50 | """WEBVTT 51 | 52 | 00:00:00.650 --> 00:00:03.000 53 |

Hello World

54 | 55 | 00:00:03.024 --> 00:00:07.524 56 | Mindmarker je krátká zpráva formou 57 | videa, souborů PDF... 58 | 59 | 00:00:07.548 --> 00:0 simple_html_css: ^2.0.0+2 60 | 0:12.448 61 | colorful 62 | 63 | 00:00:12.472 --> 00:00:16.072 64 | Mindmarker budeš obdržovat 65 | ve specifický chvílích... 66 | 67 | 00:00:16.100 --> 00:00:20.100 68 | abychom lépe utužili tvé znalosti.""", 69 | ), 70 | // subtitleProvider: SubtitleProvider.fromNetwork( 71 | // 'https://duoidi6ujfbv.cloudfront.net/media/0/subtitles/5675420c9d9a3.vtt'), 72 | iqTheme: IQTheme( 73 | loadingProgress: SpinKitCircle( 74 | color: Colors.red, 75 | ), 76 | playButtonColor: Colors.transparent, 77 | videoPlayedColor: Colors.indigo, 78 | playButton: (BuildContext context, bool isPlay, 79 | AnimationController animationController) { 80 | if (isPlay) 81 | return Icon( 82 | Icons.pause_circle_filled, 83 | color: Colors.red, 84 | size: 50, 85 | ); 86 | return Icon( 87 | Icons.play_circle_outline, 88 | color: Colors.red, 89 | size: 50, 90 | ); 91 | }, 92 | ), 93 | ), 94 | ), 95 | ); 96 | }, 97 | ), 98 | ], 99 | ), 100 | ), 101 | ); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /lib/src/ui/iqscreen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:video_player/video_player.dart'; 4 | 5 | import '../blocs/player/player_bloc.dart'; 6 | import '../blocs/screen/screen_bloc.dart'; 7 | import '../blocs/subtitle/bloc.dart'; 8 | import '../utils/iqtheme.dart'; 9 | import '../utils/subtitle_provider.dart'; 10 | import 'screen_controllers.dart'; 11 | 12 | /// UI Screen provide an awesome video player as a screen. 13 | class IQScreen extends StatefulWidget { 14 | /// Provide a title of video on screen. 15 | final String title; 16 | 17 | /// Provide a description of video on screen. 18 | final String description; 19 | 20 | /// Controls a platform video player, and provides updates when the state is changing. 21 | final VideoPlayerController videoPlayerController; 22 | 23 | /// Provide a subtitle to display it. 24 | final SubtitleProvider? subtitleProvider; 25 | 26 | /// You make your customization on theme. 27 | final IQTheme iqTheme; 28 | 29 | const IQScreen({ 30 | Key? key, 31 | required this.title, 32 | required this.videoPlayerController, 33 | this.iqTheme: const IQTheme(), 34 | this.description: '', 35 | this.subtitleProvider, 36 | }) : super(key: key); 37 | 38 | @override 39 | _IQScreenState createState() => _IQScreenState(); 40 | } 41 | 42 | class _IQScreenState extends State 43 | with SingleTickerProviderStateMixin { 44 | late AnimationController playAnimationController; 45 | 46 | String get title => widget.title; 47 | 48 | String get description => widget.description; 49 | 50 | VideoPlayerController get videoPlayerController => 51 | widget.videoPlayerController; 52 | 53 | SubtitleProvider? get subtitleProvider => widget.subtitleProvider; 54 | 55 | IQTheme get iqTheme => widget.iqTheme; 56 | 57 | @override 58 | void initState() { 59 | playAnimationController = AnimationController( 60 | vsync: this, 61 | duration: Duration(milliseconds: 300), 62 | ); 63 | videoPlayerController.initialize(); 64 | videoPlayerController.play(); 65 | super.initState(); 66 | } 67 | 68 | @override 69 | void dispose() { 70 | videoPlayerController.dispose(); 71 | playAnimationController.dispose(); 72 | super.dispose(); 73 | } 74 | 75 | @override 76 | Widget build(BuildContext context) { 77 | return Scaffold( 78 | backgroundColor: Colors.black, 79 | body: Stack( 80 | children: [ 81 | Container( 82 | alignment: Alignment.center, 83 | child: AspectRatio( 84 | aspectRatio: 16 / 9, 85 | child: VideoPlayer( 86 | videoPlayerController, 87 | ), 88 | ), 89 | ), 90 | Positioned( 91 | top: 0, 92 | bottom: 0, 93 | left: 0, 94 | right: 0, 95 | child: MultiBlocProvider( 96 | providers: [ 97 | BlocProvider( 98 | create: (context) => ScreenBloc( 99 | title: title, 100 | description: description, 101 | ), 102 | ), 103 | BlocProvider( 104 | create: (context) => 105 | PlayerBloc(videoPlayerController)..add(FetchData()), 106 | ), 107 | if (widget.subtitleProvider != null) 108 | BlocProvider( 109 | create: (context) => 110 | SubtitleBloc(subtitleProvider!)..add(FetchSubtitles()), 111 | ), 112 | ], 113 | child: ScreenControllers( 114 | iqTheme: iqTheme, 115 | playAnimationController: playAnimationController, 116 | ), 117 | ), 118 | ), 119 | ], 120 | ), 121 | ); 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.5.0" 11 | bloc: 12 | dependency: transitive 13 | description: 14 | name: bloc 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "6.0.2" 18 | boolean_selector: 19 | dependency: transitive 20 | description: 21 | name: boolean_selector 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.1.0" 25 | characters: 26 | dependency: transitive 27 | description: 28 | name: characters 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.1.0" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.2.0" 39 | clock: 40 | dependency: transitive 41 | description: 42 | name: clock 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.1.0" 46 | collection: 47 | dependency: transitive 48 | description: 49 | name: collection 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.15.0" 53 | convert: 54 | dependency: transitive 55 | description: 56 | name: convert 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.1" 60 | cupertino_icons: 61 | dependency: "direct main" 62 | description: 63 | name: cupertino_icons 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "0.1.3" 67 | equatable: 68 | dependency: transitive 69 | description: 70 | name: equatable 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "1.2.3" 74 | fake_async: 75 | dependency: transitive 76 | description: 77 | name: fake_async 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "1.2.0" 81 | flutter: 82 | dependency: "direct main" 83 | description: flutter 84 | source: sdk 85 | version: "0.0.0" 86 | flutter_bloc: 87 | dependency: transitive 88 | description: 89 | name: flutter_bloc 90 | url: "https://pub.dartlang.org" 91 | source: hosted 92 | version: "6.0.1" 93 | flutter_spinkit: 94 | dependency: "direct main" 95 | description: 96 | name: flutter_spinkit 97 | url: "https://pub.dartlang.org" 98 | source: hosted 99 | version: "4.1.2+1" 100 | flutter_test: 101 | dependency: "direct dev" 102 | description: flutter 103 | source: sdk 104 | version: "0.0.0" 105 | flutter_web_plugins: 106 | dependency: transitive 107 | description: flutter 108 | source: sdk 109 | version: "0.0.0" 110 | html_unescape: 111 | dependency: transitive 112 | description: 113 | name: html_unescape 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "1.0.1+3" 117 | http: 118 | dependency: transitive 119 | description: 120 | name: http 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "0.12.2" 124 | http_parser: 125 | dependency: transitive 126 | description: 127 | name: http_parser 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "3.1.4" 131 | iqplayer: 132 | dependency: "direct main" 133 | description: 134 | path: "." 135 | ref: hotfix 136 | resolved-ref: "21d9e47f4659d2db4c91f584f04b3a9902b58195" 137 | url: "https://github.com/MuhmdHsn313/IQPlayer.git" 138 | source: git 139 | version: "0.4.0+1" 140 | js: 141 | dependency: transitive 142 | description: 143 | name: js 144 | url: "https://pub.dartlang.org" 145 | source: hosted 146 | version: "0.6.3" 147 | matcher: 148 | dependency: transitive 149 | description: 150 | name: matcher 151 | url: "https://pub.dartlang.org" 152 | source: hosted 153 | version: "0.12.10" 154 | meta: 155 | dependency: transitive 156 | description: 157 | name: meta 158 | url: "https://pub.dartlang.org" 159 | source: hosted 160 | version: "1.3.0" 161 | nested: 162 | dependency: transitive 163 | description: 164 | name: nested 165 | url: "https://pub.dartlang.org" 166 | source: hosted 167 | version: "0.0.4" 168 | path: 169 | dependency: transitive 170 | description: 171 | name: path 172 | url: "https://pub.dartlang.org" 173 | source: hosted 174 | version: "1.8.0" 175 | pedantic: 176 | dependency: transitive 177 | description: 178 | name: pedantic 179 | url: "https://pub.dartlang.org" 180 | source: hosted 181 | version: "1.9.0" 182 | petitparser: 183 | dependency: transitive 184 | description: 185 | name: petitparser 186 | url: "https://pub.dartlang.org" 187 | source: hosted 188 | version: "3.0.4" 189 | provider: 190 | dependency: transitive 191 | description: 192 | name: provider 193 | url: "https://pub.dartlang.org" 194 | source: hosted 195 | version: "4.3.2+1" 196 | screen: 197 | dependency: transitive 198 | description: 199 | name: screen 200 | url: "https://pub.dartlang.org" 201 | source: hosted 202 | version: "0.0.5" 203 | simple_html_css: 204 | dependency: transitive 205 | description: 206 | name: simple_html_css 207 | url: "https://pub.dartlang.org" 208 | source: hosted 209 | version: "2.0.0+2" 210 | sky_engine: 211 | dependency: transitive 212 | description: flutter 213 | source: sdk 214 | version: "0.0.99" 215 | source_span: 216 | dependency: transitive 217 | description: 218 | name: source_span 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "1.8.0" 222 | stack_trace: 223 | dependency: transitive 224 | description: 225 | name: stack_trace 226 | url: "https://pub.dartlang.org" 227 | source: hosted 228 | version: "1.10.0" 229 | stream_channel: 230 | dependency: transitive 231 | description: 232 | name: stream_channel 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "2.1.0" 236 | string_scanner: 237 | dependency: transitive 238 | description: 239 | name: string_scanner 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "1.1.0" 243 | term_glyph: 244 | dependency: transitive 245 | description: 246 | name: term_glyph 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "1.2.0" 250 | test_api: 251 | dependency: transitive 252 | description: 253 | name: test_api 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "0.2.19" 257 | typed_data: 258 | dependency: transitive 259 | description: 260 | name: typed_data 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "1.3.0" 264 | vector_math: 265 | dependency: transitive 266 | description: 267 | name: vector_math 268 | url: "https://pub.dartlang.org" 269 | source: hosted 270 | version: "2.1.0" 271 | video_player: 272 | dependency: transitive 273 | description: 274 | name: video_player 275 | url: "https://pub.dartlang.org" 276 | source: hosted 277 | version: "0.10.12" 278 | video_player_platform_interface: 279 | dependency: transitive 280 | description: 281 | name: video_player_platform_interface 282 | url: "https://pub.dartlang.org" 283 | source: hosted 284 | version: "2.1.0" 285 | video_player_web: 286 | dependency: transitive 287 | description: 288 | name: video_player_web 289 | url: "https://pub.dartlang.org" 290 | source: hosted 291 | version: "0.1.3+2" 292 | xml: 293 | dependency: transitive 294 | description: 295 | name: xml 296 | url: "https://pub.dartlang.org" 297 | source: hosted 298 | version: "3.7.0" 299 | sdks: 300 | dart: ">=2.12.0-0.0 <3.0.0" 301 | flutter: ">=1.16.0" 302 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IQPlayer 2 | 3 | Simple video player with subtitle wrote for Flutter. 4 | 5 | ![GitHub release (latest by date)](https://img.shields.io/github/v/release/Muhmdhsn313/IQPlayer?style=flat-square) 6 | ![GitHub](https://img.shields.io/github/license/muhmdhsn313/iqplayer?style=flat-square) 7 | ![GitHub followers](https://img.shields.io/github/followers/muhmdhsn313?style=social) 8 | 9 | > This package as a gift for my teacher and my leader [Mr. Muqtada Al-Sadr](https://twitter.com/Mu_AlSadr). 10 | 11 | > Proudly based on [BLoC](https://pub.dev/packages/flutter_bloc). 12 | 13 | 14 | ![Screenshot_1589120660](https://user-images.githubusercontent.com/33749659/81501966-bdeed980-92e3-11ea-88b5-365cfe93bd1a.png) 15 | 16 | ## Features 17 | 1. [x] Play video from Assets, Files, Network by `VideoPlayerController` from video_player. 18 | 2. [x] Parse subtitles from Assets, Files, Network `SubtitleProvider` class. 19 | 3. [x] Custom theme you can use with `IQTheme` class. 20 | 4. [x] Support Subtitles: 21 | 1. [x] VTT format 22 | 2. [ ] SRT format 23 | 3. [ ] User define format 24 | 5. [x] **IQScreen:** a video player scaffold screen. 25 | 6. [ ] **IQPlayer:** a widget enable you to watch video implement with your screen. 26 | 7. [x] **IQParser:** a subtitle package that view subtitles, included the widget and parser. 27 | 8. [x] **IQTheme:** to make your customizations on player ui and make it more integrated with your own app. 28 | 29 | 30 | # Installation 31 | ## 1. Depends on 32 | Go to `pubspec.yaml` and add it to the dependencies list like: 33 | 34 | ```yaml 35 | dependencies: 36 | iqplayer: 37 | ``` 38 | 39 | Install packages from the command line with Flutter: 40 | 41 | ```shell script 42 | flutter pub get 43 | ``` 44 | 45 | ## 2. Install 46 | 47 | ### Android 48 | Ensure the following permission is presented in your Android Manifest file, located in /android/app/src/main/AndroidManifest.xml: 49 | ```xml 50 | 51 | ``` 52 | The Flutter project template adds it, so it may already be there. 53 | ### IOS 54 | 55 | Warning: The video player is not functional on iOS simulators. An IOS device must be used during development/testing. 56 | 57 | Add the following entry into your Info.plist file, located in /ios/Runner/Info.plist: 58 | 59 | ``` 60 | NSAppTransportSecurity 61 | 62 | NSAllowsArbitraryLoads 63 | 64 | 65 | ``` 66 | This entry allows your app to access video files by URL. 67 | 68 | 69 | ## 3. Import 70 | 71 | Now in your Dart files, you can use: 72 | 73 | ```dart 74 | import "package:iqplayer/iqplayer.dart"; 75 | ``` 76 | # Componets 77 | 1. **IQScreen:** 78 | ```dart 79 | IQScreen( 80 | videoPlayerController = VideoPlayerController.network(""), 81 | subtitleProvider: SubtitleProvider.fromNetwork(""), 82 | title: "Simple Video", 83 | description: "Simple Description", 84 | ); 85 | ``` 86 | 2. **IQPlayer:** 87 | 88 | > In development. 89 | 90 | 3. **IQParser:** 91 | 92 | > Note: It is used automatically with `IQScreen` and you can use and display data with `SubtitleProvider`. 93 | 94 | ```dart 95 | BlocProvider( 96 | create: (context) => 97 | SubtitleBloc( 98 | SubtitleProvider.fromNetwork(""), 99 | )..add(FetchSubtitles()), 100 | child: MyParser(), 101 | ); 102 | ``` 103 | 104 | 105 | 4. **IQTheme:** 106 | > Note: You can customize your theme on `IQScreen`, `IQPlayer` or `IQParser` with this class. 107 | 108 | > You have +17 option to customize theme! 109 | 110 | ```dart 111 | IQScreen( 112 | ... 113 | iqTheme: IQTheme( 114 | ... 115 | ), 116 | ); 117 | ``` 118 | 119 | # Using 120 | 121 | 1. Start using `IQScreen` with Navigator: 122 | 123 | ```dart 124 | Navigator.push( 125 | context, 126 | MaterialPageRoute( 127 | builder: (BuildContext context) => IQScreen( 128 | title: "", 129 | description: "", 130 | videoPlayerController: VideoPlayerController.network(""), 131 | subtitleProvider: SubtitleProvider.fromNetwork(""), 132 | ), 133 | ), 134 | ); 135 | ``` 136 | 137 | 2. Using of `IQParser`: 138 | 139 | > You have to use `BlocProvider` with `SubtitleProvider` to configure subtitles. 140 | 141 | ```dart 142 | // In Your widget 143 | BlocProvider( 144 | create: (context) => 145 | SubtitleBloc( 146 | SubtitleProvider.fromNetwork(""), 147 | )..add(FetchSubtitles()), 148 | child: MyParser(), 149 | ); 150 | 151 | // new parser class, you can exclude `MyParser` 152 | class MyParser extends StatelessWidget { 153 | @override 154 | Widget build(BuildContext context) { 155 | return IQParser(); 156 | } 157 | } 158 | ``` 159 | > Note: You can exclude "MyParser" and delete it! 160 | 161 | > Note: What is the reason for creating `MyParser`? [see this](https://bloclibrary.dev/#/faqs?id=blocproviderof-fails-to-find-bloc) 162 | 163 | 164 | 3. You can use `IQTheme` to customize ui like: 165 | 166 | > You have +17 option to customize theme! 167 | 168 | ```dart 169 | IQTheme( 170 | loadingProgress: SpinKitCircle( 171 | color: Colors.red, 172 | ), 173 | playButtonColor: Colors.transparent, 174 | videoPlayedColor: Colors.indigo, 175 | playButton: (bool isPlay) { 176 | if (isPlay) 177 | return Icon( 178 | Icons.pause_circle_filled, 179 | color: Colors.red, 180 | size: 50, 181 | ); 182 | return Icon( 183 | Icons.play_circle_outline, 184 | color: Colors.red, 185 | size: 50, 186 | ); 187 | }, 188 | ); 189 | ``` 190 | 191 | # Example 192 | ```dart 193 | import 'package:flutter/material.dart'; 194 | import 'package:flutter_spinkit/flutter_spinkit.dart'; 195 | import 'package:iqplayer/iqplayer.dart'; 196 | 197 | void main() { 198 | runApp(MyApp()); 199 | } 200 | 201 | class MyApp extends StatelessWidget { 202 | @override 203 | Widget build(BuildContext context) { 204 | return MaterialApp( 205 | title: 'IQPlayer Demo', 206 | theme: ThemeData( 207 | primarySwatch: Colors.blue, 208 | visualDensity: VisualDensity.adaptivePlatformDensity, 209 | ), 210 | home: MyHomePage(title: 'IQPlayer Demo'), 211 | ); 212 | } 213 | } 214 | 215 | class MyHomePage extends StatelessWidget { 216 | MyHomePage({Key key, this.title}) : super(key: key); 217 | 218 | final String title; 219 | 220 | @override 221 | Widget build(BuildContext context) { 222 | return Scaffold( 223 | appBar: AppBar( 224 | title: Text(title), 225 | ), 226 | body: Center( 227 | child: RaisedButton( 228 | child: Text('Open IQPlayer'), 229 | onPressed: () { 230 | Navigator.push( 231 | context, 232 | MaterialPageRoute( 233 | builder: (BuildContext context) => IQScreen( 234 | title: title, 235 | description: 'Simple video as a demo video', 236 | videoPlayerController: VideoPlayerController.network( 237 | 'https://d11b76aq44vj33.cloudfront.net/media/720/video/5def7824adbbc.mp4', 238 | ), 239 | subtitleProvider: SubtitleProvider.fromNetwork( 240 | 'https://duoidi6ujfbv.cloudfront.net/media/0/subtitles/5675420c9d9a3.vtt'), 241 | iqTheme: IQTheme( 242 | loadingProgress: SpinKitCircle( 243 | color: Colors.red, 244 | ), 245 | playButtonColor: Colors.transparent, 246 | videoPlayedColor: Colors.indigo, 247 | playButton: (bool isPlay) { 248 | if (isPlay) 249 | return Icon( 250 | Icons.pause_circle_filled, 251 | color: Colors.red, 252 | size: 50, 253 | ); 254 | return Icon( 255 | Icons.play_circle_outline, 256 | color: Colors.red, 257 | size: 50, 258 | ); 259 | }, 260 | ), 261 | ), 262 | ), 263 | ); 264 | }, 265 | ), 266 | ), 267 | ); 268 | } 269 | } 270 | 271 | ``` 272 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _fe_analyzer_shared: 5 | dependency: transitive 6 | description: 7 | name: _fe_analyzer_shared 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "7.0.0" 11 | analyzer: 12 | dependency: transitive 13 | description: 14 | name: analyzer 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "0.39.17" 18 | args: 19 | dependency: transitive 20 | description: 21 | name: args 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.6.0" 25 | async: 26 | dependency: transitive 27 | description: 28 | name: async 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.5.0" 32 | bloc: 33 | dependency: "direct main" 34 | description: 35 | name: bloc 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "7.0.0" 39 | bloc_test: 40 | dependency: "direct dev" 41 | description: 42 | name: bloc_test 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "8.0.0" 46 | boolean_selector: 47 | dependency: transitive 48 | description: 49 | name: boolean_selector 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "2.1.0" 53 | characters: 54 | dependency: transitive 55 | description: 56 | name: characters 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "1.1.0" 60 | charcode: 61 | dependency: transitive 62 | description: 63 | name: charcode 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.2.0" 67 | cli_util: 68 | dependency: transitive 69 | description: 70 | name: cli_util 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "0.2.0" 74 | clock: 75 | dependency: transitive 76 | description: 77 | name: clock 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "1.1.0" 81 | collection: 82 | dependency: transitive 83 | description: 84 | name: collection 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "1.15.0" 88 | convert: 89 | dependency: transitive 90 | description: 91 | name: convert 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "2.1.1" 95 | coverage: 96 | dependency: transitive 97 | description: 98 | name: coverage 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "0.14.0" 102 | crypto: 103 | dependency: transitive 104 | description: 105 | name: crypto 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "2.1.5" 109 | csslib: 110 | dependency: transitive 111 | description: 112 | name: csslib 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "0.16.2" 116 | equatable: 117 | dependency: "direct main" 118 | description: 119 | name: equatable 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "2.0.0" 123 | fake_async: 124 | dependency: transitive 125 | description: 126 | name: fake_async 127 | url: "https://pub.dartlang.org" 128 | source: hosted 129 | version: "1.2.0" 130 | flutter: 131 | dependency: "direct main" 132 | description: flutter 133 | source: sdk 134 | version: "0.0.0" 135 | flutter_bloc: 136 | dependency: "direct main" 137 | description: 138 | name: flutter_bloc 139 | url: "https://pub.dartlang.org" 140 | source: hosted 141 | version: "7.0.0" 142 | flutter_test: 143 | dependency: "direct dev" 144 | description: flutter 145 | source: sdk 146 | version: "0.0.0" 147 | flutter_web_plugins: 148 | dependency: transitive 149 | description: flutter 150 | source: sdk 151 | version: "0.0.0" 152 | glob: 153 | dependency: transitive 154 | description: 155 | name: glob 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.2.0" 159 | html: 160 | dependency: transitive 161 | description: 162 | name: html 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "0.14.0+3" 166 | html_unescape: 167 | dependency: transitive 168 | description: 169 | name: html_unescape 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "2.0.0" 173 | http: 174 | dependency: "direct main" 175 | description: 176 | name: http 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "0.13.3" 180 | http_multi_server: 181 | dependency: transitive 182 | description: 183 | name: http_multi_server 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "2.2.0" 187 | http_parser: 188 | dependency: transitive 189 | description: 190 | name: http_parser 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "4.0.0" 194 | io: 195 | dependency: transitive 196 | description: 197 | name: io 198 | url: "https://pub.dartlang.org" 199 | source: hosted 200 | version: "0.3.4" 201 | js: 202 | dependency: transitive 203 | description: 204 | name: js 205 | url: "https://pub.dartlang.org" 206 | source: hosted 207 | version: "0.6.3" 208 | logging: 209 | dependency: transitive 210 | description: 211 | name: logging 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "0.11.4" 215 | matcher: 216 | dependency: transitive 217 | description: 218 | name: matcher 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "0.12.10" 222 | meta: 223 | dependency: transitive 224 | description: 225 | name: meta 226 | url: "https://pub.dartlang.org" 227 | source: hosted 228 | version: "1.3.0" 229 | mime: 230 | dependency: transitive 231 | description: 232 | name: mime 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "0.9.7" 236 | mocktail: 237 | dependency: transitive 238 | description: 239 | name: mocktail 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "0.1.2" 243 | nested: 244 | dependency: transitive 245 | description: 246 | name: nested 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "1.0.0" 250 | node_interop: 251 | dependency: transitive 252 | description: 253 | name: node_interop 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "1.1.1" 257 | node_io: 258 | dependency: transitive 259 | description: 260 | name: node_io 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "1.1.1" 264 | node_preamble: 265 | dependency: transitive 266 | description: 267 | name: node_preamble 268 | url: "https://pub.dartlang.org" 269 | source: hosted 270 | version: "1.4.12" 271 | package_config: 272 | dependency: transitive 273 | description: 274 | name: package_config 275 | url: "https://pub.dartlang.org" 276 | source: hosted 277 | version: "1.9.3" 278 | path: 279 | dependency: transitive 280 | description: 281 | name: path 282 | url: "https://pub.dartlang.org" 283 | source: hosted 284 | version: "1.8.0" 285 | pedantic: 286 | dependency: transitive 287 | description: 288 | name: pedantic 289 | url: "https://pub.dartlang.org" 290 | source: hosted 291 | version: "1.11.0" 292 | petitparser: 293 | dependency: transitive 294 | description: 295 | name: petitparser 296 | url: "https://pub.dartlang.org" 297 | source: hosted 298 | version: "4.1.0" 299 | pool: 300 | dependency: transitive 301 | description: 302 | name: pool 303 | url: "https://pub.dartlang.org" 304 | source: hosted 305 | version: "1.5.0" 306 | provider: 307 | dependency: transitive 308 | description: 309 | name: provider 310 | url: "https://pub.dartlang.org" 311 | source: hosted 312 | version: "5.0.0" 313 | pub_semver: 314 | dependency: transitive 315 | description: 316 | name: pub_semver 317 | url: "https://pub.dartlang.org" 318 | source: hosted 319 | version: "1.4.4" 320 | shelf: 321 | dependency: transitive 322 | description: 323 | name: shelf 324 | url: "https://pub.dartlang.org" 325 | source: hosted 326 | version: "1.1.1" 327 | shelf_packages_handler: 328 | dependency: transitive 329 | description: 330 | name: shelf_packages_handler 331 | url: "https://pub.dartlang.org" 332 | source: hosted 333 | version: "2.0.1" 334 | shelf_static: 335 | dependency: transitive 336 | description: 337 | name: shelf_static 338 | url: "https://pub.dartlang.org" 339 | source: hosted 340 | version: "0.2.9+2" 341 | shelf_web_socket: 342 | dependency: transitive 343 | description: 344 | name: shelf_web_socket 345 | url: "https://pub.dartlang.org" 346 | source: hosted 347 | version: "0.2.4+1" 348 | simple_html_css: 349 | dependency: "direct main" 350 | description: 351 | name: simple_html_css 352 | url: "https://pub.dartlang.org" 353 | source: hosted 354 | version: "3.0.1" 355 | sky_engine: 356 | dependency: transitive 357 | description: flutter 358 | source: sdk 359 | version: "0.0.99" 360 | source_map_stack_trace: 361 | dependency: transitive 362 | description: 363 | name: source_map_stack_trace 364 | url: "https://pub.dartlang.org" 365 | source: hosted 366 | version: "2.1.0" 367 | source_maps: 368 | dependency: transitive 369 | description: 370 | name: source_maps 371 | url: "https://pub.dartlang.org" 372 | source: hosted 373 | version: "0.10.10" 374 | source_span: 375 | dependency: transitive 376 | description: 377 | name: source_span 378 | url: "https://pub.dartlang.org" 379 | source: hosted 380 | version: "1.8.0" 381 | stack_trace: 382 | dependency: transitive 383 | description: 384 | name: stack_trace 385 | url: "https://pub.dartlang.org" 386 | source: hosted 387 | version: "1.10.0" 388 | stream_channel: 389 | dependency: transitive 390 | description: 391 | name: stream_channel 392 | url: "https://pub.dartlang.org" 393 | source: hosted 394 | version: "2.1.0" 395 | string_scanner: 396 | dependency: transitive 397 | description: 398 | name: string_scanner 399 | url: "https://pub.dartlang.org" 400 | source: hosted 401 | version: "1.1.0" 402 | term_glyph: 403 | dependency: transitive 404 | description: 405 | name: term_glyph 406 | url: "https://pub.dartlang.org" 407 | source: hosted 408 | version: "1.2.0" 409 | test: 410 | dependency: transitive 411 | description: 412 | name: test 413 | url: "https://pub.dartlang.org" 414 | source: hosted 415 | version: "1.16.5" 416 | test_api: 417 | dependency: transitive 418 | description: 419 | name: test_api 420 | url: "https://pub.dartlang.org" 421 | source: hosted 422 | version: "0.2.19" 423 | test_core: 424 | dependency: transitive 425 | description: 426 | name: test_core 427 | url: "https://pub.dartlang.org" 428 | source: hosted 429 | version: "0.3.15" 430 | typed_data: 431 | dependency: transitive 432 | description: 433 | name: typed_data 434 | url: "https://pub.dartlang.org" 435 | source: hosted 436 | version: "1.3.0" 437 | vector_math: 438 | dependency: transitive 439 | description: 440 | name: vector_math 441 | url: "https://pub.dartlang.org" 442 | source: hosted 443 | version: "2.1.0" 444 | video_player: 445 | dependency: "direct main" 446 | description: 447 | name: video_player 448 | url: "https://pub.dartlang.org" 449 | source: hosted 450 | version: "2.1.1" 451 | video_player_platform_interface: 452 | dependency: transitive 453 | description: 454 | name: video_player_platform_interface 455 | url: "https://pub.dartlang.org" 456 | source: hosted 457 | version: "4.1.0" 458 | video_player_web: 459 | dependency: transitive 460 | description: 461 | name: video_player_web 462 | url: "https://pub.dartlang.org" 463 | source: hosted 464 | version: "2.0.0" 465 | vm_service: 466 | dependency: transitive 467 | description: 468 | name: vm_service 469 | url: "https://pub.dartlang.org" 470 | source: hosted 471 | version: "4.2.0" 472 | watcher: 473 | dependency: transitive 474 | description: 475 | name: watcher 476 | url: "https://pub.dartlang.org" 477 | source: hosted 478 | version: "0.9.7+15" 479 | web_socket_channel: 480 | dependency: transitive 481 | description: 482 | name: web_socket_channel 483 | url: "https://pub.dartlang.org" 484 | source: hosted 485 | version: "1.1.0" 486 | webkit_inspection_protocol: 487 | dependency: transitive 488 | description: 489 | name: webkit_inspection_protocol 490 | url: "https://pub.dartlang.org" 491 | source: hosted 492 | version: "0.7.3" 493 | xml: 494 | dependency: transitive 495 | description: 496 | name: xml 497 | url: "https://pub.dartlang.org" 498 | source: hosted 499 | version: "5.1.0" 500 | yaml: 501 | dependency: transitive 502 | description: 503 | name: yaml 504 | url: "https://pub.dartlang.org" 505 | source: hosted 506 | version: "2.2.1" 507 | sdks: 508 | dart: ">=2.12.2 <3.0.0" 509 | flutter: ">=2.0.0" 510 | -------------------------------------------------------------------------------- /lib/src/ui/screen_controllers.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | 4 | import '../blocs/player/player_bloc.dart'; 5 | import '../blocs/screen/bloc.dart'; 6 | import '../utils/iqtheme.dart'; 7 | import 'iqparser.dart'; 8 | 9 | ///! The user have not to use this class. 10 | /// The ui of [IQScreen]. 11 | class ScreenControllers extends StatelessWidget { 12 | final AnimationController playAnimationController; 13 | final IQTheme iqTheme; 14 | 15 | const ScreenControllers({ 16 | Key? key, 17 | required this.playAnimationController, 18 | required this.iqTheme, 19 | }) : super(key: key); 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | return BlocBuilder( 24 | bloc: BlocProvider.of(context), 25 | builder: (context, state) => GestureDetector( 26 | onTap: () => BlocProvider.of(context).add( 27 | state.showControls ? HideControls() : ShowControls(), 28 | ), 29 | child: state.showControls && !state.lockScreen 30 | ? Container( 31 | width: MediaQuery.of(context).size.width, 32 | height: MediaQuery.of(context).size.height, 33 | decoration: BoxDecoration( 34 | gradient: LinearGradient( 35 | begin: Alignment.topCenter, 36 | end: Alignment.bottomCenter, 37 | colors: [ 38 | Colors.black87, 39 | Colors.transparent, 40 | Colors.black87, 41 | ], 42 | ), 43 | ), 44 | child: Column( 45 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 46 | children: [ 47 | _buildAppBar(context, state), 48 | Row( 49 | mainAxisSize: MainAxisSize.max, 50 | mainAxisAlignment: MainAxisAlignment.spaceAround, 51 | children: [ 52 | IconButton( 53 | icon: iqTheme.backwardIconButton ?? 54 | Icon( 55 | Icons.replay_5, 56 | color: Colors.white, 57 | ), 58 | onPressed: () => BlocProvider.of(context) 59 | .add(Backward()), 60 | ), 61 | _mainButton(context), 62 | IconButton( 63 | icon: iqTheme.forwardIconButton ?? 64 | Icon( 65 | Icons.forward_10, 66 | color: Colors.white, 67 | ), 68 | onPressed: () => BlocProvider.of(context) 69 | .add(Forward()), 70 | ), 71 | ], 72 | ), 73 | Column( 74 | mainAxisSize: MainAxisSize.min, 75 | mainAxisAlignment: MainAxisAlignment.center, 76 | children: [ 77 | IQParser( 78 | subtitleDefaultTextStyle: iqTheme.subtitleStyle!, 79 | ), 80 | _buildBottomScreen(context, state), 81 | ], 82 | ), 83 | ], 84 | ), 85 | ) 86 | : Container( 87 | width: MediaQuery.of(context).size.width, 88 | height: MediaQuery.of(context).size.height, 89 | child: Stack( 90 | children: [ 91 | AppBar( 92 | backgroundColor: Colors.transparent, 93 | elevation: 0, 94 | leading: Container(), 95 | actions: [ 96 | IconButton( 97 | icon: Icon( 98 | state.lockScreen ? Icons.lock : Icons.lock_open, 99 | color: iqTheme.lockScreenColor, 100 | ), 101 | tooltip: state.lockScreen 102 | ? 'Unlock Screen' 103 | : 'Lock Screen', 104 | onPressed: () => 105 | BlocProvider.of(context).add( 106 | state.lockScreen ? UnlockScreen() : LockScreen(), 107 | ), 108 | ), 109 | ], 110 | ), 111 | Container( 112 | alignment: Alignment.center, 113 | child: BlocBuilder( 114 | bloc: BlocProvider.of(context), 115 | builder: (BuildContext context, PlayerState state) { 116 | if (state is LoadingState) 117 | return iqTheme.loadingProgress ?? 118 | CircularProgressIndicator( 119 | valueColor: AlwaysStoppedAnimation( 120 | iqTheme.playButtonColor ?? Colors.green, 121 | ), 122 | ); 123 | 124 | if (state is FinishState) 125 | return Container( 126 | decoration: BoxDecoration( 127 | color: iqTheme.playButtonColor ?? Colors.green, 128 | borderRadius: BorderRadius.circular(50), 129 | boxShadow: iqTheme.replayButton != null 130 | ? [] 131 | : [ 132 | BoxShadow(color: Colors.black45), 133 | ], 134 | ), 135 | child: IconButton( 136 | color: Colors.white, 137 | icon: 138 | iqTheme.replayButton ?? Icon(Icons.replay), 139 | onPressed: () { 140 | BlocProvider.of(context) 141 | .add(ReplayVideo()); 142 | }, 143 | ), 144 | ); 145 | 146 | return Container(); 147 | }, 148 | ), 149 | ), 150 | Positioned( 151 | left: 0, 152 | right: 0, 153 | bottom: 25, 154 | child: Center( 155 | child: IQParser( 156 | subtitleDefaultTextStyle: iqTheme.subtitleStyle, 157 | ), 158 | ), 159 | ), 160 | ], 161 | ), 162 | ), 163 | ), 164 | ); 165 | } 166 | 167 | Widget _buildAppBar(BuildContext context, ScreenState state) { 168 | return AppBar( 169 | title: Column( 170 | crossAxisAlignment: CrossAxisAlignment.center, 171 | mainAxisAlignment: MainAxisAlignment.center, 172 | children: [ 173 | Text( 174 | BlocProvider.of(context).title, 175 | style: iqTheme.titleStyle, 176 | ), 177 | Text( 178 | BlocProvider.of(context).description, 179 | overflow: TextOverflow.fade, 180 | style: iqTheme.descriptionStyle ?? 181 | TextStyle( 182 | fontSize: 12, 183 | fontWeight: FontWeight.w300, 184 | ), 185 | ), 186 | ], 187 | ), 188 | centerTitle: true, 189 | backgroundColor: Colors.transparent, 190 | elevation: 0, 191 | actions: [ 192 | IconButton( 193 | icon: iqTheme.lockRotation != null 194 | ? iqTheme.lockRotation!( 195 | context, state.lockRotation, playAnimationController) 196 | : Icon( 197 | state.lockRotation 198 | ? Icons.screen_lock_rotation 199 | : Icons.screen_rotation, 200 | color: iqTheme.lockRotationColor, 201 | ), 202 | tooltip: state.lockRotation ? 'Unlock Rotation' : 'Lock Rotation', 203 | onPressed: () => BlocProvider.of(context).add( 204 | state.lockRotation 205 | ? UnlockRotation() 206 | : LockRotation(MediaQuery.of(context).orientation), 207 | ), 208 | ), 209 | IconButton( 210 | icon: iqTheme.lockScreen != null 211 | ? iqTheme.lockScreen!( 212 | context, state.lockScreen, playAnimationController) 213 | : Icon( 214 | state.lockScreen ? Icons.lock : Icons.lock_open, 215 | color: iqTheme.lockScreenColor, 216 | ), 217 | tooltip: state.lockScreen ? 'Unlock Screen' : 'Lock Screen', 218 | onPressed: () => BlocProvider.of(context).add( 219 | state.lockScreen ? UnlockScreen() : LockScreen(), 220 | ), 221 | ), 222 | ], 223 | ); 224 | } 225 | 226 | Widget _buildBottomScreen(BuildContext context, ScreenState state) { 227 | return BlocBuilder( 228 | bloc: BlocProvider.of(context), 229 | builder: (context, state) { 230 | if (state is PlayingState) 231 | return Container( 232 | margin: EdgeInsets.symmetric(vertical: 5), 233 | padding: EdgeInsets.all(8.0), 234 | child: Row( 235 | mainAxisSize: MainAxisSize.max, 236 | children: [ 237 | Text( 238 | _formatDuration(state.position), 239 | style: 240 | iqTheme.durationStyle ?? TextStyle(color: Colors.white), 241 | ), 242 | Expanded( 243 | child: Slider( 244 | value: state.position.inSeconds.toDouble(), 245 | min: Duration.zero.inSeconds.toDouble(), 246 | max: state.duration.inSeconds.toDouble(), 247 | activeColor: iqTheme.videoPlayedColor ?? Colors.green, 248 | inactiveColor: 249 | iqTheme.backgroundProgressColor ?? Colors.green[200], 250 | onChanged: (value) => 251 | BlocProvider.of(context).add( 252 | ChangeTimeTo( 253 | Duration(seconds: value.toInt()), 254 | ), 255 | ), 256 | ), 257 | ), 258 | Text( 259 | _formatDuration(state.duration), 260 | style: 261 | iqTheme.durationStyle ?? TextStyle(color: Colors.white), 262 | ), 263 | ], 264 | ), 265 | ); 266 | 267 | return Container( 268 | margin: EdgeInsets.symmetric(vertical: 5), 269 | padding: EdgeInsets.all(8.0), 270 | child: Row( 271 | mainAxisSize: MainAxisSize.max, 272 | children: [ 273 | Text( 274 | _formatDuration(Duration.zero), 275 | style: iqTheme.durationStyle ?? TextStyle(color: Colors.white), 276 | ), 277 | Expanded( 278 | child: Slider( 279 | value: Duration.zero.inSeconds.toDouble(), 280 | min: Duration.zero.inSeconds.toDouble(), 281 | max: Duration.zero.inSeconds.toDouble(), 282 | activeColor: iqTheme.videoPlayedColor ?? Colors.green, 283 | inactiveColor: 284 | iqTheme.backgroundProgressColor ?? Colors.green[200], 285 | onChanged: (double value) {}, 286 | ), 287 | ), 288 | Text( 289 | _formatDuration(Duration.zero), 290 | style: iqTheme.durationStyle ?? TextStyle(color: Colors.white), 291 | ), 292 | ], 293 | ), 294 | ); 295 | }, 296 | ); 297 | } 298 | 299 | Widget _mainButton(BuildContext context) { 300 | return BlocBuilder( 301 | bloc: BlocProvider.of(context), 302 | builder: (BuildContext context, PlayerState state) { 303 | if (state is PlayingState) 304 | return Container( 305 | decoration: BoxDecoration( 306 | color: iqTheme.playButtonColor ?? Colors.green, 307 | borderRadius: BorderRadius.circular(50), 308 | boxShadow: iqTheme.playButton != null 309 | ? [] 310 | : [ 311 | BoxShadow(color: Colors.black45), 312 | ], 313 | ), 314 | child: IconButton( 315 | color: Colors.white, 316 | icon: state is FinishState 317 | ? iqTheme.replayButton ?? Icon(Icons.replay) 318 | : iqTheme.playButton != null 319 | ? iqTheme.playButton!( 320 | context, state.isPlay, playAnimationController) 321 | : AnimatedIcon( 322 | icon: AnimatedIcons.pause_play, 323 | progress: Tween(begin: 0.0, end: 1.0).animate( 324 | playAnimationController, 325 | ), 326 | ), 327 | onPressed: () { 328 | if (state is FinishState) { 329 | print('FetchVideo'); 330 | BlocProvider.of(context).add(ReplayVideo()); 331 | return; 332 | } 333 | print(state.isPlay); 334 | if (!state.isPlay) { 335 | print('PlayVideo'); 336 | BlocProvider.of(context).add(PlayVideo()); 337 | playAnimationController.reverse(); 338 | return; 339 | } 340 | if (state.isPlay) { 341 | print('PauseVideo'); 342 | BlocProvider.of(context).add(PauseVideo()); 343 | playAnimationController.forward(); 344 | return; 345 | } 346 | }, 347 | ), 348 | ); 349 | 350 | if (state is ErrorState) return errorWidget(context, state); 351 | if (state is FinishState) 352 | return Container( 353 | decoration: BoxDecoration( 354 | color: iqTheme.playButtonColor ?? Colors.green, 355 | borderRadius: BorderRadius.circular(50), 356 | boxShadow: iqTheme.replayButton != null 357 | ? [] 358 | : [ 359 | BoxShadow(color: Colors.black45), 360 | ], 361 | ), 362 | child: IconButton( 363 | color: Colors.white, 364 | icon: iqTheme.replayButton ?? Icon(Icons.replay), 365 | onPressed: () { 366 | BlocProvider.of(context).add(ReplayVideo()); 367 | }, 368 | ), 369 | ); 370 | return iqTheme.loadingProgress ?? 371 | CircularProgressIndicator( 372 | valueColor: AlwaysStoppedAnimation( 373 | iqTheme.loadingProgressColor ?? Colors.green, 374 | ), 375 | ); 376 | }, 377 | ); 378 | } 379 | 380 | Widget errorWidget(context, state) { 381 | if (iqTheme.errorWidget != null) 382 | return iqTheme.errorWidget!(context, state.error); 383 | 384 | return Row( 385 | children: [ 386 | Icon( 387 | Icons.error, 388 | color: Colors.white, 389 | ), 390 | Text('${state.error}'), 391 | ], 392 | ); 393 | } 394 | 395 | String _formatDuration(Duration position) { 396 | final ms = position.inMilliseconds; 397 | 398 | int seconds = ms ~/ 1000; 399 | final int hours = seconds ~/ 3600; 400 | seconds = seconds % 3600; 401 | var minutes = seconds ~/ 60; 402 | seconds = seconds % 60; 403 | 404 | final hoursString = hours >= 10 405 | ? '$hours' 406 | : hours == 0 407 | ? '00' 408 | : '0$hours'; 409 | 410 | final minutesString = minutes >= 10 411 | ? '$minutes' 412 | : minutes == 0 413 | ? '00' 414 | : '0$minutes'; 415 | 416 | final secondsString = seconds >= 10 417 | ? '$seconds' 418 | : seconds == 0 419 | ? '00' 420 | : '0$seconds'; 421 | 422 | final formattedTime = 423 | '${hoursString == '00' ? '' : hoursString + ':'}$minutesString:$secondsString'; 424 | 425 | return formattedTime; 426 | } 427 | } 428 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 97C146F11CF9000F007C117D /* Supporting Files */, 94 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 95 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 96 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 97 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 98 | ); 99 | path = Runner; 100 | sourceTree = ""; 101 | }; 102 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | ); 106 | name = "Supporting Files"; 107 | sourceTree = ""; 108 | }; 109 | /* End PBXGroup section */ 110 | 111 | /* Begin PBXNativeTarget section */ 112 | 97C146ED1CF9000F007C117D /* Runner */ = { 113 | isa = PBXNativeTarget; 114 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 115 | buildPhases = ( 116 | 9740EEB61CF901F6004384FC /* Run Script */, 117 | 97C146EA1CF9000F007C117D /* Sources */, 118 | 97C146EB1CF9000F007C117D /* Frameworks */, 119 | 97C146EC1CF9000F007C117D /* Resources */, 120 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 121 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 122 | ); 123 | buildRules = ( 124 | ); 125 | dependencies = ( 126 | ); 127 | name = Runner; 128 | productName = Runner; 129 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 130 | productType = "com.apple.product-type.application"; 131 | }; 132 | /* End PBXNativeTarget section */ 133 | 134 | /* Begin PBXProject section */ 135 | 97C146E61CF9000F007C117D /* Project object */ = { 136 | isa = PBXProject; 137 | attributes = { 138 | LastUpgradeCheck = 1020; 139 | ORGANIZATIONNAME = ""; 140 | TargetAttributes = { 141 | 97C146ED1CF9000F007C117D = { 142 | CreatedOnToolsVersion = 7.3.1; 143 | LastSwiftMigration = 1100; 144 | }; 145 | }; 146 | }; 147 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 148 | compatibilityVersion = "Xcode 9.3"; 149 | developmentRegion = en; 150 | hasScannedForEncodings = 0; 151 | knownRegions = ( 152 | en, 153 | Base, 154 | ); 155 | mainGroup = 97C146E51CF9000F007C117D; 156 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 157 | projectDirPath = ""; 158 | projectRoot = ""; 159 | targets = ( 160 | 97C146ED1CF9000F007C117D /* Runner */, 161 | ); 162 | }; 163 | /* End PBXProject section */ 164 | 165 | /* Begin PBXResourcesBuildPhase section */ 166 | 97C146EC1CF9000F007C117D /* Resources */ = { 167 | isa = PBXResourcesBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 171 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 172 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 173 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 174 | ); 175 | runOnlyForDeploymentPostprocessing = 0; 176 | }; 177 | /* End PBXResourcesBuildPhase section */ 178 | 179 | /* Begin PBXShellScriptBuildPhase section */ 180 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 181 | isa = PBXShellScriptBuildPhase; 182 | buildActionMask = 2147483647; 183 | files = ( 184 | ); 185 | inputPaths = ( 186 | ); 187 | name = "Thin Binary"; 188 | outputPaths = ( 189 | ); 190 | runOnlyForDeploymentPostprocessing = 0; 191 | shellPath = /bin/sh; 192 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 193 | }; 194 | 9740EEB61CF901F6004384FC /* Run Script */ = { 195 | isa = PBXShellScriptBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | ); 199 | inputPaths = ( 200 | ); 201 | name = "Run Script"; 202 | outputPaths = ( 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | shellPath = /bin/sh; 206 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 207 | }; 208 | /* End PBXShellScriptBuildPhase section */ 209 | 210 | /* Begin PBXSourcesBuildPhase section */ 211 | 97C146EA1CF9000F007C117D /* Sources */ = { 212 | isa = PBXSourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 216 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | }; 220 | /* End PBXSourcesBuildPhase section */ 221 | 222 | /* Begin PBXVariantGroup section */ 223 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C146FB1CF9000F007C117D /* Base */, 227 | ); 228 | name = Main.storyboard; 229 | sourceTree = ""; 230 | }; 231 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 232 | isa = PBXVariantGroup; 233 | children = ( 234 | 97C147001CF9000F007C117D /* Base */, 235 | ); 236 | name = LaunchScreen.storyboard; 237 | sourceTree = ""; 238 | }; 239 | /* End PBXVariantGroup section */ 240 | 241 | /* Begin XCBuildConfiguration section */ 242 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 243 | isa = XCBuildConfiguration; 244 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 245 | buildSettings = { 246 | ALWAYS_SEARCH_USER_PATHS = NO; 247 | CLANG_ANALYZER_NONNULL = YES; 248 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 249 | CLANG_CXX_LIBRARY = "libc++"; 250 | CLANG_ENABLE_MODULES = YES; 251 | CLANG_ENABLE_OBJC_ARC = YES; 252 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 253 | CLANG_WARN_BOOL_CONVERSION = YES; 254 | CLANG_WARN_COMMA = YES; 255 | CLANG_WARN_CONSTANT_CONVERSION = YES; 256 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 257 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 258 | CLANG_WARN_EMPTY_BODY = YES; 259 | CLANG_WARN_ENUM_CONVERSION = YES; 260 | CLANG_WARN_INFINITE_RECURSION = YES; 261 | CLANG_WARN_INT_CONVERSION = YES; 262 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 263 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 264 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 265 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 266 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 267 | CLANG_WARN_STRICT_PROTOTYPES = YES; 268 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 269 | CLANG_WARN_UNREACHABLE_CODE = YES; 270 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 271 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 272 | COPY_PHASE_STRIP = NO; 273 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 274 | ENABLE_NS_ASSERTIONS = NO; 275 | ENABLE_STRICT_OBJC_MSGSEND = YES; 276 | GCC_C_LANGUAGE_STANDARD = gnu99; 277 | GCC_NO_COMMON_BLOCKS = YES; 278 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 279 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 280 | GCC_WARN_UNDECLARED_SELECTOR = YES; 281 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 282 | GCC_WARN_UNUSED_FUNCTION = YES; 283 | GCC_WARN_UNUSED_VARIABLE = YES; 284 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 285 | MTL_ENABLE_DEBUG_INFO = NO; 286 | SDKROOT = iphoneos; 287 | SUPPORTED_PLATFORMS = iphoneos; 288 | TARGETED_DEVICE_FAMILY = "1,2"; 289 | VALIDATE_PRODUCT = YES; 290 | }; 291 | name = Profile; 292 | }; 293 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 294 | isa = XCBuildConfiguration; 295 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 296 | buildSettings = { 297 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 298 | CLANG_ENABLE_MODULES = YES; 299 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 300 | ENABLE_BITCODE = NO; 301 | FRAMEWORK_SEARCH_PATHS = ( 302 | "$(inherited)", 303 | "$(PROJECT_DIR)/Flutter", 304 | ); 305 | INFOPLIST_FILE = Runner/Info.plist; 306 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 307 | LIBRARY_SEARCH_PATHS = ( 308 | "$(inherited)", 309 | "$(PROJECT_DIR)/Flutter", 310 | ); 311 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 312 | PRODUCT_NAME = "$(TARGET_NAME)"; 313 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 314 | SWIFT_VERSION = 5.0; 315 | VERSIONING_SYSTEM = "apple-generic"; 316 | }; 317 | name = Profile; 318 | }; 319 | 97C147031CF9000F007C117D /* Debug */ = { 320 | isa = XCBuildConfiguration; 321 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 322 | buildSettings = { 323 | ALWAYS_SEARCH_USER_PATHS = NO; 324 | CLANG_ANALYZER_NONNULL = YES; 325 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 326 | CLANG_CXX_LIBRARY = "libc++"; 327 | CLANG_ENABLE_MODULES = YES; 328 | CLANG_ENABLE_OBJC_ARC = YES; 329 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 330 | CLANG_WARN_BOOL_CONVERSION = YES; 331 | CLANG_WARN_COMMA = YES; 332 | CLANG_WARN_CONSTANT_CONVERSION = YES; 333 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INFINITE_RECURSION = YES; 338 | CLANG_WARN_INT_CONVERSION = YES; 339 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 340 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 341 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 342 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 343 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 344 | CLANG_WARN_STRICT_PROTOTYPES = YES; 345 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 346 | CLANG_WARN_UNREACHABLE_CODE = YES; 347 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 348 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 349 | COPY_PHASE_STRIP = NO; 350 | DEBUG_INFORMATION_FORMAT = dwarf; 351 | ENABLE_STRICT_OBJC_MSGSEND = YES; 352 | ENABLE_TESTABILITY = YES; 353 | GCC_C_LANGUAGE_STANDARD = gnu99; 354 | GCC_DYNAMIC_NO_PIC = NO; 355 | GCC_NO_COMMON_BLOCKS = YES; 356 | GCC_OPTIMIZATION_LEVEL = 0; 357 | GCC_PREPROCESSOR_DEFINITIONS = ( 358 | "DEBUG=1", 359 | "$(inherited)", 360 | ); 361 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 362 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 363 | GCC_WARN_UNDECLARED_SELECTOR = YES; 364 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 365 | GCC_WARN_UNUSED_FUNCTION = YES; 366 | GCC_WARN_UNUSED_VARIABLE = YES; 367 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 368 | MTL_ENABLE_DEBUG_INFO = YES; 369 | ONLY_ACTIVE_ARCH = YES; 370 | SDKROOT = iphoneos; 371 | TARGETED_DEVICE_FAMILY = "1,2"; 372 | }; 373 | name = Debug; 374 | }; 375 | 97C147041CF9000F007C117D /* Release */ = { 376 | isa = XCBuildConfiguration; 377 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 378 | buildSettings = { 379 | ALWAYS_SEARCH_USER_PATHS = NO; 380 | CLANG_ANALYZER_NONNULL = YES; 381 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 382 | CLANG_CXX_LIBRARY = "libc++"; 383 | CLANG_ENABLE_MODULES = YES; 384 | CLANG_ENABLE_OBJC_ARC = YES; 385 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 386 | CLANG_WARN_BOOL_CONVERSION = YES; 387 | CLANG_WARN_COMMA = YES; 388 | CLANG_WARN_CONSTANT_CONVERSION = YES; 389 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 390 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 391 | CLANG_WARN_EMPTY_BODY = YES; 392 | CLANG_WARN_ENUM_CONVERSION = YES; 393 | CLANG_WARN_INFINITE_RECURSION = YES; 394 | CLANG_WARN_INT_CONVERSION = YES; 395 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 396 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 397 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 398 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 399 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 400 | CLANG_WARN_STRICT_PROTOTYPES = YES; 401 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 402 | CLANG_WARN_UNREACHABLE_CODE = YES; 403 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 404 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 405 | COPY_PHASE_STRIP = NO; 406 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 407 | ENABLE_NS_ASSERTIONS = NO; 408 | ENABLE_STRICT_OBJC_MSGSEND = YES; 409 | GCC_C_LANGUAGE_STANDARD = gnu99; 410 | GCC_NO_COMMON_BLOCKS = YES; 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 418 | MTL_ENABLE_DEBUG_INFO = NO; 419 | SDKROOT = iphoneos; 420 | SUPPORTED_PLATFORMS = iphoneos; 421 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 422 | TARGETED_DEVICE_FAMILY = "1,2"; 423 | VALIDATE_PRODUCT = YES; 424 | }; 425 | name = Release; 426 | }; 427 | 97C147061CF9000F007C117D /* Debug */ = { 428 | isa = XCBuildConfiguration; 429 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 430 | buildSettings = { 431 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 432 | CLANG_ENABLE_MODULES = YES; 433 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 434 | ENABLE_BITCODE = NO; 435 | FRAMEWORK_SEARCH_PATHS = ( 436 | "$(inherited)", 437 | "$(PROJECT_DIR)/Flutter", 438 | ); 439 | INFOPLIST_FILE = Runner/Info.plist; 440 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 441 | LIBRARY_SEARCH_PATHS = ( 442 | "$(inherited)", 443 | "$(PROJECT_DIR)/Flutter", 444 | ); 445 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 446 | PRODUCT_NAME = "$(TARGET_NAME)"; 447 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 448 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 449 | SWIFT_VERSION = 5.0; 450 | VERSIONING_SYSTEM = "apple-generic"; 451 | }; 452 | name = Debug; 453 | }; 454 | 97C147071CF9000F007C117D /* Release */ = { 455 | isa = XCBuildConfiguration; 456 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 457 | buildSettings = { 458 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 459 | CLANG_ENABLE_MODULES = YES; 460 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 461 | ENABLE_BITCODE = NO; 462 | FRAMEWORK_SEARCH_PATHS = ( 463 | "$(inherited)", 464 | "$(PROJECT_DIR)/Flutter", 465 | ); 466 | INFOPLIST_FILE = Runner/Info.plist; 467 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 468 | LIBRARY_SEARCH_PATHS = ( 469 | "$(inherited)", 470 | "$(PROJECT_DIR)/Flutter", 471 | ); 472 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 473 | PRODUCT_NAME = "$(TARGET_NAME)"; 474 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 475 | SWIFT_VERSION = 5.0; 476 | VERSIONING_SYSTEM = "apple-generic"; 477 | }; 478 | name = Release; 479 | }; 480 | /* End XCBuildConfiguration section */ 481 | 482 | /* Begin XCConfigurationList section */ 483 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 484 | isa = XCConfigurationList; 485 | buildConfigurations = ( 486 | 97C147031CF9000F007C117D /* Debug */, 487 | 97C147041CF9000F007C117D /* Release */, 488 | 249021D3217E4FDB00AE95B9 /* Profile */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | defaultConfigurationName = Release; 492 | }; 493 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 97C147061CF9000F007C117D /* Debug */, 497 | 97C147071CF9000F007C117D /* Release */, 498 | 249021D4217E4FDB00AE95B9 /* Profile */, 499 | ); 500 | defaultConfigurationIsVisible = 0; 501 | defaultConfigurationName = Release; 502 | }; 503 | /* End XCConfigurationList section */ 504 | }; 505 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 506 | } 507 | --------------------------------------------------------------------------------