diff --git a/CHANGELOG.md b/CHANGELOG.md index ed3353d..a745392 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## [1.2.1] + +* support macos,linux,windows & web platform. + ## [1.2.0] * add flutterError view diff --git a/example/android/app/src/main/res/drawable-v21/launch_background.xml b/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..449a9f9 --- /dev/null +++ b/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/macos/.gitignore b/example/macos/.gitignore new file mode 100644 index 0000000..d2fd377 --- /dev/null +++ b/example/macos/.gitignore @@ -0,0 +1,6 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/xcuserdata/ diff --git a/example/macos/Flutter/Flutter-Debug.xcconfig b/example/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 0000000..4b81f9b --- /dev/null +++ b/example/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/example/macos/Flutter/Flutter-Release.xcconfig b/example/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 0000000..5caa9d1 --- /dev/null +++ b/example/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 0000000..15f797d --- /dev/null +++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,14 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + +import device_info_plus_macos +import package_info_plus_macos + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) + FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) +} diff --git a/example/macos/Podfile b/example/macos/Podfile new file mode 100644 index 0000000..dade8df --- /dev/null +++ b/example/macos/Podfile @@ -0,0 +1,40 @@ +platform :osx, '10.11' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + end +end diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock new file mode 100644 index 0000000..ec30de4 --- /dev/null +++ b/example/macos/Podfile.lock @@ -0,0 +1,28 @@ +PODS: + - device_info_plus_macos (0.0.1): + - FlutterMacOS + - FlutterMacOS (1.0.0) + - package_info_plus_macos (0.0.1): + - FlutterMacOS + +DEPENDENCIES: + - device_info_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus_macos/macos`) + - FlutterMacOS (from `Flutter/ephemeral`) + - package_info_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos`) + +EXTERNAL SOURCES: + device_info_plus_macos: + :path: Flutter/ephemeral/.symlinks/plugins/device_info_plus_macos/macos + FlutterMacOS: + :path: Flutter/ephemeral + package_info_plus_macos: + :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus_macos/macos + +SPEC CHECKSUMS: + device_info_plus_macos: 1ad388a1ef433505c4038e7dd9605aadd1e2e9c7 + FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 + package_info_plus_macos: f010621b07802a241d96d01876d6705f15e77c1c + +PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c + +COCOAPODS: 1.10.1 diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..71d4572 --- /dev/null +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,632 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 1E5A1D7ABBC415CF7FC2C590 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 487370CA489361A54A9E6D01 /* Pods_Runner.framework */; }; + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 2DDB5ACCB9F58ACC36A398C4 /* 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 = ""; }; + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 487370CA489361A54A9E6D01 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 5943B496A718BED9D6FA5E5C /* 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 = ""; }; + 6F2CEFBDA242461D8256C953 /* 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 = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1E5A1D7ABBC415CF7FC2C590 /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + AC410F9708D7C4FD91BEDEF1 /* Pods */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* example.app */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + AC410F9708D7C4FD91BEDEF1 /* Pods */ = { + isa = PBXGroup; + children = ( + 2DDB5ACCB9F58ACC36A398C4 /* Pods-Runner.debug.xcconfig */, + 5943B496A718BED9D6FA5E5C /* Pods-Runner.release.xcconfig */, + 6F2CEFBDA242461D8256C953 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 487370CA489361A54A9E6D01 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9D545641C5CDE83020E4BBB0 /* [CP] Check Pods Manifest.lock */, + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + A31D2FE734AEE9DFB9A7C16E /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 0930; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; + 9D545641C5CDE83020E4BBB0 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + 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"; + showEnvVarsInLog = 0; + }; + A31D2FE734AEE9DFB9A7C16E /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..ae8ff59 --- /dev/null +++ b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/macos/Runner.xcworkspace/contents.xcworkspacedata b/example/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..21a3cc1 --- /dev/null +++ b/example/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/macos/Runner/AppDelegate.swift b/example/macos/Runner/AppDelegate.swift new file mode 100644 index 0000000..d53ef64 --- /dev/null +++ b/example/macos/Runner/AppDelegate.swift @@ -0,0 +1,9 @@ +import Cocoa +import FlutterMacOS + +@NSApplicationMain +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } +} diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..a2ec33f --- /dev/null +++ b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 0000000..3c4935a Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 0000000..ed4cc16 Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 0000000..483be61 Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 0000000..bcbf36d Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 0000000..9c0a652 Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 0000000..e71a726 Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 0000000..8a31fe2 Binary files /dev/null and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/example/macos/Runner/Base.lproj/MainMenu.xib b/example/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 0000000..537341a --- /dev/null +++ b/example/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,339 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/macos/Runner/Configs/AppInfo.xcconfig b/example/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 0000000..cf9be60 --- /dev/null +++ b/example/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = example + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.example + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2021 com.example. All rights reserved. diff --git a/example/macos/Runner/Configs/Debug.xcconfig b/example/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 0000000..36b0fd9 --- /dev/null +++ b/example/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/example/macos/Runner/Configs/Release.xcconfig b/example/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 0000000..dff4f49 --- /dev/null +++ b/example/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/example/macos/Runner/Configs/Warnings.xcconfig b/example/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 0000000..42bcbf4 --- /dev/null +++ b/example/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/example/macos/Runner/DebugProfile.entitlements b/example/macos/Runner/DebugProfile.entitlements new file mode 100644 index 0000000..dddb8a3 --- /dev/null +++ b/example/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.cs.allow-jit + + com.apple.security.network.server + + + diff --git a/example/macos/Runner/Info.plist b/example/macos/Runner/Info.plist new file mode 100644 index 0000000..4789daa --- /dev/null +++ b/example/macos/Runner/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/example/macos/Runner/MainFlutterWindow.swift b/example/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 0000000..2722837 --- /dev/null +++ b/example/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,15 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController.init() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/example/macos/Runner/Release.entitlements b/example/macos/Runner/Release.entitlements new file mode 100644 index 0000000..852fa1a --- /dev/null +++ b/example/macos/Runner/Release.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/example/pubspec.lock b/example/pubspec.lock index 457fab7..ba450a5 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -57,20 +57,48 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.2" - device_info: + device_info_plus: dependency: transitive description: - name: device_info + name: device_info_plus url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.0" - device_info_platform_interface: + version: "1.0.0" + device_info_plus_linux: + dependency: transitive + description: + name: device_info_plus_linux + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + device_info_plus_macos: + dependency: transitive + description: + name: device_info_plus_macos + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.1" + device_info_plus_web: dependency: transitive description: - name: device_info_platform_interface + name: device_info_plus_web url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.1" + version: "1.0.0" + device_info_plus_windows: + dependency: transitive + description: + name: device_info_plus_windows + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" dio: dependency: "direct main" description: @@ -85,6 +113,20 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" + ffi: + dependency: transitive + description: + name: ffi + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + file: + dependency: transitive + description: + name: file + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.1.0" flutter: dependency: "direct main" description: flutter @@ -102,6 +144,11 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" get: dependency: "direct main" description: @@ -116,6 +163,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.7.0" + http: + dependency: transitive + description: + name: http + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.13.1" http_parser: dependency: transitive description: @@ -123,6 +177,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "4.0.0" + js: + dependency: transitive + description: + name: js + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.6.3" logger: dependency: transitive description: @@ -144,13 +205,48 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.3.0" - package_info: + package_info_plus: dependency: transitive description: - name: package_info + name: package_info_plus url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.0" + version: "1.0.0" + package_info_plus_linux: + dependency: transitive + description: + name: package_info_plus_linux + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + package_info_plus_macos: + dependency: transitive + description: + name: package_info_plus_macos + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + package_info_plus_web: + dependency: transitive + description: + name: package_info_plus_web + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + package_info_plus_windows: + dependency: transitive + description: + name: package_info_plus_windows + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" path: dependency: transitive description: @@ -158,6 +254,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.8.0" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.11.0" plugin_platform_interface: dependency: transitive description: @@ -233,6 +336,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" + win32: + dependency: transitive + description: + name: win32 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.5" sdks: dart: ">=2.12.0 <3.0.0" - flutter: ">=1.17.0" + flutter: ">=1.20.0" diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart new file mode 100644 index 0000000..747db1d --- /dev/null +++ b/example/test/widget_test.dart @@ -0,0 +1,30 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility that Flutter provides. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:example/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(MyApp()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +} diff --git a/example/web/favicon.png b/example/web/favicon.png new file mode 100644 index 0000000..8aaa46a Binary files /dev/null and b/example/web/favicon.png differ diff --git a/example/web/icons/Icon-192.png b/example/web/icons/Icon-192.png new file mode 100644 index 0000000..b749bfe Binary files /dev/null and b/example/web/icons/Icon-192.png differ diff --git a/example/web/icons/Icon-512.png b/example/web/icons/Icon-512.png new file mode 100644 index 0000000..88cfd48 Binary files /dev/null and b/example/web/icons/Icon-512.png differ diff --git a/example/web/index.html b/example/web/index.html new file mode 100644 index 0000000..1460b5e --- /dev/null +++ b/example/web/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + example + + + + + + + + diff --git a/example/web/manifest.json b/example/web/manifest.json new file mode 100644 index 0000000..8c01291 --- /dev/null +++ b/example/web/manifest.json @@ -0,0 +1,23 @@ +{ + "name": "example", + "short_name": "example", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} diff --git a/lib/src/views/info_view.dart b/lib/src/views/info_view.dart index 2667414..f916ce6 100644 --- a/lib/src/views/info_view.dart +++ b/lib/src/views/info_view.dart @@ -1,11 +1,18 @@ import 'dart:io'; import 'package:auto_size_text/auto_size_text.dart'; -import 'package:device_info/device_info.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; +import 'package:device_info_plus/device_info_plus.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart' hide AndroidView; import 'package:flutter/services.dart'; -import 'package:package_info/package_info.dart'; +import 'package:package_info_plus/package_info_plus.dart'; +import 'package:power_logger/src/views/platform_specific/_android_view.dart'; +import 'package:power_logger/src/views/platform_specific/_ios_view.dart'; +import 'package:power_logger/src/views/platform_specific/_linux_view.dart'; +import 'package:power_logger/src/views/platform_specific/_mac_view.dart'; +import 'package:power_logger/src/views/platform_specific/_web_view.dart'; +import 'package:power_logger/src/views/platform_specific/_windows_view.dart'; +import 'package:power_logger/src/views/platform_specific/info_tile.dart'; class InfoView extends StatefulWidget { InfoView({Key? key}) : super(key: key); @@ -19,135 +26,34 @@ class _InfoViewState extends State PackageInfo? packageInfo; AndroidDeviceInfo? androidInfo; IosDeviceInfo? iosInfo; + MacOsDeviceInfo? macInfo; + WebBrowserInfo? webInfo; + WindowsDeviceInfo? windowsInfo; + LinuxDeviceInfo? linuxInfo; Future getAllInfo() async { DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); packageInfo = await PackageInfo.fromPlatform(); + if (kIsWeb) webInfo = await deviceInfo.webBrowserInfo; if (Platform.isAndroid) androidInfo = await deviceInfo.androidInfo; if (Platform.isIOS) iosInfo = await deviceInfo.iosInfo; + if (Platform.isMacOS) macInfo = await deviceInfo.macOsInfo; + if (Platform.isWindows) windowsInfo = await deviceInfo.windowsInfo; + if (Platform.isLinux) linuxInfo = await deviceInfo.linuxInfo; } bool get infoWell => - packageInfo != null && (androidInfo != null || iosInfo != null); - - _buildGridItem(String title, String subTitle) { - return MaterialButton( - elevation: 2, - onPressed: () {}, - onLongPress: () { - ScaffoldMessenger.of(context).hideCurrentSnackBar(); - Clipboard.setData(ClipboardData(text: subTitle)); - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text('已复制'), - action: SnackBarAction( - label: '确定', - onPressed: () => - ScaffoldMessenger.of(context).hideCurrentSnackBar(), - ), - )); - }, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5), - ), - color: Theme.of(context).scaffoldBackgroundColor, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(title), - AutoSizeText( - subTitle, - style: TextStyle(fontSize: 26), - maxLines: 2, - ), - ], - ), - ), - ); - } - - _buildTile(String title, String? subTitle) { - return DefaultTextStyle( - style: TextStyle(color: Colors.black), - child: ListTile( - title: Text(title), - subtitle: Text(subTitle ?? ''), - onLongPress: () { - ScaffoldMessenger.of(context).hideCurrentSnackBar(); - Clipboard.setData(ClipboardData(text: subTitle)); - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text('已复制'), - action: SnackBarAction( - label: '确定', - onPressed: () => - ScaffoldMessenger.of(context).hideCurrentSnackBar(), - ), - )); - }, - ), - ); - } - - _buildAndroidList() { - return SliverList( - delegate: SliverChildListDelegate([ - _buildTile('androidId', androidInfo!.androidId), - _buildTile('board', androidInfo!.board), - _buildTile('bootloader', androidInfo!.bootloader), - _buildTile('brand', androidInfo!.brand), - _buildTile('device', androidInfo!.device), - _buildTile('display', androidInfo!.display), - _buildTile('fingerprint', androidInfo!.fingerprint), - _buildTile('hardware', androidInfo!.hardware), - _buildTile('host', androidInfo!.host), - _buildTile('id', androidInfo!.id), - _buildTile('manufacturer', androidInfo!.manufacturer), - _buildTile('model', androidInfo!.model), - _buildTile('product', androidInfo!.product), - _buildTile('tags', androidInfo!.tags), - _buildTile('type', androidInfo!.type), - _buildTile('isPhysicalDevice', androidInfo!.isPhysicalDevice.toString()), - _buildTile( - 'supported32BitAbis', androidInfo!.supported32BitAbis.join(',')), - _buildTile( - 'supported64BitAbis', androidInfo!.supported64BitAbis.join(',')), - _buildTile('supportedAbis', androidInfo!.supportedAbis.join(',')), - _buildTile('baseOS', androidInfo!.version.baseOS), - _buildTile('codename', androidInfo!.version.codename), - _buildTile('incremental', androidInfo!.version.incremental), - _buildTile('release', androidInfo!.version.release), - _buildTile('securityPatch', androidInfo!.version.securityPatch), - _buildTile( - 'previewSdkInt', androidInfo!.version.previewSdkInt.toString()), - _buildTile('sdkInt', androidInfo!.version.sdkInt.toString()), - _buildTile('systemFeatures', androidInfo!.systemFeatures.join('\n')), - ])); - } - - _buildIOSList() { - return SliverList( - delegate: SliverChildListDelegate([ - _buildTile('identifierForVendor', iosInfo!.identifierForVendor), - _buildTile('localizedModel', iosInfo!.localizedModel), - _buildTile('model', iosInfo!.model), - _buildTile('name', iosInfo!.name), - _buildTile('systemName', iosInfo!.systemName), - _buildTile('systemVersion', iosInfo!.systemVersion), - _buildTile('isPhysicalDevice', iosInfo!.isPhysicalDevice.toString()), - _buildTile('machine', iosInfo!.utsname.machine), - _buildTile('nodename', iosInfo!.utsname.nodename), - _buildTile('release', iosInfo!.utsname.release), - _buildTile('sysname', iosInfo!.utsname.sysname), - _buildTile('version', iosInfo!.utsname.version), - ])); - } + packageInfo != null && + (androidInfo != null || iosInfo != null || macInfo != null); _buildView() { - if (Platform.isAndroid) return _buildAndroidList(); - if (Platform.isIOS) - return _buildIOSList(); + if (kIsWeb) return WebDeviceView(webInfo: webInfo); + if (Platform.isAndroid) return AndroidView(androidInfo: androidInfo); + if (Platform.isIOS) return IOSView(iosInfo: iosInfo); + if (Platform.isMacOS) return MacView(macInfo: macInfo); + if (Platform.isLinux) return LinuxView(linuxInfo: linuxInfo); + if (Platform.isWindows) + return WindowsView(windowsInfo: windowsInfo); else return SliverToBoxAdapter(child: Text('不支持的平台')); } @@ -164,21 +70,23 @@ class _InfoViewState extends State return infoWell ? CustomScrollView( slivers: [ - SliverPadding( - padding: EdgeInsets.all(5), - sliver: SliverGrid.count( - crossAxisCount: 2, - childAspectRatio: 1.5, - mainAxisSpacing: 10, - crossAxisSpacing: 10, - children: [ - _buildGridItem('appName', packageInfo!.appName), - _buildGridItem('buildNumber', packageInfo!.buildNumber), - _buildGridItem('packageName', packageInfo!.packageName), - _buildGridItem('version', packageInfo!.version), - ], + SliverList( + delegate: SliverChildListDelegate([ + ListTile( + title: Text('Package Info'), + tileColor: Colors.lightBlueAccent[100], + ), + InfoTile(title: 'appName', subTitle: packageInfo!.appName), + InfoTile( + title: 'buildNumber', subTitle: packageInfo!.buildNumber), + InfoTile( + title: 'packageName', subTitle: packageInfo!.packageName), + InfoTile(title: 'version', subTitle: packageInfo!.version), + ListTile( + title: Text('Device Info'), + tileColor: Colors.lightBlueAccent[100], ), - ), + ])), _buildView(), ], ) diff --git a/lib/src/views/platform_specific/_android_view.dart b/lib/src/views/platform_specific/_android_view.dart new file mode 100644 index 0000000..772f611 --- /dev/null +++ b/lib/src/views/platform_specific/_android_view.dart @@ -0,0 +1,61 @@ +import 'package:device_info_plus/device_info_plus.dart'; +import 'package:flutter/material.dart'; +import 'package:power_logger/src/views/platform_specific/info_tile.dart'; + +class AndroidView extends StatelessWidget { + final AndroidDeviceInfo? androidInfo; + AndroidView({Key? key, required this.androidInfo}) : super(key: key); + + @override + Widget build(BuildContext context) { + return SliverList( + delegate: SliverChildListDelegate([ + InfoTile(title: 'androidId', subTitle: androidInfo!.androidId ?? ''), + InfoTile(title: 'board', subTitle: androidInfo!.board ?? ''), + InfoTile(title: 'bootloader', subTitle: androidInfo!.bootloader ?? ''), + InfoTile(title: 'brand', subTitle: androidInfo!.brand ?? ''), + InfoTile(title: 'device', subTitle: androidInfo!.device ?? ''), + InfoTile(title: 'display', subTitle: androidInfo!.display ?? ''), + InfoTile(title: 'fingerprint', subTitle: androidInfo!.fingerprint ?? ''), + InfoTile(title: 'hardware', subTitle: androidInfo!.hardware ?? ''), + InfoTile(title: 'host', subTitle: androidInfo!.host ?? ''), + InfoTile(title: 'id', subTitle: androidInfo!.id ?? ''), + InfoTile( + title: 'manufacturer', subTitle: androidInfo!.manufacturer ?? ''), + InfoTile(title: 'model', subTitle: androidInfo!.model ?? ''), + InfoTile(title: 'product', subTitle: androidInfo!.product ?? ''), + InfoTile(title: 'tags', subTitle: androidInfo!.tags ?? ''), + InfoTile(title: 'type', subTitle: androidInfo!.type ?? ''), + InfoTile( + title: 'isPhysicalDevice', + subTitle: androidInfo!.isPhysicalDevice.toString()), + InfoTile( + title: 'supported32BitAbis', + subTitle: androidInfo!.supported32BitAbis.join(',')), + InfoTile( + title: 'supported64BitAbis', + subTitle: androidInfo!.supported64BitAbis.join(',')), + InfoTile( + title: 'supportedAbis', + subTitle: androidInfo!.supportedAbis.join(',')), + InfoTile(title: 'baseOS', subTitle: androidInfo!.version.baseOS ?? ''), + InfoTile( + title: 'codename', subTitle: androidInfo!.version.codename ?? ''), + InfoTile( + title: 'incremental', + subTitle: androidInfo!.version.incremental ?? ''), + InfoTile(title: 'release', subTitle: androidInfo!.version.release ?? ''), + InfoTile( + title: 'securityPatch', + subTitle: androidInfo!.version.securityPatch ?? ''), + InfoTile( + title: 'previewSdkInt', + subTitle: androidInfo!.version.previewSdkInt.toString()), + InfoTile( + title: 'sdkInt', subTitle: androidInfo!.version.sdkInt.toString()), + InfoTile( + title: 'systemFeatures', + subTitle: androidInfo!.systemFeatures.join('\n')), + ])); + } +} diff --git a/lib/src/views/platform_specific/_ios_view.dart b/lib/src/views/platform_specific/_ios_view.dart new file mode 100644 index 0000000..5a3890a --- /dev/null +++ b/lib/src/views/platform_specific/_ios_view.dart @@ -0,0 +1,63 @@ +import 'package:device_info_plus/device_info_plus.dart'; +import 'package:flutter/material.dart'; +import 'package:power_logger/src/views/platform_specific/info_tile.dart'; + +class IOSView extends StatelessWidget { + final IosDeviceInfo? iosInfo; + const IOSView({Key? key, required this.iosInfo}) : super(key: key); + + @override + Widget build(BuildContext context) { + if (iosInfo == null) return SliverToBoxAdapter(child: SizedBox()); + return SliverList( + delegate: SliverChildListDelegate([ + InfoTile( + title: 'identifierForVendor', + subTitle: iosInfo!.identifierForVendor ?? '', + ), + InfoTile( + title: 'localizedModel', + subTitle: iosInfo!.localizedModel ?? '', + ), + InfoTile( + title: 'model', + subTitle: iosInfo!.model ?? '', + ), + InfoTile( + title: 'name', + subTitle: iosInfo!.name ?? '', + ), + InfoTile( + title: 'systemName', + subTitle: iosInfo!.systemName ?? '', + ), + InfoTile( + title: 'systemVersion', + subTitle: iosInfo!.systemVersion ?? '', + ), + InfoTile( + title: 'isPhysicalDevice', + subTitle: iosInfo!.isPhysicalDevice.toString()), + InfoTile( + title: 'machine', + subTitle: iosInfo!.utsname.machine ?? '', + ), + InfoTile( + title: 'nodename', + subTitle: iosInfo!.utsname.nodename ?? '', + ), + InfoTile( + title: 'release', + subTitle: iosInfo!.utsname.release ?? '', + ), + InfoTile( + title: 'sysname', + subTitle: iosInfo!.utsname.sysname ?? '', + ), + InfoTile( + title: 'version', + subTitle: iosInfo!.utsname.version ?? '', + ), + ])); + } +} diff --git a/lib/src/views/platform_specific/_linux_view.dart b/lib/src/views/platform_specific/_linux_view.dart new file mode 100644 index 0000000..5a4488d --- /dev/null +++ b/lib/src/views/platform_specific/_linux_view.dart @@ -0,0 +1,63 @@ +import 'package:device_info_plus/device_info_plus.dart'; +import 'package:flutter/material.dart'; +import 'package:power_logger/src/views/platform_specific/info_tile.dart'; + +class LinuxView extends StatelessWidget { + final LinuxDeviceInfo? linuxInfo; + const LinuxView({Key? key, required this.linuxInfo}) : super(key: key); + + @override + Widget build(BuildContext context) { + if (linuxInfo == null) return SliverToBoxAdapter(child: SizedBox()); + return SliverList( + delegate: SliverChildListDelegate( + [ + InfoTile( + title: 'buildId', + subTitle: linuxInfo!.buildId.toString(), + ), + InfoTile( + title: 'id', + subTitle: linuxInfo!.id, + ), + InfoTile( + title: 'idLike', + subTitle: linuxInfo!.idLike?.join(',') ?? '', + ), + InfoTile( + title: 'machineId', + subTitle: linuxInfo!.machineId ?? '', + ), + InfoTile( + title: 'name', + subTitle: linuxInfo!.name, + ), + InfoTile( + title: 'prettyName', + subTitle: linuxInfo!.prettyName, + ), + InfoTile( + title: 'variant', + subTitle: linuxInfo!.variant ?? '', + ), + InfoTile( + title: 'variantId', + subTitle: linuxInfo!.variantId ?? '', + ), + InfoTile( + title: 'version', + subTitle: linuxInfo!.version ?? '', + ), + InfoTile( + title: 'versionCodename', + subTitle: linuxInfo!.versionCodename ?? '', + ), + InfoTile( + title: 'versionId', + subTitle: linuxInfo!.versionId ?? '', + ), + ], + ), + ); + } +} diff --git a/lib/src/views/platform_specific/_mac_view.dart b/lib/src/views/platform_specific/_mac_view.dart new file mode 100644 index 0000000..dd3084c --- /dev/null +++ b/lib/src/views/platform_specific/_mac_view.dart @@ -0,0 +1,52 @@ +import 'package:device_info_plus/device_info_plus.dart'; +import 'package:flutter/material.dart'; +import 'package:power_logger/src/views/platform_specific/info_tile.dart'; + +class MacView extends StatelessWidget { + final MacOsDeviceInfo? macInfo; + const MacView({Key? key, required this.macInfo}) : super(key: key); + + @override + Widget build(BuildContext context) { + if (macInfo == null) return SliverToBoxAdapter(child: SizedBox()); + return SliverList( + delegate: SliverChildListDelegate( + [ + InfoTile( + title: 'activeCPUs', + subTitle: macInfo!.activeCPUs.toString(), + ), + InfoTile( + title: 'arch', + subTitle: macInfo!.arch, + ), + InfoTile( + title: 'model', + subTitle: macInfo!.model, + ), + InfoTile( + title: 'computerName', + subTitle: macInfo!.computerName, + ), + InfoTile( + title: 'cpuFrequency', + subTitle: macInfo!.cpuFrequency.toString(), + ), + InfoTile( + title: 'hostName', + subTitle: macInfo!.hostName, + ), + InfoTile(title: 'kernelVersion', subTitle: macInfo!.kernelVersion), + InfoTile( + title: 'memorySize', + subTitle: macInfo!.memorySize.toString(), + ), + InfoTile( + title: 'osRelease', + subTitle: macInfo!.osRelease, + ), + ], + ), + ); + } +} diff --git a/lib/src/views/platform_specific/_web_view.dart b/lib/src/views/platform_specific/_web_view.dart new file mode 100644 index 0000000..75a4908 --- /dev/null +++ b/lib/src/views/platform_specific/_web_view.dart @@ -0,0 +1,79 @@ +import 'package:device_info_plus/device_info_plus.dart'; +import 'package:flutter/material.dart'; +import 'package:power_logger/src/views/platform_specific/info_tile.dart'; + +class WebDeviceView extends StatelessWidget { + final WebBrowserInfo? webInfo; + const WebDeviceView({Key? key, required this.webInfo}) : super(key: key); + + @override + Widget build(BuildContext context) { + if (webInfo == null) return SliverToBoxAdapter(child: SizedBox()); + return SliverList( + delegate: SliverChildListDelegate( + [ + InfoTile( + title: 'appCodeName', + subTitle: webInfo!.appCodeName, + ), + InfoTile( + title: 'appName', + subTitle: webInfo!.appName, + ), + InfoTile( + title: 'appVersion', + subTitle: webInfo!.appVersion, + ), + InfoTile( + title: 'browserName', + subTitle: webInfo!.browserName.index.toString(), + ), + InfoTile( + title: 'deviceMemory', + subTitle: webInfo!.deviceMemory.toString(), + ), + InfoTile( + title: 'hardwareConcurrency', + subTitle: webInfo!.hardwareConcurrency.toString(), + ), + InfoTile( + title: 'language', + subTitle: webInfo!.language, + ), + InfoTile( + title: 'languages', + subTitle: webInfo!.languages.join(','), + ), + InfoTile( + title: 'maxTouchPoints', + subTitle: webInfo!.maxTouchPoints.toString(), + ), + InfoTile( + title: 'platform', + subTitle: webInfo!.platform, + ), + InfoTile( + title: 'product', + subTitle: webInfo!.product, + ), + InfoTile( + title: 'productSub', + subTitle: webInfo!.productSub, + ), + InfoTile( + title: 'userAgent', + subTitle: webInfo!.userAgent, + ), + InfoTile( + title: 'vendor', + subTitle: webInfo!.vendor, + ), + InfoTile( + title: 'vendorSub', + subTitle: webInfo!.vendorSub, + ), + ], + ), + ); + } +} diff --git a/lib/src/views/platform_specific/_windows_view.dart b/lib/src/views/platform_specific/_windows_view.dart new file mode 100644 index 0000000..9b22bd1 --- /dev/null +++ b/lib/src/views/platform_specific/_windows_view.dart @@ -0,0 +1,31 @@ +import 'package:device_info_plus/device_info_plus.dart'; +import 'package:flutter/material.dart'; +import 'package:power_logger/src/views/platform_specific/info_tile.dart'; + +class WindowsView extends StatelessWidget { + final WindowsDeviceInfo? windowsInfo; + const WindowsView({Key? key, required this.windowsInfo}) : super(key: key); + + @override + Widget build(BuildContext context) { + if (windowsInfo == null) return SliverToBoxAdapter(child: SizedBox()); + return SliverList( + delegate: SliverChildListDelegate( + [ + InfoTile( + title: 'computerName', + subTitle: windowsInfo!.computerName, + ), + InfoTile( + title: 'numberOfCores', + subTitle: windowsInfo!.numberOfCores.toString(), + ), + InfoTile( + title: 'systemMemoryInMegabytes', + subTitle: windowsInfo!.systemMemoryInMegabytes.toString(), + ), + ], + ), + ); + } +} diff --git a/lib/src/views/platform_specific/info_tile.dart b/lib/src/views/platform_specific/info_tile.dart new file mode 100644 index 0000000..c1d1251 --- /dev/null +++ b/lib/src/views/platform_specific/info_tile.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +class InfoTile extends StatelessWidget { + final String title; + final String subTitle; + final IconData? icon; + const InfoTile({ + Key? key, + required this.title, + required this.subTitle, + this.icon, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return ListTile( + title: Text(title), + subtitle: Text(subTitle), + onLongPress: () async { + ScaffoldMessenger.of(context).hideCurrentSnackBar(); + Clipboard.setData(ClipboardData(text: subTitle)); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text('已复制'), + action: SnackBarAction( + label: '确定', + onPressed: () => + ScaffoldMessenger.of(context).hideCurrentSnackBar(), + ), + )); + }, + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index b63723f..287b992 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -50,20 +50,48 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.15.0" - device_info: + device_info_plus: dependency: "direct main" description: - name: device_info + name: device_info_plus url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.0" - device_info_platform_interface: + version: "1.0.0" + device_info_plus_linux: + dependency: transitive + description: + name: device_info_plus_linux + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + device_info_plus_macos: + dependency: transitive + description: + name: device_info_plus_macos + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.1" + device_info_plus_web: dependency: transitive description: - name: device_info_platform_interface + name: device_info_plus_web url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.1" + version: "1.0.0" + device_info_plus_windows: + dependency: transitive + description: + name: device_info_plus_windows + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" dio: dependency: "direct main" description: @@ -78,6 +106,20 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" + ffi: + dependency: transitive + description: + name: ffi + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + file: + dependency: transitive + description: + name: file + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.1.0" flutter: dependency: "direct main" description: flutter @@ -95,6 +137,11 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" highlight: dependency: transitive description: @@ -102,6 +149,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.7.0" + http: + dependency: transitive + description: + name: http + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.13.1" http_parser: dependency: transitive description: @@ -109,6 +163,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "4.0.0" + js: + dependency: transitive + description: + name: js + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.6.3" logger: dependency: "direct main" description: @@ -130,13 +191,48 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.3.0" - package_info: + package_info_plus: dependency: "direct main" description: - name: package_info + name: package_info_plus url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.0" + version: "1.0.0" + package_info_plus_linux: + dependency: transitive + description: + name: package_info_plus_linux + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + package_info_plus_macos: + dependency: transitive + description: + name: package_info_plus_macos + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + package_info_plus_web: + dependency: transitive + description: + name: package_info_plus_web + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + package_info_plus_windows: + dependency: transitive + description: + name: package_info_plus_windows + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" path: dependency: transitive description: @@ -144,6 +240,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.8.0" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.11.0" plugin_platform_interface: dependency: transitive description: @@ -212,6 +315,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" + win32: + dependency: transitive + description: + name: win32 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.5" sdks: dart: ">=2.12.0 <3.0.0" - flutter: ">=1.17.0" + flutter: ">=1.20.0" diff --git a/pubspec.yaml b/pubspec.yaml index 3d8f218..a0fdc14 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: power_logger description: A well log tool on flutter, support Dio and custom type data. -version: 1.2.0 +version: 1.2.1 homepage: https://github.com/laiiihz/power_logger environment: @@ -12,8 +12,8 @@ dependencies: sdk: flutter dio: ^4.0.0 flutter_highlight: ^0.7.0 - device_info: ^2.0.0 - package_info: ^2.0.0 + device_info_plus: ^1.0.0 + package_info_plus: ^1.0.0 auto_size_text: ^3.0.0-nullsafety.0 logger: ^1.0.0