├── .gitignore ├── .metadata ├── .vscode ├── c_cpp_properties.json ├── launch.json └── settings.json ├── CHANGELOG.md ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── flutter_fun │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── background.jpg ├── design.png ├── fonts │ └── FunIcons.ttf └── kherel.jpeg ├── design_elements ├── config.json └── humidity_slider │ ├── chart.svg │ ├── drop.svg │ ├── home.svg │ ├── vertical_arrows.svg │ └── warning-sign.svg ├── gifs ├── fun_with_image_data.gif ├── glitch.gif ├── humidity_app_design.gif ├── humidity_app_res.gif └── today_list.gif ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── lib ├── fun_icons_icons.dart ├── glitch │ ├── glitch.dart │ └── glitch_page_screen.dart ├── humidity_slider │ ├── humidity.dart │ ├── humidity_congfig.dart │ ├── humidity_cureved_line.dart │ ├── humidity_info.dart │ ├── humidity_screen.dart │ ├── measurement_numbers.dart │ ├── scaffold.dart │ ├── slider.dart │ ├── slider_ball.dart │ └── theme.dart ├── main.dart ├── raw_rgba_fun │ ├── animated_points.dart │ ├── points.dart │ ├── raw_rgba_screen.dart │ ├── screenshot.dart │ ├── settings.dart │ └── settings_form.dart ├── today_list │ ├── arrow_button.dart │ ├── colors.dart │ ├── header_icon.dart │ ├── search.dart │ └── today_list.dart └── utils │ ├── colors.dart │ └── navigation.dart ├── linux ├── .gitignore ├── CMakeLists.txt ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake ├── main.cc ├── my_application.cc └── my_application.h ├── macos ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Podfile ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── app_icon_1024.png │ │ ├── app_icon_128.png │ │ ├── app_icon_16.png │ │ ├── app_icon_256.png │ │ ├── app_icon_32.png │ │ ├── app_icon_512.png │ │ └── app_icon_64.png │ ├── Base.lproj │ └── MainMenu.xib │ ├── Configs │ ├── AppInfo.xcconfig │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── Warnings.xcconfig │ ├── DebugProfile.entitlements │ ├── Info.plist │ ├── MainFlutterWindow.swift │ └── Release.entitlements ├── pubspec.lock ├── pubspec.yaml ├── test └── widget_test.dart ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── index.html └── manifest.json └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Exceptions to above rules. 44 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 45 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 17 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 18 | - platform: android 19 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 20 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 21 | - platform: ios 22 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 23 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 24 | - platform: linux 25 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 26 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 27 | - platform: macos 28 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 29 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 30 | - platform: web 31 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 32 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 33 | - platform: windows 34 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 35 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Win32", 5 | "includePath": [ 6 | "${workspaceFolder}/**", 7 | "${workspaceFolder}/windows/flutter/ephemeral/cpp_client_wrapper/include" 8 | ], 9 | "defines": [ 10 | "_DEBUG", 11 | "UNICODE", 12 | "_UNICODE" 13 | ], 14 | "windowsSdkVersion": "10.0.19041.0", 15 | "compilerPath": "I:/visual_studio_installation/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe", 16 | "cStandard": "c17", 17 | "cppStandard": "c++17", 18 | "intelliSenseMode": "windows-msvc-x64", 19 | "configurationProvider": "ms-vscode.cmake-tools" 20 | } 21 | ], 22 | "version": 4 23 | } -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "flutter_fun", 9 | "request": "launch", 10 | "type": "dart" 11 | }, 12 | { 13 | "name": "flutter_fun (profile mode)", 14 | "request": "launch", 15 | "type": "dart", 16 | "flutterMode": "profile" 17 | }, 18 | { 19 | "name": "flutter_fun (release mode)", 20 | "request": "launch", 21 | "type": "dart", 22 | "flutterMode": "release" 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cmake.sourceDirectory": "${workspaceFolder}/linux", 3 | "cSpell.words": [ 4 | "rgba" 5 | ] 6 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change log 2 | 3 | ## v2.0.0 - Jun21, 2022 4 | 5 | - null safety migration 6 | - replaced deprecated widgets 7 | - fixed-typo 8 | 9 | --- 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flutter_fun 2 | 3 | Just small ui challenges for Fun. 4 | 5 | ## Glitch effect experiment 6 | 7 | ![](gifs/glitch.gif) 8 | 9 | ## IoT Humidity App Slider 10 | 11 | Design: https://dribbble.com/shots/6315218-IoT-Humidity-App-Slider 12 | ![](gifs/humidity_app_design.gif) 13 | Result: 14 | ![](gifs/humidity_app_res.gif) 15 | 16 | ## Fun with ImageData 17 | 18 | ![](gifs/fun_with_image_data.gif) 19 | 20 | ## iPhone’s Today View (IOS 13) 21 | 22 | ![](gifs/today_list.gif) 23 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "com.example.flutter_fun" 48 | // You can update the following values to match your application needs. 49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 50 | minSdkVersion flutter.minSdkVersion 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | } 55 | 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | signingConfig signingConfigs.debug 61 | } 62 | } 63 | } 64 | 65 | flutter { 66 | source '../..' 67 | } 68 | 69 | dependencies { 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 71 | } 72 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/flutter_fun/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.flutter_fun 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.2' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 7 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /assets/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/assets/background.jpg -------------------------------------------------------------------------------- /assets/design.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/assets/design.png -------------------------------------------------------------------------------- /assets/fonts/FunIcons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/assets/fonts/FunIcons.ttf -------------------------------------------------------------------------------- /assets/kherel.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/assets/kherel.jpeg -------------------------------------------------------------------------------- /design_elements/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "FunIcons", 3 | "css_prefix_text": "", 4 | "css_use_suffix": false, 5 | "hinting": true, 6 | "units_per_em": 1000, 7 | "ascent": 850, 8 | "glyphs": [ 9 | { 10 | "uid": "bb10d0b527f41ab0120e02c7751f389f", 11 | "css": "chart", 12 | "code": 59392, 13 | "src": "custom_icons", 14 | "selected": true, 15 | "svg": { 16 | "path": "M852.2 94.3H698V925.1H852.2V94.3ZM115.2 356.8H269.4V925.1H115.2V356.8ZM406.6 522.9H560.8V925.1H406.6V522.9Z", 17 | "width": 1000 18 | }, 19 | "search": [ 20 | "chart" 21 | ] 22 | }, 23 | { 24 | "uid": "547442572844a352e74c2e60b3705701", 25 | "css": "drop", 26 | "code": 59393, 27 | "src": "custom_icons", 28 | "selected": true, 29 | "svg": { 30 | "path": "M483.7 26.9L205.4 474.8 184 510.7 182.9 512.5C159 558.8 146.3 610 145.8 661.9 146 749.6 181.7 833.6 245 895.5 308.4 957.5 394.2 992.3 483.7 992.5 540.9 992.5 597.2 978.3 647.3 951.3 697.3 924.2 739.6 885.1 770 837.6 800.4 790.2 818 736 821.1 680 824.2 624.1 812.7 568.3 787.8 517.9L483.7 26.9Z", 31 | "width": 1000 32 | }, 33 | "search": [ 34 | "drop" 35 | ] 36 | }, 37 | { 38 | "uid": "42816ba1c443039fc9ba451a9ad4dad6", 39 | "css": "home", 40 | "code": 59394, 41 | "src": "custom_icons", 42 | "selected": true, 43 | "svg": { 44 | "path": "M483.7 50.7L104.9 439.1V992.5H358.5V596.4H615.3V992.5H862.5V439.1L483.7 50.7Z", 45 | "width": 1000 46 | }, 47 | "search": [ 48 | "home" 49 | ] 50 | }, 51 | { 52 | "uid": "505ad6eb65fa0c13b8193f887f202c30", 53 | "css": "warningSign", 54 | "code": 59395, 55 | "src": "custom_icons", 56 | "selected": true, 57 | "svg": { 58 | "path": "M575.9 124.1L579.3 131 951.7 779.3C993.1 851.7 941.4 941.4 862.1 944.8H855.2 110.3C27.6 944.8-24.1 858.6 13.8 782.8L17.2 779.3 386.2 131C427.6 58.6 524.1 55.2 572.4 117.2L575.9 124.1ZM444.8 162.1L72.4 810.3C55.2 841.4 79.3 879.3 110.3 879.3H855.2C889.7 879.3 910.3 841.4 893.1 810.3L520.7 162.1C503.4 134.5 462.1 134.5 444.8 162.1ZM482.8 700C506.9 700 527.6 717.2 527.6 741.4 527.6 765.5 506.9 786.2 482.8 786.2 458.6 786.2 437.9 765.5 437.9 741.4 437.9 717.2 458.6 700 482.8 700ZM482.8 313.8C503.4 313.8 520.7 327.6 520.7 348.3V351.7 620.7C520.7 641.4 503.4 658.6 482.8 658.6 465.5 658.6 448.3 644.8 444.8 624.1V620.7 351.7C444.8 331 462.1 313.8 482.8 313.8Z", 59 | "width": 1000 60 | }, 61 | "search": [ 62 | "warning-sign" 63 | ] 64 | }, 65 | { 66 | "uid": "50199cd50ac3059d43d4c0c453de0ada", 67 | "css": "verticalArrows", 68 | "code": 59396, 69 | "src": "custom_icons", 70 | "selected": true, 71 | "svg": { 72 | "path": "M608.5 411.6L311.3 26.9 14 411.6H608.5ZM14 607.8L311.3 992.4 608.5 607.8H14Z", 73 | "width": 621 74 | }, 75 | "search": [ 76 | "vertical_arrows" 77 | ] 78 | } 79 | ] 80 | } -------------------------------------------------------------------------------- /design_elements/humidity_slider/chart.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /design_elements/humidity_slider/drop.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /design_elements/humidity_slider/home.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /design_elements/humidity_slider/vertical_arrows.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /design_elements/humidity_slider/warning-sign.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /gifs/fun_with_image_data.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/gifs/fun_with_image_data.gif -------------------------------------------------------------------------------- /gifs/glitch.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/gifs/glitch.gif -------------------------------------------------------------------------------- /gifs/humidity_app_design.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/gifs/humidity_app_design.gif -------------------------------------------------------------------------------- /gifs/humidity_app_res.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/gifs/humidity_app_res.gif -------------------------------------------------------------------------------- /gifs/today_list.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/gifs/today_list.gif -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '11.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - path_provider_ios (0.0.1): 4 | - Flutter 5 | 6 | DEPENDENCIES: 7 | - Flutter (from `Flutter`) 8 | - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) 9 | 10 | EXTERNAL SOURCES: 11 | Flutter: 12 | :path: Flutter 13 | path_provider_ios: 14 | :path: ".symlinks/plugins/path_provider_ios/ios" 15 | 16 | SPEC CHECKSUMS: 17 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 18 | path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 19 | 20 | PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 21 | 22 | COCOAPODS: 1.11.3 23 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Flutter Fun 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | flutter_fun 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/fun_icons_icons.dart: -------------------------------------------------------------------------------- 1 | /// Flutter icons FunIcons 2 | /// Copyright (C) 2020 by original authors @ fluttericon.com, fontello.com 3 | /// This font was generated by FlutterIcon.com, which is derived from Fontello. 4 | /// 5 | /// To use this font, place it in your fonts/ directory and include the 6 | /// following in your pubspec.yaml 7 | /// 8 | /// flutter: 9 | /// fonts: 10 | /// - family: FunIcons 11 | /// fonts: 12 | /// - asset: fonts/FunIcons.ttf 13 | /// 14 | /// 15 | /// 16 | import 'package:flutter/widgets.dart'; 17 | 18 | class FunIcons { 19 | FunIcons._(); 20 | 21 | static const _kFontFam = 'FunIcons'; 22 | static const dynamic _kFontPkg = null; 23 | 24 | static const IconData chart = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); 25 | static const IconData drop = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); 26 | static const IconData home = IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); 27 | static const IconData warningSign = IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); 28 | static const IconData verticalArrows = IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); 29 | } 30 | -------------------------------------------------------------------------------- /lib/glitch/glitch.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:math' as math; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_fun/utils/colors.dart'; 6 | 7 | class GlithEffect extends StatefulWidget { 8 | const GlithEffect({Key? key, this.child}) : super(key: key); 9 | 10 | final Widget? child; 11 | 12 | @override 13 | State createState() => _GlithEffectState(); 14 | } 15 | 16 | class _GlithEffectState extends State 17 | with SingleTickerProviderStateMixin { 18 | GlitchController? _controller; 19 | late Timer _timer; 20 | 21 | @override 22 | void initState() { 23 | _controller = GlitchController( 24 | duration: const Duration(milliseconds: 400), 25 | ); 26 | 27 | _timer = Timer.periodic( 28 | const Duration(seconds: 3), 29 | (_) { 30 | _controller! 31 | ..reset() 32 | ..forward(); 33 | }, 34 | ); 35 | super.initState(); 36 | } 37 | 38 | @override 39 | void dispose() { 40 | super.dispose(); 41 | _timer.cancel(); 42 | _controller!.dispose(); 43 | } 44 | 45 | @override 46 | Widget build(BuildContext context) { 47 | return AnimatedBuilder( 48 | animation: _controller!, 49 | builder: (_, __) { 50 | var color = getRandomColor().withOpacity(0.5); 51 | if (!_controller!.isAnimating) { 52 | return widget.child!; 53 | } 54 | return Stack( 55 | children: [ 56 | if (random.nextBool()) _clipedChild, 57 | Transform.translate( 58 | offset: randomOffset, 59 | child: ShaderMask( 60 | shaderCallback: (Rect bounds) { 61 | return LinearGradient( 62 | colors: [ 63 | color, 64 | color, 65 | ], 66 | ).createShader(bounds); 67 | }, 68 | blendMode: BlendMode.srcATop, 69 | child: _clipedChild, 70 | ), 71 | ), 72 | ], 73 | ); 74 | }); 75 | } 76 | 77 | Offset get randomOffset => Offset( 78 | (random.nextInt(10) - 5).toDouble(), 79 | (random.nextInt(10) - 5).toDouble(), 80 | ); 81 | Widget get _clipedChild => ClipPath( 82 | clipper: GlitchClipper(), 83 | child: widget.child, 84 | ); 85 | } 86 | 87 | var random = math.Random(); 88 | 89 | class GlitchClipper extends CustomClipper { 90 | final deltaMax = 15; 91 | final min = 3; 92 | 93 | @override 94 | getClip(Size size) { 95 | var path = Path(); 96 | var y = randomStep; 97 | while (y < size.height) { 98 | var yRandom = randomStep; 99 | var x = randomStep; 100 | 101 | while (x < size.width) { 102 | var xRandom = randomStep; 103 | path.addRect( 104 | Rect.fromPoints( 105 | Offset(x, y.toDouble()), 106 | Offset(x + xRandom, y + yRandom), 107 | ), 108 | ); 109 | x += randomStep * 2; 110 | } 111 | y += yRandom; 112 | } 113 | 114 | path.close(); 115 | return path; 116 | } 117 | 118 | double get randomStep => min + random.nextInt(deltaMax).toDouble(); 119 | 120 | @override 121 | bool shouldReclip(covariant CustomClipper oldClipper) => true; 122 | } 123 | 124 | class GlitchController extends Animation 125 | with 126 | AnimationEagerListenerMixin, 127 | AnimationLocalListenersMixin, 128 | AnimationLocalStatusListenersMixin { 129 | GlitchController({this.duration}); 130 | 131 | Duration? duration; 132 | List _timers = []; 133 | bool isAnimating = false; 134 | 135 | forward() { 136 | isAnimating = true; 137 | var oneStep = (duration!.inMicroseconds / 3).round(); 138 | _status = AnimationStatus.forward; 139 | _timers = [ 140 | Timer( 141 | Duration(microseconds: oneStep), 142 | () => setValue(1), 143 | ), 144 | Timer( 145 | Duration(microseconds: oneStep * 2), 146 | () => setValue(2), 147 | ), 148 | Timer( 149 | Duration(microseconds: oneStep * 3), 150 | () => setValue(3), 151 | ), 152 | Timer( 153 | Duration(microseconds: oneStep * 4), 154 | () { 155 | _status = AnimationStatus.completed; 156 | isAnimating = false; 157 | notifyListeners(); 158 | }, 159 | ), 160 | ]; 161 | } 162 | 163 | setValue(value) { 164 | _value = value; 165 | notifyListeners(); 166 | } 167 | 168 | reset() { 169 | _status = AnimationStatus.dismissed; 170 | _value = 0; 171 | } 172 | 173 | @override 174 | void dispose() { 175 | for (var timer in _timers) { 176 | timer.cancel(); 177 | } 178 | super.dispose(); 179 | } 180 | 181 | @override 182 | AnimationStatus get status => _status; 183 | late AnimationStatus _status; 184 | 185 | @override 186 | int? get value => _value; 187 | int? _value; 188 | } 189 | -------------------------------------------------------------------------------- /lib/glitch/glitch_page_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'glitch.dart'; 4 | 5 | class GlitchPageScreen extends StatelessWidget { 6 | const GlitchPageScreen({super.key}); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return MaterialApp( 11 | title: 'Flutter Demo', 12 | theme: ThemeData( 13 | primarySwatch: Colors.blue, 14 | visualDensity: VisualDensity.adaptivePlatformDensity, 15 | ), 16 | home: const MyHomePage(), 17 | ); 18 | } 19 | } 20 | 21 | class MyHomePage extends StatefulWidget { 22 | const MyHomePage({super.key}); 23 | 24 | @override 25 | State createState() => _MyHomePageState(); 26 | } 27 | 28 | class _MyHomePageState extends State { 29 | int _counter = 0; 30 | 31 | void _incrementCounter() { 32 | setState(() { 33 | _counter++; 34 | }); 35 | } 36 | 37 | @override 38 | Widget build(BuildContext context) { 39 | return Scaffold( 40 | appBar: AppBar( 41 | title: const GlithEffect( 42 | child: Text( 43 | 'Flutter Demo Home Page', 44 | ), 45 | ), 46 | ), 47 | body: Center( 48 | child: Column( 49 | mainAxisAlignment: MainAxisAlignment.start, 50 | children: [ 51 | const SizedBox(height: 100), 52 | GlithEffect( 53 | child: Image.asset( 54 | 'assets/kherel.jpeg', 55 | width: 150, 56 | ), 57 | ), 58 | const SizedBox(height: 100), 59 | const GlithEffect( 60 | child: Text( 61 | 'You have pushed the button this many times:', 62 | ), 63 | ), 64 | GlithEffect( 65 | child: Text( 66 | '$_counter', 67 | style: Theme.of(context).textTheme.headline4!.copyWith( 68 | fontSize: 60, 69 | ), 70 | ), 71 | ), 72 | const SizedBox(height: 50), 73 | GlithEffect( 74 | child: ElevatedButton( 75 | onPressed: _incrementCounter, 76 | child: const Icon(Icons.add), 77 | ), 78 | ), 79 | ], 80 | ), 81 | ), 82 | ); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /lib/humidity_slider/humidity.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class Humidity with ChangeNotifier { 4 | Humidity() { 5 | _transitionalValue = _defaultValue.toDouble(); 6 | _finalValue = _defaultValue; 7 | } 8 | 9 | final int _defaultValue = 37; 10 | 11 | double? _transitionalValue; 12 | double? get transitionalValue => _transitionalValue; 13 | 14 | int? _finalValue; 15 | int? get finalValue => _finalValue; 16 | 17 | void updateTrasitionalValue(double newValue) { 18 | _transitionalValue = newValue; 19 | notifyListeners(); 20 | } 21 | 22 | void updateFinalValue() { 23 | _finalValue = _transitionalValue!.round(); 24 | notifyListeners(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/humidity_slider/humidity_congfig.dart: -------------------------------------------------------------------------------- 1 | class HumidityConfig { 2 | int firstActiveIndex = 2; 3 | int lastActiveIndex = 7; 4 | 5 | final paddingTopInPercentage = 13.3; 6 | final paddingBottomInPercentage = 11.2; 7 | 8 | final List list = const [0, 10, 25, 30, 35, 40, 45, 50, 75, 100]; 9 | } 10 | 11 | double kNumberFontSize = 18; 12 | -------------------------------------------------------------------------------- /lib/humidity_slider/humidity_cureved_line.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_fun/humidity_slider/theme.dart'; 3 | 4 | class HumidityCurevedLine extends StatelessWidget { 5 | const HumidityCurevedLine({Key? key, this.y}) : super(key: key); 6 | 7 | final double? y; 8 | @override 9 | Widget build(BuildContext context) { 10 | return ClipPath( 11 | clipper: _MovingCurvedCliper(y), 12 | child: Container( 13 | width: 41, 14 | decoration: BoxDecoration( 15 | gradient: LinearGradient( 16 | begin: const Alignment(0, -1), 17 | end: const Alignment(0, 1), 18 | colors: [ 19 | BrandColors.background, 20 | BrandColors.redViolet, 21 | BrandColors.redViolet, 22 | BrandColors.cerulean, 23 | BrandColors.cerulean, 24 | BrandColors.redViolet, 25 | BrandColors.redViolet, 26 | BrandColors.background, 27 | ], 28 | stops: const [ 29 | 0.01, 30 | 0.1, 31 | 0.25, 32 | 0.37, 33 | 0.66, 34 | 0.78, 35 | 0.9, 36 | 0.99 37 | ]), 38 | ), 39 | ), 40 | ); 41 | } 42 | } 43 | 44 | class _MovingCurvedCliper extends CustomClipper { 45 | _MovingCurvedCliper(this.centerY); 46 | 47 | final double? centerY; 48 | 49 | @override 50 | Path getClip(Size size) { 51 | var unit = size.height / 100; 52 | 53 | var deltaY = -(52 - centerY! / unit) * unit; 54 | return Path() 55 | ..moveTo(unit * 4.49826, unit * 45.4994 + deltaY) 56 | ..lineTo(unit * 4.49826, 0.0) 57 | ..lineTo(unit * 5.02865, 0.0) 58 | ..lineTo(unit * 5.02865, unit * 45.4994 + deltaY) 59 | ..cubicTo(unit * 5.0289, unit * 48.0554 + deltaY, unit * 3.8406, 60 | unit * 49.3551 + deltaY, unit * 2.7054, unit * 50.5294 + deltaY) 61 | ..cubicTo(unit * 2.6739, unit * 50.5620 + deltaY, unit * 2.6424, 62 | unit * 50.5944 + deltaY, unit * 2.6111, unit * 50.6268 + deltaY) 63 | ..cubicTo(unit * 1.5185, unit * 51.7552 + deltaY, unit * 0.5304, 64 | unit * 52.7758 + deltaY, unit * 0.5304, unit * 54.7627 + deltaY) 65 | ..cubicTo(unit * 0.5304, unit * 56.7496 + deltaY, unit * 1.5185, 66 | unit * 57.7702 + deltaY, unit * 2.6111, unit * 58.8986 + deltaY) 67 | ..cubicTo(unit * 2.6424, unit * 58.9310 + deltaY, unit * 2.6739, 68 | unit * 58.9635 + deltaY, unit * 2.7054, unit * 58.9961 + deltaY) 69 | ..cubicTo(unit * 3.8406, unit * 60.1703 + deltaY, unit * 5.0289, 70 | unit * 61.4700 + deltaY, unit * 5.0286, unit * 64.0260 + deltaY) 71 | ..lineTo(unit * 5.02865, size.height) 72 | ..lineTo(unit * 4.49826, size.height) 73 | ..lineTo(unit * 4.49826, unit * 64.026 + deltaY) 74 | ..cubicTo(unit * 4.4985, unit * 61.6857 + deltaY, unit * 3.4377, 75 | unit * 60.5159 + deltaY, unit * 2.3237, unit * 59.3636 + deltaY) 76 | ..cubicTo(unit * 2.2857, unit * 59.3244 + deltaY, unit * 2.2477, 77 | unit * 59.2851 + deltaY, unit * 2.2096, unit * 59.2459 + deltaY) 78 | ..cubicTo(unit * 1.1236, unit * 58.1252 + deltaY, 0.0, 79 | unit * 56.9659 + deltaY, 0.0, unit * 54.7627 + deltaY) 80 | ..cubicTo(0.0, unit * 52.5596 + deltaY, unit * 1.1236, 81 | unit * 51.4003 + deltaY, unit * 2.2096, unit * 50.2796 + deltaY) 82 | ..cubicTo(unit * 2.2477, unit * 50.2403 + deltaY, unit * 2.2857, 83 | unit * 50.2011 + deltaY, unit * 2.3237, unit * 50.1618 + deltaY) 84 | ..cubicTo(unit * 3.4377, unit * 49.0096 + deltaY, unit * 4.4985, 85 | unit * 47.8397 + deltaY, unit * 4.4983, unit * 45.4994 + deltaY) 86 | ..close(); 87 | } 88 | 89 | @override 90 | bool shouldReclip(_MovingCurvedCliper oldClipper) { 91 | return oldClipper.centerY != centerY; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /lib/humidity_slider/humidity_info.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_fun/fun_icons_icons.dart'; 3 | import 'package:flutter_fun/humidity_slider/theme.dart'; 4 | import 'package:provider/provider.dart'; 5 | 6 | import 'humidity.dart'; 7 | 8 | class HumidityInfo extends StatelessWidget { 9 | const HumidityInfo({super.key}); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | var value = context.watch().finalValue; 14 | return Column( 15 | mainAxisAlignment: MainAxisAlignment.start, 16 | crossAxisAlignment: CrossAxisAlignment.start, 17 | children: [ 18 | const Spacer(flex: 2), 19 | Container( 20 | height: 470, 21 | alignment: Alignment.topLeft, 22 | child: Column( 23 | crossAxisAlignment: CrossAxisAlignment.start, 24 | children: [ 25 | const _Subtitle('Return temperature'), 26 | const Spacer(flex: 10), 27 | const Text( 28 | '20℃', 29 | style: TextStyle( 30 | fontSize: 30, 31 | fontWeight: FontWeight.bold, 32 | ), 33 | ), 34 | const Spacer(flex: 50), 35 | const _Subtitle('Current humidity'), 36 | const Spacer(flex: 10), 37 | Row( 38 | children: [ 39 | AnimatedLetter( 40 | letter: value.toString()[0], 41 | ), 42 | AnimatedLetter( 43 | letter: value.toString()[1], 44 | ), 45 | SizedBox( 46 | child: Text('%', style: currentHumidityStyle), 47 | ) 48 | ], 49 | ), 50 | const Spacer(flex: 40), 51 | const _Subtitle('Absolute humidity'), 52 | const Spacer(flex: 12), 53 | const Text( 54 | '4gr/fg3', 55 | style: TextStyle( 56 | fontSize: 27, 57 | fontWeight: FontWeight.bold, 58 | ), 59 | ), 60 | const Spacer(flex: 42), 61 | Icon( 62 | FunIcons.warningSign, 63 | color: BrandColors.attention, 64 | ), 65 | const Spacer(flex: 10), 66 | RichText( 67 | text: TextSpan( 68 | children: [ 69 | WidgetSpan( 70 | alignment: PlaceholderAlignment.middle, 71 | child: Icon( 72 | Icons.brightness_1, 73 | size: 8, 74 | color: BrandColors.attention, 75 | ), 76 | ), 77 | const TextSpan( 78 | style: TextStyle(height: 1.3), 79 | text: 80 | ' — extreme humidity level. \n Use precaution for set-points \n outside of 20%-50%', 81 | ), 82 | ], 83 | ), 84 | ) 85 | ], 86 | ), 87 | ), 88 | const Spacer(flex: 1), 89 | ], 90 | ); 91 | } 92 | } 93 | 94 | class AnimatedLetter extends StatefulWidget { 95 | const AnimatedLetter({super.key, this.letter}); 96 | 97 | final String? letter; 98 | 99 | @override 100 | State createState() => _AnimatedLetterState(); 101 | } 102 | 103 | class _AnimatedLetterState extends State 104 | with SingleTickerProviderStateMixin { 105 | AnimationController? controller; 106 | 107 | String? currentLetter; 108 | String? prevLetter; 109 | 110 | @override 111 | void initState() { 112 | controller = AnimationController( 113 | duration: const Duration(milliseconds: 300), 114 | vsync: this, 115 | ); 116 | currentLetter = widget.letter; 117 | prevLetter = widget.letter; 118 | super.initState(); 119 | } 120 | 121 | @override 122 | void didUpdateWidget(AnimatedLetter oldWidget) { 123 | if (widget.letter != oldWidget.letter) { 124 | setState(() { 125 | prevLetter = oldWidget.letter; 126 | currentLetter = widget.letter; 127 | controller! 128 | ..reset() 129 | ..forward(); 130 | }); 131 | } 132 | 133 | super.didUpdateWidget(oldWidget); 134 | } 135 | 136 | @override 137 | Widget build(BuildContext context) { 138 | return AnimatedBuilder( 139 | animation: controller!, 140 | builder: (_, __) { 141 | return SizedBox( 142 | width: 48, 143 | child: Stack( 144 | children: [ 145 | Transform.translate( 146 | offset: Offset(0, -controller!.value * 50), 147 | child: Opacity( 148 | opacity: 1 - controller!.value, 149 | child: Text( 150 | prevLetter!, 151 | style: currentHumidityStyle, 152 | ), 153 | ), 154 | ), 155 | Transform.translate( 156 | offset: Offset(0, 50 - controller!.value * 50), 157 | child: Opacity( 158 | opacity: controller!.value, 159 | child: Text( 160 | currentLetter!, 161 | style: currentHumidityStyle, 162 | ), 163 | ), 164 | ), 165 | ], 166 | ), 167 | ); 168 | }); 169 | } 170 | } 171 | 172 | class _Subtitle extends StatelessWidget { 173 | const _Subtitle( 174 | this.text, { 175 | Key? key, 176 | }) : super(key: key); 177 | 178 | final String text; 179 | @override 180 | Widget build(BuildContext context) { 181 | return Text( 182 | text.toUpperCase(), 183 | style: Theme.of(context).textTheme.subtitle1, 184 | ); 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /lib/humidity_slider/humidity_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provider/provider.dart'; 3 | 4 | import 'humidity.dart'; 5 | import 'humidity_congfig.dart'; 6 | import 'humidity_info.dart'; 7 | import 'scaffold.dart'; 8 | import 'slider.dart'; 9 | 10 | class HumidityScreen extends StatelessWidget { 11 | const HumidityScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return MultiProvider( 16 | providers: [ 17 | Provider(create: (_) => HumidityConfig()), 18 | ChangeNotifierProvider(create: (_) => Humidity()) 19 | ], 20 | child: const HSScaffold( 21 | activeIndex: 1, 22 | body: HumiditySliderPage(), 23 | ), 24 | ); 25 | } 26 | } 27 | 28 | class HumiditySliderPage extends StatelessWidget { 29 | const HumiditySliderPage({Key? key}) : super(key: key); 30 | 31 | final bool kShowBack = false; 32 | 33 | @override 34 | Widget build(BuildContext context) { 35 | return Container( 36 | alignment: Alignment.center, 37 | decoration: BoxDecoration( 38 | image: kShowBack 39 | ? const DecorationImage( 40 | image: AssetImage("assets/design.png"), 41 | fit: BoxFit.cover, 42 | ) 43 | : null, 44 | ), 45 | child: Row( 46 | crossAxisAlignment: CrossAxisAlignment.stretch, 47 | children: const [ 48 | SizedBox( 49 | width: 208, 50 | child: HumiditySlider(), 51 | ), 52 | Expanded(child: HumidityInfo()) 53 | ], 54 | ), 55 | ); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /lib/humidity_slider/measurement_numbers.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_fun/humidity_slider/theme.dart'; 3 | import 'package:provider/provider.dart'; 4 | 5 | import 'humidity.dart'; 6 | import 'humidity_congfig.dart'; 7 | 8 | class MeasurementNumbers extends StatefulWidget { 9 | const MeasurementNumbers( 10 | this.oneUnit, 11 | this.value, { 12 | super.key, 13 | }); 14 | 15 | final double oneUnit; 16 | final double? value; 17 | 18 | @override 19 | State createState() => _MeasurementNumbersState(); 20 | } 21 | 22 | class _MeasurementNumbersState extends State { 23 | int? activeIndex; 24 | 25 | late HumidityConfig config; 26 | @override 27 | void initState() { 28 | super.initState(); 29 | 30 | config = context.read(); 31 | var initValue = widget.value; 32 | 33 | activeIndex = findNearestIndex(initValue); 34 | } 35 | 36 | int findNearestIndex(double? value) { 37 | var a = [...config.list.reversed] 38 | ..sort((a, b) => (a - value!).abs().compareTo((b - value).abs())); 39 | return config.list.length - config.list.indexOf(a.first) - 1; 40 | } 41 | 42 | @override 43 | void didUpdateWidget(MeasurementNumbers oldWidget) { 44 | var oldActiveValue = config.list.reversed.toList()[activeIndex!]; 45 | 46 | var delta = (widget.value! - oldActiveValue).abs().round(); 47 | 48 | if (delta >= 5) { 49 | activeIndex = findNearestIndex(widget.value); 50 | } 51 | super.didUpdateWidget(oldWidget); 52 | } 53 | 54 | @override 55 | Widget build(BuildContext context) { 56 | var value = context.watch().transitionalValue!; 57 | 58 | var list = config.list; 59 | var firstIndex = config.firstActiveIndex; 60 | var lastIndex = config.lastActiveIndex; 61 | var paddingTop = config.paddingTopInPercentage * widget.oneUnit; 62 | var paddingBottom = config.paddingBottomInPercentage * widget.oneUnit; 63 | 64 | return Container( 65 | padding: const EdgeInsets.only(left: 10), 66 | child: Column( 67 | crossAxisAlignment: CrossAxisAlignment.start, 68 | children: [ 69 | SizedBox( 70 | height: paddingTop, 71 | child: Text(value.toStringAsFixed(3)), 72 | ), 73 | Expanded( 74 | child: Column( 75 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 76 | crossAxisAlignment: CrossAxisAlignment.start, 77 | children: _buildNumbers(list, firstIndex, lastIndex), 78 | ), 79 | ), 80 | SizedBox(height: paddingBottom), 81 | ], 82 | ), 83 | ); 84 | } 85 | 86 | List _buildNumbers(List list, int firstIndex, int lastIndex) { 87 | return list.reversed 88 | .toList() 89 | .asMap() 90 | .map((i, n) => MapEntry( 91 | i, 92 | Row( 93 | children: [ 94 | Icon( 95 | Icons.brightness_1, 96 | size: 6, 97 | color: n <= list[firstIndex] || n >= list[lastIndex] 98 | ? BrandColors.attention 99 | : Colors.transparent, 100 | ), 101 | AnimatedText( 102 | key: ValueKey(n), 103 | notActiveNumber: n, 104 | activeValue: widget.value, 105 | isActive: i == activeIndex, 106 | oneUnit: widget.oneUnit, 107 | ), 108 | ], 109 | ), 110 | )) 111 | .values 112 | .toList(); 113 | } 114 | } 115 | 116 | class AnimatedText extends StatefulWidget { 117 | const AnimatedText({ 118 | super.key, 119 | this.notActiveNumber, 120 | this.activeValue, 121 | this.isActive, 122 | this.oneUnit, 123 | }); 124 | 125 | final int? notActiveNumber; 126 | final double? activeValue; 127 | final double? oneUnit; 128 | final bool? isActive; 129 | 130 | @override 131 | State createState() => _AnimatedTextState(); 132 | } 133 | 134 | class _AnimatedTextState extends State 135 | with SingleTickerProviderStateMixin { 136 | AnimationController? controller; 137 | late Tween colorTween; 138 | 139 | @override 140 | void initState() { 141 | controller = AnimationController( 142 | duration: const Duration(milliseconds: 200), 143 | vsync: this, 144 | ); 145 | 146 | colorTween = ColorTween( 147 | begin: BrandColors.sugarCane, 148 | end: BrandColors.cerulean, 149 | ); 150 | if (widget.isActive!) { 151 | controller!.forward(); 152 | } 153 | super.initState(); 154 | } 155 | 156 | late bool isGoingUp; 157 | 158 | @override 159 | void didUpdateWidget(AnimatedText oldWidget) { 160 | if (widget.isActive! && !oldWidget.isActive!) { 161 | controller!.forward(); 162 | } else if (!widget.isActive! && oldWidget.isActive!) { 163 | isGoingUp = widget.activeValue! > widget.notActiveNumber!; 164 | controller!.reverse(); 165 | } 166 | 167 | super.didUpdateWidget(oldWidget); 168 | } 169 | 170 | @override 171 | Widget build(BuildContext context) { 172 | return AnimatedBuilder( 173 | animation: controller!, 174 | builder: (_, __) { 175 | String text; 176 | Offset offset; 177 | 178 | if (controller!.isAnimating && 179 | controller!.status == AnimationStatus.reverse) { 180 | var number = widget.notActiveNumber! + 181 | (controller!.value.round() * 5 * (isGoingUp ? -1 : 1)); 182 | text = ' $number%'; 183 | var dy = 184 | controller!.value * 5 * (isGoingUp ? -1 : 1) * widget.oneUnit!; 185 | offset = Offset(0, dy); 186 | } else { 187 | if (widget.isActive!) { 188 | text = ' ${widget.activeValue!.round()}%'; 189 | var dy = (widget.notActiveNumber! - widget.activeValue!) * 190 | widget.oneUnit!; 191 | offset = Offset(0, dy); 192 | } else { 193 | text = ' ${widget.notActiveNumber}%'; 194 | offset = Offset.zero; 195 | } 196 | } 197 | 198 | return Transform.scale( 199 | alignment: Alignment.centerLeft, 200 | scale: 1 + (0.4 * controller!.value), 201 | child: Transform.translate( 202 | offset: offset, 203 | child: Text( 204 | text, 205 | style: TextStyle( 206 | fontSize: kNumberFontSize, 207 | fontWeight: FontWeight.w900, 208 | height: 1, 209 | color: colorTween.evaluate(controller!), 210 | ), 211 | ), 212 | ), 213 | ); 214 | }); 215 | } 216 | } 217 | -------------------------------------------------------------------------------- /lib/humidity_slider/scaffold.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import 'package:flutter_fun/fun_icons_icons.dart'; 4 | import 'package:flutter_fun/humidity_slider/humidity_screen.dart'; 5 | import 'package:flutter_fun/humidity_slider/theme.dart'; 6 | import 'package:flutter_fun/utils/navigation.dart'; 7 | 8 | class HSScaffold extends StatelessWidget { 9 | const HSScaffold({ 10 | Key? key, 11 | this.body, 12 | required this.activeIndex, 13 | }) : super(key: key); 14 | 15 | final Widget? body; 16 | final int activeIndex; 17 | @override 18 | Widget build(BuildContext context) { 19 | SystemChrome.setSystemUIOverlayStyle( 20 | SystemUiOverlayStyle.dark.copyWith(statusBarBrightness: Brightness.dark), 21 | ); 22 | return Theme( 23 | data: humiditySliderTheme, 24 | child: Scaffold( 25 | backgroundColor: humiditySliderTheme.backgroundColor, 26 | body: SafeArea( 27 | child: Stack( 28 | children: [ 29 | body!, 30 | Align( 31 | alignment: Alignment.topRight, 32 | child: Padding( 33 | padding: const EdgeInsets.only(right: 15, top: 3), 34 | child: IconButton( 35 | iconSize: 44, 36 | icon: const Icon(Icons.more_horiz), 37 | onPressed: () => print('menu'), 38 | ), 39 | ), 40 | ), 41 | Align( 42 | alignment: Alignment.bottomCenter, 43 | child: Padding( 44 | padding: const EdgeInsets.symmetric(horizontal: 10), 45 | child: Row( 46 | mainAxisAlignment: MainAxisAlignment.spaceAround, 47 | children: [ 48 | _buildButton( 49 | context, 50 | FunIcons.chart, 51 | const _MockPage( 52 | iconData: FunIcons.chart, 53 | activeIndex: 0, 54 | ), 55 | isActive: activeIndex == 0, 56 | ), 57 | _buildButton( 58 | context, 59 | FunIcons.drop, 60 | const HumidityScreen(), 61 | isActive: activeIndex == 1, 62 | ), 63 | _buildButton( 64 | context, 65 | FunIcons.home, 66 | const _MockPage( 67 | iconData: FunIcons.home, 68 | activeIndex: 2, 69 | ), 70 | isActive: activeIndex == 2, 71 | ), 72 | ], 73 | ), 74 | ), 75 | ), 76 | ], 77 | ), 78 | ), 79 | ), 80 | ); 81 | } 82 | 83 | Widget _buildButton( 84 | BuildContext context, 85 | IconData iconData, 86 | Widget page, { 87 | bool isActive = false, 88 | }) { 89 | return IconButton( 90 | icon: Icon( 91 | iconData, 92 | color: isActive ? BrandColors.sugarCane : BrandColors.fiord, 93 | ), 94 | onPressed: isActive 95 | ? null 96 | : () => Navigator.of(context).pushReplacement(noAnimationRoute(page)), 97 | ); 98 | } 99 | } 100 | 101 | class _MockPage extends StatelessWidget { 102 | const _MockPage({ 103 | Key? key, 104 | required this.iconData, 105 | required this.activeIndex, 106 | }) : super(key: key); 107 | 108 | final IconData iconData; 109 | final int activeIndex; 110 | @override 111 | Widget build(BuildContext context) { 112 | return HSScaffold( 113 | activeIndex: activeIndex, 114 | body: Container( 115 | alignment: Alignment.center, 116 | child: Icon( 117 | iconData, 118 | color: BrandColors.sugarCane, 119 | size: 100, 120 | ), 121 | ), 122 | ); 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /lib/humidity_slider/slider.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math' as math; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_fun/humidity_slider/slider_ball.dart'; 5 | import 'package:provider/provider.dart'; 6 | 7 | import 'humidity.dart'; 8 | import 'humidity_congfig.dart'; 9 | import 'humidity_cureved_line.dart'; 10 | import 'measurement_numbers.dart'; 11 | import 'theme.dart'; 12 | 13 | class HumiditySlider extends StatelessWidget { 14 | const HumiditySlider({super.key}); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return LayoutBuilder(builder: (context, constraintes) { 19 | var maxHeight = constraintes.maxHeight; 20 | var oneUnit = maxHeight / 100; 21 | var value = context.watch().transitionalValue; 22 | return Row( 23 | children: [MeasurementNumbers(oneUnit, value), SliderHandle(oneUnit)], 24 | ); 25 | }); 26 | } 27 | } 28 | 29 | class SliderHandle extends StatefulWidget { 30 | const SliderHandle( 31 | this.oneUnit, { 32 | super.key, 33 | }); 34 | final double oneUnit; 35 | 36 | @override 37 | State createState() => _SliderHandleState(); 38 | } 39 | 40 | class _SliderHandleState extends State { 41 | double? dy = 400; 42 | double diameter = kBallSize; 43 | HumidityConfig? config; 44 | 45 | late double _min; 46 | double? _max; 47 | late double _stepHeight; 48 | late void Function(double) updateTrasitionalHumidity; 49 | late void Function() updateFinalHumidity; 50 | 51 | void handleDrag(details) { 52 | double? newDy = (details.globalPosition.dy - diameter).clamp(_min, _max); 53 | 54 | if (dy != newDy) { 55 | setState(() { 56 | updateTrasitionalHumidity(_calcualteHumidity(newDy)); 57 | dy = newDy; 58 | }); 59 | } 60 | } 61 | 62 | late double Function(double?) _calcualteHumidity; 63 | 64 | @override 65 | void initState() { 66 | super.initState(); 67 | updateTrasitionalHumidity = context.read().updateTrasitionalValue; 68 | updateFinalHumidity = context.read().updateFinalValue; 69 | 70 | config = context.read(); 71 | var fontSizeShift = kNumberFontSize / 2; 72 | 73 | var paddingTop = 74 | widget.oneUnit * config!.paddingTopInPercentage + fontSizeShift; 75 | var paddingBottom = 76 | widget.oneUnit * config!.paddingBottomInPercentage + fontSizeShift; 77 | var height = widget.oneUnit * 100; 78 | var body = height - paddingTop - paddingBottom; 79 | var stepsCount = config!.list.length; 80 | _stepHeight = body / (stepsCount - 1); 81 | var disacitvatedTopPart = 82 | _stepHeight * (stepsCount - config!.lastActiveIndex - 1); 83 | var disacitvatedBottomPart = _stepHeight * (config!.firstActiveIndex); 84 | 85 | _calcualteHumidity = (newDy) { 86 | var procantage = 1 - (newDy! - _min) / (_stepHeight * 5); 87 | 88 | var activeCapacity = config!.list[config!.lastActiveIndex] - 89 | config!.list[config!.firstActiveIndex]; 90 | return procantage * activeCapacity + 91 | config!.list[config!.firstActiveIndex]; 92 | }; 93 | 94 | _min = disacitvatedTopPart + paddingTop; 95 | _max = height - disacitvatedBottomPart - paddingBottom; 96 | } 97 | 98 | @override 99 | Widget build(BuildContext context) { 100 | var centerY = dy! - diameter / 2; 101 | return SizedBox( 102 | width: 100, 103 | child: Stack( 104 | fit: StackFit.passthrough, 105 | children: [ 106 | Positioned( 107 | top: 0, 108 | bottom: 0, 109 | left: 15, 110 | right: 40, 111 | child: CustomPaint(painter: LinesPainter(config, centerY)), 112 | ), 113 | Positioned( 114 | top: 0, 115 | bottom: 0, 116 | right: 25, 117 | child: HumidityCurevedLine( 118 | y: centerY, 119 | ), 120 | ), 121 | Positioned( 122 | right: 0, 123 | top: centerY, 124 | child: GestureDetector( 125 | onVerticalDragStart: handleDrag, 126 | onVerticalDragUpdate: handleDrag, 127 | onVerticalDragEnd: (_) => updateFinalHumidity(), 128 | child: const SliderBall(), 129 | ), 130 | ), 131 | ], 132 | ), 133 | ); 134 | } 135 | } 136 | 137 | class LinesPainter extends CustomPainter { 138 | LinesPainter(this.config, this.centerY); 139 | final HumidityConfig? config; 140 | final double centerY; 141 | 142 | @override 143 | void paint(Canvas canvas, Size size) { 144 | final width = size.width; 145 | final height = size.height; 146 | final linesCount = (config!.list.length - 1) * 5 + 1; 147 | 148 | final paddingTop = 149 | config!.paddingTopInPercentage * height / 100 + kNumberFontSize / 2; 150 | final paddingBottom = 151 | config!.paddingBottomInPercentage * height / 100 + kNumberFontSize / 2; 152 | 153 | final oneLineStep = 154 | (height - paddingTop - paddingBottom) / (linesCount - 1); 155 | var y = paddingTop; 156 | var path = Path(); 157 | 158 | for (var i = 0; i < linesCount; i++) { 159 | var isLong = i % 5 == 0; 160 | var startX = isLong ? 22.0 : 29.0; 161 | var endX = width; 162 | var fix = 23; // don't know why do I need it. 😅 163 | var distanceTillCenter = (y - centerY - fix).abs(); 164 | if (distanceTillCenter < 50) { 165 | var sin = distanceTillCenter / 50; 166 | var angle = math.asin(sin); 167 | var cos = math.cos(angle); 168 | var delta = 30 * cos * cos * 1.05; 169 | startX -= delta; 170 | endX -= delta; 171 | } 172 | path 173 | ..moveTo(startX, y) 174 | ..lineTo(endX, y); 175 | 176 | y += oneLineStep; 177 | } 178 | 179 | var paint = Paint() 180 | ..color = BrandColors.fiord 181 | ..style = PaintingStyle.stroke 182 | ..strokeWidth = 1; 183 | 184 | canvas.drawPath(path, paint); 185 | } 186 | 187 | @override 188 | bool shouldRepaint(CustomPainter oldDelegate) { 189 | return true; 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /lib/humidity_slider/slider_ball.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:flutter_fun/fun_icons_icons.dart'; 4 | import 'package:flutter_fun/humidity_slider/theme.dart'; 5 | 6 | class SliderBall extends StatelessWidget { 7 | const SliderBall({Key? key}) : super(key: key); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Container( 12 | decoration: const BoxDecoration( 13 | shape: BoxShape.circle, 14 | color: BrandColors.sugarCane, 15 | ), 16 | height: kBallSize, 17 | width: kBallSize, 18 | alignment: Alignment.center, 19 | child: const Icon( 20 | FunIcons.verticalArrows, 21 | color: BrandColors.fiord, 22 | size: 20, 23 | ), 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/humidity_slider/theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:google_fonts/google_fonts.dart'; 3 | 4 | var kBallSize = 44.0; 5 | 6 | var humiditySliderTheme = ThemeData.dark().copyWith( 7 | backgroundColor: BrandColors.background, 8 | textTheme: GoogleFonts.rubikTextTheme( 9 | TextTheme( 10 | subtitle1: TextStyle( 11 | color: BrandColors.secondaryText, 12 | fontSize: 14.5, 13 | ), 14 | bodyText1: TextStyle( 15 | color: BrandColors.mainText, 16 | ), 17 | ), 18 | ), 19 | ); 20 | 21 | var currentHumidityStyle = const TextStyle( 22 | fontSize: 80, 23 | fontWeight: FontWeight.bold, 24 | ); 25 | 26 | class BrandColors { 27 | static Color get attention => schoolBusYellow; 28 | static Color get background => blackpearl; 29 | static Color get mainText => sugarCane; 30 | static Color get secondaryText => fiord; 31 | static Color get active => cerulean; 32 | 33 | static const blackpearl = Color(0xFF060829); 34 | static const sugarCane = Color(0xFFfefffe); 35 | static const cerulean = Color(0xFF00b4e1); 36 | static const redViolet = Color(0xFFff008d); 37 | static const fiord = Color(0xFF444c68); 38 | static const schoolBusYellow = Color(0xFFfddc08); 39 | } 40 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_fun/glitch/glitch_page_screen.dart'; 3 | import 'package:flutter_fun/raw_rgba_fun/raw_rgba_screen.dart'; 4 | import 'package:flutter_fun/utils/navigation.dart'; 5 | import 'humidity_slider/humidity_screen.dart'; 6 | import 'today_list/today_list.dart'; 7 | 8 | void main() { 9 | runApp(const MyApp()); 10 | } 11 | 12 | class MyApp extends StatelessWidget { 13 | const MyApp({super.key}); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return const MaterialApp( 18 | title: 'Flutter Fun', 19 | home: Home(), 20 | ); 21 | } 22 | } 23 | 24 | class Home extends StatelessWidget { 25 | const Home({ 26 | Key? key, 27 | }) : super(key: key); 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | return Center( 32 | child: Column( 33 | mainAxisAlignment: MainAxisAlignment.center, 34 | children: [ 35 | ElevatedButton( 36 | child: const Text('Glitch effect'), 37 | onPressed: () => Navigator.of(context).push( 38 | noAnimationRoute(const GlitchPageScreen()), 39 | ), 40 | ), 41 | ElevatedButton( 42 | child: const Text('HumiditySlider'), 43 | onPressed: () => Navigator.of(context).push( 44 | noAnimationRoute(const HumidityScreen()), 45 | ), 46 | ), 47 | ElevatedButton( 48 | child: const Text('ImageAnimationScreen'), 49 | onPressed: () => Navigator.of(context).push( 50 | noAnimationRoute(const RawRgbaAnimationScreen()), 51 | ), 52 | ), 53 | ElevatedButton( 54 | child: const Text('IOS 13 Today List'), 55 | onPressed: () => Navigator.of(context).push( 56 | noAnimationRoute(const TodayListScreen()), 57 | ), 58 | ), 59 | ], 60 | ), 61 | ); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /lib/raw_rgba_fun/animated_points.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui' as ui; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_fun/raw_rgba_fun/points.dart'; 4 | import 'package:flutter_fun/raw_rgba_fun/settings.dart'; 5 | 6 | import 'package:provider/provider.dart'; 7 | 8 | class AnimatedPoints extends StatefulWidget { 9 | const AnimatedPoints({Key? key}) : super(key: key); 10 | 11 | @override 12 | State createState() => _AnimatedPointsState(); 13 | } 14 | 15 | class _AnimatedPointsState extends State 16 | with SingleTickerProviderStateMixin { 17 | late AnimationController controller; 18 | @override 19 | void initState() { 20 | controller = AnimationController( 21 | lowerBound: 0.0, 22 | upperBound: 1000.0, 23 | duration: const Duration(seconds: 1000), 24 | vsync: this, 25 | ); 26 | controller.forward(); 27 | super.initState(); 28 | } 29 | 30 | @override 31 | void dispose() { 32 | controller.dispose(); 33 | super.dispose(); 34 | } 35 | 36 | @override 37 | Widget build(BuildContext context) { 38 | var points = context.watch().points; 39 | var settings = context.watch(); 40 | 41 | return SizedBox( 42 | height: 300, 43 | width: MediaQuery.of(context).size.width, 44 | child: AnimatedBuilder( 45 | animation: controller, 46 | builder: (_, __) { 47 | return CustomPaint( 48 | painter: PointsPainter(points, controller.value, settings), 49 | ); 50 | }, 51 | ), 52 | ); 53 | } 54 | } 55 | 56 | class PointsPainter extends CustomPainter { 57 | PointsPainter( 58 | this.points, 59 | this.animationValue, 60 | this.settings, 61 | ); 62 | 63 | final List? points; 64 | final double animationValue; 65 | final Settings settings; 66 | 67 | @override 68 | void paint(ui.Canvas canvas, ui.Size size) { 69 | var paint = Paint()..style = PaintingStyle.fill; 70 | for (var point in points!) { 71 | paint.color = point.color; 72 | // print(point.startDelay); 73 | if (animationValue >= point.startDelay) { 74 | var animationFactor = 75 | ((animationValue - point.startDelay) * settings.speed % kMax / kMax) 76 | .abs(); 77 | 78 | var size = settings.size * point.sizeFactor * animationFactor; 79 | canvas.drawCircle( 80 | point.offset, 81 | size, 82 | paint, 83 | ); 84 | } 85 | } 86 | } 87 | 88 | @override 89 | bool shouldRepaint(CustomPainter oldDelegate) => true; 90 | } 91 | -------------------------------------------------------------------------------- /lib/raw_rgba_fun/points.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_fun/raw_rgba_fun/settings.dart'; 5 | 6 | class PointNotifier with ChangeNotifier { 7 | List? _points; 8 | bool _isReady = false; 9 | 10 | List? get points => _points; 11 | bool get isReady => _isReady; 12 | 13 | void setPoints(List points) => _points = points; 14 | 15 | void setIsReady(bool isReady) { 16 | _isReady = isReady; 17 | notifyListeners(); 18 | } 19 | } 20 | 21 | Random random = Random(); 22 | 23 | class Point { 24 | Point(this.offset, int alfa, int speed) 25 | : sizeFactor = alfa / 255, 26 | color = Colors.primaries[random.nextInt(Colors.primaries.length)], 27 | startDelay = random.nextDouble() * kMax - speed; 28 | 29 | final Offset offset; 30 | final double sizeFactor; 31 | final Color color; 32 | final double startDelay; 33 | } 34 | -------------------------------------------------------------------------------- /lib/raw_rgba_fun/raw_rgba_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_fun/raw_rgba_fun/points.dart'; 3 | import 'package:flutter_fun/raw_rgba_fun/screenshot.dart'; 4 | import 'package:flutter_fun/raw_rgba_fun/settings.dart'; 5 | import 'package:flutter_fun/raw_rgba_fun/settings_form.dart'; 6 | 7 | import 'package:provider/provider.dart'; 8 | 9 | import 'animated_points.dart'; 10 | 11 | class RawRgbaAnimationScreen extends StatelessWidget { 12 | const RawRgbaAnimationScreen({super.key}); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return MultiProvider( 17 | providers: [ 18 | ChangeNotifierProvider(create: (_) => PointNotifier()), 19 | ChangeNotifierProvider(create: (_) => Settings()) 20 | ], 21 | child: Material( 22 | child: Scaffold( 23 | body: SafeArea( 24 | child: SingleChildScrollView( 25 | child: Column( 26 | children: const [ 27 | MainScene(), 28 | SettingsForm(), 29 | ], 30 | ), 31 | ), 32 | ), 33 | ), 34 | ), 35 | ); 36 | } 37 | } 38 | 39 | class MainScene extends StatefulWidget { 40 | const MainScene({super.key}); 41 | 42 | @override 43 | State createState() => _MainSceneState(); 44 | } 45 | 46 | class _MainSceneState extends State { 47 | @override 48 | Widget build(BuildContext context) { 49 | final settings = context.watch(); 50 | return context.watch().isReady 51 | ? const AnimatedPoints() 52 | : ScreenShot( 53 | size: settings.size, 54 | speed: settings.speed, 55 | resolution: settings.resolution, 56 | text: settings.text, 57 | ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /lib/raw_rgba_fun/screenshot.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:typed_data'; 3 | import 'dart:ui' as ui; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/rendering.dart'; 6 | import 'package:flutter_fun/raw_rgba_fun/points.dart'; 7 | import 'package:flutter_fun/raw_rgba_fun/settings.dart'; 8 | 9 | import 'package:provider/provider.dart'; 10 | 11 | class ScreenShot extends StatefulWidget { 12 | const ScreenShot({ 13 | Key? key, 14 | this.size, 15 | this.speed, 16 | this.resolution, 17 | this.text, 18 | }) : super(key: key); 19 | 20 | final int? size; 21 | final int? speed; 22 | final int? resolution; 23 | final String? text; 24 | 25 | @override 26 | State createState() => _ScreenShotState(); 27 | } 28 | 29 | class _ScreenShotState extends State { 30 | final GlobalKey _globalKey = GlobalKey(); 31 | @override 32 | void initState() { 33 | super.initState(); 34 | WidgetsBinding.instance.addPostFrameCallback((_) => _setArray()); 35 | } 36 | 37 | _setArray() async { 38 | var notifier = context.read(); 39 | Future.delayed(const Duration(milliseconds: 100), () async { 40 | try { 41 | RenderRepaintBoundary boundary = _globalKey.currentContext! 42 | .findRenderObject() as RenderRepaintBoundary; 43 | var image = await boundary.toImage(pixelRatio: 1); 44 | var width = image.width; 45 | var height = image.height; 46 | 47 | var byteData = await (image.toByteData( 48 | format: ui.ImageByteFormat.rawRgba) as FutureOr); 49 | var pngBytes = byteData.buffer.asUint8List(); 50 | var points = []; 51 | 52 | /// [step] is how many pixel we step forvard, cannot be 0; 53 | var step = kMax.round() - widget.resolution! + 1; 54 | for (var y = 3; y < height; y += step) { 55 | for (var x = 0; x < width; x += step) { 56 | var index = 4 * (y * width + x) + 3; 57 | 58 | if (pngBytes[index] != 0) { 59 | points.add( 60 | Point( 61 | Offset( 62 | x.toDouble(), 63 | y.toDouble(), 64 | ), 65 | pngBytes[index], 66 | widget.speed!, 67 | ), 68 | ); 69 | } 70 | } 71 | } 72 | notifier 73 | ..setPoints(points) 74 | ..setIsReady(true); 75 | } catch (e) { 76 | print(e); 77 | } 78 | }); 79 | } 80 | 81 | AnimationController? controller; 82 | @override 83 | void didUpdateWidget(ScreenShot oldWidget) { 84 | if (oldWidget.size != widget.size || 85 | oldWidget.speed != widget.speed || 86 | oldWidget.resolution != widget.resolution || 87 | oldWidget.text != widget.text) { 88 | context.read().setIsReady(false); 89 | _setArray(); 90 | } 91 | 92 | super.didUpdateWidget(oldWidget); 93 | } 94 | 95 | @override 96 | Widget build(BuildContext context) { 97 | return RepaintBoundary( 98 | key: _globalKey, 99 | child: SizedBox( 100 | height: 300, 101 | width: MediaQuery.of(context).size.width, 102 | child: Column( 103 | mainAxisAlignment: MainAxisAlignment.center, 104 | children: [ 105 | const FlutterLogo( 106 | size: 150, 107 | ), 108 | const SizedBox(height: 30), 109 | Text( 110 | context.watch().text, 111 | style: const TextStyle(fontSize: 55), 112 | ), 113 | ], 114 | ), 115 | ), 116 | ); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /lib/raw_rgba_fun/settings.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | const kMax = 5.0; 4 | 5 | class Settings with ChangeNotifier { 6 | int _size = 3; 7 | int _speed = 1; 8 | int _resolution = 3; 9 | String _text = 'Flutter'; 10 | 11 | int get size => _size; 12 | int get speed => _speed; 13 | int get resolution => _resolution; 14 | String get text => _text; 15 | 16 | void updateText(String newValue) { 17 | _text = newValue; 18 | notifyListeners(); 19 | } 20 | 21 | void updateSize(double newValue) { 22 | _size = newValue.round(); 23 | notifyListeners(); 24 | } 25 | 26 | void updateDuration(double newValue) { 27 | _speed = newValue.round(); 28 | notifyListeners(); 29 | } 30 | 31 | void updateResolution(double newValue) { 32 | _resolution = newValue.round(); 33 | notifyListeners(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/raw_rgba_fun/settings_form.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_fun/raw_rgba_fun/points.dart'; 3 | import 'package:flutter_fun/raw_rgba_fun/settings.dart'; 4 | import 'package:provider/provider.dart'; 5 | 6 | class SettingsForm extends StatefulWidget { 7 | const SettingsForm({Key? key}) : super(key: key); 8 | 9 | @override 10 | State createState() => _SettingsFormState(); 11 | } 12 | 13 | class _SettingsFormState extends State { 14 | TextEditingController? _controller; 15 | 16 | late double _resolution; 17 | late double _size; 18 | late double _speed; 19 | 20 | @override 21 | void initState() { 22 | var settings = context.read(); 23 | _controller = TextEditingController(text: settings.text); 24 | _resolution = settings.resolution.toDouble(); 25 | _size = settings.size.toDouble(); 26 | _speed = settings.speed.toDouble(); 27 | 28 | super.initState(); 29 | } 30 | 31 | @override 32 | void dispose() { 33 | _controller!.dispose(); 34 | super.dispose(); 35 | } 36 | 37 | void Function(double value) _notifyChange(Function callback) => 38 | (double value) { 39 | callback(value); 40 | context.read().setIsReady(false); 41 | }; 42 | 43 | @override 44 | Widget build(BuildContext context) { 45 | final settings = Provider.of(context); 46 | 47 | return Padding( 48 | padding: const EdgeInsets.symmetric(horizontal: 40.0), 49 | child: Column( 50 | children: [ 51 | TextField( 52 | textAlign: TextAlign.center, 53 | controller: _controller, 54 | onChanged: (String value) { 55 | context.read().setIsReady(false); 56 | settings.updateText(value); 57 | }, 58 | ), 59 | const SizedBox(height: 30), 60 | _buildSlider( 61 | 'Size', 62 | _size, 63 | (v) => _size = v, 64 | _notifyChange(settings.updateSize), 65 | ), 66 | _buildSlider( 67 | 'Speed', 68 | _speed, 69 | (v) => _speed = v, 70 | _notifyChange(settings.updateDuration), 71 | ), 72 | _buildSlider( 73 | 'Resolution', 74 | _resolution, 75 | (v) => _resolution = v, 76 | _notifyChange(settings.updateResolution), 77 | ), 78 | ], 79 | ), 80 | ); 81 | } 82 | 83 | Widget _buildSlider( 84 | String name, 85 | double value, 86 | Function onChange, 87 | Function setValue, { 88 | canBeZero = false, 89 | }) { 90 | return Row( 91 | mainAxisAlignment: MainAxisAlignment.center, 92 | children: [ 93 | Expanded(child: Text(name)), 94 | Slider( 95 | min: canBeZero ? 0 : 1, 96 | max: kMax, 97 | value: value.toDouble(), 98 | onChanged: (value) => 99 | setState(() => onChange(value.round().toDouble())), 100 | onChangeEnd: setValue as void Function(double)?, 101 | ), 102 | ], 103 | ); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /lib/today_list/arrow_button.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math' as math; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | class ArrowButton extends StatefulWidget { 6 | const ArrowButton({ 7 | super.key, 8 | required this.onTap, 9 | required this.isExpanded, 10 | }); 11 | 12 | final void Function(bool isExpanded) onTap; 13 | final bool isExpanded; 14 | 15 | @override 16 | State createState() => _ArrowButtonState(); 17 | } 18 | 19 | class _ArrowButtonState extends State 20 | with SingleTickerProviderStateMixin { 21 | late AnimationController _controller; 22 | late Animation _animation; 23 | 24 | @override 25 | void dispose() { 26 | _controller.dispose(); 27 | super.dispose(); 28 | } 29 | 30 | @override 31 | void initState() { 32 | _controller = AnimationController( 33 | duration: const Duration(milliseconds: 150), 34 | vsync: this, 35 | ); 36 | _animation = _controller.drive(CurveTween(curve: Curves.easeIn)); 37 | 38 | super.initState(); 39 | } 40 | 41 | void _handleTap() { 42 | setState(() { 43 | widget.onTap(!widget.isExpanded); 44 | if (widget.isExpanded) { 45 | _controller.reverse(); 46 | } else { 47 | _controller.forward(); 48 | } 49 | }); 50 | } 51 | 52 | @override 53 | Widget build(BuildContext context) { 54 | return GestureDetector( 55 | onTap: _handleTap, 56 | behavior: HitTestBehavior.opaque, 57 | child: Padding( 58 | padding: const EdgeInsets.all(3.0), 59 | child: AnimatedBuilder( 60 | animation: _controller.view, 61 | builder: (context, child) { 62 | return Transform.rotate( 63 | angle: math.pi * _animation.value * 0.5, 64 | child: child, 65 | ); 66 | }, 67 | child: const Icon( 68 | Icons.arrow_forward_ios, 69 | color: Colors.white30, 70 | size: 14, 71 | ), 72 | ), 73 | ), 74 | ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /lib/today_list/colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class BrandColors { 4 | static Color pink = const Color(0xFFece4f7); 5 | 6 | static Gradient gradient1 = const LinearGradient(colors: [ 7 | Colors.blue, 8 | Colors.blueAccent, 9 | ]); 10 | 11 | static Gradient gradient2 = const LinearGradient( 12 | colors: [ 13 | Colors.redAccent, 14 | Colors.orange, 15 | ], 16 | begin: Alignment.topLeft, 17 | end: Alignment.bottomRight, 18 | ); 19 | 20 | static Gradient gradient3 = const RadialGradient( 21 | colors: [ 22 | Colors.greenAccent, 23 | Colors.green, 24 | ], 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /lib/today_list/header_icon.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class HeaderIcon extends StatelessWidget { 4 | const HeaderIcon({ 5 | super.key, 6 | required this.gradient, 7 | required this.iconData, 8 | }); 9 | 10 | final IconData iconData; 11 | final Gradient gradient; 12 | @override 13 | Widget build(BuildContext context) { 14 | return ClipRRect( 15 | borderRadius: BorderRadius.circular(5), 16 | child: Container( 17 | decoration: BoxDecoration(gradient: gradient), 18 | height: 23, 19 | width: 23, 20 | child: Icon( 21 | iconData, 22 | size: 18, 23 | color: Colors.white, 24 | ), 25 | ), 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/today_list/search.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | import 'colors.dart'; 7 | 8 | class Search extends StatelessWidget { 9 | const Search({super.key}); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Container( 14 | margin: const EdgeInsets.only(bottom: 10), 15 | decoration: const BoxDecoration( 16 | boxShadow: [ 17 | BoxShadow( 18 | blurRadius: 5, 19 | spreadRadius: 5, 20 | color: Colors.black12, 21 | ), 22 | ], 23 | ), 24 | child: ClipRRect( 25 | borderRadius: BorderRadius.circular(10), 26 | child: BackdropFilter( 27 | filter: ImageFilter.blur(sigmaX: 8, sigmaY: 3), 28 | child: Container( 29 | decoration: BoxDecoration( 30 | backgroundBlendMode: BlendMode.plus, 31 | color: Colors.white.withOpacity(0.08), 32 | ), 33 | alignment: Alignment.center, 34 | height: 35, 35 | child: Row( 36 | mainAxisAlignment: MainAxisAlignment.center, 37 | children: [ 38 | Padding( 39 | padding: const EdgeInsets.symmetric(horizontal: 7), 40 | child: Icon( 41 | CupertinoIcons.search, 42 | color: BrandColors.pink, 43 | size: 20, 44 | ), 45 | ), 46 | Text( 47 | 'Search', 48 | style: TextStyle(color: BrandColors.pink, fontSize: 16), 49 | ), 50 | const Spacer(), 51 | Padding( 52 | padding: const EdgeInsets.symmetric(horizontal: 7), 53 | child: Icon( 54 | CupertinoIcons.mic_solid, 55 | color: BrandColors.pink, 56 | size: 20, 57 | ), 58 | ), 59 | ], 60 | ), 61 | ), 62 | ), 63 | ), 64 | ); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/today_list/today_list.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | 7 | import 'arrow_button.dart'; 8 | import 'colors.dart'; 9 | import 'header_icon.dart'; 10 | import 'search.dart'; 11 | 12 | class TodayListScreen extends StatelessWidget { 13 | const TodayListScreen({Key? key}) : super(key: key); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | SystemChrome.setSystemUIOverlayStyle( 18 | SystemUiOverlayStyle.dark.copyWith(statusBarBrightness: Brightness.dark), 19 | ); 20 | return const TodayList(); 21 | } 22 | } 23 | 24 | class TodayList extends StatelessWidget { 25 | const TodayList({Key? key}) : super(key: key); 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | return Scaffold( 30 | backgroundColor: Colors.black, 31 | body: Container( 32 | decoration: const BoxDecoration( 33 | image: DecorationImage( 34 | fit: BoxFit.fill, 35 | image: AssetImage( 36 | 'assets/background.jpg', 37 | ), 38 | ), 39 | ), 40 | alignment: Alignment.topLeft, 41 | child: SafeArea( 42 | child: Padding( 43 | padding: const EdgeInsets.all(8.0), 44 | child: Column( 45 | children: [ 46 | const Search(), 47 | Expanded( 48 | child: CustomScrollView( 49 | slivers: [ 50 | TodayListTile( 51 | title: 'Teléfono', 52 | main: _BrandTable( 53 | list: [ 54 | _TableRowData( 55 | text: 'Calls:', 56 | color: Colors.yellow, 57 | count: 3, 58 | hasPoint: true), 59 | _TableRowData( 60 | text: 'Messages:', 61 | color: Colors.greenAccent, 62 | count: 2, 63 | hasPoint: true), 64 | ], 65 | ), 66 | extra: _BrandTable( 67 | list: [ 68 | _TableRowData( 69 | text: 'Emails:', 70 | color: Colors.blue, 71 | count: 99, 72 | hasPoint: true), 73 | _TableRowData( 74 | text: 'SMS:', 75 | color: Colors.greenAccent, 76 | count: 0, 77 | hasPoint: false), 78 | ], 79 | ), 80 | icon: HeaderIcon( 81 | iconData: CupertinoIcons.phone_solid, 82 | gradient: BrandColors.gradient3, 83 | ), 84 | ), 85 | TodayListTile( 86 | title: 'Duración de la batería', 87 | main: _BrandTable( 88 | list: [ 89 | _TableRowData( 90 | text: 'Time left:', 91 | color: Colors.orangeAccent, 92 | count: 2, 93 | hasPoint: true), 94 | _TableRowData( 95 | text: 'Time needed to full charge:', 96 | color: Colors.greenAccent, 97 | count: 3, 98 | hasPoint: true), 99 | ], 100 | ), 101 | icon: HeaderIcon( 102 | iconData: CupertinoIcons.battery_25_percent, 103 | gradient: BrandColors.gradient2, 104 | ), 105 | ), 106 | TodayListTile( 107 | title: 'Despertador', 108 | main: _BrandTable( 109 | list: [ 110 | _TableRowData( 111 | text: 'Calls:', 112 | color: Colors.yellow, 113 | count: 3, 114 | hasPoint: true), 115 | _TableRowData( 116 | text: 'Messages:', 117 | color: Colors.greenAccent, 118 | count: 2, 119 | hasPoint: true), 120 | ], 121 | ), 122 | icon: HeaderIcon( 123 | iconData: CupertinoIcons.clock, 124 | gradient: BrandColors.gradient1, 125 | ), 126 | ), 127 | SliverToBoxAdapter( 128 | child: Container( 129 | height: 600, 130 | color: Colors.blueAccent, 131 | ), 132 | ) 133 | ], 134 | ), 135 | ) 136 | ], 137 | ), 138 | ), 139 | ), 140 | ), 141 | ); 142 | } 143 | } 144 | 145 | class TodayListTile extends StatefulWidget { 146 | const TodayListTile({ 147 | super.key, 148 | required this.title, 149 | required this.icon, 150 | required this.main, 151 | this.extra, 152 | }); 153 | 154 | final String title; 155 | final HeaderIcon icon; 156 | final Widget main; 157 | final Widget? extra; 158 | 159 | @override 160 | State createState() => _TodayListTileState(); 161 | } 162 | 163 | class _TodayListTileState extends State { 164 | double maxExtend = 200; 165 | 166 | late double extraHeight; 167 | late double mainHeight; 168 | 169 | final GlobalKey mainKey = GlobalKey(); 170 | final GlobalKey extraKey = GlobalKey(); 171 | bool isOpen = false; 172 | 173 | @override 174 | void initState() { 175 | super.initState(); 176 | WidgetsBinding.instance.addPostFrameCallback( 177 | (_) => setState( 178 | () { 179 | mainHeight = mainKey.currentContext!.size!.height; 180 | if (widget.extra != null) { 181 | extraHeight = extraKey.currentContext!.size!.height; 182 | } 183 | maxExtend = mainHeight + 45; 184 | }, 185 | ), 186 | ); 187 | } 188 | 189 | @override 190 | Widget build(BuildContext context) { 191 | return SliverPersistentHeader( 192 | pinned: false, 193 | delegate: _TodayListTileDelegate( 194 | mainKey: mainKey, 195 | extraKey: extraKey, 196 | widget: widget, 197 | maxExtent: maxExtend, 198 | isOpen: isOpen, 199 | setMaxExtend: (bool isOpen) { 200 | setState(() { 201 | this.isOpen = isOpen; 202 | maxExtend = (isOpen ? mainHeight + extraHeight : mainHeight) + 45; 203 | }); 204 | }), 205 | ); 206 | } 207 | } 208 | 209 | class _TodayListTileDelegate extends SliverPersistentHeaderDelegate { 210 | final TodayListTile? widget; 211 | final void Function(bool isOpen)? setMaxExtend; 212 | 213 | _TodayListTileDelegate({ 214 | this.widget, 215 | required this.maxExtent, 216 | this.setMaxExtend, 217 | this.mainKey, 218 | this.extraKey, 219 | this.isOpen, 220 | }); 221 | 222 | final Key? mainKey; 223 | final Key? extraKey; 224 | final bool? isOpen; 225 | 226 | @override 227 | Widget build(context, shrinkOffset, overlapsContent) { 228 | var leftSize = maxExtent - shrinkOffset; 229 | var v = leftSize.clamp(0, 45) / 45; 230 | 231 | bool isShrinking = v < 1; 232 | 233 | var scale = v * 0.2 + 0.8; 234 | var dy = 5 - (leftSize.clamp(0, 30) / 30) * 5; 235 | var child = Transform.scale( 236 | scale: scale, 237 | child: Transform.translate( 238 | offset: Offset(0, dy), 239 | child: Container( 240 | margin: const EdgeInsets.only(bottom: 5), 241 | height: isShrinking ? 40 : null, 242 | child: ClipRRect( 243 | borderRadius: BorderRadius.circular(10), 244 | child: BackdropFilter( 245 | filter: ImageFilter.blur(sigmaX: 10, sigmaY: 40), 246 | child: Container( 247 | decoration: BoxDecoration( 248 | color: Colors.black.withOpacity(0.18), 249 | ), 250 | child: SingleChildScrollView( 251 | physics: const NeverScrollableScrollPhysics(), 252 | child: Column( 253 | mainAxisSize: MainAxisSize.min, 254 | children: [ 255 | tileHeader(), 256 | Container( 257 | key: mainKey, 258 | child: widget!.main, 259 | ), 260 | if (widget!.extra != null) 261 | Container( 262 | key: extraKey, 263 | child: widget!.extra, 264 | ) 265 | ], 266 | ), 267 | ), 268 | ), 269 | ), 270 | ), 271 | ), 272 | ), 273 | ); 274 | 275 | if (isShrinking) { 276 | return SingleChildScrollView( 277 | physics: const NeverScrollableScrollPhysics(), 278 | child: IgnorePointer( 279 | ignoringSemantics: false, 280 | child: Container( 281 | padding: const EdgeInsets.only(bottom: 10), 282 | child: child, 283 | ), 284 | ), 285 | ); 286 | } 287 | 288 | return child; 289 | } 290 | 291 | Padding tileHeader() { 292 | return Padding( 293 | padding: const EdgeInsets.all(8), 294 | child: Row( 295 | children: [ 296 | widget!.icon, 297 | const SizedBox(width: 10), 298 | Text( 299 | widget!.title, 300 | style: const TextStyle( 301 | color: Colors.white30, 302 | fontWeight: FontWeight.w500, 303 | fontSize: 14, 304 | ), 305 | ), 306 | const Spacer(), 307 | if (widget!.extra != null) 308 | ArrowButton( 309 | onTap: setMaxExtend!, 310 | isExpanded: isOpen!, 311 | ), 312 | ], 313 | ), 314 | ); 315 | } 316 | 317 | @override 318 | double maxExtent; 319 | 320 | @override 321 | double get minExtent => 0; 322 | 323 | @override 324 | bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) => true; 325 | } 326 | 327 | class _BrandTable extends StatelessWidget { 328 | const _BrandTable({ 329 | Key? key, 330 | required this.list, 331 | }) : super(key: key); 332 | 333 | final List<_TableRowData> list; 334 | @override 335 | Widget build(BuildContext context) { 336 | return Container( 337 | alignment: Alignment.center, 338 | padding: const EdgeInsets.all(5), 339 | child: Table( 340 | defaultColumnWidth: const FlexColumnWidth(0.2), 341 | defaultVerticalAlignment: TableCellVerticalAlignment.middle, 342 | columnWidths: const { 343 | 1: FlexColumnWidth(1), 344 | 2: FlexColumnWidth(0.5), 345 | }, 346 | children: list 347 | .map((d) => buildRow(d.text!, d.color, d.count, d.hasPoint!)) 348 | .toList(), 349 | ), 350 | ); 351 | } 352 | 353 | TableRow buildRow( 354 | String text, 355 | Color? color, 356 | int? count, 357 | bool hasPoint, 358 | ) { 359 | return TableRow( 360 | children: [ 361 | Visibility( 362 | visible: hasPoint, 363 | child: Container( 364 | decoration: BoxDecoration( 365 | shape: BoxShape.circle, 366 | color: color, 367 | ), 368 | width: 5, 369 | height: 5, 370 | ), 371 | ), 372 | Text( 373 | text, 374 | style: TextStyle(color: color), 375 | ), 376 | Text( 377 | count.toString(), 378 | style: TextStyle(color: color), 379 | textAlign: TextAlign.center, 380 | ), 381 | ], 382 | ); 383 | } 384 | } 385 | 386 | class _TableRowData { 387 | _TableRowData({this.text, this.color, this.count, this.hasPoint}); 388 | 389 | final String? text; 390 | final Color? color; 391 | final int? count; 392 | final bool? hasPoint; 393 | } 394 | -------------------------------------------------------------------------------- /lib/utils/colors.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | // getRandomColor() => Colors.primaries[Random().nextInt(Colors.primaries.length)]; 6 | 7 | getRandomColor() => [ 8 | Colors.blueAccent, 9 | Colors.redAccent, 10 | Colors.greenAccent, 11 | ][Random().nextInt(3)]; 12 | -------------------------------------------------------------------------------- /lib/utils/navigation.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | Route noAnimationRoute(Widget widget) => PageRouteBuilder( 4 | pageBuilder: (context, animation1, animation2) => widget, 5 | ); 6 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "flutter_fun") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "dev.kherel.flutter_fun") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | # Generated plugin build rules, which manage building the plugins and adding 90 | # them to the application. 91 | include(flutter/generated_plugins.cmake) 92 | 93 | 94 | # === Installation === 95 | # By default, "installing" just makes a relocatable bundle in the build 96 | # directory. 97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 100 | endif() 101 | 102 | # Start with a clean build bundle directory every time. 103 | install(CODE " 104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 105 | " COMPONENT Runtime) 106 | 107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 109 | 110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 111 | COMPONENT Runtime) 112 | 113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 114 | COMPONENT Runtime) 115 | 116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 117 | COMPONENT Runtime) 118 | 119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 120 | install(FILES "${bundled_library}" 121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 122 | COMPONENT Runtime) 123 | endforeach(bundled_library) 124 | 125 | # Fully re-copy the assets directory on each build to avoid having stale files 126 | # from a previous install. 127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 128 | install(CODE " 129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 130 | " COMPONENT Runtime) 131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 133 | 134 | # Install the AOT library on non-Debug builds only. 135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 137 | COMPONENT Runtime) 138 | endif() 139 | -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "flutter_fun"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "flutter_fun"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import path_provider_macos 9 | 10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 11 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 12 | } 13 | -------------------------------------------------------------------------------- /macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.11' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = flutter_fun 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = dev.kherel.flutterFun 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 dev.kherel. All rights reserved. 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.9.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.2.1" 25 | clock: 26 | dependency: transitive 27 | description: 28 | name: clock 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.1.1" 32 | collection: 33 | dependency: transitive 34 | description: 35 | name: collection 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.16.0" 39 | crypto: 40 | dependency: transitive 41 | description: 42 | name: crypto 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "3.0.2" 46 | cupertino_icons: 47 | dependency: "direct main" 48 | description: 49 | name: cupertino_icons 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.0.5" 53 | fake_async: 54 | dependency: transitive 55 | description: 56 | name: fake_async 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "1.3.1" 60 | ffi: 61 | dependency: transitive 62 | description: 63 | name: ffi 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "2.0.1" 67 | file: 68 | dependency: transitive 69 | description: 70 | name: file 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "6.1.2" 74 | flutter: 75 | dependency: "direct main" 76 | description: flutter 77 | source: sdk 78 | version: "0.0.0" 79 | flutter_lints: 80 | dependency: "direct dev" 81 | description: 82 | name: flutter_lints 83 | url: "https://pub.dartlang.org" 84 | source: hosted 85 | version: "2.0.1" 86 | flutter_test: 87 | dependency: "direct dev" 88 | description: flutter 89 | source: sdk 90 | version: "0.0.0" 91 | google_fonts: 92 | dependency: "direct main" 93 | description: 94 | name: google_fonts 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "3.0.1" 98 | http: 99 | dependency: transitive 100 | description: 101 | name: http 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "0.13.4" 105 | http_parser: 106 | dependency: transitive 107 | description: 108 | name: http_parser 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "4.0.1" 112 | lints: 113 | dependency: transitive 114 | description: 115 | name: lints 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "2.0.1" 119 | matcher: 120 | dependency: transitive 121 | description: 122 | name: matcher 123 | url: "https://pub.dartlang.org" 124 | source: hosted 125 | version: "0.12.12" 126 | material_color_utilities: 127 | dependency: transitive 128 | description: 129 | name: material_color_utilities 130 | url: "https://pub.dartlang.org" 131 | source: hosted 132 | version: "0.1.5" 133 | meta: 134 | dependency: transitive 135 | description: 136 | name: meta 137 | url: "https://pub.dartlang.org" 138 | source: hosted 139 | version: "1.8.0" 140 | nested: 141 | dependency: transitive 142 | description: 143 | name: nested 144 | url: "https://pub.dartlang.org" 145 | source: hosted 146 | version: "1.0.0" 147 | path: 148 | dependency: transitive 149 | description: 150 | name: path 151 | url: "https://pub.dartlang.org" 152 | source: hosted 153 | version: "1.8.2" 154 | path_provider: 155 | dependency: transitive 156 | description: 157 | name: path_provider 158 | url: "https://pub.dartlang.org" 159 | source: hosted 160 | version: "2.0.11" 161 | path_provider_android: 162 | dependency: transitive 163 | description: 164 | name: path_provider_android 165 | url: "https://pub.dartlang.org" 166 | source: hosted 167 | version: "2.0.15" 168 | path_provider_ios: 169 | dependency: transitive 170 | description: 171 | name: path_provider_ios 172 | url: "https://pub.dartlang.org" 173 | source: hosted 174 | version: "2.0.10" 175 | path_provider_linux: 176 | dependency: transitive 177 | description: 178 | name: path_provider_linux 179 | url: "https://pub.dartlang.org" 180 | source: hosted 181 | version: "2.1.7" 182 | path_provider_macos: 183 | dependency: transitive 184 | description: 185 | name: path_provider_macos 186 | url: "https://pub.dartlang.org" 187 | source: hosted 188 | version: "2.0.6" 189 | path_provider_platform_interface: 190 | dependency: transitive 191 | description: 192 | name: path_provider_platform_interface 193 | url: "https://pub.dartlang.org" 194 | source: hosted 195 | version: "2.0.4" 196 | path_provider_windows: 197 | dependency: transitive 198 | description: 199 | name: path_provider_windows 200 | url: "https://pub.dartlang.org" 201 | source: hosted 202 | version: "2.1.0" 203 | platform: 204 | dependency: transitive 205 | description: 206 | name: platform 207 | url: "https://pub.dartlang.org" 208 | source: hosted 209 | version: "3.1.0" 210 | plugin_platform_interface: 211 | dependency: transitive 212 | description: 213 | name: plugin_platform_interface 214 | url: "https://pub.dartlang.org" 215 | source: hosted 216 | version: "2.1.2" 217 | process: 218 | dependency: transitive 219 | description: 220 | name: process 221 | url: "https://pub.dartlang.org" 222 | source: hosted 223 | version: "4.2.4" 224 | provider: 225 | dependency: "direct main" 226 | description: 227 | name: provider 228 | url: "https://pub.dartlang.org" 229 | source: hosted 230 | version: "6.0.3" 231 | sky_engine: 232 | dependency: transitive 233 | description: flutter 234 | source: sdk 235 | version: "0.0.99" 236 | source_span: 237 | dependency: transitive 238 | description: 239 | name: source_span 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "1.9.0" 243 | stack_trace: 244 | dependency: transitive 245 | description: 246 | name: stack_trace 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "1.10.0" 250 | stream_channel: 251 | dependency: transitive 252 | description: 253 | name: stream_channel 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "2.1.0" 257 | string_scanner: 258 | dependency: transitive 259 | description: 260 | name: string_scanner 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "1.1.1" 264 | term_glyph: 265 | dependency: transitive 266 | description: 267 | name: term_glyph 268 | url: "https://pub.dartlang.org" 269 | source: hosted 270 | version: "1.2.1" 271 | test_api: 272 | dependency: transitive 273 | description: 274 | name: test_api 275 | url: "https://pub.dartlang.org" 276 | source: hosted 277 | version: "0.4.12" 278 | typed_data: 279 | dependency: transitive 280 | description: 281 | name: typed_data 282 | url: "https://pub.dartlang.org" 283 | source: hosted 284 | version: "1.3.1" 285 | vector_math: 286 | dependency: transitive 287 | description: 288 | name: vector_math 289 | url: "https://pub.dartlang.org" 290 | source: hosted 291 | version: "2.1.2" 292 | win32: 293 | dependency: transitive 294 | description: 295 | name: win32 296 | url: "https://pub.dartlang.org" 297 | source: hosted 298 | version: "2.7.0" 299 | xdg_directories: 300 | dependency: transitive 301 | description: 302 | name: xdg_directories 303 | url: "https://pub.dartlang.org" 304 | source: hosted 305 | version: "0.2.0+1" 306 | sdks: 307 | dart: ">=2.17.0 <3.0.0" 308 | flutter: ">=3.0.0" 309 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_fun 2 | description: small ui challenges 3 | publish_to: 'none' 4 | version: 1.0.0+1 5 | 6 | environment: 7 | sdk: '>=2.17.0 <3.0.0' 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | cupertino_icons: ^1.0.5 13 | google_fonts: ^3.0.1 14 | provider: ^6.0.3 15 | 16 | dev_dependencies: 17 | flutter_lints: 2.0.1 18 | flutter_test: 19 | sdk: flutter 20 | 21 | flutter: 22 | uses-material-design: true 23 | assets: 24 | - assets/ 25 | 26 | fonts: 27 | - family: FunIcons 28 | fonts: 29 | - asset: assets/fonts/FunIcons.ttf 30 | 31 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:flutter_fun/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | flutter_fun 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flutter_fun", 3 | "short_name": "flutter_fun", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(flutter_fun LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "flutter_fun") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(SET CMP0063 NEW) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | # Generated plugin build rules, which manage building the plugins and adding 56 | # them to the application. 57 | include(flutter/generated_plugins.cmake) 58 | 59 | 60 | # === Installation === 61 | # Support files are copied into place next to the executable, so that it can 62 | # run in place. This is done instead of making a separate bundle (as on Linux) 63 | # so that building and running from within Visual Studio will work. 64 | set(BUILD_BUNDLE_DIR "$") 65 | # Make the "install" step default, as it's required to run. 66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 69 | endif() 70 | 71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 73 | 74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 75 | COMPONENT Runtime) 76 | 77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 78 | COMPONENT Runtime) 79 | 80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 81 | COMPONENT Runtime) 82 | 83 | if(PLUGIN_BUNDLED_LIBRARIES) 84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 86 | COMPONENT Runtime) 87 | endif() 88 | 89 | # Fully re-copy the assets directory on each build to avoid having stale files 90 | # from a previous install. 91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 92 | install(CODE " 93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 94 | " COMPONENT Runtime) 95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 97 | 98 | # Install the AOT library on non-Debug builds only. 99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 100 | CONFIGURATIONS Profile;Release 101 | COMPONENT Runtime) 102 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Disable Windows macros that collide with C++ standard library functions. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 25 | 26 | # Add dependency libraries and include directories. Add any application-specific 27 | # dependencies here. 28 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 29 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 30 | 31 | # Run the Flutter tool portions of the build. This must not be removed. 32 | add_dependencies(${BINARY_NAME} flutter_assemble) 33 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "dev.kherel" "\0" 93 | VALUE "FileDescription", "flutter_fun" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "flutter_fun" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 dev.kherel. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "flutter_fun.exe" "\0" 98 | VALUE "ProductName", "flutter_fun" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"flutter_fun", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kherel/flutter_fun/b8155a7f644a6e295fc9caafcb5b794105c9849e/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | 5 | #include "resource.h" 6 | 7 | namespace { 8 | 9 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 10 | 11 | // The number of Win32Window objects that currently exist. 12 | static int g_active_window_count = 0; 13 | 14 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 15 | 16 | // Scale helper to convert logical scaler values to physical using passed in 17 | // scale factor 18 | int Scale(int source, double scale_factor) { 19 | return static_cast(source * scale_factor); 20 | } 21 | 22 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 23 | // This API is only needed for PerMonitor V1 awareness mode. 24 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 25 | HMODULE user32_module = LoadLibraryA("User32.dll"); 26 | if (!user32_module) { 27 | return; 28 | } 29 | auto enable_non_client_dpi_scaling = 30 | reinterpret_cast( 31 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 32 | if (enable_non_client_dpi_scaling != nullptr) { 33 | enable_non_client_dpi_scaling(hwnd); 34 | FreeLibrary(user32_module); 35 | } 36 | } 37 | 38 | } // namespace 39 | 40 | // Manages the Win32Window's window class registration. 41 | class WindowClassRegistrar { 42 | public: 43 | ~WindowClassRegistrar() = default; 44 | 45 | // Returns the singleton registar instance. 46 | static WindowClassRegistrar* GetInstance() { 47 | if (!instance_) { 48 | instance_ = new WindowClassRegistrar(); 49 | } 50 | return instance_; 51 | } 52 | 53 | // Returns the name of the window class, registering the class if it hasn't 54 | // previously been registered. 55 | const wchar_t* GetWindowClass(); 56 | 57 | // Unregisters the window class. Should only be called if there are no 58 | // instances of the window. 59 | void UnregisterWindowClass(); 60 | 61 | private: 62 | WindowClassRegistrar() = default; 63 | 64 | static WindowClassRegistrar* instance_; 65 | 66 | bool class_registered_ = false; 67 | }; 68 | 69 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 70 | 71 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 72 | if (!class_registered_) { 73 | WNDCLASS window_class{}; 74 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 75 | window_class.lpszClassName = kWindowClassName; 76 | window_class.style = CS_HREDRAW | CS_VREDRAW; 77 | window_class.cbClsExtra = 0; 78 | window_class.cbWndExtra = 0; 79 | window_class.hInstance = GetModuleHandle(nullptr); 80 | window_class.hIcon = 81 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 82 | window_class.hbrBackground = 0; 83 | window_class.lpszMenuName = nullptr; 84 | window_class.lpfnWndProc = Win32Window::WndProc; 85 | RegisterClass(&window_class); 86 | class_registered_ = true; 87 | } 88 | return kWindowClassName; 89 | } 90 | 91 | void WindowClassRegistrar::UnregisterWindowClass() { 92 | UnregisterClass(kWindowClassName, nullptr); 93 | class_registered_ = false; 94 | } 95 | 96 | Win32Window::Win32Window() { 97 | ++g_active_window_count; 98 | } 99 | 100 | Win32Window::~Win32Window() { 101 | --g_active_window_count; 102 | Destroy(); 103 | } 104 | 105 | bool Win32Window::CreateAndShow(const std::wstring& title, 106 | const Point& origin, 107 | const Size& size) { 108 | Destroy(); 109 | 110 | const wchar_t* window_class = 111 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 112 | 113 | const POINT target_point = {static_cast(origin.x), 114 | static_cast(origin.y)}; 115 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 116 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 117 | double scale_factor = dpi / 96.0; 118 | 119 | HWND window = CreateWindow( 120 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, 121 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 122 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 123 | nullptr, nullptr, GetModuleHandle(nullptr), this); 124 | 125 | if (!window) { 126 | return false; 127 | } 128 | 129 | return OnCreate(); 130 | } 131 | 132 | // static 133 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 134 | UINT const message, 135 | WPARAM const wparam, 136 | LPARAM const lparam) noexcept { 137 | if (message == WM_NCCREATE) { 138 | auto window_struct = reinterpret_cast(lparam); 139 | SetWindowLongPtr(window, GWLP_USERDATA, 140 | reinterpret_cast(window_struct->lpCreateParams)); 141 | 142 | auto that = static_cast(window_struct->lpCreateParams); 143 | EnableFullDpiSupportIfAvailable(window); 144 | that->window_handle_ = window; 145 | } else if (Win32Window* that = GetThisFromHandle(window)) { 146 | return that->MessageHandler(window, message, wparam, lparam); 147 | } 148 | 149 | return DefWindowProc(window, message, wparam, lparam); 150 | } 151 | 152 | LRESULT 153 | Win32Window::MessageHandler(HWND hwnd, 154 | UINT const message, 155 | WPARAM const wparam, 156 | LPARAM const lparam) noexcept { 157 | switch (message) { 158 | case WM_DESTROY: 159 | window_handle_ = nullptr; 160 | Destroy(); 161 | if (quit_on_close_) { 162 | PostQuitMessage(0); 163 | } 164 | return 0; 165 | 166 | case WM_DPICHANGED: { 167 | auto newRectSize = reinterpret_cast(lparam); 168 | LONG newWidth = newRectSize->right - newRectSize->left; 169 | LONG newHeight = newRectSize->bottom - newRectSize->top; 170 | 171 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 172 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 173 | 174 | return 0; 175 | } 176 | case WM_SIZE: { 177 | RECT rect = GetClientArea(); 178 | if (child_content_ != nullptr) { 179 | // Size and position the child window. 180 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 181 | rect.bottom - rect.top, TRUE); 182 | } 183 | return 0; 184 | } 185 | 186 | case WM_ACTIVATE: 187 | if (child_content_ != nullptr) { 188 | SetFocus(child_content_); 189 | } 190 | return 0; 191 | } 192 | 193 | return DefWindowProc(window_handle_, message, wparam, lparam); 194 | } 195 | 196 | void Win32Window::Destroy() { 197 | OnDestroy(); 198 | 199 | if (window_handle_) { 200 | DestroyWindow(window_handle_); 201 | window_handle_ = nullptr; 202 | } 203 | if (g_active_window_count == 0) { 204 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 205 | } 206 | } 207 | 208 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 209 | return reinterpret_cast( 210 | GetWindowLongPtr(window, GWLP_USERDATA)); 211 | } 212 | 213 | void Win32Window::SetChildContent(HWND content) { 214 | child_content_ = content; 215 | SetParent(content, window_handle_); 216 | RECT frame = GetClientArea(); 217 | 218 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 219 | frame.bottom - frame.top, true); 220 | 221 | SetFocus(child_content_); 222 | } 223 | 224 | RECT Win32Window::GetClientArea() { 225 | RECT frame; 226 | GetClientRect(window_handle_, &frame); 227 | return frame; 228 | } 229 | 230 | HWND Win32Window::GetHandle() { 231 | return window_handle_; 232 | } 233 | 234 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 235 | quit_on_close_ = quit_on_close; 236 | } 237 | 238 | bool Win32Window::OnCreate() { 239 | // No-op; provided for subclasses. 240 | return true; 241 | } 242 | 243 | void Win32Window::OnDestroy() { 244 | // No-op; provided for subclasses. 245 | } 246 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | --------------------------------------------------------------------------------