diff --git a/experimental/web_dashboard/.gitignore b/experimental/web_dashboard/.gitignore new file mode 100644 index 00000000000..ae1f1838ee7 --- /dev/null +++ b/experimental/web_dashboard/.gitignore @@ -0,0 +1,37 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related +lib/generated_plugin_registrant.dart + +# Exceptions to above rules. +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages diff --git a/experimental/web_dashboard/.metadata b/experimental/web_dashboard/.metadata new file mode 100644 index 00000000000..4390eea94d8 --- /dev/null +++ b/experimental/web_dashboard/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: bc6f270c584d1fdba81330090ef6e822b9082919 + channel: master + +project_type: app diff --git a/experimental/web_dashboard/README.md b/experimental/web_dashboard/README.md new file mode 100644 index 00000000000..9c384c1e465 --- /dev/null +++ b/experimental/web_dashboard/README.md @@ -0,0 +1,17 @@ +# web_dashboard + +(In progress) A dashboard app for the web, built with Flutter. + +## Running + +Normal mode (DDC): + +``` +flutter run -d chrome +``` + +Skia / CanvasKit mode: + +``` +flutter run -d chrome --release --dart-define=FLUTTER_WEB_USE_SKIA=true +``` \ No newline at end of file diff --git a/experimental/web_dashboard/android/.gitignore b/experimental/web_dashboard/android/.gitignore new file mode 100644 index 00000000000..bc2100d8f75 --- /dev/null +++ b/experimental/web_dashboard/android/.gitignore @@ -0,0 +1,7 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java diff --git a/experimental/web_dashboard/android/app/build.gradle b/experimental/web_dashboard/android/app/build.gradle new file mode 100644 index 00000000000..f6151e0b0c9 --- /dev/null +++ b/experimental/web_dashboard/android/app/build.gradle @@ -0,0 +1,67 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 28 + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "dev.flutter.web_dashboard" + minSdkVersion 16 + targetSdkVersion 28 + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test:runner:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' +} diff --git a/experimental/web_dashboard/android/app/src/debug/AndroidManifest.xml b/experimental/web_dashboard/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 00000000000..2b793b60030 --- /dev/null +++ b/experimental/web_dashboard/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/experimental/web_dashboard/android/app/src/main/AndroidManifest.xml b/experimental/web_dashboard/android/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000000..efe78a26953 --- /dev/null +++ b/experimental/web_dashboard/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + diff --git a/experimental/web_dashboard/android/app/src/main/kotlin/dev/flutter/web_dashboard/MainActivity.kt b/experimental/web_dashboard/android/app/src/main/kotlin/dev/flutter/web_dashboard/MainActivity.kt new file mode 100644 index 00000000000..7eabff5a553 --- /dev/null +++ b/experimental/web_dashboard/android/app/src/main/kotlin/dev/flutter/web_dashboard/MainActivity.kt @@ -0,0 +1,12 @@ +package dev.flutter.web_dashboard + +import androidx.annotation.NonNull; +import io.flutter.embedding.android.FlutterActivity +import io.flutter.embedding.engine.FlutterEngine +import io.flutter.plugins.GeneratedPluginRegistrant + +class MainActivity: FlutterActivity() { + override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { + GeneratedPluginRegistrant.registerWith(flutterEngine); + } +} diff --git a/experimental/web_dashboard/android/app/src/main/res/drawable/launch_background.xml b/experimental/web_dashboard/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 00000000000..304732f8842 --- /dev/null +++ b/experimental/web_dashboard/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/experimental/web_dashboard/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/experimental/web_dashboard/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000000..db77bb4b7b0 Binary files /dev/null and b/experimental/web_dashboard/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/experimental/web_dashboard/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/experimental/web_dashboard/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000000..17987b79bb8 Binary files /dev/null and b/experimental/web_dashboard/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/experimental/web_dashboard/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/experimental/web_dashboard/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000000..09d4391482b Binary files /dev/null and b/experimental/web_dashboard/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/experimental/web_dashboard/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/experimental/web_dashboard/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000000..d5f1c8d34e7 Binary files /dev/null and b/experimental/web_dashboard/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/experimental/web_dashboard/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/experimental/web_dashboard/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000000..4d6372eebdb Binary files /dev/null and b/experimental/web_dashboard/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/experimental/web_dashboard/android/app/src/main/res/values/styles.xml b/experimental/web_dashboard/android/app/src/main/res/values/styles.xml new file mode 100644 index 00000000000..00fa4417cfb --- /dev/null +++ b/experimental/web_dashboard/android/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + diff --git a/experimental/web_dashboard/android/app/src/profile/AndroidManifest.xml b/experimental/web_dashboard/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 00000000000..2b793b60030 --- /dev/null +++ b/experimental/web_dashboard/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/experimental/web_dashboard/android/build.gradle b/experimental/web_dashboard/android/build.gradle new file mode 100644 index 00000000000..3100ad2d555 --- /dev/null +++ b/experimental/web_dashboard/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + ext.kotlin_version = '1.3.50' + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.5.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/experimental/web_dashboard/android/gradle.properties b/experimental/web_dashboard/android/gradle.properties new file mode 100644 index 00000000000..38c8d4544ff --- /dev/null +++ b/experimental/web_dashboard/android/gradle.properties @@ -0,0 +1,4 @@ +org.gradle.jvmargs=-Xmx1536M +android.enableR8=true +android.useAndroidX=true +android.enableJetifier=true diff --git a/experimental/web_dashboard/android/gradle/wrapper/gradle-wrapper.properties b/experimental/web_dashboard/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000000..296b146b731 --- /dev/null +++ b/experimental/web_dashboard/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip diff --git a/experimental/web_dashboard/android/settings.gradle b/experimental/web_dashboard/android/settings.gradle new file mode 100644 index 00000000000..5a2f14fb18f --- /dev/null +++ b/experimental/web_dashboard/android/settings.gradle @@ -0,0 +1,15 @@ +include ':app' + +def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() + +def plugins = new Properties() +def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') +if (pluginsFile.exists()) { + pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } +} + +plugins.each { name, path -> + def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() + include ":$name" + project(":$name").projectDir = pluginDirectory +} diff --git a/experimental/web_dashboard/ios/.gitignore b/experimental/web_dashboard/ios/.gitignore new file mode 100644 index 00000000000..e96ef602b8d --- /dev/null +++ b/experimental/web_dashboard/ios/.gitignore @@ -0,0 +1,32 @@ +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/experimental/web_dashboard/ios/Flutter/AppFrameworkInfo.plist b/experimental/web_dashboard/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 00000000000..6b4c0f78a78 --- /dev/null +++ b/experimental/web_dashboard/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 8.0 + + diff --git a/experimental/web_dashboard/ios/Flutter/Debug.xcconfig b/experimental/web_dashboard/ios/Flutter/Debug.xcconfig new file mode 100644 index 00000000000..592ceee85b8 --- /dev/null +++ b/experimental/web_dashboard/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/experimental/web_dashboard/ios/Flutter/Release.xcconfig b/experimental/web_dashboard/ios/Flutter/Release.xcconfig new file mode 100644 index 00000000000..592ceee85b8 --- /dev/null +++ b/experimental/web_dashboard/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/experimental/web_dashboard/ios/Runner.xcodeproj/project.pbxproj b/experimental/web_dashboard/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..53e2e54c89b --- /dev/null +++ b/experimental/web_dashboard/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,518 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; + 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; + 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, + 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B80C3931E831B6300D905FE /* App.framework */, + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEBA1CF902C7004384FC /* Flutter.framework */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 97C146F11CF9000F007C117D /* Supporting Files */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; + 97C146F11CF9000F007C117D /* Supporting Files */ = { + isa = PBXGroup; + children = ( + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.webDashboard; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.webDashboard; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.webDashboard; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/experimental/web_dashboard/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/experimental/web_dashboard/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000000..1d526a16ed0 --- /dev/null +++ b/experimental/web_dashboard/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/experimental/web_dashboard/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/experimental/web_dashboard/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 00000000000..a28140cfdb3 --- /dev/null +++ b/experimental/web_dashboard/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/experimental/web_dashboard/ios/Runner.xcworkspace/contents.xcworkspacedata b/experimental/web_dashboard/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000000..1d526a16ed0 --- /dev/null +++ b/experimental/web_dashboard/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/experimental/web_dashboard/ios/Runner/AppDelegate.swift b/experimental/web_dashboard/ios/Runner/AppDelegate.swift new file mode 100644 index 00000000000..70693e4a8c1 --- /dev/null +++ b/experimental/web_dashboard/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000000..d36b1fab2d9 --- /dev/null +++ b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 00000000000..dc9ada4725e Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 00000000000..28c6bf03016 Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 00000000000..2ccbfd967d9 Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 00000000000..f091b6b0bca Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 00000000000..4cde12118dd Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 00000000000..d0ef06e7edb Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 00000000000..dcdc2306c28 Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 00000000000..2ccbfd967d9 Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 00000000000..c8f9ed8f5ce Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 00000000000..a6d6b8609df Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 00000000000..a6d6b8609df Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 00000000000..75b2d164a5a Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 00000000000..c4df70d39da Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 00000000000..6a84f41e14e Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 00000000000..d0e1f585360 Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/experimental/web_dashboard/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 00000000000..0bedcf2fd46 --- /dev/null +++ b/experimental/web_dashboard/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 00000000000..9da19eacad3 Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 00000000000..9da19eacad3 Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/experimental/web_dashboard/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 00000000000..9da19eacad3 Binary files /dev/null and b/experimental/web_dashboard/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/experimental/web_dashboard/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/experimental/web_dashboard/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 00000000000..89c2725b70f --- /dev/null +++ b/experimental/web_dashboard/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/experimental/web_dashboard/ios/Runner/Base.lproj/LaunchScreen.storyboard b/experimental/web_dashboard/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000000..f2e259c7c93 --- /dev/null +++ b/experimental/web_dashboard/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/experimental/web_dashboard/ios/Runner/Base.lproj/Main.storyboard b/experimental/web_dashboard/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 00000000000..f3c28516fb3 --- /dev/null +++ b/experimental/web_dashboard/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/experimental/web_dashboard/ios/Runner/Info.plist b/experimental/web_dashboard/ios/Runner/Info.plist new file mode 100644 index 00000000000..112680a4105 --- /dev/null +++ b/experimental/web_dashboard/ios/Runner/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + web_dashboard + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/experimental/web_dashboard/ios/Runner/Runner-Bridging-Header.h b/experimental/web_dashboard/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 00000000000..308a2a560b4 --- /dev/null +++ b/experimental/web_dashboard/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/experimental/web_dashboard/lib/main.dart b/experimental/web_dashboard/lib/main.dart new file mode 100644 index 00000000000..1a6339fa892 --- /dev/null +++ b/experimental/web_dashboard/lib/main.dart @@ -0,0 +1,204 @@ +// Copyright 2020, the Flutter project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:flutter/material.dart'; +import 'package:flutter/scheduler.dart'; + +import 'src/adaptive_scaffold.dart'; + +/// The [Key] for the inner [Navigator]. +GlobalKey _navigatorKey = GlobalKey(); + +void main() { + runApp(DashboardApp()); +} + +/// An app that shows a responsive dashboard. +class DashboardApp extends StatefulWidget { + @override + _DashboardAppState createState() => _DashboardAppState(); +} + +class _DashboardAppState extends State { + @override + Widget build(BuildContext context) { + return MaterialApp( + // Forward the initial route to the app shell. + onGenerateInitialRoutes: (initialRoute) { + return [ + PageRouteBuilder( + // Use the same route settings in the child navigator. + settings: RouteSettings(name: initialRoute), + // Send the route to AppShell so it can select the correct item in + // the Drawer / NavigationRail / BottomAppBar. + pageBuilder: (context, animation, secondaryAnimation) { + return AppShell(initialRoute); + }, + ), + ]; + }, + ); + } +} + +/// The outer "shell" of the app. Uses an [AdaptiveScaffold] with a [Navigator] +/// to handle route events and display the correct page in the Drawer / +/// BottomNavigationBar, or NavigationRail, as well as the correct page in the +/// body of the Scaffold. +class AppShell extends StatefulWidget { + final String routeName; + + AppShell(this.routeName); + + @override + _AppShellState createState() => _AppShellState(); +} + +class _AppShellState extends State { + int _currentIndex = 0; + + void initState() { + super.initState(); + _currentIndex = _indexForRoute(widget.routeName); + } + + @override + Widget build(BuildContext context) { + return AdaptiveScaffold( + title: Text('Dashboard App'), + body: Navigator( + key: _navigatorKey, + initialRoute: widget.routeName, + onGenerateRoute: (settings) { + var routeName = settings.name; + var pageWidget = _pageForRoute(routeName); + + // Change the _currentIndex to highlight the correct menu item / + // BottomNavigationBarItem. + // + // Use a post-frame callback to avoid calling setState() during the + // initial build phase. Right now this is being called in the wrong + // order. (Refreshing the browser with the initial route set to + // '/settings' invokes onGenerateRoute with '/' instead of + // '/settings'.) + SchedulerBinding.instance.addPostFrameCallback((dur) { + setState(() { + _currentIndex = _indexForRoute(routeName); + }); + }); + // Instead of a SchedulerBinding, this check should ensure that + // setState() isn't called during the initial build phase + // (_currentIndex is set to the correct value in initState()). + // + // if (_currentIndex != _indexForRoute(routeName)) { + // setState(() { + // _currentIndex = _indexForRoute(routeName); + // }); + // } + + return PageRouteBuilder( + pageBuilder: (context, animation, secondaryAnimation) { + return pageWidget; + }, + transitionsBuilder: + (context, animation, secondaryAnimation, child) { + var curveTween = CurveTween(curve: Curves.easeInQuart); + return FadeTransition( + opacity: animation.drive(curveTween), + child: child, + ); + }, + settings: settings, + ); + }, + ), + currentIndex: _currentIndex, + destinations: const [ + AdaptiveScaffoldDestination(title: 'Dashboard', icon: Icons.dashboard), + AdaptiveScaffoldDestination(title: 'Metrics', icon: Icons.show_chart), + AdaptiveScaffoldDestination(title: 'Settings', icon: Icons.settings), + ], + onNavigationIndexChange: (idx) { + setState(() { + _currentIndex = idx; + }); + + // Use the inner Navigator to change the route. + var navState = _navigatorKey.currentState as NavigatorState; + navState.pushNamed(_routeForIndex(idx)); + }, + floatingActionButton: FloatingActionButton( + onPressed: () {}, + child: Icon(Icons.add), + ), + ); + } +} + +List _routes = [ + '/dashboard', + '/metrics', + '/settings', +]; + +String _routeForIndex(int index) { + if (index >= 0 && index < _routes.length) { + return _routes[index]; + } + return _routes[0]; +} + +Widget _pageForRoute(String name) { + if (name == '/dashboard') return DashboardPage(); + if (name == '/metrics') return MetricsPage(); + if (name == '/settings') return SettingsPage(); + return DashboardPage(); +} + +int _indexForRoute(String name) { + var idx = _routes.indexOf(name); + if (idx < 0) { + return 0; + } + return idx; +} + +class DashboardPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center( + child: Text('Dashboard'), + ), + ); + } +} + +class MetricsPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center( + child: Text('Metrics'), + ), + ); + } +} + +class SettingsPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center( + child: RaisedButton( + child: Text('Go to Dashboard'), + onPressed: () { + (_navigatorKey.currentState as NavigatorState) + .pushReplacementNamed('/dashboard'); + }, + ), + ), + ); + } +} diff --git a/experimental/web_dashboard/lib/src/adaptive_scaffold.dart b/experimental/web_dashboard/lib/src/adaptive_scaffold.dart new file mode 100644 index 00000000000..a452f1f04ea --- /dev/null +++ b/experimental/web_dashboard/lib/src/adaptive_scaffold.dart @@ -0,0 +1,154 @@ +// Copyright 2020, the Flutter project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'package:flutter/material.dart'; + +import 'navigation_rail.dart'; + +bool _isLargeScreen(BuildContext context) { + return MediaQuery.of(context).size.width > 960.0; +} + +bool _isMediumScreen(BuildContext context) { + return MediaQuery.of(context).size.width > 640.0; +} + +/// See bottomNavigationBarItem or NavigationRailDestination +class AdaptiveScaffoldDestination { + final String title; + final IconData icon; + + const AdaptiveScaffoldDestination({ + @required this.title, + @required this.icon, + }); +} + +/// A widget that adapts to the current display size, displaying a [Drawer], +/// [NavigationRail], or [BottomNavigationBar]. Navigation destinations are +/// defined in the [destinations] parameter. +class AdaptiveScaffold extends StatefulWidget { + final Widget title; + final Widget body; + final int currentIndex; + final List destinations; + final ValueChanged onNavigationIndexChange; + final FloatingActionButton floatingActionButton; + + AdaptiveScaffold({ + this.title, + this.body, + @required this.currentIndex, + @required this.destinations, + this.onNavigationIndexChange, + this.floatingActionButton, + }); + + @override + _AdaptiveScaffoldState createState() => _AdaptiveScaffoldState(); +} + +class _AdaptiveScaffoldState extends State { + @override + Widget build(BuildContext context) { + // Show a Drawer + if (_isLargeScreen(context)) { + return Row( + children: [ + Drawer( + child: Column( + children: [ + DrawerHeader( + child: Center( + child: widget.title, + ), + ), + for (var d in widget.destinations) + ListTile( + leading: Icon(d.icon), + title: Text(d.title), + selected: + widget.destinations.indexOf(d) == widget.currentIndex, + onTap: () => _destinationTapped(d), + ), + ], + ), + ), + VerticalDivider( + width: 1, + thickness: 1, + color: Colors.grey[300], + ), + Expanded( + child: Scaffold( + appBar: AppBar(), + body: widget.body, + floatingActionButton: widget.floatingActionButton, + ), + ), + ], + ); + } + + // Show a navigation rail + if (_isMediumScreen(context)) { + return Scaffold( + appBar: AppBar( + title: widget.title, + ), + body: Row( + children: [ + NavigationRail( + leading: widget.floatingActionButton, + destinations: [ + ...widget.destinations.map( + (d) => NavigationRailDestination( + icon: Icon(d.icon), + title: Text(d.title), + ), + ), + ], + currentIndex: widget.currentIndex, + onDestinationSelected: widget.onNavigationIndexChange, + ), + VerticalDivider( + width: 1, + thickness: 1, + color: Colors.grey[300], + ), + Expanded( + child: widget.body, + ), + ], + ), + ); + } + + // Show a bottom app bar + return Scaffold( + body: widget.body, + appBar: AppBar(title: widget.title), + bottomNavigationBar: BottomNavigationBar( + items: [ + ...widget.destinations.map( + (d) => BottomNavigationBarItem( + icon: Icon(d.icon), + title: Text(d.title), + ), + ), + ], + currentIndex: widget.currentIndex, + onTap: widget.onNavigationIndexChange, + ), + floatingActionButton: widget.floatingActionButton, + ); + } + + void _destinationTapped(AdaptiveScaffoldDestination destination) { + var idx = widget.destinations.indexOf(destination); + if (idx != widget.currentIndex) { + widget.onNavigationIndexChange(idx); + } + } +} diff --git a/experimental/web_dashboard/lib/src/navigation_rail.dart b/experimental/web_dashboard/lib/src/navigation_rail.dart new file mode 100644 index 00000000000..219cb63f261 --- /dev/null +++ b/experimental/web_dashboard/lib/src/navigation_rail.dart @@ -0,0 +1,402 @@ +// Copyright 2020, the Flutter project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// Original pull request: https://github.com/flutter/flutter/pull/49574 +import 'package:flutter/material.dart'; + +/// Defines the behavior of the labels of a [NavigationRail]. +/// +/// See also: +/// +/// * [NavigationRail] +enum NavigationRailLabelType { + /// Only the icons of a navigation rail item are shown. + none, + + /// Only the selected navigation rail item will show its label. + /// + /// The label will animate in and out as new items are selected. + selected, + + /// All navigation rail items will show their label. + all, +} + +/// Defines the alignment for the group of [NavigationRailDestination]s within +/// a [NavigationRail]. +/// +/// Navigation rail destinations can be aligned as a group to the [top], +/// [bottom], or [center] of a layout. +enum NavigationRailGroupAlignment { + /// Place the [NavigationRailDestination]s at the top of the rail. + top, + + /// Place the [NavigationRailDestination]s in the center of the rail. + center, + + /// Place the [NavigationRailDestination]s at the bottom of the rail. + bottom, +} + +/// A description for an interactive button within a [NavigationRail]. +/// +/// See also: +/// +/// * [NavigationRail] +class NavigationRailDestination { + /// Creates an destination that is used with [NavigationRail.destinations]. + /// + /// [icon] should not be null and [title] should not be null when this + /// destination is used in the [NavigationRail]. + const NavigationRailDestination({ + @required this.icon, + Widget activeIcon, + this.title, + }) : activeIcon = activeIcon ?? icon, + assert(icon != null); + + /// The icon of the destination. + /// + /// Typically the icon is an [Icon] or an [ImageIcon] widget. If another type + /// of widget is provided then it should configure itself to match the current + /// [IconTheme] size and color. + /// + /// If [activeIcon] is provided, this will only be displayed when the + /// destination is not selected. + /// + /// To make the [NavigationRail] more accessible, consider choosing an + /// icon with a stroked and filled version, such as [Icons.cloud] and + /// [Icons.cloud_queue]. [icon] should be set to the stroked version and + /// [activeIcon] to the filled version. + final Widget icon; + + /// An alternative icon displayed when this destination is selected. + /// + /// If this icon is not provided, the [NavigationRail] will display [icon] in + /// either state. + /// + /// See also: + /// + /// * [NavigationRailDestination.icon], for a description of how to pair + /// icons. + final Widget activeIcon; + + /// The title of the item. If the title is not provided only the icon will be + /// shown when not used in a [NavigationRail]. + final Widget title; +} + +/// TODO +class NavigationRail extends StatefulWidget { + /// TODO + NavigationRail({ + this.leading, + this.destinations, + this.currentIndex, + this.onDestinationSelected, + this.groupAlignment = NavigationRailGroupAlignment.top, + this.labelType = NavigationRailLabelType.none, + this.labelTextStyle, + this.selectedLabelTextStyle, + this.iconTheme, + this.selectedIconTheme, + }); + + /// The leading widget in the rail that is placed above the items. + /// + /// This is commonly a [FloatingActionButton], but may also be a non-button, + /// such as a logo. + final Widget leading; + + /// Defines the appearance of the button items that are arrayed within the + /// navigation rail. + final List destinations; + + /// The index into [destinations] for the current active [NavigationRailDestination]. + final int currentIndex; + + /// Called when one of the [destinations] is selected. + /// + /// The stateful widget that creates the navigation rail needs to keep + /// track of the index of the selected [NavigationRailDestination] and call + /// `setState` to rebuild the navigation rail with the new [currentIndex]. + final ValueChanged onDestinationSelected; + + /// The alignment for the [NavigationRailDestination]s as they are positioned + /// within the [NavigationRail]. + /// + /// Navigation rail destinations can be aligned as a group to the [top], + /// [bottom], or [center] of a layout. + final NavigationRailGroupAlignment groupAlignment; + + /// Defines the layout and behavior of the labels in the [NavigationRail]. + /// + /// See also: + /// + /// * [NavigationRailLabelType] for information on the meaning of different + /// types. + final NavigationRailLabelType labelType; + + /// The [TextStyle] of the [NavigationRailDestination] labels. + /// + /// This is the default [TextStyle] for all labels. When the + /// [NavigationRailDestination] is selected, the [selectedLabelTextStyle] will be + /// used instead. + final TextStyle labelTextStyle; + + /// The [TextStyle] of the [NavigationRailDestination] labels when they are + /// selected. + /// + /// This field overrides the [labelTextStyle] for selected items. + /// + /// When the [NavigationRailDestination] is not selected, [labelTextStyle] will be + /// used. + final TextStyle selectedLabelTextStyle; + + /// The default size, opacity, and color of the icon in the + /// [NavigationRailDestination]. + /// + /// If this field is not provided, or provided with any null properties, then + ///a copy of the [IconThemeData.fallback] with a custom [NavigationRail] + /// specific color will be used. + final IconTheme iconTheme; + + /// The size, opacity, and color of the icon in the selected + /// [NavigationRailDestination]. + /// + /// This field overrides the [iconTheme] for selected items. + /// + /// When the [NavigationRailDestination] is not selected, [iconTheme] will be + /// used. + final IconTheme selectedIconTheme; + + @override + _NavigationRailState createState() => _NavigationRailState(); +} + +class _NavigationRailState extends State + with TickerProviderStateMixin { + List _controllers = []; + List> _animations; + + @override + void initState() { + super.initState(); + _initControllers(); + } + + @override + void dispose() { + _disposeControllers(); + super.dispose(); + } + + @override + void didUpdateWidget(NavigationRail oldWidget) { + super.didUpdateWidget(oldWidget); + + // No animated segue if the length of the items list changes. + if (widget.destinations.length != oldWidget.destinations.length) { + _resetState(); + return; + } + + if (widget.currentIndex != oldWidget.currentIndex) { + _controllers[oldWidget.currentIndex].reverse(); + _controllers[widget.currentIndex].forward(); + } + } + + @override + Widget build(BuildContext context) { + final Widget leading = widget.leading; + return DefaultTextStyle( + style: TextStyle(color: Theme.of(context).colorScheme.primary), + child: Container( + width: _railWidth, + color: Theme.of(context).colorScheme.surface, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _verticalSpacing, + if (leading != null) ...[ + SizedBox( + height: _railItemHeight, + width: _railItemWidth, + child: Align( + alignment: Alignment.center, + child: leading, + ), + ), + _verticalSpacing, + ], + for (int i = 0; i < widget.destinations.length; i++) + _RailItem( + animation: _animations[i], + labelKind: widget.labelType, + selected: widget.currentIndex == i, + icon: widget.currentIndex == i + ? widget.destinations[i].activeIcon + : widget.destinations[i].icon, + title: DefaultTextStyle( + style: TextStyle( + color: widget.currentIndex == i + ? Theme.of(context).colorScheme.primary + : Theme.of(context) + .colorScheme + .onSurface + .withOpacity(0.64)), + child: widget.destinations[i].title, + ), + onTap: () { + widget.onDestinationSelected(i); + }, + ), + ], + ), + ), + ); + } + + void _disposeControllers() { + for (final AnimationController controller in _controllers) + controller.dispose(); + } + + void _initControllers() { + _controllers = List.generate( + widget.destinations.length, (int index) { + return AnimationController( + duration: kThemeAnimationDuration, + vsync: this, + )..addListener(_rebuild); + }); + _animations = _controllers + .map((AnimationController controller) => controller.view) + .toList(); + _controllers[widget.currentIndex].value = 1.0; + } + + void _resetState() { + _disposeControllers(); + _initControllers(); + } + + void _rebuild() { + setState(() { + // Rebuilding when any of the controllers tick, i.e. when the items are + // animated. + }); + } +} + +class _RailItem extends StatelessWidget { + _RailItem({ + this.animation, + this.labelKind, + this.selected, + this.icon, + this.title, + this.onTap, + }) : assert(labelKind != null), + _positionAnimation = CurvedAnimation( + parent: ReverseAnimation(animation), + curve: Curves.easeInOut, + reverseCurve: Curves.easeInOut.flipped, + ); + + final Animation _positionAnimation; + + final Animation animation; + final NavigationRailLabelType labelKind; + final bool selected; + final Widget icon; + final Widget title; + final VoidCallback onTap; + + double _fadeInValue() { + if (animation.value < 0.25) { + return 0; + } else if (animation.value < 0.75) { + return (animation.value - 0.25) * 2; + } else { + return 1; + } + } + + double _fadeOutValue() { + if (animation.value > 0.75) { + return (animation.value - 0.75) * 4; + } else { + return 0; + } + } + + @override + Widget build(BuildContext context) { + Widget content; + switch (labelKind) { + case NavigationRailLabelType.none: + content = SizedBox(width: _railItemWidth, child: icon); + break; + case NavigationRailLabelType.selected: + content = SizedBox( + width: 72, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox(height: _positionAnimation.value * 18), + icon, + Opacity( + alwaysIncludeSemantics: true, + opacity: selected ? _fadeInValue() : _fadeOutValue(), + child: title, + ), + ], + ), + ); + break; + case NavigationRailLabelType.all: + content = SizedBox( + width: 72, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + icon, + title, + ], + ), + ); + break; + } + + final ColorScheme colors = Theme.of(context).colorScheme; + return IconTheme( + data: IconThemeData( + color: selected ? colors.primary : colors.onSurface.withOpacity(0.64), + ), + child: SizedBox( + height: 72, + child: Material( + type: MaterialType.transparency, + clipBehavior: Clip.none, + child: InkResponse( + onTap: onTap, + onHover: (_) {}, + splashColor: + Theme.of(context).colorScheme.primary.withOpacity(0.12), + hoverColor: Theme.of(context).colorScheme.primary.withOpacity(0.04), + child: content, + ), + ), + ), + ); + } +} + +const double _railWidth = 72; +const double _railItemWidth = _railWidth; +const double _railItemHeight = _railItemWidth; +const double _spacing = 8; +const Widget _verticalSpacing = SizedBox(height: _spacing); diff --git a/experimental/web_dashboard/pubspec.lock b/experimental/web_dashboard/pubspec.lock new file mode 100644 index 00000000000..fcf676353bd --- /dev/null +++ b/experimental/web_dashboard/pubspec.lock @@ -0,0 +1,195 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.11" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.2" + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.2" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.14.11" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.3" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + image: + dependency: transitive + description: + name: image + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.4" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.6" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.8" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.4" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0+1" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.0" + quiver: + dependency: transitive + description: + name: quiver + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.5" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.5" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.3" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.11" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.6" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.8" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.dartlang.org" + source: hosted + version: "3.5.0" +sdks: + dart: ">=2.4.0 <3.0.0" diff --git a/experimental/web_dashboard/pubspec.yaml b/experimental/web_dashboard/pubspec.yaml new file mode 100644 index 00000000000..ec0cf411a42 --- /dev/null +++ b/experimental/web_dashboard/pubspec.yaml @@ -0,0 +1,14 @@ +name: web_dashboard +description: A desktop-friendly dashboard app +version: 1.0.0+1 +environment: + sdk: ">=2.3.0 <3.0.0" +dependencies: + flutter: + sdk: flutter + cupertino_icons: ^0.1.2 +dev_dependencies: + flutter_test: + sdk: flutter +flutter: + uses-material-design: true diff --git a/experimental/web_dashboard/web/icons/Icon-192.png b/experimental/web_dashboard/web/icons/Icon-192.png new file mode 100644 index 00000000000..b749bfef074 Binary files /dev/null and b/experimental/web_dashboard/web/icons/Icon-192.png differ diff --git a/experimental/web_dashboard/web/icons/Icon-512.png b/experimental/web_dashboard/web/icons/Icon-512.png new file mode 100644 index 00000000000..88cfd48dff1 Binary files /dev/null and b/experimental/web_dashboard/web/icons/Icon-512.png differ diff --git a/experimental/web_dashboard/web/index.html b/experimental/web_dashboard/web/index.html new file mode 100644 index 00000000000..aa0b74c95b2 --- /dev/null +++ b/experimental/web_dashboard/web/index.html @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + web_dashboard + + + + + + + + diff --git a/experimental/web_dashboard/web/manifest.json b/experimental/web_dashboard/web/manifest.json new file mode 100644 index 00000000000..0aeff59840c --- /dev/null +++ b/experimental/web_dashboard/web/manifest.json @@ -0,0 +1,23 @@ +{ + "name": "web_dashboard", + "short_name": "web_dashboard", + "start_url": ".", + "display": "minimal-ui", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A desktop-friendly dashboard app", + "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" + } + ] +}