├── ios ├── Assets │ └── .gitkeep ├── .gitignore ├── sys_volume.podspec └── Classes │ ├── FlutterVolumePlugin.h │ ├── QueuingEventSink.h │ ├── QueuingEventSink.m │ └── FlutterVolumePlugin.m ├── android ├── gradle.properties ├── .gitignore ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── kotlin │ │ └── com │ │ └── befovy │ │ └── flutter_volume │ │ ├── QueueEventSink.kt │ │ └── FlutterVolumePlugin.kt ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── build.gradle ├── CHANGELOG.md ├── example ├── android │ ├── gradle.properties │ ├── 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 │ │ │ │ │ ├── values │ │ │ │ │ │ └── styles.xml │ │ │ │ │ └── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── befovy │ │ │ │ │ │ └── flutter_volume_example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ └── build.gradle ├── ios │ ├── 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 │ │ ├── Info.plist │ │ └── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.storyboard │ ├── Flutter │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── AppFrameworkInfo.plist │ ├── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ └── project.pbxproj │ ├── Runner.xcworkspace │ │ └── contents.xcworkspacedata │ ├── Podfile.lock │ └── Podfile ├── demo.gif ├── .metadata ├── README.md ├── test │ └── widget_test.dart ├── .gitignore ├── pubspec.yaml ├── lib │ └── main.dart └── pubspec.lock ├── .gitignore ├── .metadata ├── test └── flutter_volume_test.dart ├── README.md ├── LICENSE ├── flutter_volume.iml ├── pubspec.yaml ├── pubspec.lock └── lib └── flutter_volume.dart /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | 3 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.1 2 | 3 | * TODO: Describe initial release. 4 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | 3 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /example/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/befovy/flutter_volume/HEAD/example/demo.gif -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | 9 | .idea/ 10 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/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/befovy/flutter_volume/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 6 | -------------------------------------------------------------------------------- /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-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.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: 2d2a1ffec95cc70a3218872a2cd3f8de4933c42f 8 | channel: stable 9 | 10 | project_type: plugin 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: 2d2a1ffec95cc70a3218872a2cd3f8de4933c42f 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/android/app/src/debug/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. -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /test/flutter_volume_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | void main() { 5 | const MethodChannel channel = MethodChannel('flutter_volume'); 6 | 7 | setUp(() { 8 | channel.setMockMethodCallHandler((MethodCall methodCall) async { 9 | return '42'; 10 | }); 11 | }); 12 | 13 | tearDown(() { 14 | channel.setMockMethodCallHandler(null); 15 | }); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | /Flutter/flutter_export_environment.sh -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - sys_volume (0.1.0): 4 | - Flutter 5 | 6 | DEPENDENCIES: 7 | - Flutter (from `Flutter`) 8 | - sys_volume (from `.symlinks/plugins/sys_volume/ios`) 9 | 10 | EXTERNAL SOURCES: 11 | Flutter: 12 | :path: Flutter 13 | sys_volume: 14 | :path: ".symlinks/plugins/sys_volume/ios" 15 | 16 | SPEC CHECKSUMS: 17 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec 18 | sys_volume: 76971cb39ff96966c3cf801a9ab765dea0048d38 19 | 20 | PODFILE CHECKSUM: c34e2287a9ccaa606aeceab922830efb9a6ff69a 21 | 22 | COCOAPODS: 1.9.3 23 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'flutter_volume' 2 | 3 | include ':app' 4 | 5 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 6 | 7 | def plugins = new Properties() 8 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 9 | if (pluginsFile.exists()) { 10 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 11 | } 12 | 13 | plugins.each { name, path -> 14 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 15 | include ":$name" 16 | project(":$name").projectDir = pluginDirectory 17 | } 18 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # flutter_volume_example 2 | 3 | Demonstrates how to use the flutter_volume plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.72' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.2.1' 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 | -------------------------------------------------------------------------------- /ios/sys_volume.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 3 | # 4 | Pod::Spec.new do |s| 5 | s.name = 'sys_volume' 6 | s.version = '0.1.0' 7 | s.summary = 'A new flutter plugin project.' 8 | s.description = <<-DESC 9 | A new flutter plugin project. 10 | DESC 11 | s.homepage = 'http://example.com' 12 | s.license = { :file => '../LICENSE' } 13 | s.author = { 'Your Company' => 'email@example.com' } 14 | s.source = { :path => '.' } 15 | s.source_files = 'Classes/**/*' 16 | s.public_header_files = 'Classes/**/*.h' 17 | s.dependency 'Flutter' 18 | 19 | s.ios.deployment_target = '8.0' 20 | end 21 | 22 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flutter_volume 2 | 3 | A flutter plugin for volume control and monitoring, support iOS and Android 4 | 5 | 手把手带你写 Flutter 系统音量插件 6 | https://www.yuque.com/befovy/share/flutter_volume 7 | 8 | 9 | ![](example/demo.gif) 10 | 11 | 12 | If you have problems about kotlin environment. Maybe you should add next codes in your android root project build.gradle. 13 | 14 | ``` 15 | buildscript { 16 | ext.kotlin_version = '1.3.72' 17 | repositories { 18 | google() 19 | jcenter() 20 | } 21 | 22 | dependencies { 23 | classpath 'com.android.tools.build:gradle:3.2.1' 24 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 25 | } 26 | } 27 | ``` 28 | 29 | ## Declaration 30 | 31 | This repo is created for example about how to create a flutter plugin. 32 | 33 | I don't want this repo to be used in productive environment. 34 | If someone want use this as a volume plugin, please fork and make your own publish. 35 | -------------------------------------------------------------------------------- /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:flutter_volume_example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Verify Platform version', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that platform version is retrieved. 19 | expect( 20 | find.byWidgetPredicate( 21 | (Widget widget) => 22 | widget is Text && widget.data.startsWith('Running on:'), 23 | ), 24 | findsOneWidget, 25 | ); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'com.befovy.flutter_volume' 2 | version '1.0-SNAPSHOT' 3 | 4 | /* 5 | buildscript { 6 | ext.kotlin_version = '1.3.72' 7 | repositories { 8 | google() 9 | jcenter() 10 | } 11 | 12 | dependencies { 13 | classpath 'com.android.tools.build:gradle:3.2.1' 14 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 15 | } 16 | } 17 | */ 18 | 19 | rootProject.allprojects { 20 | repositories { 21 | google() 22 | jcenter() 23 | } 24 | } 25 | 26 | apply plugin: 'com.android.library' 27 | apply plugin: 'kotlin-android' 28 | 29 | android { 30 | compileSdkVersion 28 31 | 32 | sourceSets { 33 | main.java.srcDirs += 'src/main/kotlin' 34 | } 35 | defaultConfig { 36 | minSdkVersion 16 37 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 38 | } 39 | lintOptions { 40 | disable 'InvalidPackage' 41 | } 42 | } 43 | 44 | dependencies { 45 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 46 | } 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [2019] [Befovy] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /flutter_volume.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /ios/Classes/FlutterVolumePlugin.h: -------------------------------------------------------------------------------- 1 | //MIT License 2 | // 3 | //Copyright (c) [2019] [Befovy] 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy 6 | //of this software and associated documentation files (the "Software"), to deal 7 | //in the Software without restriction, including without limitation the rights 8 | //to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | //copies of the Software, and to permit persons to whom the Software is 10 | //furnished to do so, subject to the following conditions: 11 | // 12 | //The above copyright notice and this permission notice shall be included in all 13 | //copies or substantial portions of the Software. 14 | // 15 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | //SOFTWARE. 22 | 23 | #import 24 | 25 | @interface FlutterVolumePlugin : NSObject 26 | @end 27 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/befovy/flutter_volume_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.befovy.flutter_volume_example 2 | 3 | import android.os.Bundle 4 | import android.view.KeyEvent 5 | import com.befovy.flutter_volume.CanListenVolumeKey 6 | import com.befovy.flutter_volume.VolumeKeyListener 7 | 8 | import io.flutter.app.FlutterActivity 9 | import io.flutter.plugins.GeneratedPluginRegistrant 10 | 11 | class MainActivity : FlutterActivity(), CanListenVolumeKey { 12 | 13 | var mlistener: VolumeKeyListener? = null 14 | override fun setVolumeKeyListener(listener: VolumeKeyListener?) { 15 | mlistener = listener 16 | } 17 | 18 | override fun onCreate(savedInstanceState: Bundle?) { 19 | super.onCreate(savedInstanceState) 20 | GeneratedPluginRegistrant.registerWith(this) 21 | } 22 | 23 | 24 | override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean { 25 | return when (keyCode) { 26 | KeyEvent.KEYCODE_VOLUME_MUTE, 27 | KeyEvent.KEYCODE_VOLUME_UP, 28 | KeyEvent.KEYCODE_VOLUME_DOWN -> { 29 | if (mlistener != null) { 30 | mlistener!!.onVolumeKeyDown(keyCode, event) 31 | } else { 32 | super.onKeyDown(keyCode, event) 33 | } 34 | } 35 | else -> { 36 | super.onKeyDown(keyCode, event) 37 | 38 | } 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /ios/Classes/QueuingEventSink.h: -------------------------------------------------------------------------------- 1 | //MIT License 2 | // 3 | //Copyright (c) [2019] [Befovy] 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy 6 | //of this software and associated documentation files (the "Software"), to deal 7 | //in the Software without restriction, including without limitation the rights 8 | //to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | //copies of the Software, and to permit persons to whom the Software is 10 | //furnished to do so, subject to the following conditions: 11 | // 12 | //The above copyright notice and this permission notice shall be included in all 13 | //copies or substantial portions of the Software. 14 | // 15 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | //SOFTWARE. 22 | 23 | #import 24 | #import 25 | NS_ASSUME_NONNULL_BEGIN 26 | 27 | @interface QueuingEventSink : NSObject 28 | 29 | - (void)setDelegate:(FlutterEventSink _Nullable)sink; 30 | 31 | - (void)endOfStream; 32 | 33 | - (void)error:(NSString *)code 34 | message:(NSString *_Nullable)message 35 | details:(id _Nullable)details; 36 | 37 | - (void)success:(NSObject *)event; 38 | 39 | @end 40 | 41 | NS_ASSUME_NONNULL_END 42 | -------------------------------------------------------------------------------- /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 | flutter_volume_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 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 | -------------------------------------------------------------------------------- /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/.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 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | /build/ 31 | 32 | # Android related 33 | **/android/**/gradle-wrapper.jar 34 | **/android/.gradle 35 | **/android/captures/ 36 | **/android/gradlew 37 | **/android/gradlew.bat 38 | **/android/local.properties 39 | **/android/**/GeneratedPluginRegistrant.java 40 | 41 | # iOS/XCode related 42 | **/ios/**/*.mode1v3 43 | **/ios/**/*.mode2v3 44 | **/ios/**/*.moved-aside 45 | **/ios/**/*.pbxuser 46 | **/ios/**/*.perspectivev3 47 | **/ios/**/*sync/ 48 | **/ios/**/.sconsign.dblite 49 | **/ios/**/.tags* 50 | **/ios/**/.vagrant/ 51 | **/ios/**/DerivedData/ 52 | **/ios/**/Icon? 53 | **/ios/**/Pods/ 54 | **/ios/**/.symlinks/ 55 | **/ios/**/profile 56 | **/ios/**/xcuserdata 57 | **/ios/.generated/ 58 | **/ios/Flutter/App.framework 59 | **/ios/Flutter/Flutter.framework 60 | **/ios/Flutter/Generated.xcconfig 61 | **/ios/Flutter/app.flx 62 | **/ios/Flutter/app.zip 63 | **/ios/Flutter/flutter_assets/ 64 | **/ios/Flutter/flutter_export_environment.sh 65 | **/ios/ServiceDefinitions.json 66 | **/ios/Runner/GeneratedPluginRegistrant.* 67 | 68 | # Exceptions to above rules. 69 | !**/ios/**/default.mode1v3 70 | !**/ios/**/default.mode2v3 71 | !**/ios/**/default.pbxuser 72 | !**/ios/**/default.perspectivev3 73 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 74 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: sys_volume 2 | description: A Plugin for Volume Control and Monitoring, support iOS and Android 3 | version: 0.1.0 4 | author: befovy 5 | homepage: https://blog.befovy.com 6 | 7 | environment: 8 | sdk: ">=2.1.0 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | dev_dependencies: 15 | flutter_test: 16 | sdk: flutter 17 | 18 | # For information on the generic Dart part of this file, see the 19 | # following page: https://dart.dev/tools/pub/pubspec 20 | 21 | # The following section is specific to Flutter. 22 | flutter: 23 | # This section identifies this Flutter project as a plugin project. 24 | # The androidPackage and pluginClass identifiers should not ordinarily 25 | # be modified. They are used by the tooling to maintain consistency when 26 | # adding or updating assets for this project. 27 | plugin: 28 | androidPackage: com.befovy.flutter_volume 29 | pluginClass: FlutterVolumePlugin 30 | 31 | # To add assets to your plugin package, add an assets section, like this: 32 | # assets: 33 | # - images/a_dot_burr.jpeg 34 | # - images/a_dot_ham.jpeg 35 | # 36 | # For details regarding assets in packages, see 37 | # https://flutter.dev/assets-and-images/#from-packages 38 | # 39 | # An image asset can refer to one or more resolution-specific "variants", see 40 | # https://flutter.dev/assets-and-images/#resolution-aware. 41 | 42 | # To add custom fonts to your plugin package, add a fonts section here, 43 | # in this "flutter" section. Each entry in this list should have a 44 | # "family" key with the font family name, and a "fonts" key with a 45 | # list giving the asset and other descriptors for the font. For 46 | # example: 47 | # fonts: 48 | # - family: Schyler 49 | # fonts: 50 | # - asset: fonts/Schyler-Regular.ttf 51 | # - asset: fonts/Schyler-Italic.ttf 52 | # style: italic 53 | # - family: Trajan Pro 54 | # fonts: 55 | # - asset: fonts/TrajanPro.ttf 56 | # - asset: fonts/TrajanPro_Bold.ttf 57 | # weight: 700 58 | # 59 | # For details regarding fonts in packages, see 60 | # https://flutter.dev/custom-fonts/#from-packages 61 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_volume_example 2 | description: Demonstrates how to use the sys_volume plugin. 3 | publish_to: 'none' 4 | 5 | environment: 6 | sdk: ">=2.1.0 <3.0.0" 7 | 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | 12 | # The following adds the Cupertino Icons font to your application. 13 | # Use with the CupertinoIcons class for iOS style icons. 14 | cupertino_icons: ^0.1.2 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | 20 | sys_volume: 21 | path: ../ 22 | 23 | # For information on the generic Dart part of this file, see the 24 | # following page: https://dart.dev/tools/pub/pubspec 25 | 26 | # The following section is specific to Flutter. 27 | flutter: 28 | 29 | # The following line ensures that the Material Icons font is 30 | # included with your application, so that you can use the icons in 31 | # the material Icons class. 32 | uses-material-design: true 33 | 34 | # To add assets to your application, add an assets section, like this: 35 | # assets: 36 | # - images/a_dot_burr.jpeg 37 | # - images/a_dot_ham.jpeg 38 | 39 | # An image asset can refer to one or more resolution-specific "variants", see 40 | # https://flutter.dev/assets-and-images/#resolution-aware. 41 | 42 | # For details regarding adding assets from package dependencies, see 43 | # https://flutter.dev/assets-and-images/#from-packages 44 | 45 | # To add custom fonts to your application, add a fonts section here, 46 | # in this "flutter" section. Each entry in this list should have a 47 | # "family" key with the font family name, and a "fonts" key with a 48 | # list giving the asset and other descriptors for the font. For 49 | # example: 50 | # fonts: 51 | # - family: Schyler 52 | # fonts: 53 | # - asset: fonts/Schyler-Regular.ttf 54 | # - asset: fonts/Schyler-Italic.ttf 55 | # style: italic 56 | # - family: Trajan Pro 57 | # fonts: 58 | # - asset: fonts/TrajanPro.ttf 59 | # - asset: fonts/TrajanPro_Bold.ttf 60 | # weight: 700 61 | # 62 | # For details regarding fonts from package dependencies, 63 | # see https://flutter.dev/custom-fonts/#from-packages 64 | -------------------------------------------------------------------------------- /android/src/main/kotlin/com/befovy/flutter_volume/QueueEventSink.kt: -------------------------------------------------------------------------------- 1 | package com.befovy.flutter_volume 2 | 3 | import io.flutter.plugin.common.EventChannel 4 | 5 | /** 6 | * And implementation of {@link EventChannel.EventSink} which can wrap an underlying sink. 7 | * 8 | *

It delivers messages immediately when downstream is available, but it queues messages before 9 | * the delegate event sink is set with setDelegate. 10 | * 11 | *

This class is not thread-safe. All calls must be done on the same thread or synchronized 12 | * externally. 13 | */ 14 | internal class QueuingEventSink : EventChannel.EventSink { 15 | 16 | private var delegate: EventChannel.EventSink? = null 17 | private val eventQueue: MutableList = mutableListOf() 18 | private var done = false 19 | 20 | fun setDelegate(delegate: EventChannel.EventSink?) { 21 | this.delegate = delegate 22 | maybeFlush() 23 | } 24 | 25 | override fun endOfStream() { 26 | enqueue(EndOfStreamEvent()) 27 | maybeFlush() 28 | done = true 29 | } 30 | 31 | override fun error(code: String, message: String, details: Any) { 32 | enqueue(ErrorEvent(code, message, details)) 33 | maybeFlush() 34 | } 35 | 36 | override fun success(event: Any) { 37 | enqueue(event) 38 | maybeFlush() 39 | } 40 | 41 | private fun enqueue(event: Any) { 42 | if (done) { 43 | return 44 | } 45 | eventQueue.add(event) 46 | } 47 | 48 | private fun maybeFlush() { 49 | if (delegate == null) { 50 | return 51 | } 52 | for (event in eventQueue) { 53 | when (event) { 54 | is EndOfStreamEvent -> delegate!!.endOfStream() 55 | is ErrorEvent -> { 56 | delegate!!.error(event.code, event.message, event.details) 57 | } 58 | else -> delegate!!.success(event) 59 | } 60 | } 61 | eventQueue.clear() 62 | } 63 | 64 | private class EndOfStreamEvent 65 | 66 | private class ErrorEvent constructor(internal var code: String, internal var message: String, internal var details: Any) 67 | } 68 | -------------------------------------------------------------------------------- /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.befovy.flutter_volume_example" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 66 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 67 | } 68 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Classes/QueuingEventSink.m: -------------------------------------------------------------------------------- 1 | //MIT License 2 | // 3 | //Copyright (c) [2019] [Befovy] 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy 6 | //of this software and associated documentation files (the "Software"), to deal 7 | //in the Software without restriction, including without limitation the rights 8 | //to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | //copies of the Software, and to permit persons to whom the Software is 10 | //furnished to do so, subject to the following conditions: 11 | // 12 | //The above copyright notice and this permission notice shall be included in all 13 | //copies or substantial portions of the Software. 14 | // 15 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | //SOFTWARE. 22 | 23 | #import "QueuingEventSink.h" 24 | 25 | @implementation QueuingEventSink { 26 | NSMutableArray *_eventQueue; 27 | BOOL _done; 28 | FlutterEventSink _delegate; 29 | } 30 | 31 | - (instancetype)init { 32 | self = [super init]; 33 | if (self) { 34 | _delegate = nil; 35 | _done = false; 36 | _eventQueue = [[NSMutableArray alloc] init]; 37 | } 38 | return self; 39 | } 40 | 41 | - (void)maybeFlush { 42 | if (_delegate == nil) 43 | return; 44 | 45 | for (NSObject *event in _eventQueue) { 46 | _delegate(event); 47 | } 48 | [_eventQueue removeAllObjects]; 49 | } 50 | 51 | - (void)enqueue:(const NSObject *)event { 52 | if (_done) 53 | return; 54 | [_eventQueue addObject:event]; 55 | } 56 | 57 | - (void)setDelegate:(FlutterEventSink)sink { 58 | _delegate = sink; 59 | [self maybeFlush]; 60 | } 61 | 62 | - (void)endOfStream { 63 | [self enqueue:FlutterEndOfEventStream]; 64 | [self maybeFlush]; 65 | _done = TRUE; 66 | } 67 | 68 | - (void)error:(NSString *)code 69 | message:(NSString *_Nullable)message 70 | details:(id _Nullable)details { 71 | [self enqueue:[FlutterError errorWithCode:code 72 | message:message 73 | details:details]]; 74 | [self maybeFlush]; 75 | } 76 | 77 | - (void)success:(NSObject *)event { 78 | [self enqueue:event]; 79 | [self maybeFlush]; 80 | } 81 | 82 | - (void)dealloc { 83 | if (_eventQueue) { 84 | [_eventQueue removeAllObjects]; 85 | _eventQueue = nil; 86 | } 87 | } 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def parse_KV_file(file, separator='=') 14 | file_abs_path = File.expand_path(file) 15 | if !File.exists? file_abs_path 16 | return []; 17 | end 18 | generated_key_values = {} 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) do |line| 21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 22 | plugin = line.split(pattern=separator) 23 | if plugin.length == 2 24 | podname = plugin[0].strip() 25 | path = plugin[1].strip() 26 | podpath = File.expand_path("#{path}", file_abs_path) 27 | generated_key_values[podname] = podpath 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | end 32 | generated_key_values 33 | end 34 | 35 | target 'Runner' do 36 | use_frameworks! 37 | use_modular_headers! 38 | 39 | # Flutter Pod 40 | 41 | copied_flutter_dir = File.join(__dir__, 'Flutter') 42 | copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') 43 | copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') 44 | unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) 45 | # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. 46 | # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. 47 | # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. 48 | 49 | generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') 50 | unless File.exist?(generated_xcode_build_settings_path) 51 | raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" 52 | end 53 | generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) 54 | cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; 55 | 56 | unless File.exist?(copied_framework_path) 57 | FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) 58 | end 59 | unless File.exist?(copied_podspec_path) 60 | FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) 61 | end 62 | end 63 | 64 | # Keep pod path relative so it can be checked into Podfile.lock. 65 | pod 'Flutter', :path => 'Flutter' 66 | 67 | # Plugin Pods 68 | 69 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 70 | # referring to absolute paths on developers' machines. 71 | system('rm -rf .symlinks') 72 | system('mkdir -p .symlinks/plugins') 73 | plugin_pods = parse_KV_file('../.flutter-plugins') 74 | plugin_pods.each do |name, path| 75 | symlink = File.join('.symlinks', 'plugins', name) 76 | File.symlink(path, symlink) 77 | pod name, :path => File.join(symlink, 'ios') 78 | end 79 | end 80 | 81 | post_install do |installer| 82 | installer.pods_project.targets.each do |target| 83 | target.build_configurations.each do |config| 84 | config.build_settings['ENABLE_BITCODE'] = 'NO' 85 | end 86 | end 87 | end 88 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | import 'package:sys_volume/flutter_volume.dart'; 4 | 5 | void main() => runApp(MyApp()); 6 | 7 | class MyApp extends StatefulWidget { 8 | @override 9 | _MyAppState createState() => _MyAppState(); 10 | } 11 | 12 | class _MyAppState extends State { 13 | bool sliding = false; 14 | double sliderVal = 0; 15 | double volume = 0; 16 | 17 | @override 18 | void initState() { 19 | super.initState(); 20 | FlutterVolume.get().then((v) { 21 | setState(() { 22 | volume = v; 23 | }); 24 | }); 25 | } 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | return MaterialApp( 30 | home: Scaffold( 31 | appBar: AppBar( 32 | title: const Text('Plugin example app'), 33 | ), 34 | body: VolumeWatcher( 35 | watcher: (vol) { 36 | setState(() { 37 | volume = vol.vol; 38 | }); 39 | }, 40 | child: Center( 41 | child: Column( 42 | children: [ 43 | FlatButton( 44 | onPressed: () { 45 | FlutterVolume.up(); 46 | }, 47 | child: Text("up")), 48 | FlatButton( 49 | onPressed: () { 50 | FlutterVolume.down(); 51 | }, 52 | child: Text("down")), 53 | FlatButton( 54 | onPressed: () { 55 | FlutterVolume.mute(); 56 | }, 57 | child: Text("mute")), 58 | Slider( 59 | value: sliding ? sliderVal : volume, 60 | onChangeStart: (v) { 61 | setState(() { 62 | sliding = true; 63 | }); 64 | }, 65 | onChangeEnd: (v) { 66 | FlutterVolume.set(v).then((_) { 67 | setState(() { 68 | sliding = false; 69 | }); 70 | }); 71 | }, 72 | onChanged: (v) { 73 | FlutterVolume.set(v); 74 | setState(() { 75 | sliderVal = v; 76 | }); 77 | }, 78 | ), 79 | 80 | Expanded(child: Container(),), 81 | FlatButton( 82 | onPressed: () { 83 | FlutterVolume.enableWatcher(); 84 | FlutterVolume.get().then((v) { 85 | setState(() { 86 | volume = v; 87 | }); 88 | }); 89 | }, 90 | child: Text("enable watch")), 91 | FlatButton( 92 | onPressed: () { 93 | FlutterVolume.disableWatcher(); 94 | }, 95 | child: Text("disable watch")), 96 | FlatButton( 97 | onPressed: () { 98 | FlutterVolume.enableUI(); 99 | }, 100 | child: Text("enable OS UI")), 101 | FlatButton( 102 | onPressed: () { 103 | FlutterVolume.disableUI(); 104 | }, 105 | child: Text("disable OS UI")), 106 | ], 107 | ), 108 | ), 109 | ), 110 | ), 111 | ); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /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.3.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.0.5" 18 | charcode: 19 | dependency: transitive 20 | description: 21 | name: charcode 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.2" 25 | collection: 26 | dependency: transitive 27 | description: 28 | name: collection 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.14.11" 32 | flutter: 33 | dependency: "direct main" 34 | description: flutter 35 | source: sdk 36 | version: "0.0.0" 37 | flutter_test: 38 | dependency: "direct dev" 39 | description: flutter 40 | source: sdk 41 | version: "0.0.0" 42 | matcher: 43 | dependency: transitive 44 | description: 45 | name: matcher 46 | url: "https://pub.dartlang.org" 47 | source: hosted 48 | version: "0.12.5" 49 | meta: 50 | dependency: transitive 51 | description: 52 | name: meta 53 | url: "https://pub.dartlang.org" 54 | source: hosted 55 | version: "1.1.7" 56 | path: 57 | dependency: transitive 58 | description: 59 | name: path 60 | url: "https://pub.dartlang.org" 61 | source: hosted 62 | version: "1.6.4" 63 | pedantic: 64 | dependency: transitive 65 | description: 66 | name: pedantic 67 | url: "https://pub.dartlang.org" 68 | source: hosted 69 | version: "1.8.0+1" 70 | quiver: 71 | dependency: transitive 72 | description: 73 | name: quiver 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "2.0.5" 77 | sky_engine: 78 | dependency: transitive 79 | description: flutter 80 | source: sdk 81 | version: "0.0.99" 82 | source_span: 83 | dependency: transitive 84 | description: 85 | name: source_span 86 | url: "https://pub.dartlang.org" 87 | source: hosted 88 | version: "1.5.5" 89 | stack_trace: 90 | dependency: transitive 91 | description: 92 | name: stack_trace 93 | url: "https://pub.dartlang.org" 94 | source: hosted 95 | version: "1.9.3" 96 | stream_channel: 97 | dependency: transitive 98 | description: 99 | name: stream_channel 100 | url: "https://pub.dartlang.org" 101 | source: hosted 102 | version: "2.0.0" 103 | string_scanner: 104 | dependency: transitive 105 | description: 106 | name: string_scanner 107 | url: "https://pub.dartlang.org" 108 | source: hosted 109 | version: "1.0.5" 110 | term_glyph: 111 | dependency: transitive 112 | description: 113 | name: term_glyph 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "1.1.0" 117 | test_api: 118 | dependency: transitive 119 | description: 120 | name: test_api 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "0.2.5" 124 | typed_data: 125 | dependency: transitive 126 | description: 127 | name: typed_data 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.1.6" 131 | vector_math: 132 | dependency: transitive 133 | description: 134 | name: vector_math 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "2.0.8" 138 | sdks: 139 | dart: ">=2.2.2 <3.0.0" 140 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.0.13" 11 | args: 12 | dependency: transitive 13 | description: 14 | name: args 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.6.0" 18 | async: 19 | dependency: transitive 20 | description: 21 | name: async 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.4.1" 25 | boolean_selector: 26 | dependency: transitive 27 | description: 28 | name: boolean_selector 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.0.0" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.3" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.14.12" 46 | convert: 47 | dependency: transitive 48 | description: 49 | name: convert 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "2.1.1" 53 | crypto: 54 | dependency: transitive 55 | description: 56 | name: crypto 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.4" 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.2" 67 | flutter: 68 | dependency: "direct main" 69 | description: flutter 70 | source: sdk 71 | version: "0.0.0" 72 | flutter_test: 73 | dependency: "direct dev" 74 | description: flutter 75 | source: sdk 76 | version: "0.0.0" 77 | image: 78 | dependency: transitive 79 | description: 80 | name: image 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "2.1.12" 84 | matcher: 85 | dependency: transitive 86 | description: 87 | name: matcher 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "0.12.6" 91 | meta: 92 | dependency: transitive 93 | description: 94 | name: meta 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "1.1.8" 98 | path: 99 | dependency: transitive 100 | description: 101 | name: path 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "1.6.4" 105 | petitparser: 106 | dependency: transitive 107 | description: 108 | name: petitparser 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "2.4.0" 112 | quiver: 113 | dependency: transitive 114 | description: 115 | name: quiver 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "2.1.3" 119 | sky_engine: 120 | dependency: transitive 121 | description: flutter 122 | source: sdk 123 | version: "0.0.99" 124 | source_span: 125 | dependency: transitive 126 | description: 127 | name: source_span 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.7.0" 131 | stack_trace: 132 | dependency: transitive 133 | description: 134 | name: stack_trace 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.9.3" 138 | stream_channel: 139 | dependency: transitive 140 | description: 141 | name: stream_channel 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "2.0.0" 145 | string_scanner: 146 | dependency: transitive 147 | description: 148 | name: string_scanner 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.0.5" 152 | sys_volume: 153 | dependency: "direct dev" 154 | description: 155 | path: ".." 156 | relative: true 157 | source: path 158 | version: "0.1.0" 159 | term_glyph: 160 | dependency: transitive 161 | description: 162 | name: term_glyph 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "1.1.0" 166 | test_api: 167 | dependency: transitive 168 | description: 169 | name: test_api 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "0.2.15" 173 | typed_data: 174 | dependency: transitive 175 | description: 176 | name: typed_data 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "1.1.6" 180 | vector_math: 181 | dependency: transitive 182 | description: 183 | name: vector_math 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "2.0.8" 187 | xml: 188 | dependency: transitive 189 | description: 190 | name: xml 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "3.6.1" 194 | sdks: 195 | dart: ">=2.6.0 <3.0.0" 196 | -------------------------------------------------------------------------------- /lib/flutter_volume.dart: -------------------------------------------------------------------------------- 1 | //MIT License 2 | // 3 | //Copyright (c) [2019] [Befovy] 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy 6 | //of this software and associated documentation files (the "Software"), to deal 7 | //in the Software without restriction, including without limitation the rights 8 | //to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | //copies of the Software, and to permit persons to whom the Software is 10 | //furnished to do so, subject to the following conditions: 11 | // 12 | //The above copyright notice and this permission notice shall be included in all 13 | //copies or substantial portions of the Software. 14 | // 15 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | //SOFTWARE. 22 | 23 | import 'dart:async'; 24 | 25 | import 'package:flutter/services.dart'; 26 | import 'package:flutter/widgets.dart'; 27 | 28 | @immutable 29 | class VolumeVal { 30 | final double vol; 31 | final int type; 32 | 33 | VolumeVal({ 34 | @required this.vol, 35 | @required this.type, 36 | }) : assert(vol != null), 37 | assert(type != null); 38 | 39 | @override 40 | bool operator ==(Object other) => 41 | identical(this, other) || 42 | (other is VolumeVal && hashCode == other.hashCode); 43 | 44 | @override 45 | int get hashCode => hashValues(vol, type); 46 | } 47 | 48 | class _VolumeValueNotifier extends ValueNotifier { 49 | _VolumeValueNotifier(VolumeVal value) : super(value); 50 | } 51 | 52 | typedef VolumeCallback = void Function(VolumeVal value); 53 | 54 | class FlutterVolume { 55 | static const int STREAM_VOICE_CALL = 0; 56 | static const int STREAM_SYSTEM = 1; 57 | static const int STREAM_RING = 2; 58 | static const int STREAM_MUSIC = 3; 59 | static const int STREAM_ALARM = 4; 60 | 61 | static const double _step = 1.0 / 16.0; 62 | static const MethodChannel _channel = 63 | const MethodChannel('com.befovy.flutter_volume'); 64 | 65 | static _VolumeValueNotifier _notifier = 66 | _VolumeValueNotifier(VolumeVal(vol: 0, type: 0)); 67 | 68 | static StreamSubscription _eventSubs; 69 | 70 | static void enableWatcher() async { 71 | if (_eventSubs == null) { 72 | await _channel.invokeMethod("enable_watch"); 73 | _eventSubs = EventChannel('com.befovy.flutter_volume/event') 74 | .receiveBroadcastStream() 75 | .listen(_eventListener, onError: _errorListener); 76 | } 77 | } 78 | 79 | static void disableWatcher() async { 80 | _eventSubs?.cancel(); 81 | await _channel.invokeMethod("disable_watch"); 82 | _eventSubs = null; 83 | } 84 | 85 | static Future enableUI() { 86 | return _channel.invokeMethod("enable_ui"); 87 | } 88 | 89 | static Future disableUI() { 90 | return _channel.invokeMethod("disable_ui"); 91 | } 92 | 93 | static void _eventListener(dynamic event) { 94 | final Map map = event; 95 | switch (map['event']) { 96 | case 'vol': 97 | double vol = map['v']; 98 | int type = map['t']; 99 | _notifier.value = VolumeVal(vol: vol, type: type); 100 | break; 101 | default: 102 | break; 103 | } 104 | } 105 | 106 | static void _errorListener(Object obj) { 107 | print("errorListener: $obj"); 108 | } 109 | 110 | static Future up({ 111 | double step = _step, 112 | int type = STREAM_MUSIC, 113 | }) { 114 | return _channel.invokeMethod("up", { 115 | 'step': step, 116 | 'type': type, 117 | }); 118 | } 119 | 120 | static Future down({ 121 | double step = _step, 122 | int type = STREAM_MUSIC, 123 | }) { 124 | return _channel.invokeMethod("down", { 125 | 'step': step, 126 | 'type': type, 127 | }); 128 | } 129 | 130 | static Future mute({ 131 | int type = STREAM_MUSIC, 132 | }) { 133 | return _channel.invokeMethod("mute", { 134 | 'type': type, 135 | }); 136 | } 137 | 138 | static Future get({ 139 | int type = STREAM_MUSIC, 140 | }) { 141 | return _channel.invokeMethod("get", { 142 | 'type': type, 143 | }); 144 | } 145 | 146 | static Future set(double vol, {int type = STREAM_MUSIC}) { 147 | return _channel.invokeMethod("set", { 148 | 'vol': vol, 149 | 'type': type, 150 | }); 151 | } 152 | 153 | static void addVolListener(VoidCallback listener) { 154 | _notifier.addListener(listener); 155 | } 156 | 157 | static void removeVolListener(VoidCallback listener) { 158 | _notifier.removeListener(listener); 159 | } 160 | 161 | static VolumeVal get value => _notifier.value; 162 | } 163 | 164 | class VolumeWatcher extends StatefulWidget { 165 | final VolumeCallback watcher; 166 | final Widget child; 167 | 168 | VolumeWatcher({ 169 | @required this.watcher, 170 | @required this.child, 171 | }) : assert(child != null), 172 | assert(watcher != null); 173 | 174 | @override 175 | _VolumeWatcherState createState() => _VolumeWatcherState(); 176 | } 177 | 178 | class _VolumeWatcherState extends State { 179 | @override 180 | void initState() { 181 | super.initState(); 182 | FlutterVolume.enableWatcher(); 183 | FlutterVolume.addVolListener(_volListener); 184 | } 185 | 186 | void _volListener() { 187 | VolumeVal value = FlutterVolume.value; 188 | widget.watcher(value); 189 | } 190 | 191 | @override 192 | void dispose() { 193 | super.dispose(); 194 | FlutterVolume.removeVolListener(_volListener); 195 | } 196 | 197 | @override 198 | Widget build(BuildContext context) { 199 | return widget.child; 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /ios/Classes/FlutterVolumePlugin.m: -------------------------------------------------------------------------------- 1 | //MIT License 2 | // 3 | //Copyright (c) [2019] [Befovy] 4 | // 5 | //Permission is hereby granted, free of charge, to any person obtaining a copy 6 | //of this software and associated documentation files (the "Software"), to deal 7 | //in the Software without restriction, including without limitation the rights 8 | //to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | //copies of the Software, and to permit persons to whom the Software is 10 | //furnished to do so, subject to the following conditions: 11 | // 12 | //The above copyright notice and this permission notice shall be included in all 13 | //copies or substantial portions of the Software. 14 | // 15 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | //SOFTWARE. 22 | 23 | #import "FlutterVolumePlugin.h" 24 | #import "QueuingEventSink.h" 25 | #import 26 | #import 27 | #import 28 | 29 | @implementation FlutterVolumePlugin { 30 | NSObject *_registrar; 31 | QueuingEventSink *_eventSink; 32 | FlutterEventChannel *_eventChannel; 33 | 34 | MPVolumeView *_volumeView; 35 | UISlider *_volumeViewSlider; 36 | BOOL _volumeInWindow; 37 | BOOL _eventListening; 38 | BOOL _enable_ui; 39 | float _volStep; 40 | } 41 | 42 | + (void)registerWithRegistrar:(NSObject *)registrar { 43 | 44 | FlutterMethodChannel *channel = 45 | [FlutterMethodChannel methodChannelWithName:@"com.befovy.flutter_volume" 46 | binaryMessenger:[registrar messenger]]; 47 | FlutterVolumePlugin *instance = 48 | [[FlutterVolumePlugin alloc] initWithRegistrar:registrar]; 49 | [registrar addMethodCallDelegate:instance channel:channel]; 50 | } 51 | 52 | - (instancetype)initWithRegistrar: 53 | (NSObject *)registrar { 54 | self = [super init]; 55 | if (self) { 56 | _registrar = registrar; 57 | _eventListening = FALSE; 58 | _volStep = 1.0 / 16.0; 59 | _enable_ui = TRUE; 60 | _eventSink = [[QueuingEventSink alloc] init]; 61 | } 62 | return self; 63 | } 64 | 65 | - (void)handleMethodCall:(FlutterMethodCall *)call 66 | result:(FlutterResult)result { 67 | NSDictionary *argsMap = call.arguments; 68 | 69 | if ([@"up" isEqualToString:call.method]) { 70 | NSNumber *number = argsMap[@"step"]; 71 | float step = number == nil ? _volStep : [number floatValue]; 72 | float vol = [self getVolume]; 73 | vol += step; 74 | vol = [self setVolume:vol]; 75 | result(@(vol)); 76 | } else if ([@"down" isEqualToString:call.method]) { 77 | NSNumber *number = argsMap[@"step"]; 78 | float step = number == nil ? _volStep : [number floatValue]; 79 | float vol = [self getVolume]; 80 | vol -= step; 81 | vol = [self setVolume:vol]; 82 | result(@(vol)); 83 | } else if ([@"mute" isEqualToString:call.method]) { 84 | float vol = [self setVolume:0.0f]; 85 | result(@(vol)); 86 | } else if ([@"set" isEqualToString:call.method]) { 87 | NSNumber *number = argsMap[@"vol"]; 88 | float v = number == nil ? [self getVolume] : [number floatValue]; 89 | v = [self setVolume:v]; 90 | result(@(v)); 91 | } else if ([@"get" isEqualToString:call.method]) { 92 | result(@([self getVolume])); 93 | } else if ([@"enable_watch" isEqualToString:call.method]) { 94 | [self enableWatch]; 95 | result(nil); 96 | } else if ([@"disable_watch" isEqualToString:call.method]) { 97 | [self disableWatch]; 98 | result(nil); 99 | } else if ([@"enable_ui" isEqualToString:call.method]) { 100 | if (_volumeView != nil) 101 | _volumeView.hidden = TRUE; 102 | else 103 | NSLog(@"enable ui failed, null volume view"); 104 | result(nil); 105 | } else if ([@"disable_ui" isEqualToString:call.method]) { 106 | if (_volumeView != nil) 107 | _volumeView.hidden = FALSE; 108 | else 109 | NSLog(@"enable ui failed, null volume view"); 110 | result(nil); 111 | } 112 | } 113 | 114 | - (void)initVolumeView { 115 | if (_volumeView == nil) { 116 | _volumeView = 117 | [[MPVolumeView alloc] initWithFrame:CGRectMake(-100, -100, 10, 10)]; 118 | _volumeView.hidden = YES; 119 | } 120 | if (_volumeViewSlider == nil) { 121 | for (UIView *view in [_volumeView subviews]) { 122 | if ([view.class.description isEqualToString:@"MPVolumeSlider"]) { 123 | _volumeViewSlider = (UISlider *)view; 124 | _volumeViewSlider.value = [AVAudioSession sharedInstance].outputVolume; 125 | break; 126 | } 127 | } 128 | } 129 | if (!_volumeInWindow) { 130 | UIWindow *window = UIApplication.sharedApplication.keyWindow; 131 | if (window != nil) { 132 | [window addSubview:_volumeView]; 133 | _volumeInWindow = YES; 134 | } 135 | } 136 | } 137 | 138 | - (float)getVolume { 139 | [self initVolumeView]; 140 | if (_volumeViewSlider == nil) { 141 | AVAudioSession *audioSession = [AVAudioSession sharedInstance]; 142 | CGFloat currentVol = audioSession.outputVolume; 143 | return currentVol; 144 | } else { 145 | return _volumeViewSlider.value; 146 | } 147 | } 148 | 149 | - (float)setVolume:(float)vol { 150 | [self initVolumeView]; 151 | if (vol > 1.0) { 152 | vol = 1.0; 153 | } else if (vol < 0) { 154 | vol = 0.0; 155 | } 156 | [_volumeViewSlider setValue:vol animated:FALSE]; 157 | vol = _volumeViewSlider.value; 158 | return vol; 159 | } 160 | 161 | - (void)enableWatch { 162 | if (_eventListening == NO) { 163 | _eventListening = YES; 164 | 165 | [[NSNotificationCenter defaultCenter] 166 | addObserver:self 167 | selector:@selector(volumeChange:) 168 | name:@"AVSystemController_SystemVolumeDidChangeNotification" 169 | object:nil]; 170 | 171 | _eventChannel = [FlutterEventChannel 172 | eventChannelWithName:@"com.befovy.flutter_volume/event" 173 | binaryMessenger:[_registrar messenger]]; 174 | [_eventChannel setStreamHandler:self]; 175 | } 176 | } 177 | 178 | - (void)disableWatch { 179 | if (_eventListening == YES) { 180 | _eventListening = NO; 181 | 182 | [[NSNotificationCenter defaultCenter] 183 | removeObserver:self 184 | name:@"AVSystemController_SystemVolumeDidChangeNotification" 185 | object:nil]; 186 | [_eventChannel setStreamHandler:nil]; 187 | _eventChannel = nil; 188 | } 189 | } 190 | 191 | - (void)volumeChange:(NSNotification *)notification { 192 | NSString *style = [notification.userInfo 193 | objectForKey:@"AVSystemController_AudioCategoryNotificationParameter"]; 194 | CGFloat value = [[notification.userInfo 195 | objectForKey:@"AVSystemController_AudioVolumeNotificationParameter"] 196 | doubleValue]; 197 | if ([style isEqualToString:@"Audio/Video"]) { 198 | [self sendVolumeChange:value]; 199 | } 200 | } 201 | 202 | - (void)sendVolumeChange:(float)value { 203 | if (_eventListening) { 204 | NSLog(@"volume val %f\n", value); 205 | [_eventSink success:@{@"event" : @"vol", @"v" : @(value), @"t": @(3)}]; 206 | } 207 | } 208 | 209 | - (FlutterError *_Nullable)onCancelWithArguments:(id _Nullable)arguments { 210 | [_eventSink setDelegate:nil]; 211 | return nil; 212 | } 213 | 214 | - (FlutterError *_Nullable)onListenWithArguments:(id _Nullable)arguments 215 | eventSink: 216 | (nonnull FlutterEventSink)events { 217 | [_eventSink setDelegate:events]; 218 | return nil; 219 | } 220 | 221 | @end 222 | -------------------------------------------------------------------------------- /android/src/main/kotlin/com/befovy/flutter_volume/FlutterVolumePlugin.kt: -------------------------------------------------------------------------------- 1 | package com.befovy.flutter_volume 2 | 3 | import android.content.BroadcastReceiver 4 | import android.content.Context 5 | import android.content.Intent 6 | import android.content.IntentFilter 7 | import android.media.AudioManager 8 | import android.view.KeyEvent 9 | import io.flutter.plugin.common.EventChannel 10 | import io.flutter.plugin.common.MethodCall 11 | import io.flutter.plugin.common.MethodChannel 12 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler 13 | import io.flutter.plugin.common.MethodChannel.Result 14 | import io.flutter.plugin.common.PluginRegistry.Registrar 15 | import java.lang.ref.WeakReference 16 | import kotlin.math.max 17 | import kotlin.math.min 18 | 19 | interface VolumeKeyListener { 20 | fun onVolumeKeyDown(keyCode: Int, event: KeyEvent): Boolean 21 | } 22 | 23 | interface CanListenVolumeKey { 24 | fun setVolumeKeyListener(listener: VolumeKeyListener?) 25 | } 26 | 27 | 28 | class FlutterVolumePlugin(registrar: Registrar) : MethodCallHandler, VolumeKeyListener { 29 | companion object { 30 | @JvmStatic 31 | fun registerWith(registrar: Registrar) { 32 | val channel = MethodChannel(registrar.messenger(), "com.befovy.flutter_volume") 33 | 34 | plugin = FlutterVolumePlugin(registrar) 35 | channel.setMethodCallHandler(plugin) 36 | } 37 | 38 | private const val VOLUME_CHANGED_ACTION = "android.media.VOLUME_CHANGED_ACTION" 39 | 40 | private lateinit var plugin: FlutterVolumePlugin 41 | } 42 | 43 | private val mRegistrar: Registrar = registrar 44 | private val mEventSink = QueuingEventSink() 45 | private var mEventChannel: EventChannel? = null 46 | private var mWatching: Boolean = false 47 | private var mEnableUI: Boolean = true 48 | private var mVolumeReceiver: VolumeReceiver? = null 49 | 50 | 51 | private var volStep = 1.0f / 16.0f 52 | 53 | private var minStep: Float = 0.0f 54 | 55 | init { 56 | val max = audioManager().getStreamMaxVolume(AudioManager.STREAM_MUSIC) 57 | minStep = 1.0f / max.toFloat() 58 | volStep = max(minStep, volStep) 59 | } 60 | 61 | override fun onMethodCall(call: MethodCall, result: Result) { 62 | when (call.method) { 63 | "up" -> { 64 | var stepUp = volStep 65 | if (call.hasArgument("step")) { 66 | val step = call.argument("step") 67 | stepUp = step?.toFloat() ?: stepUp 68 | } 69 | stepUp = max(minStep, stepUp) 70 | result.success(volumeUp(stepUp)) 71 | } 72 | "down" -> { 73 | var stepDown = volStep 74 | if (call.hasArgument("step")) { 75 | val step = call.argument("step") 76 | stepDown = step?.toFloat() ?: stepDown 77 | } 78 | stepDown = max(minStep, stepDown) 79 | result.success(volumeUp(-stepDown)) 80 | } 81 | "mute" -> { 82 | result.success(setVolume(0.0f)) 83 | } 84 | "get" -> { 85 | result.success(getVolume()) 86 | } 87 | "set" -> { 88 | var vol = getVolume() 89 | if (call.hasArgument("vol")) { 90 | val v = call.argument("vol") 91 | vol = setVolume(v!!.toFloat()) 92 | } 93 | result.success(vol) 94 | } 95 | "enable_watch" -> { 96 | enableWatch() 97 | result.success(null) 98 | } 99 | "disable_watch" -> { 100 | disableWatch() 101 | result.success(null) 102 | } 103 | "enable_ui" -> { 104 | mEnableUI = true 105 | result.success(null) 106 | } 107 | "disable_ui" -> { 108 | mEnableUI = false 109 | result.success(null) 110 | } 111 | else -> result.notImplemented() 112 | } 113 | } 114 | 115 | private fun audioManager(): AudioManager { 116 | val activity = mRegistrar.activity() 117 | return activity.getSystemService(Context.AUDIO_SERVICE) as AudioManager 118 | } 119 | 120 | private val flag: Int 121 | get() { 122 | return if (mEnableUI) AudioManager.FLAG_SHOW_UI else 0 123 | } 124 | 125 | fun getVolume(type: Int = AudioManager.STREAM_MUSIC): Float { 126 | val audioManager = audioManager() 127 | val max = audioManager.getStreamMaxVolume(type).toFloat() 128 | val vol = audioManager.getStreamVolume(type).toFloat() 129 | return vol / max 130 | } 131 | 132 | private fun setVolume(vol: Float, type: Int = AudioManager.STREAM_MUSIC): Float { 133 | val audioManager = audioManager() 134 | val max = audioManager.getStreamMaxVolume(type) 135 | var volIndex = (vol * max).toInt() 136 | volIndex = min(volIndex, max) 137 | volIndex = max(volIndex, 0) 138 | audioManager.setStreamVolume(type, volIndex, flag) 139 | return volIndex.toFloat() / max.toFloat() 140 | } 141 | 142 | private fun volumeUp(step: Float, type: Int = AudioManager.STREAM_MUSIC): Float { 143 | var vol = getVolume(type) + step 144 | vol = setVolume(vol, type) 145 | return vol 146 | } 147 | 148 | private fun enableWatch() { 149 | 150 | if (!mWatching) { 151 | mWatching = true 152 | mEventChannel = EventChannel(mRegistrar.messenger(), "com.befovy.flutter_volume/event") 153 | mEventChannel!!.setStreamHandler(object : EventChannel.StreamHandler { 154 | override fun onListen(o: Any?, eventSink: EventChannel.EventSink) { 155 | mEventSink.setDelegate(eventSink) 156 | } 157 | 158 | override fun onCancel(o: Any?) { 159 | mEventSink.setDelegate(null) 160 | } 161 | }) 162 | 163 | val activity = mRegistrar.activity() 164 | if (activity is CanListenVolumeKey) { 165 | activity.setVolumeKeyListener(this) 166 | } 167 | mVolumeReceiver = VolumeReceiver(this) 168 | val filter = IntentFilter() 169 | filter.addAction(VOLUME_CHANGED_ACTION) 170 | mRegistrar.activeContext().registerReceiver(mVolumeReceiver, filter) 171 | } 172 | 173 | } 174 | 175 | private fun disableWatch() { 176 | if (mWatching) { 177 | mWatching = false 178 | mEventChannel!!.setStreamHandler(null) 179 | mEventChannel = null 180 | 181 | val activity = mRegistrar.activity() 182 | if (activity is CanListenVolumeKey) { 183 | activity.setVolumeKeyListener(null) 184 | } 185 | 186 | mRegistrar.activeContext().unregisterReceiver(mVolumeReceiver) 187 | mVolumeReceiver = null 188 | } 189 | } 190 | 191 | fun sink(event: Any) { 192 | mEventSink.success(event) 193 | } 194 | 195 | override fun onVolumeKeyDown(keyCode: Int, event: KeyEvent): Boolean { 196 | when (keyCode) { 197 | KeyEvent.KEYCODE_VOLUME_MUTE -> setVolume(0.0f) 198 | KeyEvent.KEYCODE_VOLUME_UP -> volumeUp(minStep) 199 | KeyEvent.KEYCODE_VOLUME_DOWN -> volumeUp(-minStep) 200 | } 201 | return true 202 | } 203 | } 204 | 205 | 206 | private class VolumeReceiver(plugin: FlutterVolumePlugin) : BroadcastReceiver() { 207 | private var mPlugin: WeakReference = WeakReference(plugin) 208 | 209 | override fun onReceive(context: Context, intent: Intent) { 210 | if (intent.action == "android.media.VOLUME_CHANGED_ACTION") { 211 | val plugin = mPlugin.get() 212 | if (plugin != null) { 213 | val volume = plugin.getVolume() 214 | val event: MutableMap = mutableMapOf() 215 | event["event"] = "vol" 216 | event["v"] = volume 217 | event["t"] = AudioManager.STREAM_MUSIC 218 | plugin.sink(event) 219 | } 220 | } 221 | } 222 | } 223 | -------------------------------------------------------------------------------- /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 | 1B546AA7E6A9257AB42EA4BF /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AEAFD97A879DB5D0647FC0DB /* Pods_Runner.framework */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 13 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 14 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 15 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 16 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 17 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXCopyFilesBuildPhase section */ 21 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 22 | isa = PBXCopyFilesBuildPhase; 23 | buildActionMask = 2147483647; 24 | dstPath = ""; 25 | dstSubfolderSpec = 10; 26 | files = ( 27 | ); 28 | name = "Embed Frameworks"; 29 | runOnlyForDeploymentPostprocessing = 0; 30 | }; 31 | /* End PBXCopyFilesBuildPhase section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 35 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 36 | 1D2CCACCDAEBC4AE5BBBC7A7 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 37 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 38 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 39 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 40 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 41 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 42 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 43 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 45 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 46 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 47 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | AEAFD97A879DB5D0647FC0DB /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | EDED18B3F056A8C1712AD306 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 50 | F07A1E1CB20E39AC3A9A3BD8 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 51 | /* End PBXFileReference section */ 52 | 53 | /* Begin PBXFrameworksBuildPhase section */ 54 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 55 | isa = PBXFrameworksBuildPhase; 56 | buildActionMask = 2147483647; 57 | files = ( 58 | 1B546AA7E6A9257AB42EA4BF /* Pods_Runner.framework in Frameworks */, 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | /* End PBXFrameworksBuildPhase section */ 63 | 64 | /* Begin PBXGroup section */ 65 | 0281A59A3B96B7540A266C29 /* Pods */ = { 66 | isa = PBXGroup; 67 | children = ( 68 | F07A1E1CB20E39AC3A9A3BD8 /* Pods-Runner.debug.xcconfig */, 69 | 1D2CCACCDAEBC4AE5BBBC7A7 /* Pods-Runner.release.xcconfig */, 70 | EDED18B3F056A8C1712AD306 /* Pods-Runner.profile.xcconfig */, 71 | ); 72 | path = Pods; 73 | sourceTree = ""; 74 | }; 75 | 9740EEB11CF90186004384FC /* Flutter */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 79 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 80 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 81 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 82 | ); 83 | name = Flutter; 84 | sourceTree = ""; 85 | }; 86 | 97C146E51CF9000F007C117D = { 87 | isa = PBXGroup; 88 | children = ( 89 | 9740EEB11CF90186004384FC /* Flutter */, 90 | 97C146F01CF9000F007C117D /* Runner */, 91 | 97C146EF1CF9000F007C117D /* Products */, 92 | 0281A59A3B96B7540A266C29 /* Pods */, 93 | AC7AD97FCF4E52A63FC09AA0 /* Frameworks */, 94 | ); 95 | sourceTree = ""; 96 | }; 97 | 97C146EF1CF9000F007C117D /* Products */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 97C146EE1CF9000F007C117D /* Runner.app */, 101 | ); 102 | name = Products; 103 | sourceTree = ""; 104 | }; 105 | 97C146F01CF9000F007C117D /* Runner */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 109 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 110 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 111 | 97C147021CF9000F007C117D /* Info.plist */, 112 | 97C146F11CF9000F007C117D /* Supporting Files */, 113 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 114 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 115 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 116 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 117 | ); 118 | path = Runner; 119 | sourceTree = ""; 120 | }; 121 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | ); 125 | name = "Supporting Files"; 126 | sourceTree = ""; 127 | }; 128 | AC7AD97FCF4E52A63FC09AA0 /* Frameworks */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | AEAFD97A879DB5D0647FC0DB /* Pods_Runner.framework */, 132 | ); 133 | name = Frameworks; 134 | sourceTree = ""; 135 | }; 136 | /* End PBXGroup section */ 137 | 138 | /* Begin PBXNativeTarget section */ 139 | 97C146ED1CF9000F007C117D /* Runner */ = { 140 | isa = PBXNativeTarget; 141 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 142 | buildPhases = ( 143 | C15133F7BCF9556152E619E2 /* [CP] Check Pods Manifest.lock */, 144 | 9740EEB61CF901F6004384FC /* Run Script */, 145 | 97C146EA1CF9000F007C117D /* Sources */, 146 | 97C146EB1CF9000F007C117D /* Frameworks */, 147 | 97C146EC1CF9000F007C117D /* Resources */, 148 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 149 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 150 | 9EA9264586829AB715D48268 /* [CP] Embed Pods Frameworks */, 151 | ); 152 | buildRules = ( 153 | ); 154 | dependencies = ( 155 | ); 156 | name = Runner; 157 | productName = Runner; 158 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 159 | productType = "com.apple.product-type.application"; 160 | }; 161 | /* End PBXNativeTarget section */ 162 | 163 | /* Begin PBXProject section */ 164 | 97C146E61CF9000F007C117D /* Project object */ = { 165 | isa = PBXProject; 166 | attributes = { 167 | LastUpgradeCheck = 1020; 168 | ORGANIZATIONNAME = "The Chromium Authors"; 169 | TargetAttributes = { 170 | 97C146ED1CF9000F007C117D = { 171 | CreatedOnToolsVersion = 7.3.1; 172 | DevelopmentTeam = 7SUQ9UM9P2; 173 | LastSwiftMigration = 0910; 174 | }; 175 | }; 176 | }; 177 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 178 | compatibilityVersion = "Xcode 3.2"; 179 | developmentRegion = en; 180 | hasScannedForEncodings = 0; 181 | knownRegions = ( 182 | en, 183 | Base, 184 | ); 185 | mainGroup = 97C146E51CF9000F007C117D; 186 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 187 | projectDirPath = ""; 188 | projectRoot = ""; 189 | targets = ( 190 | 97C146ED1CF9000F007C117D /* Runner */, 191 | ); 192 | }; 193 | /* End PBXProject section */ 194 | 195 | /* Begin PBXResourcesBuildPhase section */ 196 | 97C146EC1CF9000F007C117D /* Resources */ = { 197 | isa = PBXResourcesBuildPhase; 198 | buildActionMask = 2147483647; 199 | files = ( 200 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 201 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 202 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 203 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 204 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 205 | ); 206 | runOnlyForDeploymentPostprocessing = 0; 207 | }; 208 | /* End PBXResourcesBuildPhase section */ 209 | 210 | /* Begin PBXShellScriptBuildPhase section */ 211 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 212 | isa = PBXShellScriptBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | ); 216 | inputPaths = ( 217 | ); 218 | name = "Thin Binary"; 219 | outputPaths = ( 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | shellPath = /bin/sh; 223 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 224 | }; 225 | 9740EEB61CF901F6004384FC /* Run Script */ = { 226 | isa = PBXShellScriptBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | ); 230 | inputPaths = ( 231 | ); 232 | name = "Run Script"; 233 | outputPaths = ( 234 | ); 235 | runOnlyForDeploymentPostprocessing = 0; 236 | shellPath = /bin/sh; 237 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 238 | }; 239 | 9EA9264586829AB715D48268 /* [CP] Embed Pods Frameworks */ = { 240 | isa = PBXShellScriptBuildPhase; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | ); 244 | inputPaths = ( 245 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", 246 | "${PODS_ROOT}/../Flutter/Flutter.framework", 247 | "${BUILT_PRODUCTS_DIR}/sys_volume/sys_volume.framework", 248 | ); 249 | name = "[CP] Embed Pods Frameworks"; 250 | outputPaths = ( 251 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", 252 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sys_volume.framework", 253 | ); 254 | runOnlyForDeploymentPostprocessing = 0; 255 | shellPath = /bin/sh; 256 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 257 | showEnvVarsInLog = 0; 258 | }; 259 | C15133F7BCF9556152E619E2 /* [CP] Check Pods Manifest.lock */ = { 260 | isa = PBXShellScriptBuildPhase; 261 | buildActionMask = 2147483647; 262 | files = ( 263 | ); 264 | inputFileListPaths = ( 265 | ); 266 | inputPaths = ( 267 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 268 | "${PODS_ROOT}/Manifest.lock", 269 | ); 270 | name = "[CP] Check Pods Manifest.lock"; 271 | outputFileListPaths = ( 272 | ); 273 | outputPaths = ( 274 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 275 | ); 276 | runOnlyForDeploymentPostprocessing = 0; 277 | shellPath = /bin/sh; 278 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 279 | showEnvVarsInLog = 0; 280 | }; 281 | /* End PBXShellScriptBuildPhase section */ 282 | 283 | /* Begin PBXSourcesBuildPhase section */ 284 | 97C146EA1CF9000F007C117D /* Sources */ = { 285 | isa = PBXSourcesBuildPhase; 286 | buildActionMask = 2147483647; 287 | files = ( 288 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 289 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | /* End PBXSourcesBuildPhase section */ 294 | 295 | /* Begin PBXVariantGroup section */ 296 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 297 | isa = PBXVariantGroup; 298 | children = ( 299 | 97C146FB1CF9000F007C117D /* Base */, 300 | ); 301 | name = Main.storyboard; 302 | sourceTree = ""; 303 | }; 304 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 305 | isa = PBXVariantGroup; 306 | children = ( 307 | 97C147001CF9000F007C117D /* Base */, 308 | ); 309 | name = LaunchScreen.storyboard; 310 | sourceTree = ""; 311 | }; 312 | /* End PBXVariantGroup section */ 313 | 314 | /* Begin XCBuildConfiguration section */ 315 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 316 | isa = XCBuildConfiguration; 317 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 318 | buildSettings = { 319 | ALWAYS_SEARCH_USER_PATHS = NO; 320 | CLANG_ANALYZER_NONNULL = YES; 321 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 322 | CLANG_CXX_LIBRARY = "libc++"; 323 | CLANG_ENABLE_MODULES = YES; 324 | CLANG_ENABLE_OBJC_ARC = YES; 325 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 326 | CLANG_WARN_BOOL_CONVERSION = YES; 327 | CLANG_WARN_COMMA = YES; 328 | CLANG_WARN_CONSTANT_CONVERSION = YES; 329 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 330 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 331 | CLANG_WARN_EMPTY_BODY = YES; 332 | CLANG_WARN_ENUM_CONVERSION = YES; 333 | CLANG_WARN_INFINITE_RECURSION = YES; 334 | CLANG_WARN_INT_CONVERSION = YES; 335 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 336 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 337 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 338 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 339 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 340 | CLANG_WARN_STRICT_PROTOTYPES = YES; 341 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 342 | CLANG_WARN_UNREACHABLE_CODE = YES; 343 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 344 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 345 | COPY_PHASE_STRIP = NO; 346 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 347 | ENABLE_NS_ASSERTIONS = NO; 348 | ENABLE_STRICT_OBJC_MSGSEND = YES; 349 | GCC_C_LANGUAGE_STANDARD = gnu99; 350 | GCC_NO_COMMON_BLOCKS = YES; 351 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 352 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 353 | GCC_WARN_UNDECLARED_SELECTOR = YES; 354 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 355 | GCC_WARN_UNUSED_FUNCTION = YES; 356 | GCC_WARN_UNUSED_VARIABLE = YES; 357 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 358 | MTL_ENABLE_DEBUG_INFO = NO; 359 | SDKROOT = iphoneos; 360 | TARGETED_DEVICE_FAMILY = "1,2"; 361 | VALIDATE_PRODUCT = YES; 362 | }; 363 | name = Profile; 364 | }; 365 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 366 | isa = XCBuildConfiguration; 367 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 368 | buildSettings = { 369 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 370 | CLANG_ENABLE_MODULES = YES; 371 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 372 | DEVELOPMENT_TEAM = 7SUQ9UM9P2; 373 | ENABLE_BITCODE = NO; 374 | FRAMEWORK_SEARCH_PATHS = ( 375 | "$(inherited)", 376 | "$(PROJECT_DIR)/Flutter", 377 | ); 378 | INFOPLIST_FILE = Runner/Info.plist; 379 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 380 | LIBRARY_SEARCH_PATHS = ( 381 | "$(inherited)", 382 | "$(PROJECT_DIR)/Flutter", 383 | ); 384 | PRODUCT_BUNDLE_IDENTIFIER = com.befovy.flutterVolumeExample; 385 | PRODUCT_NAME = "$(TARGET_NAME)"; 386 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 387 | SWIFT_VERSION = 4.0; 388 | VERSIONING_SYSTEM = "apple-generic"; 389 | }; 390 | name = Profile; 391 | }; 392 | 97C147031CF9000F007C117D /* Debug */ = { 393 | isa = XCBuildConfiguration; 394 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 395 | buildSettings = { 396 | ALWAYS_SEARCH_USER_PATHS = NO; 397 | CLANG_ANALYZER_NONNULL = YES; 398 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 399 | CLANG_CXX_LIBRARY = "libc++"; 400 | CLANG_ENABLE_MODULES = YES; 401 | CLANG_ENABLE_OBJC_ARC = YES; 402 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 403 | CLANG_WARN_BOOL_CONVERSION = YES; 404 | CLANG_WARN_COMMA = YES; 405 | CLANG_WARN_CONSTANT_CONVERSION = YES; 406 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 407 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 408 | CLANG_WARN_EMPTY_BODY = YES; 409 | CLANG_WARN_ENUM_CONVERSION = YES; 410 | CLANG_WARN_INFINITE_RECURSION = YES; 411 | CLANG_WARN_INT_CONVERSION = YES; 412 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 413 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 414 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 415 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 416 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 417 | CLANG_WARN_STRICT_PROTOTYPES = YES; 418 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 419 | CLANG_WARN_UNREACHABLE_CODE = YES; 420 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 421 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 422 | COPY_PHASE_STRIP = NO; 423 | DEBUG_INFORMATION_FORMAT = dwarf; 424 | ENABLE_STRICT_OBJC_MSGSEND = YES; 425 | ENABLE_TESTABILITY = YES; 426 | GCC_C_LANGUAGE_STANDARD = gnu99; 427 | GCC_DYNAMIC_NO_PIC = NO; 428 | GCC_NO_COMMON_BLOCKS = YES; 429 | GCC_OPTIMIZATION_LEVEL = 0; 430 | GCC_PREPROCESSOR_DEFINITIONS = ( 431 | "DEBUG=1", 432 | "$(inherited)", 433 | ); 434 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 435 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 436 | GCC_WARN_UNDECLARED_SELECTOR = YES; 437 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 438 | GCC_WARN_UNUSED_FUNCTION = YES; 439 | GCC_WARN_UNUSED_VARIABLE = YES; 440 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 441 | MTL_ENABLE_DEBUG_INFO = YES; 442 | ONLY_ACTIVE_ARCH = YES; 443 | SDKROOT = iphoneos; 444 | TARGETED_DEVICE_FAMILY = "1,2"; 445 | }; 446 | name = Debug; 447 | }; 448 | 97C147041CF9000F007C117D /* Release */ = { 449 | isa = XCBuildConfiguration; 450 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 451 | buildSettings = { 452 | ALWAYS_SEARCH_USER_PATHS = NO; 453 | CLANG_ANALYZER_NONNULL = YES; 454 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 455 | CLANG_CXX_LIBRARY = "libc++"; 456 | CLANG_ENABLE_MODULES = YES; 457 | CLANG_ENABLE_OBJC_ARC = YES; 458 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 459 | CLANG_WARN_BOOL_CONVERSION = YES; 460 | CLANG_WARN_COMMA = YES; 461 | CLANG_WARN_CONSTANT_CONVERSION = YES; 462 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 463 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 464 | CLANG_WARN_EMPTY_BODY = YES; 465 | CLANG_WARN_ENUM_CONVERSION = YES; 466 | CLANG_WARN_INFINITE_RECURSION = YES; 467 | CLANG_WARN_INT_CONVERSION = YES; 468 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 469 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 470 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 471 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 472 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 473 | CLANG_WARN_STRICT_PROTOTYPES = YES; 474 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 475 | CLANG_WARN_UNREACHABLE_CODE = YES; 476 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 477 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 478 | COPY_PHASE_STRIP = NO; 479 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 480 | ENABLE_NS_ASSERTIONS = NO; 481 | ENABLE_STRICT_OBJC_MSGSEND = YES; 482 | GCC_C_LANGUAGE_STANDARD = gnu99; 483 | GCC_NO_COMMON_BLOCKS = YES; 484 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 485 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 486 | GCC_WARN_UNDECLARED_SELECTOR = YES; 487 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 488 | GCC_WARN_UNUSED_FUNCTION = YES; 489 | GCC_WARN_UNUSED_VARIABLE = YES; 490 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 491 | MTL_ENABLE_DEBUG_INFO = NO; 492 | SDKROOT = iphoneos; 493 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 494 | TARGETED_DEVICE_FAMILY = "1,2"; 495 | VALIDATE_PRODUCT = YES; 496 | }; 497 | name = Release; 498 | }; 499 | 97C147061CF9000F007C117D /* Debug */ = { 500 | isa = XCBuildConfiguration; 501 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 502 | buildSettings = { 503 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 504 | CLANG_ENABLE_MODULES = YES; 505 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 506 | DEVELOPMENT_TEAM = 7SUQ9UM9P2; 507 | ENABLE_BITCODE = NO; 508 | FRAMEWORK_SEARCH_PATHS = ( 509 | "$(inherited)", 510 | "$(PROJECT_DIR)/Flutter", 511 | ); 512 | INFOPLIST_FILE = Runner/Info.plist; 513 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 514 | LIBRARY_SEARCH_PATHS = ( 515 | "$(inherited)", 516 | "$(PROJECT_DIR)/Flutter", 517 | ); 518 | PRODUCT_BUNDLE_IDENTIFIER = com.befovy.flutterVolumeExample; 519 | PRODUCT_NAME = "$(TARGET_NAME)"; 520 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 521 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 522 | SWIFT_VERSION = 4.0; 523 | VERSIONING_SYSTEM = "apple-generic"; 524 | }; 525 | name = Debug; 526 | }; 527 | 97C147071CF9000F007C117D /* Release */ = { 528 | isa = XCBuildConfiguration; 529 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 530 | buildSettings = { 531 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 532 | CLANG_ENABLE_MODULES = YES; 533 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 534 | DEVELOPMENT_TEAM = 7SUQ9UM9P2; 535 | ENABLE_BITCODE = NO; 536 | FRAMEWORK_SEARCH_PATHS = ( 537 | "$(inherited)", 538 | "$(PROJECT_DIR)/Flutter", 539 | ); 540 | INFOPLIST_FILE = Runner/Info.plist; 541 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 542 | LIBRARY_SEARCH_PATHS = ( 543 | "$(inherited)", 544 | "$(PROJECT_DIR)/Flutter", 545 | ); 546 | PRODUCT_BUNDLE_IDENTIFIER = com.befovy.flutterVolumeExample; 547 | PRODUCT_NAME = "$(TARGET_NAME)"; 548 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 549 | SWIFT_VERSION = 4.0; 550 | VERSIONING_SYSTEM = "apple-generic"; 551 | }; 552 | name = Release; 553 | }; 554 | /* End XCBuildConfiguration section */ 555 | 556 | /* Begin XCConfigurationList section */ 557 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 558 | isa = XCConfigurationList; 559 | buildConfigurations = ( 560 | 97C147031CF9000F007C117D /* Debug */, 561 | 97C147041CF9000F007C117D /* Release */, 562 | 249021D3217E4FDB00AE95B9 /* Profile */, 563 | ); 564 | defaultConfigurationIsVisible = 0; 565 | defaultConfigurationName = Release; 566 | }; 567 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 568 | isa = XCConfigurationList; 569 | buildConfigurations = ( 570 | 97C147061CF9000F007C117D /* Debug */, 571 | 97C147071CF9000F007C117D /* Release */, 572 | 249021D4217E4FDB00AE95B9 /* Profile */, 573 | ); 574 | defaultConfigurationIsVisible = 0; 575 | defaultConfigurationName = Release; 576 | }; 577 | /* End XCConfigurationList section */ 578 | }; 579 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 580 | } 581 | --------------------------------------------------------------------------------