├── dart_test.yaml
├── example
├── linux
│ ├── .gitignore
│ ├── main.cc
│ ├── flutter
│ │ ├── generated_plugin_registrant.cc
│ │ ├── generated_plugin_registrant.h
│ │ ├── generated_plugins.cmake
│ │ └── CMakeLists.txt
│ ├── my_application.h
│ ├── my_application.cc
│ └── CMakeLists.txt
├── ios
│ ├── Flutter
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── AppFrameworkInfo.plist
│ ├── Runner
│ │ ├── Runner-Bridging-Header.h
│ │ ├── Assets.xcassets
│ │ │ ├── LaunchImage.imageset
│ │ │ │ ├── LaunchImage.png
│ │ │ │ ├── LaunchImage@2x.png
│ │ │ │ ├── LaunchImage@3x.png
│ │ │ │ ├── README.md
│ │ │ │ └── Contents.json
│ │ │ └── AppIcon.appiconset
│ │ │ │ ├── Icon-App-20x20@1x.png
│ │ │ │ ├── Icon-App-20x20@2x.png
│ │ │ │ ├── Icon-App-20x20@3x.png
│ │ │ │ ├── Icon-App-29x29@1x.png
│ │ │ │ ├── Icon-App-29x29@2x.png
│ │ │ │ ├── Icon-App-29x29@3x.png
│ │ │ │ ├── Icon-App-40x40@1x.png
│ │ │ │ ├── Icon-App-40x40@2x.png
│ │ │ │ ├── Icon-App-40x40@3x.png
│ │ │ │ ├── Icon-App-60x60@2x.png
│ │ │ │ ├── Icon-App-60x60@3x.png
│ │ │ │ ├── Icon-App-76x76@1x.png
│ │ │ │ ├── Icon-App-76x76@2x.png
│ │ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ │ ├── Icon-App-83.5x83.5@2x.png
│ │ │ │ └── Contents.json
│ │ ├── AppDelegate.swift
│ │ ├── Base.lproj
│ │ │ ├── Main.storyboard
│ │ │ └── LaunchScreen.storyboard
│ │ └── Info.plist
│ ├── Runner.xcodeproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ └── IDEWorkspaceChecks.plist
│ └── .gitignore
├── macos
│ ├── Flutter
│ │ ├── Flutter-Debug.xcconfig
│ │ ├── Flutter-Release.xcconfig
│ │ └── GeneratedPluginRegistrant.swift
│ ├── Runner
│ │ ├── Configs
│ │ │ ├── Debug.xcconfig
│ │ │ ├── Release.xcconfig
│ │ │ ├── Warnings.xcconfig
│ │ │ └── AppInfo.xcconfig
│ │ ├── Assets.xcassets
│ │ │ └── AppIcon.appiconset
│ │ │ │ ├── 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
│ │ │ │ └── Contents.json
│ │ ├── AppDelegate.swift
│ │ ├── Release.entitlements
│ │ ├── DebugProfile.entitlements
│ │ ├── MainFlutterWindow.swift
│ │ └── Info.plist
│ ├── .gitignore
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── Runner.xcodeproj
│ │ ├── project.xcworkspace
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── web
│ ├── favicon.png
│ ├── icons
│ │ ├── Icon-192.png
│ │ ├── Icon-512.png
│ │ ├── Icon-maskable-192.png
│ │ └── Icon-maskable-512.png
│ ├── manifest.json
│ └── index.html
├── android
│ ├── gradle.properties
│ ├── app
│ │ ├── src
│ │ │ ├── main
│ │ │ │ ├── res
│ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── drawable
│ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── drawable-v21
│ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── values
│ │ │ │ │ │ └── styles.xml
│ │ │ │ │ └── values-night
│ │ │ │ │ │ └── styles.xml
│ │ │ │ ├── kotlin
│ │ │ │ │ └── com
│ │ │ │ │ │ └── example
│ │ │ │ │ │ ├── example
│ │ │ │ │ │ └── MainActivity.kt
│ │ │ │ │ │ └── showcase
│ │ │ │ │ │ └── MainActivity.kt
│ │ │ │ └── AndroidManifest.xml
│ │ │ ├── debug
│ │ │ │ └── AndroidManifest.xml
│ │ │ └── profile
│ │ │ │ └── AndroidManifest.xml
│ │ └── build.gradle
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ ├── .gitignore
│ ├── settings.gradle
│ └── build.gradle
├── windows
│ ├── runner
│ │ ├── resources
│ │ │ └── app_icon.ico
│ │ ├── resource.h
│ │ ├── CMakeLists.txt
│ │ ├── utils.h
│ │ ├── runner.exe.manifest
│ │ ├── flutter_window.h
│ │ ├── main.cpp
│ │ ├── utils.cpp
│ │ ├── flutter_window.cpp
│ │ ├── Runner.rc
│ │ ├── win32_window.h
│ │ └── win32_window.cpp
│ ├── flutter
│ │ ├── generated_plugin_registrant.cc
│ │ ├── generated_plugin_registrant.h
│ │ ├── generated_plugins.cmake
│ │ └── CMakeLists.txt
│ ├── .gitignore
│ └── CMakeLists.txt
├── README.md
├── .gitignore
├── test
│ └── widget_test.dart
├── analysis_options.yaml
├── .metadata
├── pubspec.yaml
├── pubspec.lock
└── lib
│ └── main.dart
├── android
├── local.properties
└── app
│ └── src
│ └── main
│ └── java
│ └── io
│ └── flutter
│ └── plugins
│ └── GeneratedPluginRegistrant.java
├── test
├── goldens
│ ├── my_app_screen_test.phone.png
│ ├── my_app_screen_test.iphone11.png
│ ├── my_app_screen_test_text_field.phone.png
│ ├── my_app_screen_test_bottom_sheet.phone.png
│ ├── my_app_screen_test_text_field.iphone11.png
│ ├── my_app_screen_test_bottom_sheet.iphone11.png
│ ├── my_app_screen_test_bottom_bar_security.phone.png
│ ├── my_app_screen_test_bottom_bar_settings.phone.png
│ ├── my_app_screen_test_bottom_bar_security.iphone11.png
│ ├── my_app_screen_test_bottom_bar_settings.iphone11.png
│ ├── my_app_screen_test_floating_action_button.phone.png
│ └── my_app_screen_test_floating_action_button.iphone11.png
└── glassmorphism_widgets_test.dart
├── .vscode
└── settings.json
├── lib
├── src
│ ├── glass_text_style.dart
│ ├── glass_app.dart
│ ├── glass_text_field.dart
│ ├── glass_icon.dart
│ ├── show_glass_bottom_sheet.dart
│ ├── glass_text.dart
│ ├── glass_theme.dart
│ ├── glass_button.dart
│ ├── glass_floating_action_button.dart
│ ├── glass_drawer.dart
│ ├── glass_border.dart
│ ├── glass_list_tile.dart
│ ├── glass_app_bar.dart
│ ├── glass_flex_container.dart
│ ├── glass_theme_data.dart
│ └── glass_container.dart
└── glassmorphism_widgets.dart
├── analysis_options.yaml
├── macos
└── Flutter
│ ├── GeneratedPluginRegistrant.swift
│ └── ephemeral
│ ├── Flutter-Generated.xcconfig
│ └── flutter_export_environment.sh
├── linux
└── flutter
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
├── ios
├── Runner
│ ├── GeneratedPluginRegistrant.m
│ └── GeneratedPluginRegistrant.h
└── Flutter
│ ├── Generated.xcconfig
│ └── flutter_export_environment.sh
├── .metadata
├── .github
└── workflows
│ ├── push-and-publish.yaml
│ ├── pr-review.yaml
│ └── update-goldens.yaml
├── .gitignore
├── .pubignore
├── CHANGELOG.md
├── LICENSE
├── pubspec.yaml
├── README.md
└── pubspec.lock
/dart_test.yaml:
--------------------------------------------------------------------------------
1 | tags:
2 | golden:
--------------------------------------------------------------------------------
/example/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/web/favicon.png
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/android/local.properties:
--------------------------------------------------------------------------------
1 | sdk.dir=/Users/yamauchihiroto/Library/Android/sdk
2 | flutter.sdk=/opt/homebrew/Caskroom/flutter/3.7.3/flutter
--------------------------------------------------------------------------------
/example/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/dgph
7 | **/xcuserdata/
8 |
--------------------------------------------------------------------------------
/example/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/test/goldens/my_app_screen_test.phone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/test/goldens/my_app_screen_test.phone.png
--------------------------------------------------------------------------------
/example/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/test/goldens/my_app_screen_test.iphone11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/test/goldens/my_app_screen_test.iphone11.png
--------------------------------------------------------------------------------
/test/goldens/my_app_screen_test_text_field.phone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/test/goldens/my_app_screen_test_text_field.phone.png
--------------------------------------------------------------------------------
/test/goldens/my_app_screen_test_bottom_sheet.phone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/test/goldens/my_app_screen_test_bottom_sheet.phone.png
--------------------------------------------------------------------------------
/test/goldens/my_app_screen_test_text_field.iphone11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/test/goldens/my_app_screen_test_text_field.iphone11.png
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "cSpell.words": [
3 | "Diagnosticable",
4 | "lerp",
5 | "LTRB",
6 | "morphism",
7 | "Schyler"
8 | ]
9 | }
--------------------------------------------------------------------------------
/test/goldens/my_app_screen_test_bottom_sheet.iphone11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/test/goldens/my_app_screen_test_bottom_sheet.iphone11.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/test/goldens/my_app_screen_test_bottom_bar_security.phone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/test/goldens/my_app_screen_test_bottom_bar_security.phone.png
--------------------------------------------------------------------------------
/test/goldens/my_app_screen_test_bottom_bar_settings.phone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/test/goldens/my_app_screen_test_bottom_bar_settings.phone.png
--------------------------------------------------------------------------------
/test/goldens/my_app_screen_test_bottom_bar_security.iphone11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/test/goldens/my_app_screen_test_bottom_bar_security.iphone11.png
--------------------------------------------------------------------------------
/test/goldens/my_app_screen_test_bottom_bar_settings.iphone11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/test/goldens/my_app_screen_test_bottom_bar_settings.iphone11.png
--------------------------------------------------------------------------------
/test/goldens/my_app_screen_test_floating_action_button.phone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/test/goldens/my_app_screen_test_floating_action_button.phone.png
--------------------------------------------------------------------------------
/test/goldens/my_app_screen_test_floating_action_button.iphone11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/test/goldens/my_app_screen_test_floating_action_button.iphone11.png
--------------------------------------------------------------------------------
/lib/src/glass_text_style.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | TextStyle glassTextStyle = TextStyle(
4 | fontWeight: FontWeight.bold,
5 | color: Colors.white.withOpacity(0.5),
6 | );
7 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/com/example/showcase/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.showcase
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yama-yeah/glassmorphism_widgets/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 | #include: package:pedantic_mono/analysis_options.yaml
3 | # Additional information about this file can be found at
4 | # https://dart.dev/guides/language/analysis-options
--------------------------------------------------------------------------------
/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 |
9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
10 | }
11 |
--------------------------------------------------------------------------------
/example/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 |
9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
10 | }
11 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
7 |
--------------------------------------------------------------------------------
/example/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/GeneratedPluginRegistrant.m:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #import "GeneratedPluginRegistrant.h"
8 |
9 | @implementation GeneratedPluginRegistrant
10 |
11 | + (void)registerWithRegistry:(NSObject*)registry {
12 | }
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 77d935af4db863f6abd0b9c31c7e6df2a13de57b
8 | channel: stable
9 |
10 | project_type: package
11 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/ios/Runner/GeneratedPluginRegistrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GeneratedPluginRegistrant_h
8 | #define GeneratedPluginRegistrant_h
9 |
10 | #import
11 |
12 | NS_ASSUME_NONNULL_BEGIN
13 |
14 | @interface GeneratedPluginRegistrant : NSObject
15 | + (void)registerWithRegistry:(NSObject*)registry;
16 | @end
17 |
18 | NS_ASSUME_NONNULL_END
19 | #endif /* GeneratedPluginRegistrant_h */
20 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/macos/Flutter/ephemeral/Flutter-Generated.xcconfig:
--------------------------------------------------------------------------------
1 | // This is a generated file; do not edit or check into version control.
2 | FLUTTER_ROOT=/opt/hostedtoolcache/flutter/master-master-x64
3 | FLUTTER_APPLICATION_PATH=/home/runner/work/glassmorphism_widgets/glassmorphism_widgets
4 | COCOAPODS_PARALLEL_CODE_SIGN=true
5 | FLUTTER_BUILD_DIR=build
6 | FLUTTER_BUILD_NAME=0.1.6
7 | FLUTTER_BUILD_NUMBER=0.1.6
8 | DART_OBFUSCATION=false
9 | TRACK_WIDGET_CREATION=true
10 | TREE_SHAKE_ICONS=false
11 | PACKAGE_CONFIG=.dart_tool/package_config.json
12 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # showcase
2 |
3 | A new Flutter project.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
13 |
14 | For help getting started with Flutter, view our
15 | [online documentation](https://flutter.dev/docs), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/ios/Flutter/Generated.xcconfig:
--------------------------------------------------------------------------------
1 | // This is a generated file; do not edit or check into version control.
2 | FLUTTER_ROOT=/opt/hostedtoolcache/flutter/master-master-x64
3 | FLUTTER_APPLICATION_PATH=/home/runner/work/glassmorphism_widgets/glassmorphism_widgets
4 | COCOAPODS_PARALLEL_CODE_SIGN=true
5 | FLUTTER_TARGET=lib/main.dart
6 | FLUTTER_BUILD_DIR=build
7 | FLUTTER_BUILD_NAME=0.1.6
8 | FLUTTER_BUILD_NUMBER=0.1.6
9 | EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386
10 | EXCLUDED_ARCHS[sdk=iphoneos*]=armv7
11 | DART_OBFUSCATION=false
12 | TRACK_WIDGET_CREATION=true
13 | TREE_SHAKE_ICONS=false
14 | PACKAGE_CONFIG=.dart_tool/package_config.json
15 |
--------------------------------------------------------------------------------
/macos/Flutter/ephemeral/flutter_export_environment.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # This is a generated file; do not edit or check into version control.
3 | export "FLUTTER_ROOT=/opt/hostedtoolcache/flutter/master-master-x64"
4 | export "FLUTTER_APPLICATION_PATH=/home/runner/work/glassmorphism_widgets/glassmorphism_widgets"
5 | export "COCOAPODS_PARALLEL_CODE_SIGN=true"
6 | export "FLUTTER_BUILD_DIR=build"
7 | export "FLUTTER_BUILD_NAME=0.1.6"
8 | export "FLUTTER_BUILD_NUMBER=0.1.6"
9 | export "DART_OBFUSCATION=false"
10 | export "TRACK_WIDGET_CREATION=true"
11 | export "TREE_SHAKE_ICONS=false"
12 | export "PACKAGE_CONFIG=.dart_tool/package_config.json"
13 |
--------------------------------------------------------------------------------
/.github/workflows/push-and-publish.yaml:
--------------------------------------------------------------------------------
1 | name: Publish package on push
2 | 'on':
3 | push:
4 | branches:
5 | - master
6 |
7 | jobs:
8 | build:
9 | runs-on: ubuntu-latest
10 |
11 | steps:
12 | - uses: actions/checkout@v1
13 | - uses: subosito/flutter-action@v2
14 | with:
15 | channel: 'master'
16 | cache: true
17 | - name: Setup credentials
18 | run: |
19 | mkdir -p ~/.config/dart
20 | cat < ~/.config/dart/pub-credentials.json
21 | ${{ secrets.CREDENTIAL_JSON }}
22 | EOF
23 | - name: Publish package
24 | run: flutter pub publish -f
25 |
--------------------------------------------------------------------------------
/lib/src/glass_app.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:glassmorphism_widgets/src/glass_theme.dart';
3 | import 'package:glassmorphism_widgets/src/glass_theme_data.dart';
4 |
5 | /// A widget that provides a GlassTheme for its descendants.
6 | class GlassApp extends StatelessWidget {
7 | GlassApp({Key? key, GlassThemeData? theme, this.home})
8 | : theme = theme ?? GlassThemeData(),
9 | super(key: key);
10 | @override
11 | Widget build(BuildContext context) {
12 | return GlassTheme(data: theme, child: home ?? Container());
13 | }
14 |
15 | final GlassThemeData theme;
16 | final Widget? home;
17 | }
18 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/ios/Flutter/flutter_export_environment.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # This is a generated file; do not edit or check into version control.
3 | export "FLUTTER_ROOT=/opt/hostedtoolcache/flutter/master-master-x64"
4 | export "FLUTTER_APPLICATION_PATH=/home/runner/work/glassmorphism_widgets/glassmorphism_widgets"
5 | export "COCOAPODS_PARALLEL_CODE_SIGN=true"
6 | export "FLUTTER_TARGET=lib/main.dart"
7 | export "FLUTTER_BUILD_DIR=build"
8 | export "FLUTTER_BUILD_NAME=0.1.6"
9 | export "FLUTTER_BUILD_NUMBER=0.1.6"
10 | export "DART_OBFUSCATION=false"
11 | export "TRACK_WIDGET_CREATION=true"
12 | export "TREE_SHAKE_ICONS=false"
13 | export "PACKAGE_CONFIG=.dart_tool/package_config.json"
14 |
--------------------------------------------------------------------------------
/example/windows/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.14)
2 | project(runner LANGUAGES CXX)
3 |
4 | add_executable(${BINARY_NAME} WIN32
5 | "flutter_window.cpp"
6 | "main.cpp"
7 | "utils.cpp"
8 | "win32_window.cpp"
9 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
10 | "Runner.rc"
11 | "runner.exe.manifest"
12 | )
13 | apply_standard_settings(${BINARY_NAME})
14 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
15 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
16 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
17 | add_dependencies(${BINARY_NAME} flutter_assemble)
18 |
--------------------------------------------------------------------------------
/lib/src/glass_text_field.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /// GlassTextField is a create TextField with a glass effect.
4 | class GlassTextField extends StatelessWidget {
5 | const GlassTextField({Key? key}) : super(key: key);
6 |
7 | @override
8 | Widget build(BuildContext context) {
9 | return TextField(
10 | decoration: InputDecoration(
11 | border: OutlineInputBorder(
12 | borderRadius: BorderRadius.circular(10),
13 | ),
14 | filled: true,
15 | fillColor: Colors.white,
16 | hintText: 'Enter your email',
17 | prefixIcon: const Icon(Icons.email),
18 | ),
19 | );
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/lib/glassmorphism_widgets.dart:
--------------------------------------------------------------------------------
1 | library glassmorphism_widgets;
2 |
3 | export 'src/glass_app.dart';
4 | export 'src/glass_app_bar.dart';
5 | export 'src/glass_border.dart';
6 | export 'src/glass_bottom_bar.dart';
7 | export 'src/glass_button.dart';
8 | export 'src/glass_container.dart';
9 | export 'src/glass_drawer.dart';
10 | export 'src/glass_flex_container.dart';
11 | export 'src/glass_floating_action_button.dart';
12 | export 'src/glass_icon.dart';
13 | export 'src/glass_list_tile.dart';
14 | export 'src/glass_text.dart';
15 | export 'src/glass_text_style.dart';
16 | export 'src/glass_theme.dart';
17 | export 'src/glass_theme_data.dart';
18 | export 'src/show_glass_bottom_sheet.dart';
19 |
--------------------------------------------------------------------------------
/example/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 = example
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved.
15 |
--------------------------------------------------------------------------------
/.github/workflows/pr-review.yaml:
--------------------------------------------------------------------------------
1 | name: PR review
2 |
3 | on:
4 | pull_request:
5 |
6 | jobs:
7 | analyze:
8 | runs-on: ubuntu-latest
9 | timeout-minutes: 10
10 |
11 | steps:
12 | - uses: actions/checkout@v3
13 | - uses: subosito/flutter-action@v2
14 | with:
15 | channel: 'master'
16 | cache: true
17 | - name: Install dependencies
18 | run: |
19 | flutter pub get
20 | - name: Analyze
21 | run: |
22 | flutter analyze
23 | - name: Run tests
24 | run: |
25 | flutter test
26 | - name: Dry run
27 | run: |
28 | flutter pub publish --dry-run
29 |
30 |
--------------------------------------------------------------------------------
/lib/src/glass_icon.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /// GlassIcon is a create Icon with a glass effect.
4 | class GlassIcon extends StatelessWidget {
5 | const GlassIcon(this.icon,
6 | {Key? key, this.size, this.color, this.opacity = 0.5})
7 | : super(key: key);
8 |
9 | final IconData icon;
10 | final Color? color;
11 | final double opacity;
12 | final double? size;
13 |
14 | @override
15 | Widget build(BuildContext context) {
16 | return Icon(
17 | icon,
18 | key: key,
19 | color: color != null
20 | ? color!.withOpacity(opacity)
21 | : Colors.white.withOpacity(opacity),
22 | size: size,
23 | );
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java:
--------------------------------------------------------------------------------
1 | package io.flutter.plugins;
2 |
3 | import io.flutter.plugin.common.PluginRegistry;
4 |
5 | /**
6 | * Generated file. Do not edit.
7 | */
8 | public final class GeneratedPluginRegistrant {
9 | public static void registerWith(PluginRegistry registry) {
10 | if (alreadyRegisteredWith(registry)) {
11 | return;
12 | }
13 | }
14 |
15 | private static boolean alreadyRegisteredWith(PluginRegistry registry) {
16 | final String key = GeneratedPluginRegistrant.class.getCanonicalName();
17 | if (registry.hasPlugin(key)) {
18 | return true;
19 | }
20 | registry.registrarFor(key);
21 | return false;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/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:4.1.0'
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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/lib/src/show_glass_bottom_sheet.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:glassmorphism_widgets/src/glass_container.dart';
3 |
4 | /// Show a BottomSheet with a glass effect.
5 | void showGlassBottomSheet({
6 | required BuildContext context,
7 | Widget? child,
8 | LinearGradient? linearGradient,
9 | LinearGradient? borderGradient,
10 | double radius = 20,
11 | double? blur,
12 | BorderRadius? borderRadius,
13 | }) {
14 | showModalBottomSheet(
15 | context: context,
16 | backgroundColor: Colors.transparent,
17 | barrierColor: Colors.black.withOpacity(0.2),
18 | builder: (BuildContext ctx) {
19 | return GlassContainer(
20 | radius: radius,
21 | blur: blur,
22 | linearGradient: linearGradient,
23 | borderGradient: borderGradient,
24 | child: child,
25 | );
26 | },
27 | );
28 | }
29 |
--------------------------------------------------------------------------------
/example/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 | 9.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/.github/workflows/update-goldens.yaml:
--------------------------------------------------------------------------------
1 | name: update goldens
2 | 'on':
3 | push:
4 | branches:
5 | - master
6 |
7 | jobs:
8 | build:
9 | runs-on: ubuntu-latest
10 | timeout-minutes: 10
11 |
12 | steps:
13 | - uses: actions/checkout@v3
14 | - uses: subosito/flutter-action@v2
15 | with:
16 | channel: 'master'
17 | cache: true
18 | - name: Install dependencies
19 | run: |
20 | flutter pub get
21 | - name: update goldens
22 | run: |
23 | flutter test --update-goldens
24 | - name: Configure Git
25 | run: |
26 | git config --global user.name "yama-yeah"
27 | git config --global user.email "b1021091@fun.ac.jp"
28 | - name: Push changes
29 | run: |
30 | git add test
31 | git commit -m "$(date '+%Y-%m-%d %H:%M:%S') update goldens"
32 | git push origin master
33 |
34 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | **/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 | # Android Studio will place build artifacts here
44 | /android/app/debug
45 | /android/app/profile
46 | /android/app/release
47 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/lib/src/glass_text.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /// GlassText is a create Text with a glass effect.
4 | class GlassText extends StatelessWidget {
5 | const GlassText(
6 | this.data, {
7 | this.style,
8 | this.color = Colors.white,
9 | this.opacity = 0.5,
10 | this.fontSize,
11 | this.fontWeight = FontWeight.bold,
12 | Key? key,
13 | }) : super(key: key);
14 |
15 | final String data;
16 | final TextStyle? style;
17 | final double opacity;
18 | final double? fontSize;
19 | final FontWeight fontWeight;
20 | final Color color;
21 |
22 | @override
23 | Widget build(BuildContext context) {
24 | return Text(
25 | data,
26 | style: style?.copyWith(color: style?.color?.withOpacity(opacity)) ??
27 | TextStyle(
28 | fontSize: fontSize,
29 | fontWeight: fontWeight,
30 | color: color.withOpacity(opacity),
31 | ),
32 | );
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/example/web/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "showcase",
3 | "short_name": "showcase",
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 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/.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 | #main.dart
38 | lib/main.dart
39 |
40 | # Symbolication related
41 | app.*.symbols
42 |
43 | # Obfuscation related
44 | app.*.map.json
45 |
46 | # Android Studio will place build artifacts here
47 | /android/app/debug
48 | /android/app/profile
49 | /android/app/release
50 |
51 | #developing
52 | src/glass_text_field.dart
53 |
54 | #firebase
55 | example/.firebaserc
56 | example/firebase.json
57 | example/.firebase
58 |
59 | example/build/
--------------------------------------------------------------------------------
/.pubignore:
--------------------------------------------------------------------------------
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 | #main.dart
38 | lib/main.dart
39 |
40 | # Symbolication related
41 | app.*.symbols
42 |
43 | # Obfuscation related
44 | app.*.map.json
45 |
46 | # Android Studio will place build artifacts here
47 | /android/app/debug
48 | /android/app/profile
49 | /android/app/release
50 |
51 | #developing
52 | src/glass_text_field.dart
53 |
54 | #firebase
55 | example/.firebaserc
56 | example/firebase.json
57 | example/.firebase
58 |
59 | example/build/
60 | .gitignore
--------------------------------------------------------------------------------
/example/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility that Flutter provides. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:showcase/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 |
2 | ## 0.2.2
3 | * formated codes
4 |
5 | ## 0.2.1
6 | * refactored codes
7 |
8 | ## 0.2.0
9 | * fix:did not fit size of GlassAppBar and GlassListTile
10 | * add documents for widgets
11 |
12 | ## 0.1.6
13 | * support for dart3
14 |
15 | ## 0.1.5
16 | * fix render GlassAppBar and GlassBottomSheet
17 |
18 | ## 0.1.4
19 | * added heroTag in GlassFloatingActionButton
20 |
21 | ## 0.1.3
22 | * add example for pub.dev
23 |
24 | ## 0.1.2
25 | * fix glass border's size parameter
26 | * fix glass container's setState timing
27 |
28 | ## 0.1.1
29 | * delate warning message(Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.).
30 | * fix some bugs
31 | - app bar's color.
32 | - bottom bar's gradient isn't reflect.
33 | - touch action.
34 | ## 0.1.0
35 | * add some widget(GlassApp,GlassTheme,GlassThemeData).
36 |
37 | ## 0.0.9
38 | * fix GlassIcon's missing parameter
39 |
40 | ## 0.0.8
41 | * fix GlassBottomBar's bug
42 |
43 | ## 0.0.7
44 | * fix readme
45 |
46 | ## 0.0.6
47 |
48 | * add problem information
49 |
50 | ## 0.0.5
51 |
52 | * fix sdk version
53 |
54 | ## 0.0.4
55 |
56 | * improve readme
57 |
58 | ## 0.0.3
59 |
60 | * fix readme typo
61 |
62 | ## 0.0.2
63 |
64 | * change readme and pubspec.yaml to improve score
65 |
66 |
67 | ## 0.0.1
68 |
69 | * initial release.
70 |
71 |
--------------------------------------------------------------------------------
/lib/src/glass_theme.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:glassmorphism_widgets/src/glass_theme_data.dart';
3 |
4 | /// A widget that provides a GlassThemeData for its descendants.
5 | class GlassTheme extends StatelessWidget {
6 | const GlassTheme({
7 | Key? key,
8 | required this.data,
9 | required this.child,
10 | }) : super(key: key);
11 | final Widget child;
12 | final GlassThemeData data;
13 | static final GlassThemeData _kFallbackTheme = GlassThemeData.fallback();
14 |
15 | static GlassThemeData of(BuildContext context) {
16 | final _InheritedGlassTheme? inheritedTheme =
17 | context.dependOnInheritedWidgetOfExactType<_InheritedGlassTheme>();
18 | final GlassThemeData theme = inheritedTheme?.theme.data ?? _kFallbackTheme;
19 | return GlassThemeData.localize(theme);
20 | }
21 |
22 | @override
23 | Widget build(BuildContext context) {
24 | return _InheritedGlassTheme(
25 | theme: this,
26 | child: child,
27 | );
28 | }
29 | }
30 |
31 | class _InheritedGlassTheme extends InheritedWidget {
32 | const _InheritedGlassTheme({
33 | Key? key,
34 | required this.theme,
35 | required Widget child,
36 | }) : super(key: key, child: child);
37 | final GlassTheme theme;
38 |
39 | @override
40 | bool updateShouldNotify(_InheritedGlassTheme old) =>
41 | theme.data != old.theme.data;
42 | }
43 |
--------------------------------------------------------------------------------
/lib/src/glass_button.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import 'glass_container.dart';
4 |
5 | /// A GlassButton is a button that draws a glass effect.
6 | class GlassButton extends StatelessWidget {
7 | final double? radius;
8 | final double? border;
9 | final double? blur;
10 | final LinearGradient? linearGradient;
11 | final LinearGradient? borderGradient;
12 | final BorderRadius? borderRadius;
13 | const GlassButton({
14 | Key? key,
15 | this.radius,
16 | this.border,
17 | this.blur,
18 | this.linearGradient,
19 | this.borderGradient,
20 | this.borderRadius,
21 | this.child,
22 | required this.onPressed,
23 | this.onLongPressed,
24 | }) : super(key: key);
25 | final Widget? child;
26 | final void Function() onPressed;
27 | final void Function()? onLongPressed;
28 |
29 | @override
30 | Widget build(BuildContext context) {
31 | return GlassContainer(
32 | radius: radius,
33 | border: border,
34 | blur: blur,
35 | linearGradient: linearGradient,
36 | borderGradient: borderGradient,
37 | borderRadius: borderRadius,
38 | child: RawMaterialButton(
39 | onPressed: onPressed,
40 | onLongPress: onLongPressed,
41 | child: Padding(
42 | padding: const EdgeInsets.all(10),
43 | child: child,
44 | ),
45 | ),
46 | );
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/lib/src/glass_floating_action_button.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'glass_container.dart';
3 |
4 | /// GlassFloatingActionButton is a create FloatingActionButton with a glass effect.
5 | class GlassFloatingActionButton extends StatelessWidget {
6 | final Function() onPressed;
7 | final Widget? child;
8 | final double? radius;
9 | final double? border;
10 | final double? blur;
11 | final Object? heroTag;
12 | final LinearGradient? linearGradient;
13 | final LinearGradient? borderGradient;
14 | final BorderRadius? borderRadius;
15 | const GlassFloatingActionButton({
16 | Key? key,
17 | required this.onPressed,
18 | this.child,
19 | this.radius,
20 | this.border,
21 | this.blur,
22 | this.linearGradient,
23 | this.borderGradient,
24 | this.borderRadius,
25 | this.heroTag,
26 | }) : super(key: key);
27 |
28 | @override
29 | Widget build(BuildContext context) {
30 | return GlassContainer(
31 | borderRadius: borderRadius ?? BorderRadius.circular(radius ?? 30),
32 | blur: blur,
33 | border: border,
34 | linearGradient: linearGradient,
35 | borderGradient: borderGradient,
36 | child: FloatingActionButton(
37 | heroTag: heroTag,
38 | elevation: 0,
39 | onPressed: onPressed,
40 | backgroundColor: Colors.transparent,
41 | child: child,
42 | ),
43 | );
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/example/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"showcase", 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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2021, yama-yeah
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | 3. Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Showcase
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | showcase
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 |
47 |
48 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
15 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
30 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
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: 52b3dc25f6471c27b2144594abb11c741cb88f57
17 | base_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
18 | - platform: android
19 | create_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
20 | base_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
21 | - platform: ios
22 | create_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
23 | base_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
24 | - platform: linux
25 | create_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
26 | base_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
27 | - platform: macos
28 | create_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
29 | base_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
30 | - platform: web
31 | create_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
32 | base_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
33 | - platform: windows
34 | create_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
35 | base_revision: 52b3dc25f6471c27b2144594abb11c741cb88f57
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 |
--------------------------------------------------------------------------------
/example/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 | if (target_length == 0) {
52 | return std::string();
53 | }
54 | std::string utf8_string;
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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: glassmorphism_widgets
2 | description: A set of widgets for use in Flutter apps. You can too easy custom and develop glass morphism widgets.
3 | version: 0.2.2
4 | homepage: https://fluttergems.dev/packages/glassmorphism_widgets/
5 | repository: https://github.com/yama-yeah/glassmorphism_widgets
6 |
7 | environment:
8 | sdk: ">=2.14.0 <3.0.0"
9 | flutter: ">=1.17.0"
10 |
11 | dependencies:
12 | flutter:
13 | sdk: flutter
14 |
15 | dev_dependencies:
16 | flutter_test:
17 | sdk: flutter
18 | pedantic_mono: ^1.15.0
19 |
20 | flutter_lints: ^2.0.1
21 | golden_toolkit: ^0.15.0
22 |
23 |
24 | # For information on the generic Dart part of this file, see the
25 | # following page: https://dart.dev/tools/pub/pubspec
26 |
27 | # The following section is specific to Flutter.
28 | flutter:
29 | uses-material-design: true
30 | # To add assets to your package, add an assets section, like this:
31 |
32 | # - images/a_dot_ham.jpeg
33 | #
34 | # For details regarding assets in packages, see
35 | # https://flutter.dev/assets-and-images/#from-packages
36 | #
37 | # An image asset can refer to one or more resolution-specific "variants", see
38 | # https://flutter.dev/assets-and-images/#resolution-aware.
39 |
40 | # To add custom fonts to your package, add a fonts section here,
41 | # in this "flutter" section. Each entry in this list should have a
42 | # "family" key with the font family name, and a "fonts" key with a
43 | # list giving the asset and other descriptors for the font. For
44 | # example:
45 | # fonts:
46 | # - family: Schyler
47 | # fonts:
48 | # - asset: fonts/Schyler-Regular.ttf
49 | # - asset: fonts/Schyler-Italic.ttf
50 | # style: italic
51 | # - family: Trajan Pro
52 | # fonts:
53 | # - asset: fonts/TrajanPro.ttf
54 | # - asset: fonts/TrajanPro_Bold.ttf
55 | # weight: 700
56 | #
57 | # For details regarding fonts in packages, see
58 | # https://flutter.dev/custom-fonts/#from-packages
59 | false_secrets:
60 | - credentials.json
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion flutter.compileSdkVersion
30 |
31 | compileOptions {
32 | sourceCompatibility JavaVersion.VERSION_1_8
33 | targetCompatibility JavaVersion.VERSION_1_8
34 | }
35 |
36 | kotlinOptions {
37 | jvmTarget = '1.8'
38 | }
39 |
40 | sourceSets {
41 | main.java.srcDirs += 'src/main/kotlin'
42 | }
43 |
44 | defaultConfig {
45 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
46 | applicationId "com.example.showcase"
47 | minSdkVersion flutter.minSdkVersion
48 | targetSdkVersion flutter.targetSdkVersion
49 | versionCode flutterVersionCode.toInteger()
50 | versionName flutterVersionName
51 | }
52 |
53 | buildTypes {
54 | release {
55 | // TODO: Add your own signing config for the release build.
56 | // Signing with the debug keys for now, so `flutter run --release` works.
57 | signingConfig signingConfigs.debug
58 | }
59 | }
60 | }
61 |
62 | flutter {
63 | source '../..'
64 | }
65 |
66 | dependencies {
67 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
68 | }
69 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/lib/src/glass_drawer.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import 'glass_container.dart';
4 | import 'glass_text.dart';
5 |
6 | class GlassDrawer extends StatelessWidget {
7 | const GlassDrawer({Key? key}) : super(key: key);
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return Theme(
12 | data: Theme.of(context).copyWith(
13 | canvasColor: Colors.transparent,
14 | ),
15 | child: Drawer(
16 | child: GlassContainer(
17 | borderRadius: const BorderRadius.only(
18 | topRight: Radius.circular(16),
19 | bottomRight: Radius.circular(16),
20 | ),
21 | child: ListView(
22 | padding: const EdgeInsets.all(0),
23 | children: [
24 | DrawerHeader(
25 | decoration: BoxDecoration(
26 | color: Colors.white.withOpacity(0.1),
27 | ),
28 | child: Column(
29 | crossAxisAlignment: CrossAxisAlignment.start,
30 | children: [
31 | CircleAvatar(
32 | backgroundColor: Colors.white.withOpacity(0.3),
33 | foregroundColor: Colors.white.withOpacity(0.3),
34 | radius: 30,
35 | child: const Icon(
36 | Icons.person,
37 | size: 32,
38 | ),
39 | ),
40 | const SizedBox(height: 8),
41 | const GlassText(
42 | 'Glass Drawer',
43 | ),
44 | const GlassText(
45 | 'example@example.com',
46 | opacity: 0.25,
47 | ),
48 | ],
49 | ),
50 | ),
51 | ListView.separated(
52 | padding: const EdgeInsets.all(0),
53 | shrinkWrap: true,
54 | itemCount: 5,
55 | itemBuilder: (BuildContext context, int index) {
56 | return ListTile(
57 | title: GlassText(
58 | 'Drawer Item ${index + 1}',
59 | style: const TextStyle(fontSize: 24),
60 | ),
61 | onTap: () {},
62 | );
63 | },
64 | separatorBuilder: (BuildContext context, int index) {
65 | return Divider(
66 | thickness: 1.5,
67 | indent: 10,
68 | endIndent: 10,
69 | color: Colors.white.withOpacity(0.1),
70 | );
71 | },
72 | ),
73 | ],
74 | ),
75 | ),
76 | ),
77 | );
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/example/linux/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 |
3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
4 |
5 | # Configuration provided via flutter tool.
6 | include(${EPHEMERAL_DIR}/generated_config.cmake)
7 |
8 | # TODO: Move the rest of this into files in ephemeral. See
9 | # https://github.com/flutter/flutter/issues/57146.
10 |
11 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...),
12 | # which isn't available in 3.10.
13 | function(list_prepend LIST_NAME PREFIX)
14 | set(NEW_LIST "")
15 | foreach(element ${${LIST_NAME}})
16 | list(APPEND NEW_LIST "${PREFIX}${element}")
17 | endforeach(element)
18 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
19 | endfunction()
20 |
21 | # === Flutter Library ===
22 | # System-level dependencies.
23 | find_package(PkgConfig REQUIRED)
24 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
25 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
26 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
27 |
28 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
29 |
30 | # Published to parent scope for install step.
31 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
32 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
33 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
34 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
35 |
36 | list(APPEND FLUTTER_LIBRARY_HEADERS
37 | "fl_basic_message_channel.h"
38 | "fl_binary_codec.h"
39 | "fl_binary_messenger.h"
40 | "fl_dart_project.h"
41 | "fl_engine.h"
42 | "fl_json_message_codec.h"
43 | "fl_json_method_codec.h"
44 | "fl_message_codec.h"
45 | "fl_method_call.h"
46 | "fl_method_channel.h"
47 | "fl_method_codec.h"
48 | "fl_method_response.h"
49 | "fl_plugin_registrar.h"
50 | "fl_plugin_registry.h"
51 | "fl_standard_message_codec.h"
52 | "fl_standard_method_codec.h"
53 | "fl_string_codec.h"
54 | "fl_value.h"
55 | "fl_view.h"
56 | "flutter_linux.h"
57 | )
58 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
59 | add_library(flutter INTERFACE)
60 | target_include_directories(flutter INTERFACE
61 | "${EPHEMERAL_DIR}"
62 | )
63 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
64 | target_link_libraries(flutter INTERFACE
65 | PkgConfig::GTK
66 | PkgConfig::GLIB
67 | PkgConfig::GIO
68 | )
69 | add_dependencies(flutter flutter_assemble)
70 |
71 | # === Flutter tool backend ===
72 | # _phony_ is a non-existent file to force this command to run every time,
73 | # since currently there's no way to get a full input/output list from the
74 | # flutter tool.
75 | add_custom_command(
76 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
77 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_
78 | COMMAND ${CMAKE_COMMAND} -E env
79 | ${FLUTTER_TOOL_ENVIRONMENT}
80 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
81 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
82 | VERBATIM
83 | )
84 | add_custom_target(flutter_assemble DEPENDS
85 | "${FLUTTER_LIBRARY}"
86 | ${FLUTTER_LIBRARY_HEADERS}
87 | )
88 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/lib/src/glass_border.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class GlassBorder extends StatelessWidget {
4 | GlassBorder({
5 | Key? key,
6 | required double strokeWidth,
7 | required BorderRadius borderRadius,
8 | required Gradient gradient,
9 | this.height,
10 | this.width,
11 | }) : _painter = _GradientPainter(
12 | strokeWidth: strokeWidth,
13 | borderRadius: borderRadius,
14 | gradient: gradient),
15 | _borderRadius = borderRadius,
16 | super(key: key);
17 |
18 | final _GradientPainter _painter;
19 | final BorderRadius _borderRadius;
20 | final double? width;
21 | final double? height;
22 |
23 | @override
24 | Widget build(BuildContext context) {
25 | final size = width != null && height != null
26 | ? Size(width!, height!)
27 | : MediaQuery.of(context).size;
28 | return CustomPaint(
29 | painter: _painter,
30 | size: size,
31 | child: Container(
32 | decoration: BoxDecoration(
33 | borderRadius: _borderRadius,
34 | ),
35 | width: width,
36 | height: height,
37 | ),
38 | );
39 | }
40 | }
41 |
42 | class _GradientPainter extends CustomPainter {
43 | _GradientPainter(
44 | {required this.strokeWidth,
45 | required this.borderRadius,
46 | required this.gradient});
47 |
48 | final double strokeWidth;
49 | final Gradient gradient;
50 | final BorderRadius borderRadius;
51 | final Paint paintObject = Paint();
52 |
53 | @override
54 | void paint(Canvas canvas, Size size) {
55 | /*RRect innerRect2 = RRect.fromRectAndRadius(
56 | Rect.fromLTRB(strokeWidth, strokeWidth, size.width - (strokeWidth),
57 | size.height - (strokeWidth)),
58 | Radius.circular(radius - strokeWidth));*/
59 |
60 | Radius isMinus(double x, double y) {
61 | if (x < 0 || y < 0) {
62 | return const Radius.circular(0);
63 | } else {
64 | return Radius.elliptical(x, y);
65 | }
66 | }
67 |
68 | RRect innerRect2 = RRect.fromRectAndCorners(
69 | Rect.fromLTRB(strokeWidth, strokeWidth, size.width - (strokeWidth),
70 | size.height - (strokeWidth)),
71 | topLeft: isMinus(borderRadius.topLeft.x - strokeWidth,
72 | borderRadius.topLeft.y - strokeWidth),
73 | topRight: isMinus(borderRadius.topRight.x - strokeWidth,
74 | borderRadius.topRight.y - strokeWidth),
75 | bottomLeft: isMinus(borderRadius.bottomLeft.x - strokeWidth,
76 | borderRadius.bottomLeft.y - strokeWidth),
77 | bottomRight: isMinus(borderRadius.bottomRight.x - strokeWidth,
78 | borderRadius.bottomRight.y - strokeWidth),
79 | );
80 |
81 | RRect outerRect =
82 | borderRadius.toRRect(Rect.fromLTRB(0, 0, size.width, size.height));
83 | paintObject.shader = gradient.createShader(Offset.zero & size);
84 |
85 | Path outerRectPath = Path()..addRRect(outerRect);
86 | Path innerRectPath2 = Path()..addRRect(innerRect2);
87 | canvas.drawPath(
88 | Path.combine(PathOperation.difference, outerRectPath, innerRectPath2),
89 | paintObject);
90 | }
91 |
92 | @override
93 | bool shouldRepaint(CustomPainter oldDelegate) => true;
94 | }
95 |
--------------------------------------------------------------------------------
/example/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", "com.example" "\0"
93 | VALUE "FileDescription", "showcase" "\0"
94 | VALUE "FileVersion", VERSION_AS_STRING "\0"
95 | VALUE "InternalName", "showcase" "\0"
96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0"
97 | VALUE "OriginalFilename", "showcase.exe" "\0"
98 | VALUE "ProductName", "showcase" "\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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/lib/src/glass_list_tile.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'glass_container.dart';
3 |
4 | /// GlassListTile is a create ListTile with a glass effect.
5 | class GlassListTile extends StatefulWidget {
6 | const GlassListTile({
7 | Key? key,
8 | this.radius,
9 | this.border,
10 | this.blur,
11 | this.linearGradient,
12 | this.borderGradient,
13 | this.borderRadius,
14 | this.leading,
15 | this.title,
16 | this.subtitle,
17 | this.trailing,
18 | this.onTap,
19 | }) : super(key: key);
20 |
21 | final double? radius;
22 | final double? border;
23 | final double? blur;
24 | final LinearGradient? linearGradient;
25 | final LinearGradient? borderGradient;
26 | final BorderRadius? borderRadius;
27 |
28 | final Widget? leading;
29 | final Widget? title;
30 | final Widget? subtitle;
31 | final Widget? trailing;
32 |
33 | final void Function()? onTap;
34 |
35 | @override
36 | GlassListTileState createState() => GlassListTileState();
37 | }
38 |
39 | class GlassListTileState extends State {
40 | @override
41 | void initState() {
42 | WidgetsBinding.instance.addPostFrameCallback((_) {
43 | //ignore: unnecessary_statements
44 | MediaQuery.of(context).size;
45 | });
46 | super.initState();
47 | }
48 |
49 | @override
50 | Widget build(BuildContext context) {
51 | return GlassContainer(
52 | radius: widget.radius,
53 | linearGradient: widget.linearGradient,
54 | borderGradient: widget.borderGradient,
55 | border: widget.border,
56 | blur: widget.blur,
57 | borderRadius: widget.borderRadius,
58 | child: Center(
59 | child: Material(
60 | color: Colors.transparent,
61 | child: ListTile(
62 | leading: widget.leading,
63 | title: widget.title,
64 | subtitle: widget.subtitle,
65 | trailing: widget.trailing,
66 | onTap: widget.onTap,
67 | ),
68 | ),
69 | ),
70 | );
71 | }
72 | }
73 |
74 | // class GlassListTile extends StatelessWidget {
75 | // const GlassListTile({
76 | // Key? key,
77 | // this.radius,
78 | // this.border,
79 | // this.blur,
80 | // this.linearGradient,
81 | // this.borderGradient,
82 | // this.borderRadius,
83 | // this.leading,
84 | // this.title,
85 | // this.subtitle,
86 | // this.trailing,
87 | // this.onTap,
88 | // }) : super(key: key);
89 |
90 | // final double? radius;
91 | // final double? border;
92 | // final double? blur;
93 | // final LinearGradient? linearGradient;
94 | // final LinearGradient? borderGradient;
95 | // final BorderRadius? borderRadius;
96 |
97 | // final Widget? leading;
98 | // final Widget? title;
99 | // final Widget? subtitle;
100 | // final Widget? trailing;
101 |
102 | // final void Function()? onTap;
103 |
104 | // @override
105 | // Widget build(BuildContext context) {
106 | // return GlassContainer(
107 | // radius: radius,
108 | // linearGradient: linearGradient,
109 | // borderGradient: borderGradient,
110 | // border: border,
111 | // blur: blur,
112 | // borderRadius: borderRadius,
113 | // child: Center(
114 | // child: Material(
115 | // color: Colors.transparent,
116 | // child: ListTile(
117 | // leading: leading,
118 | // title: title,
119 | // subtitle: subtitle,
120 | // trailing: trailing,
121 | // onTap: onTap,
122 | // ),
123 | // ),
124 | // ),
125 | // );
126 | // }
127 | // }
128 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.14)
2 | project(showcase LANGUAGES CXX)
3 |
4 | set(BINARY_NAME "showcase")
5 |
6 | cmake_policy(SET CMP0063 NEW)
7 |
8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
9 |
10 | # Configure build options.
11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
12 | if(IS_MULTICONFIG)
13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
14 | CACHE STRING "" FORCE)
15 | else()
16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
17 | set(CMAKE_BUILD_TYPE "Debug" CACHE
18 | STRING "Flutter build mode" FORCE)
19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
20 | "Debug" "Profile" "Release")
21 | endif()
22 | endif()
23 |
24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
28 |
29 | # Use Unicode for all projects.
30 | add_definitions(-DUNICODE -D_UNICODE)
31 |
32 | # Compilation settings that should be applied to most targets.
33 | function(APPLY_STANDARD_SETTINGS TARGET)
34 | target_compile_features(${TARGET} PUBLIC cxx_std_17)
35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
36 | target_compile_options(${TARGET} PRIVATE /EHsc)
37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")
39 | endfunction()
40 |
41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
42 |
43 | # Flutter library and tool build rules.
44 | add_subdirectory(${FLUTTER_MANAGED_DIR})
45 |
46 | # Application build
47 | add_subdirectory("runner")
48 |
49 | # Generated plugin build rules, which manage building the plugins and adding
50 | # them to the application.
51 | include(flutter/generated_plugins.cmake)
52 |
53 |
54 | # === Installation ===
55 | # Support files are copied into place next to the executable, so that it can
56 | # run in place. This is done instead of making a separate bundle (as on Linux)
57 | # so that building and running from within Visual Studio will work.
58 | set(BUILD_BUNDLE_DIR "$")
59 | # Make the "install" step default, as it's required to run.
60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
63 | endif()
64 |
65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
67 |
68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
69 | COMPONENT Runtime)
70 |
71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
72 | COMPONENT Runtime)
73 |
74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
75 | COMPONENT Runtime)
76 |
77 | if(PLUGIN_BUNDLED_LIBRARIES)
78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
80 | COMPONENT Runtime)
81 | endif()
82 |
83 | # Fully re-copy the assets directory on each build to avoid having stale files
84 | # from a previous install.
85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
86 | install(CODE "
87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
88 | " COMPONENT Runtime)
89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
91 |
92 | # Install the AOT library on non-Debug builds only.
93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
94 | CONFIGURATIONS Profile;Release
95 | COMPONENT Runtime)
96 |
--------------------------------------------------------------------------------
/lib/src/glass_app_bar.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import 'glass_container.dart';
4 |
5 | /// A GlassAppBar is a Glassmorphic Design app bar that is like a [AppBar]
6 |
7 | class GlassAppBar extends StatefulWidget implements PreferredSizeWidget {
8 | const GlassAppBar({
9 | Key? key,
10 | this.leading,
11 | this.title,
12 | this.centerTitle,
13 | this.radius,
14 | this.border,
15 | this.blur,
16 | this.linearGradient,
17 | this.borderGradient,
18 | this.borderRadius,
19 | this.actions,
20 | }) : preferredSize = const Size.fromHeight(kToolbarHeight),
21 | super(key: key);
22 |
23 | final double? radius;
24 | final double? border;
25 | final double? blur;
26 | final LinearGradient? linearGradient;
27 | final LinearGradient? borderGradient;
28 | final BorderRadius? borderRadius;
29 | final List? actions;
30 |
31 | final Widget? leading;
32 | final Widget? title;
33 | final bool? centerTitle;
34 |
35 | @override
36 | final Size preferredSize;
37 |
38 | @override
39 | State createState() => _GlassAppBarState();
40 | }
41 |
42 | class _GlassAppBarState extends State {
43 | @override
44 | void initState() {
45 | WidgetsBinding.instance.addPostFrameCallback((_) {
46 | //ignore: unnecessary_statements
47 | MediaQuery.of(context).size;
48 | });
49 | super.initState();
50 | }
51 |
52 | @override
53 | Widget build(BuildContext context) {
54 | return GlassContainer(
55 | radius: widget.radius ?? 0,
56 | border: widget.border,
57 | blur: widget.blur,
58 | linearGradient: widget.linearGradient,
59 | borderGradient: widget.borderGradient,
60 | borderRadius: widget.borderRadius,
61 | child: AppBar(
62 | backgroundColor: Colors.transparent,
63 | shadowColor: Colors.transparent,
64 | leading: widget.leading,
65 | title: widget.title,
66 | centerTitle: widget.centerTitle,
67 | actions: widget.actions,
68 | ),
69 | );
70 | }
71 | }
72 |
73 | // class GlassAppBar extends StatelessWidget implements PreferredSizeWidget {
74 | // const GlassAppBar({
75 | // Key? key,
76 | // this.leading,
77 | // this.title,
78 | // this.centerTitle,
79 | // this.radius,
80 | // this.border,
81 | // this.blur,
82 | // this.linearGradient,
83 | // this.borderGradient,
84 | // this.borderRadius,
85 | // this.actions,
86 | // }) : preferredSize = const Size.fromHeight(kToolbarHeight),
87 | // super(key: key);
88 |
89 | // final double? radius;
90 | // final double? border;
91 | // final double? blur;
92 | // final LinearGradient? linearGradient;
93 | // final LinearGradient? borderGradient;
94 | // final BorderRadius? borderRadius;
95 | // final List? actions;
96 |
97 | // final Widget? leading;
98 | // final Widget? title;
99 | // final bool? centerTitle;
100 |
101 | // @override
102 | // final Size preferredSize;
103 |
104 | // @override
105 | // Widget build(BuildContext context) {
106 | // final size = MediaQuery.of(context).size;
107 | // return GlassContainer(
108 | // radius: radius ?? 0,
109 | // border: border,
110 | // blur: blur,
111 | // linearGradient: linearGradient,
112 | // borderGradient: borderGradient,
113 | // borderRadius: borderRadius,
114 | // child: AppBar(
115 | // backgroundColor: Colors.transparent,
116 | // shadowColor: Colors.transparent,
117 | // leading: leading,
118 | // title: title,
119 | // centerTitle: centerTitle,
120 | // actions: actions,
121 | // ),
122 | // );
123 | // }
124 | // }
125 |
--------------------------------------------------------------------------------
/example/windows/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.14)
2 |
3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
4 |
5 | # Configuration provided via flutter tool.
6 | include(${EPHEMERAL_DIR}/generated_config.cmake)
7 |
8 | # TODO: Move the rest of this into files in ephemeral. See
9 | # https://github.com/flutter/flutter/issues/57146.
10 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
11 |
12 | # === Flutter Library ===
13 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
14 |
15 | # Published to parent scope for install step.
16 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
17 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
18 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
19 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
20 |
21 | list(APPEND FLUTTER_LIBRARY_HEADERS
22 | "flutter_export.h"
23 | "flutter_windows.h"
24 | "flutter_messenger.h"
25 | "flutter_plugin_registrar.h"
26 | "flutter_texture_registrar.h"
27 | )
28 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
29 | add_library(flutter INTERFACE)
30 | target_include_directories(flutter INTERFACE
31 | "${EPHEMERAL_DIR}"
32 | )
33 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
34 | add_dependencies(flutter flutter_assemble)
35 |
36 | # === Wrapper ===
37 | list(APPEND CPP_WRAPPER_SOURCES_CORE
38 | "core_implementations.cc"
39 | "standard_codec.cc"
40 | )
41 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
42 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
43 | "plugin_registrar.cc"
44 | )
45 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
46 | list(APPEND CPP_WRAPPER_SOURCES_APP
47 | "flutter_engine.cc"
48 | "flutter_view_controller.cc"
49 | )
50 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
51 |
52 | # Wrapper sources needed for a plugin.
53 | add_library(flutter_wrapper_plugin STATIC
54 | ${CPP_WRAPPER_SOURCES_CORE}
55 | ${CPP_WRAPPER_SOURCES_PLUGIN}
56 | )
57 | apply_standard_settings(flutter_wrapper_plugin)
58 | set_target_properties(flutter_wrapper_plugin PROPERTIES
59 | POSITION_INDEPENDENT_CODE ON)
60 | set_target_properties(flutter_wrapper_plugin PROPERTIES
61 | CXX_VISIBILITY_PRESET hidden)
62 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
63 | target_include_directories(flutter_wrapper_plugin PUBLIC
64 | "${WRAPPER_ROOT}/include"
65 | )
66 | add_dependencies(flutter_wrapper_plugin flutter_assemble)
67 |
68 | # Wrapper sources needed for the runner.
69 | add_library(flutter_wrapper_app STATIC
70 | ${CPP_WRAPPER_SOURCES_CORE}
71 | ${CPP_WRAPPER_SOURCES_APP}
72 | )
73 | apply_standard_settings(flutter_wrapper_app)
74 | target_link_libraries(flutter_wrapper_app PUBLIC flutter)
75 | target_include_directories(flutter_wrapper_app PUBLIC
76 | "${WRAPPER_ROOT}/include"
77 | )
78 | add_dependencies(flutter_wrapper_app flutter_assemble)
79 |
80 | # === Flutter tool backend ===
81 | # _phony_ is a non-existent file to force this command to run every time,
82 | # since currently there's no way to get a full input/output list from the
83 | # flutter tool.
84 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
85 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
86 | add_custom_command(
87 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
88 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
89 | ${CPP_WRAPPER_SOURCES_APP}
90 | ${PHONY_OUTPUT}
91 | COMMAND ${CMAKE_COMMAND} -E env
92 | ${FLUTTER_TOOL_ENVIRONMENT}
93 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
94 | windows-x64 $
95 | VERBATIM
96 | )
97 | add_custom_target(flutter_assemble DEPENDS
98 | "${FLUTTER_LIBRARY}"
99 | ${FLUTTER_LIBRARY_HEADERS}
100 | ${CPP_WRAPPER_SOURCES_CORE}
101 | ${CPP_WRAPPER_SOURCES_PLUGIN}
102 | ${CPP_WRAPPER_SOURCES_APP}
103 | )
104 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: showcase
2 | description: A new Flutter project.
3 |
4 | # The following line prevents the package from being accidentally published to
5 | # pub.dev using `flutter pub publish`. This is preferred for private packages.
6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev
7 |
8 | # The following defines the version and build number for your application.
9 | # A version number is three numbers separated by dots, like 1.2.43
10 | # followed by an optional build number separated by a +.
11 | # Both the version and the builder number may be overridden in flutter
12 | # build by specifying --build-name and --build-number, respectively.
13 | # In Android, build-name is used as versionName while build-number used as versionCode.
14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
16 | # Read more about iOS versioning at
17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18 | version: 1.0.0+1
19 |
20 | environment:
21 | sdk: ">=2.16.0 <3.0.0"
22 |
23 | # Dependencies specify other packages that your package needs in order to work.
24 | # To automatically upgrade your package dependencies to the latest versions
25 | # consider running `flutter pub upgrade --major-versions`. Alternatively,
26 | # dependencies can be manually updated by changing the version numbers below to
27 | # the latest version available on pub.dev. To see which dependencies have newer
28 | # versions available, run `flutter pub outdated`.
29 | dependencies:
30 | flutter:
31 | sdk: flutter
32 |
33 |
34 | # The following adds the Cupertino Icons font to your application.
35 | # Use with the CupertinoIcons class for iOS style icons.
36 | cupertino_icons: ^1.0.2
37 | glassmorphism_widgets:
38 | path: ../
39 |
40 | dev_dependencies:
41 | flutter_test:
42 | sdk: flutter
43 |
44 | # The "flutter_lints" package below contains a set of recommended lints to
45 | # encourage good coding practices. The lint set provided by the package is
46 | # activated in the `analysis_options.yaml` file located at the root of your
47 | # package. See that file for information about deactivating specific lint
48 | # rules and activating additional ones.
49 | flutter_lints: ^1.0.0
50 |
51 | # For information on the generic Dart part of this file, see the
52 | # following page: https://dart.dev/tools/pub/pubspec
53 |
54 | # The following section is specific to Flutter.
55 | flutter:
56 |
57 | # The following line ensures that the Material Icons font is
58 | # included with your application, so that you can use the icons in
59 | # the material Icons class.
60 | uses-material-design: true
61 |
62 | # To add assets to your application, add an assets section, like this:
63 | # assets:
64 | # - images/a_dot_burr.jpeg
65 | # - images/a_dot_ham.jpeg
66 |
67 | # An image asset can refer to one or more resolution-specific "variants", see
68 | # https://flutter.dev/assets-and-images/#resolution-aware.
69 |
70 | # For details regarding adding assets from package dependencies, see
71 | # https://flutter.dev/assets-and-images/#from-packages
72 |
73 | # To add custom fonts to your application, add a fonts section here,
74 | # in this "flutter" section. Each entry in this list should have a
75 | # "family" key with the font family name, and a "fonts" key with a
76 | # list giving the asset and other descriptors for the font. For
77 | # example:
78 | # fonts:
79 | # - family: Schyler
80 | # fonts:
81 | # - asset: fonts/Schyler-Regular.ttf
82 | # - asset: fonts/Schyler-Italic.ttf
83 | # style: italic
84 | # - family: Trajan Pro
85 | # fonts:
86 | # - asset: fonts/TrajanPro.ttf
87 | # - asset: fonts/TrajanPro_Bold.ttf
88 | # weight: 700
89 | #
90 | # For details regarding fonts from package dependencies,
91 | # see https://flutter.dev/custom-fonts/#from-packages
92 | #dependency_overrides:
93 | # glassmorphism_widgets:
94 | # path: ../../
--------------------------------------------------------------------------------
/lib/src/glass_flex_container.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:flutter/material.dart';
4 |
5 | import 'glass_border.dart';
6 |
7 | class GlassFlexContainer extends StatelessWidget {
8 | final AlignmentGeometry? alignment;
9 | final EdgeInsetsGeometry? padding;
10 |
11 | final int? flex;
12 | final EdgeInsetsGeometry? margin;
13 |
14 | final Matrix4? transform;
15 |
16 | final BorderRadius borderRadius;
17 | final Widget? child;
18 |
19 | final double radius;
20 | final BoxShape shape;
21 | final BoxConstraints? constraints;
22 | final double border;
23 | final double blur;
24 | final LinearGradient? linearGradient;
25 | final LinearGradient? borderGradient;
26 |
27 | GlassFlexContainer(
28 | {Key? key,
29 | this.child,
30 | this.alignment,
31 | this.padding,
32 | this.shape = BoxShape.rectangle,
33 | this.margin,
34 | this.transform,
35 | double? radius,
36 | this.linearGradient,
37 | double? border,
38 | double? blur,
39 | this.borderGradient,
40 | BorderRadius? borderRadius,
41 | this.constraints,
42 | this.flex = 1})
43 | : assert(margin == null || margin.isNonNegative),
44 | assert(padding == null || padding.isNonNegative),
45 | assert(
46 | flex! >= 1,
47 | 'Flex value can be less than 1 : $flex. Please Provide a flex value > 1',
48 | ),
49 | assert(constraints == null || constraints.debugAssertIsValid()),
50 | borderRadius = borderRadius ?? BorderRadius.circular(radius ?? 20),
51 | radius = radius ?? 20,
52 | border = border ?? 2,
53 | blur = blur ?? 20,
54 | super(key: key);
55 |
56 | @override
57 | Widget build(BuildContext context) {
58 | return Expanded(
59 | flex: flex!,
60 | child: Container(
61 | key: key,
62 | alignment: alignment,
63 | padding: padding,
64 | constraints: const BoxConstraints.tightForFinite(),
65 | transform: transform,
66 | child: Stack(
67 | children: [
68 | ClipRRect(
69 | clipBehavior: Clip.hardEdge,
70 | borderRadius: borderRadius,
71 | child: BackdropFilter(
72 | filter: ImageFilter.blur(sigmaX: blur, sigmaY: blur * 2),
73 | child: Container(
74 | alignment: alignment ?? Alignment.topLeft,
75 | decoration: BoxDecoration(
76 | borderRadius: borderRadius,
77 | gradient: linearGradient ??
78 | LinearGradient(
79 | begin: Alignment.topLeft,
80 | end: Alignment.bottomRight,
81 | colors: [
82 | const Color(0xFFffffff).withOpacity(0.1),
83 | const Color(0xFFFFFFFF).withOpacity(0.05),
84 | ],
85 | stops: const [
86 | 0.1,
87 | 1,
88 | ],
89 | ),
90 | ),
91 | ),
92 | ),
93 | ),
94 | GlassBorder(
95 | strokeWidth: border,
96 | borderRadius: borderRadius,
97 | gradient: borderGradient ??
98 | LinearGradient(
99 | begin: Alignment.topLeft,
100 | end: Alignment.bottomRight,
101 | colors: [
102 | const Color(0xFFffffff).withOpacity(0.5),
103 | const Color((0xFFFFFFFF)).withOpacity(0.5),
104 | ],
105 | ),
106 | ),
107 | ClipRRect(
108 | clipBehavior: Clip.hardEdge,
109 | borderRadius: borderRadius,
110 | child: Container(
111 | child: child,
112 | ),
113 | ),
114 | ],
115 | ),
116 | ),
117 | );
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/example/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, "showcase");
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, "showcase");
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 |
--------------------------------------------------------------------------------
/example/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | showcase
33 |
34 |
35 |
36 |
39 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/example/linux/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(runner LANGUAGES CXX)
3 |
4 | set(BINARY_NAME "showcase")
5 | set(APPLICATION_ID "com.example.showcase")
6 |
7 | cmake_policy(SET CMP0063 NEW)
8 |
9 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
10 |
11 | # Root filesystem for cross-building.
12 | if(FLUTTER_TARGET_PLATFORM_SYSROOT)
13 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
14 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
15 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
16 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
17 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
18 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
19 | endif()
20 |
21 | # Configure build options.
22 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
23 | set(CMAKE_BUILD_TYPE "Debug" CACHE
24 | STRING "Flutter build mode" FORCE)
25 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
26 | "Debug" "Profile" "Release")
27 | endif()
28 |
29 | # Compilation settings that should be applied to most targets.
30 | function(APPLY_STANDARD_SETTINGS TARGET)
31 | target_compile_features(${TARGET} PUBLIC cxx_std_14)
32 | target_compile_options(${TARGET} PRIVATE -Wall -Werror)
33 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>")
34 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>")
35 | endfunction()
36 |
37 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
38 |
39 | # Flutter library and tool build rules.
40 | add_subdirectory(${FLUTTER_MANAGED_DIR})
41 |
42 | # System-level dependencies.
43 | find_package(PkgConfig REQUIRED)
44 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
45 |
46 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
47 |
48 | # Application build
49 | add_executable(${BINARY_NAME}
50 | "main.cc"
51 | "my_application.cc"
52 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
53 | )
54 | apply_standard_settings(${BINARY_NAME})
55 | target_link_libraries(${BINARY_NAME} PRIVATE flutter)
56 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
57 | add_dependencies(${BINARY_NAME} flutter_assemble)
58 | # Only the install-generated bundle's copy of the executable will launch
59 | # correctly, since the resources must in the right relative locations. To avoid
60 | # people trying to run the unbundled copy, put it in a subdirectory instead of
61 | # the default top-level location.
62 | set_target_properties(${BINARY_NAME}
63 | PROPERTIES
64 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
65 | )
66 |
67 | # Generated plugin build rules, which manage building the plugins and adding
68 | # them to the application.
69 | include(flutter/generated_plugins.cmake)
70 |
71 |
72 | # === Installation ===
73 | # By default, "installing" just makes a relocatable bundle in the build
74 | # directory.
75 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
76 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
77 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
78 | endif()
79 |
80 | # Start with a clean build bundle directory every time.
81 | install(CODE "
82 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
83 | " COMPONENT Runtime)
84 |
85 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
86 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
87 |
88 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
89 | COMPONENT Runtime)
90 |
91 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
92 | COMPONENT Runtime)
93 |
94 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
95 | COMPONENT Runtime)
96 |
97 | if(PLUGIN_BUNDLED_LIBRARIES)
98 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
99 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
100 | COMPONENT Runtime)
101 | endif()
102 |
103 | # Fully re-copy the assets directory on each build to avoid having stale files
104 | # from a previous install.
105 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
106 | install(CODE "
107 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
108 | " COMPONENT Runtime)
109 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
110 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
111 |
112 | # Install the AOT library on non-Debug builds only.
113 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
114 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
115 | COMPONENT Runtime)
116 | endif()
117 |
--------------------------------------------------------------------------------
/lib/src/glass_theme_data.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/foundation.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | /// A GlassThemeData is a theme for a GlassWidgets.
5 | class GlassThemeData with Diagnosticable {
6 | factory GlassThemeData({
7 | double? radius,
8 | double? border,
9 | double? blur,
10 | LinearGradient? linearGradient,
11 | LinearGradient? borderGradient,
12 | BorderRadius? borderRadius,
13 | }) {
14 | radius ??= 20;
15 | border ??= 2;
16 | blur ??= 20;
17 | linearGradient ??= LinearGradient(
18 | begin: Alignment.topLeft,
19 | end: Alignment.bottomRight,
20 | colors: [
21 | const Color(0xFFffffff).withOpacity(0.1),
22 | const Color(0xFFFFFFFF).withOpacity(0.05),
23 | ],
24 | stops: const [
25 | 0.1,
26 | 1,
27 | ],
28 | );
29 | borderGradient ??= LinearGradient(
30 | begin: Alignment.topLeft,
31 | end: Alignment.bottomRight,
32 | colors: [
33 | const Color(0xFFffffff).withOpacity(0.5),
34 | const Color(0xFFFFFFFF).withOpacity(0.5),
35 | ],
36 | );
37 | borderRadius ??= BorderRadius.circular(radius);
38 | return GlassThemeData.raw(
39 | radius: radius,
40 | border: border,
41 | blur: blur,
42 | linearGradient: linearGradient,
43 | borderGradient: borderGradient,
44 | borderRadius: borderRadius,
45 | );
46 | }
47 |
48 | const GlassThemeData.raw({
49 | required this.radius,
50 | required this.border,
51 | required this.blur,
52 | required this.linearGradient,
53 | required this.borderGradient,
54 | required this.borderRadius,
55 | });
56 |
57 | factory GlassThemeData.fallback() => GlassThemeData(
58 | radius: null,
59 | border: null,
60 | blur: null,
61 | linearGradient: LinearGradient(
62 | begin: Alignment.topLeft,
63 | end: Alignment.bottomRight,
64 | colors: [
65 | const Color(0xFFffffff).withOpacity(0.1),
66 | const Color(0xFFFFFFFF).withOpacity(0.05),
67 | ],
68 | stops: const [
69 | 0.1,
70 | 1,
71 | ],
72 | ),
73 | borderGradient: null,
74 | borderRadius: null,
75 | );
76 |
77 | GlassThemeData copyWith(
78 | {double? radius,
79 | double? border,
80 | double? blur,
81 | LinearGradient? linearGradient,
82 | LinearGradient? borderGradient,
83 | BorderRadius? borderRadius}) =>
84 | GlassThemeData.raw(
85 | radius: radius ?? this.radius,
86 | border: border ?? this.border,
87 | blur: blur ?? this.blur,
88 | linearGradient: linearGradient ?? this.linearGradient,
89 | borderGradient: borderGradient ?? this.borderGradient,
90 | borderRadius: borderRadius ?? this.borderRadius,
91 | );
92 |
93 | static GlassThemeData localize(GlassThemeData baseTheme) {
94 | return _localizedThemeDataCache.putIfAbsent(
95 | _IdentityGlassThemeDataCacheKey(baseTheme),
96 | () {
97 | return baseTheme.copyWith(
98 | blur: baseTheme.blur,
99 | border: baseTheme.border,
100 | borderRadius: baseTheme.borderRadius,
101 | linearGradient: baseTheme.linearGradient,
102 | borderGradient: baseTheme.borderGradient,
103 | );
104 | },
105 | );
106 | }
107 |
108 | static const int _localizedThemeDataCacheSize = 5;
109 |
110 | static final _FifoCache<_IdentityGlassThemeDataCacheKey, GlassThemeData>
111 | _localizedThemeDataCache =
112 | _FifoCache<_IdentityGlassThemeDataCacheKey, GlassThemeData>(
113 | _localizedThemeDataCacheSize);
114 |
115 | final double radius;
116 | final double border;
117 | final double blur;
118 | final LinearGradient linearGradient;
119 | final LinearGradient borderGradient;
120 | final BorderRadius borderRadius;
121 | }
122 |
123 | @immutable
124 | class _IdentityGlassThemeDataCacheKey {
125 | const _IdentityGlassThemeDataCacheKey(this.baseTheme);
126 | //this.localTextGeometry);
127 |
128 | final GlassThemeData baseTheme;
129 |
130 | // Using XOR to make the hash function as fast as possible (e.g. Jenkins is
131 | // noticeably slower).
132 | @override
133 | int get hashCode => identityHashCode(baseTheme);
134 | // ^ identityHashCode(localTextGeometry);
135 |
136 | @override
137 | bool operator ==(Object other) {
138 | // We are explicitly ignoring the possibility that the types might not
139 | // match in the interests of speed.
140 | return other is _IdentityGlassThemeDataCacheKey &&
141 | identical(other.baseTheme, baseTheme);
142 | //&& identical(other.localTextGeometry, localTextGeometry);
143 | }
144 | }
145 |
146 | class _FifoCache {
147 | _FifoCache(this._maximumSize) : assert(_maximumSize > 0);
148 |
149 | /// In Dart the map literal uses a linked hash-map implementation, whose keys
150 | /// are stored such that [Map.keys] returns them in the order they were
151 | /// inserted.
152 | final Map _cache = {};
153 |
154 | /// Maximum number of entries to store in the cache.
155 | ///
156 | /// Once this many entries have been cached, the entry inserted least recently
157 | /// is evicted when adding a new entry.
158 | final int _maximumSize;
159 |
160 | /// Returns the previously cached value for the given key, if available;
161 | /// if not, calls the given callback to obtain it first.
162 | ///
163 | /// The arguments must not be null.
164 | V putIfAbsent(K key, V Function() loader) {
165 | assert(key != null);
166 | final V? result = _cache[key];
167 | if (result != null) return result;
168 | if (_cache.length == _maximumSize) _cache.remove(_cache.keys.first);
169 | return _cache[key] = loader();
170 | }
171 | }
172 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
13 |
14 | ## Glassmorphism Widgets
15 |
16 |
17 | ## About
18 | This package allows you to easily create a Glassmorphism UI.
19 | The AppBar, ListTile, and even the BottomNavigationBar work like Material Design widgets.
20 | The color, shape, and size of the glass are all up to you.
21 | Create your ideal Glassmorphism App!
22 | This package currently supports only stable channel.
23 |
24 |
25 | ## Getting started
26 |
27 | You should add the following to the `pubspec.yaml` file:
28 |
29 | ```yaml
30 | dependencies:
31 | glassmorphism_widgets:
32 | ```
33 |
34 | You should then run `flutter packages get` in your terminal so as to get the package.
35 |
36 | Now import the package in the dart file:
37 |
38 | ```dart
39 | import 'package:glassmorphism_widgets/glassmorphism_widgets.dart';
40 | ```
41 |
42 | ## Usage
43 | Here is an example of how to use Glassmorphism Widgets.
44 | Many of the parameters are based on the original Material Design widget.
45 | If you want to know glass specific parameter.
46 | You should look [here](#a-specific-Glass-widget-parameter).
47 |
48 | ### GlassContainer
49 | a simple glass container.
50 | ```dart
51 | GlassContainer(
52 | child: Padding(
53 | padding: EdgeInsets.all(8),
54 | child: GlassText("Hello World"),
55 | ),
56 | ),
57 | ```
58 |
59 | ### GlassFlexContainer
60 | ```dart
61 | Container(
62 | height:200,
63 | width:200,
64 | GlassFlexContainer(
65 | child: Padding(
66 | padding: EdgeInsets.all(8),
67 | child: GlassText("Hello World"),
68 | ),
69 | ),
70 | ),
71 | ```
72 | ### GlassApp & GlassThemeData
73 | If you want to change glass widgets look all together.
74 | You should use GlassApp and GlassThemeData.
75 | ```dart
76 | GlassApp(
77 | theme: GlassThemeData(
78 | blur: 10,
79 | ),
80 | home: MaterialApp(
81 | title: 'Flutter Demo',
82 | theme: ThemeData(
83 | primarySwatch: Colors.blue,
84 | ),
85 | home: const MyHomePage(title: 'Flutter Demo Home Page'),
86 | ),
87 | )
88 | ```
89 |
90 | ### GlassTheme
91 | If you want to access GlassThemeData.
92 | You should use GlassTheme.
93 | ```dart
94 | GlassThemeData data = GlassTheme.of(context);
95 | ```
96 |
97 | ### GlassText
98 | It is a thin white text.
99 | ```dart
100 | GlassText("Hello World"),
101 | ```
102 |
103 | ### GlassAppBar
104 | a simple glass app bar.
105 | ```dart
106 | appBar: GlassAppBar(
107 | title: GlassText(
108 | 'Glass Morphic Demo',
109 | fontWeight: FontWeight.bold,
110 | color: Colors.white,
111 | ),
112 | ),
113 | ```
114 | ### GlassListTile
115 | a simple glass list tile
116 | ```dart
117 | GlassListTile(
118 | leading: GlassIcon(Icons.search),
119 | title: TextField(
120 | decoration: InputDecoration(
121 | hintText: 'Search',
122 | border: InputBorder.none,
123 | hintStyle: glassTextStyle,
124 | ),
125 | style: glassTextStyle,
126 | ),
127 | onTap: () {},
128 | ),
129 | ```
130 | ### GlassButton
131 | a simple glass button
132 | ```dart
133 | GlassButton(
134 | onPressed: () {
135 | showGlassBottomSheet(
136 | context: context,
137 | child: Center(
138 | child: GlassText("Hello World", fontSize: 20)));
139 | },
140 | child: GlassText("Button"),
141 | ),
142 | ```
143 | ### showGlassBottomSheet
144 | Display bottom sheet like glass
145 | ```dart
146 | showGlassBottomSheet(
147 | context: context,
148 | child: Center(
149 | child: GlassText("Hello World", fontSize: 20)));
150 | ```
151 | ### GlassFloatingActionButton
152 | ```dart
153 | floatingActionButton: GlassFloatingActionButton(
154 | onPressed: () {
155 | setState(() {
156 | index++;
157 | });
158 | },
159 | child: GlassText("$index"),
160 | ),
161 | ```
162 | ### GlassBottomBar
163 | ```dart
164 | bottomNavigationBar: GlassBottomBar(
165 | items: [
166 | GlassBottomBarItem(
167 | icon: Icon(Icons.home),
168 | title: GlassText("Home"),
169 | ),
170 | GlassBottomBarItem(
171 | icon: Icon(Icons.search),
172 | title: GlassText("Search"),
173 | ),
174 | GlassBottomBarItem(
175 | icon: Icon(Icons.settings),
176 | title: GlassText("Settings"),
177 | ),
178 | ],
179 | onTap: (i) {
180 | setState(() {
181 | index = i;
182 | });
183 | },
184 | currentIndex: index,
185 | ),
186 | ```
187 | ### GlassIcon
188 | ```dart
189 | IconButton(
190 | icon: GlassIcon(Icons.search),
191 | onPressed: () {},
192 | ),
193 | ```
194 | ## a specific Glass widget parameter
195 | ### How to change widgets gradient?
196 | You should add parameter linearGradient.
197 |
198 | ### How to change widgets shape?
199 | You should add parameter radius or borderRadius.
200 | borderRadius takes precedence over radius.
201 |
202 | ### I want to create more clear glass or more frosted glass
203 | You should add parameter blur.
204 | If you set blur lower value. GlassWidgets will become clear.
205 | ## Problem
206 | Master Channel cannot use GlassFloatingActionButton.
207 |
208 | ## Contact
209 | If you have anything you want to inform me ([@yama-yeah](https://github.com/yama-yeah)), such as suggestions to enhance this package or functionalities you want etc, feel free to make [issues on GitHub](https://github.com/yama-yeah/glassmorphism_widgets/issues)
210 |
--------------------------------------------------------------------------------
/example/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | async:
5 | dependency: transitive
6 | description:
7 | name: async
8 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
9 | url: "https://pub.dev"
10 | source: hosted
11 | version: "2.11.0"
12 | boolean_selector:
13 | dependency: transitive
14 | description:
15 | name: boolean_selector
16 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
17 | url: "https://pub.dev"
18 | source: hosted
19 | version: "2.1.1"
20 | characters:
21 | dependency: transitive
22 | description:
23 | name: characters
24 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
25 | url: "https://pub.dev"
26 | source: hosted
27 | version: "1.3.0"
28 | clock:
29 | dependency: transitive
30 | description:
31 | name: clock
32 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
33 | url: "https://pub.dev"
34 | source: hosted
35 | version: "1.1.1"
36 | collection:
37 | dependency: transitive
38 | description:
39 | name: collection
40 | sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
41 | url: "https://pub.dev"
42 | source: hosted
43 | version: "1.17.1"
44 | cupertino_icons:
45 | dependency: "direct main"
46 | description:
47 | name: cupertino_icons
48 | sha256: "1989d917fbe8e6b39806207df5a3fdd3d816cbd090fac2ce26fb45e9a71476e5"
49 | url: "https://pub.dev"
50 | source: hosted
51 | version: "1.0.4"
52 | fake_async:
53 | dependency: transitive
54 | description:
55 | name: fake_async
56 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
57 | url: "https://pub.dev"
58 | source: hosted
59 | version: "1.3.1"
60 | flutter:
61 | dependency: "direct main"
62 | description: flutter
63 | source: sdk
64 | version: "0.0.0"
65 | flutter_lints:
66 | dependency: "direct dev"
67 | description:
68 | name: flutter_lints
69 | sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493
70 | url: "https://pub.dev"
71 | source: hosted
72 | version: "1.0.4"
73 | flutter_test:
74 | dependency: "direct dev"
75 | description: flutter
76 | source: sdk
77 | version: "0.0.0"
78 | glassmorphism_widgets:
79 | dependency: "direct main"
80 | description:
81 | path: ".."
82 | relative: true
83 | source: path
84 | version: "0.2.1"
85 | js:
86 | dependency: transitive
87 | description:
88 | name: js
89 | sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
90 | url: "https://pub.dev"
91 | source: hosted
92 | version: "0.6.7"
93 | lints:
94 | dependency: transitive
95 | description:
96 | name: lints
97 | sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c
98 | url: "https://pub.dev"
99 | source: hosted
100 | version: "1.0.1"
101 | matcher:
102 | dependency: transitive
103 | description:
104 | name: matcher
105 | sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
106 | url: "https://pub.dev"
107 | source: hosted
108 | version: "0.12.15"
109 | material_color_utilities:
110 | dependency: transitive
111 | description:
112 | name: material_color_utilities
113 | sha256: "586678f20e112219ed0f73215f01bcdf1d769824ba2ebae45ad918a9bfde9bdb"
114 | url: "https://pub.dev"
115 | source: hosted
116 | version: "0.3.0"
117 | meta:
118 | dependency: transitive
119 | description:
120 | name: meta
121 | sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
122 | url: "https://pub.dev"
123 | source: hosted
124 | version: "1.9.1"
125 | path:
126 | dependency: transitive
127 | description:
128 | name: path
129 | sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
130 | url: "https://pub.dev"
131 | source: hosted
132 | version: "1.8.3"
133 | sky_engine:
134 | dependency: transitive
135 | description: flutter
136 | source: sdk
137 | version: "0.0.99"
138 | source_span:
139 | dependency: transitive
140 | description:
141 | name: source_span
142 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
143 | url: "https://pub.dev"
144 | source: hosted
145 | version: "1.10.0"
146 | stack_trace:
147 | dependency: transitive
148 | description:
149 | name: stack_trace
150 | sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
151 | url: "https://pub.dev"
152 | source: hosted
153 | version: "1.11.0"
154 | stream_channel:
155 | dependency: transitive
156 | description:
157 | name: stream_channel
158 | sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
159 | url: "https://pub.dev"
160 | source: hosted
161 | version: "2.1.1"
162 | string_scanner:
163 | dependency: transitive
164 | description:
165 | name: string_scanner
166 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
167 | url: "https://pub.dev"
168 | source: hosted
169 | version: "1.2.0"
170 | term_glyph:
171 | dependency: transitive
172 | description:
173 | name: term_glyph
174 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
175 | url: "https://pub.dev"
176 | source: hosted
177 | version: "1.2.1"
178 | test_api:
179 | dependency: transitive
180 | description:
181 | name: test_api
182 | sha256: daadc9baabec998b062c9091525aa95786508b1c48e9c30f1f891b8bf6ff2e64
183 | url: "https://pub.dev"
184 | source: hosted
185 | version: "0.5.2"
186 | vector_math:
187 | dependency: transitive
188 | description:
189 | name: vector_math
190 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
191 | url: "https://pub.dev"
192 | source: hosted
193 | version: "2.1.4"
194 | sdks:
195 | dart: ">=3.0.0-0 <4.0.0"
196 | flutter: ">=1.17.0"
197 |
--------------------------------------------------------------------------------
/lib/src/glass_container.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:flutter/cupertino.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:glassmorphism_widgets/src/glass_theme.dart';
6 |
7 | import 'glass_border.dart';
8 |
9 | /// A GlassContainer is a container that draws a glass effect.
10 | class GlassContainer extends StatefulWidget {
11 | /*Key? key,
12 | this.alignment,
13 | this.padding,
14 | this.color,
15 | this.decoration,
16 | this.foregroundDecoration,
17 | double? width,
18 | double? height,
19 | BoxConstraints? constraints,
20 | this.margin,
21 | this.transform,
22 | this.transformAlignment,
23 | this.child,
24 | this.clipBehavior = Clip.none,*/
25 | const GlassContainer({
26 | Key? key,
27 | this.alignment,
28 | this.padding,
29 | this.linearGradient,
30 | this.borderGradient,
31 | this.blur,
32 | this.width,
33 | this.height,
34 | this.constraints,
35 | this.margin,
36 | this.transform,
37 | this.transformAlignment,
38 | this.radius,
39 | this.border,
40 | this.borderRadius,
41 | this.child,
42 | }) : super(key: key);
43 |
44 | final EdgeInsetsGeometry? padding;
45 | final AlignmentGeometry? alignment;
46 | final AlignmentGeometry? transformAlignment;
47 |
48 | final EdgeInsetsGeometry? margin;
49 | final Matrix4? transform;
50 |
51 | final Widget? child;
52 | final double? radius;
53 | final double? border;
54 | final double? blur;
55 | final LinearGradient? linearGradient;
56 | final LinearGradient? borderGradient;
57 | final BorderRadius? borderRadius;
58 | final double? width;
59 | final double? height;
60 | final BoxConstraints? constraints;
61 |
62 | @override
63 | GlassContainerState createState() => GlassContainerState();
64 | }
65 |
66 | class GlassContainerState extends State {
67 | final GlobalKey _contentKey = GlobalKey();
68 |
69 | BuildContext? contentBox;
70 | Size? size;
71 | WidgetsBinding? get _widgetsBindingInstance => WidgetsBinding.instance;
72 |
73 | @override
74 | Widget build(BuildContext context) {
75 | _widgetsBindingInstance?.addPostFrameCallback((_) {
76 | if (size != _contentKey.currentContext?.size) {
77 | if (mounted) {
78 | setState(() {
79 | size = _contentKey.currentContext?.size;
80 | });
81 | }
82 | }
83 | //print(_contentKey.currentContext?.size);
84 | });
85 | final linearGradient =
86 | widget.linearGradient ?? GlassTheme.of(context).linearGradient;
87 | final borderGradient =
88 | widget.borderGradient ?? GlassTheme.of(context).borderGradient;
89 | final blur = widget.blur ?? GlassTheme.of(context).blur;
90 | final border = widget.border ?? GlassTheme.of(context).border;
91 | final borderRadius = widget.borderRadius == null
92 | ? widget.radius == null
93 | ? GlassTheme.of(context).borderRadius
94 | : BorderRadius.circular(widget.radius!)
95 | : widget.borderRadius!;
96 | return Container(
97 | key: widget.key,
98 | //alignment: widget.alignment,
99 | padding: widget.padding,
100 | width: widget.width,
101 | height: widget.height,
102 | constraints: widget.constraints,
103 | margin: widget.margin,
104 | transform: widget.transform,
105 | transformAlignment: widget.transformAlignment,
106 | child: ClipRRect(
107 | borderRadius: borderRadius,
108 | child: BackdropFilter(
109 | filter: ImageFilter.blur(sigmaX: blur, sigmaY: blur * 2),
110 | child: Stack(
111 | children: [
112 | SizedBox(
113 | width: widget.width ?? size?.width,
114 | height: widget.height ?? size?.height,
115 | child: Stack(
116 | alignment: Alignment.topLeft,
117 | children: [
118 | size != null
119 | ? ClipRRect(
120 | clipBehavior: Clip.hardEdge,
121 | borderRadius: borderRadius,
122 | child: SizedBox(
123 | width: widget.width ?? size?.width,
124 | height: widget.height ?? size?.height,
125 | child: Container(
126 | decoration: BoxDecoration(
127 | borderRadius: borderRadius,
128 | gradient: linearGradient),
129 | width: widget.width ?? size?.width,
130 | height: widget.height ?? size?.height,
131 | ),
132 | ),
133 | )
134 | : const Text(''),
135 | size == null
136 | ? const Text('')
137 | : SizedBox(
138 | height: widget.height ?? size?.height,
139 | width: widget.width ?? size?.width,
140 | child: GlassBorder(
141 | strokeWidth: border,
142 | borderRadius: borderRadius,
143 | width: widget.width ?? size?.width,
144 | height: widget.height ?? size?.height,
145 | gradient: borderGradient,
146 | ),
147 | ),
148 | ],
149 | ),
150 | ),
151 | ClipRRect(
152 | clipBehavior: Clip.hardEdge,
153 | borderRadius: borderRadius,
154 | child: SizedBox(
155 | height: widget.height,
156 | key: _contentKey,
157 | width: widget.width,
158 | //alignment: Alignment.topCenter,
159 | //alignment: widget.alignment,
160 | //alignment: widget.alignment,
161 | //color: Colors.red,
162 | //color: Colors.red,
163 | child: widget.child,
164 | ),
165 | ),
166 | ],
167 | ),
168 | ),
169 | ),
170 | );
171 | }
172 | }
173 |
--------------------------------------------------------------------------------
/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:glassmorphism_widgets/glassmorphism_widgets.dart';
3 |
4 | void main() {
5 | runApp(const MyApp());
6 | }
7 |
8 | class MyApp extends StatelessWidget {
9 | const MyApp({Key? key}) : super(key: key);
10 |
11 | // This widget is the root of your application.
12 | @override
13 | Widget build(BuildContext context) {
14 | return GlassApp(
15 | theme: GlassThemeData(
16 | blur: 10,
17 | ),
18 | home: MaterialApp(
19 | title: 'Flutter Demo',
20 | theme: ThemeData(
21 | primarySwatch: Colors.blue,
22 | ),
23 | home: const MyHomePage(title: 'Flutter Demo Home Page'),
24 | ),
25 | );
26 | }
27 | }
28 |
29 | class MyHomePage extends StatefulWidget {
30 | const MyHomePage({Key? key, required this.title}) : super(key: key);
31 |
32 | // This widget is the home page of your application. It is stateful, meaning
33 | // that it has a State object (defined below) that contains fields that affect
34 | // how it looks.
35 |
36 | // This class is the configuration for the state. It holds the values (in this
37 | // case the title) provided by the parent (in this case the App widget) and
38 | // used by the build method of the State. Fields in a Widget subclass are
39 | // always marked "final".
40 |
41 | final String title;
42 |
43 | @override
44 | State createState() => _MyHomePageState();
45 | }
46 |
47 | class _MyHomePageState extends State {
48 | int index = 0;
49 |
50 | @override
51 | Widget build(BuildContext context) {
52 | // This method is rerun every time setState is called, for instance as done
53 | // by the _incrementCounter method above.
54 | //
55 | // The Flutter framework has been optimized to make rerunning build methods
56 | // fast, so that you can just rebuild anything that needs updating rather
57 | // than having to individually change instances of widgets.
58 | return Stack(
59 | children: [
60 | Scaffold(
61 | body: Container(
62 | decoration: BoxDecoration(
63 | image: DecorationImage(
64 | image: Image.network(
65 | "https://picsum.photos/${MediaQuery.of(context).size.width.toInt()}/${MediaQuery.of(context).size.height.toInt()}")
66 | .image,
67 | fit: BoxFit.cover,
68 | ),
69 | ),
70 | ),
71 | ),
72 | Scaffold(
73 | backgroundColor: Colors.transparent,
74 | appBar: GlassAppBar(
75 | title: const GlassText(
76 | 'Glass Morphic Demo',
77 | fontWeight: FontWeight.bold,
78 | color: Colors.white,
79 | ),
80 | actions: [
81 | IconButton(
82 | icon: const GlassIcon(Icons.search),
83 | onPressed: () {},
84 | ),
85 | IconButton(
86 | icon: const GlassIcon(Icons.more_vert),
87 | onPressed: () {},
88 | ),
89 | ],
90 | ),
91 | body: Column(
92 | mainAxisAlignment: MainAxisAlignment.center,
93 | children: [
94 | GlassListTile(
95 | leading: const GlassIcon(Icons.search),
96 | title: TextField(
97 | decoration: InputDecoration(
98 | hintText: 'Search',
99 | border: InputBorder.none,
100 | hintStyle: glassTextStyle,
101 | ),
102 | style: glassTextStyle,
103 | ),
104 | onTap: () {},
105 | ),
106 | const GlassIcon(Icons.add),
107 | const Center(
108 | child: Center(
109 | child: GlassContainer(
110 | child: Padding(
111 | padding: EdgeInsets.all(8),
112 | child: GlassText("Hello World"),
113 | ),
114 | ),
115 | ),
116 | ),
117 | const GlassIcon(Icons.add),
118 | GlassButton(
119 | blur: 10,
120 | linearGradient: LinearGradient(
121 | colors: [
122 | Colors.blue.withOpacity(0.5),
123 | Colors.blue.withOpacity(0.4),
124 | ],
125 | ),
126 | onPressed: () {
127 | showGlassBottomSheet(
128 | blur: 2,
129 | context: context,
130 | child: const Center(
131 | child: GlassText("Hello World", fontSize: 20),
132 | ),
133 | );
134 | },
135 | child: const GlassText("Button")),
136 | ],
137 | ),
138 | floatingActionButton: GlassFloatingActionButton(
139 | onPressed: () {
140 | setState(() {
141 | index++;
142 | });
143 | },
144 | child: GlassText("$index"),
145 | ),
146 | bottomNavigationBar: GlassBottomBar(
147 | items: [
148 | GlassBottomBarItem(
149 | icon: const Icon(Icons.home),
150 | title: const GlassText("Home"),
151 | selectedGradient: LinearGradient(
152 | colors: [
153 | Colors.blue.withOpacity(0.5),
154 | Colors.yellow.withOpacity(0.5),
155 | Colors.red.withOpacity(0.5),
156 | ],
157 | ),
158 | ),
159 | GlassBottomBarItem(
160 | icon: const Icon(Icons.search),
161 | title: const GlassText("Search"),
162 | ),
163 | GlassBottomBarItem(
164 | icon: const Icon(Icons.settings),
165 | title: const GlassText("Settings"),
166 | ),
167 | ],
168 | onTap: (i) {
169 | setState(() {
170 | index = i;
171 | });
172 | },
173 | currentIndex: index,
174 | ),
175 | )
176 | ],
177 | );
178 | }
179 | }
180 |
--------------------------------------------------------------------------------
/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 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
9 | url: "https://pub.dev"
10 | source: hosted
11 | version: "2.11.0"
12 | boolean_selector:
13 | dependency: transitive
14 | description:
15 | name: boolean_selector
16 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
17 | url: "https://pub.dev"
18 | source: hosted
19 | version: "2.1.1"
20 | characters:
21 | dependency: transitive
22 | description:
23 | name: characters
24 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
25 | url: "https://pub.dev"
26 | source: hosted
27 | version: "1.3.0"
28 | clock:
29 | dependency: transitive
30 | description:
31 | name: clock
32 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
33 | url: "https://pub.dev"
34 | source: hosted
35 | version: "1.1.1"
36 | collection:
37 | dependency: transitive
38 | description:
39 | name: collection
40 | sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
41 | url: "https://pub.dev"
42 | source: hosted
43 | version: "1.17.1"
44 | fake_async:
45 | dependency: transitive
46 | description:
47 | name: fake_async
48 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
49 | url: "https://pub.dev"
50 | source: hosted
51 | version: "1.3.1"
52 | flutter:
53 | dependency: "direct main"
54 | description: flutter
55 | source: sdk
56 | version: "0.0.0"
57 | flutter_lints:
58 | dependency: "direct dev"
59 | description:
60 | name: flutter_lints
61 | sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c
62 | url: "https://pub.dev"
63 | source: hosted
64 | version: "2.0.1"
65 | flutter_test:
66 | dependency: "direct dev"
67 | description: flutter
68 | source: sdk
69 | version: "0.0.0"
70 | golden_toolkit:
71 | dependency: "direct dev"
72 | description:
73 | name: golden_toolkit
74 | sha256: "8f74adab33154fe7b731395782797021f97d2edc52f7bfb85ff4f1b5c4a215f0"
75 | url: "https://pub.dev"
76 | source: hosted
77 | version: "0.15.0"
78 | js:
79 | dependency: transitive
80 | description:
81 | name: js
82 | sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
83 | url: "https://pub.dev"
84 | source: hosted
85 | version: "0.6.7"
86 | lints:
87 | dependency: transitive
88 | description:
89 | name: lints
90 | sha256: "6b0206b0bf4f04961fc5438198ccb3a885685cd67d4d4a32cc20ad7f8adbe015"
91 | url: "https://pub.dev"
92 | source: hosted
93 | version: "2.1.0"
94 | matcher:
95 | dependency: transitive
96 | description:
97 | name: matcher
98 | sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
99 | url: "https://pub.dev"
100 | source: hosted
101 | version: "0.12.15"
102 | material_color_utilities:
103 | dependency: transitive
104 | description:
105 | name: material_color_utilities
106 | sha256: "586678f20e112219ed0f73215f01bcdf1d769824ba2ebae45ad918a9bfde9bdb"
107 | url: "https://pub.dev"
108 | source: hosted
109 | version: "0.3.0"
110 | meta:
111 | dependency: transitive
112 | description:
113 | name: meta
114 | sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
115 | url: "https://pub.dev"
116 | source: hosted
117 | version: "1.9.1"
118 | path:
119 | dependency: transitive
120 | description:
121 | name: path
122 | sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
123 | url: "https://pub.dev"
124 | source: hosted
125 | version: "1.8.3"
126 | pedantic_mono:
127 | dependency: "direct dev"
128 | description:
129 | name: pedantic_mono
130 | sha256: a852298d064d51a31d24863fd464c4bbd58aba6dfc8affbbf8a651fd803ae1b4
131 | url: "https://pub.dev"
132 | source: hosted
133 | version: "1.21.1"
134 | sky_engine:
135 | dependency: transitive
136 | description: flutter
137 | source: sdk
138 | version: "0.0.99"
139 | source_span:
140 | dependency: transitive
141 | description:
142 | name: source_span
143 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
144 | url: "https://pub.dev"
145 | source: hosted
146 | version: "1.10.0"
147 | stack_trace:
148 | dependency: transitive
149 | description:
150 | name: stack_trace
151 | sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
152 | url: "https://pub.dev"
153 | source: hosted
154 | version: "1.11.0"
155 | stream_channel:
156 | dependency: transitive
157 | description:
158 | name: stream_channel
159 | sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
160 | url: "https://pub.dev"
161 | source: hosted
162 | version: "2.1.1"
163 | string_scanner:
164 | dependency: transitive
165 | description:
166 | name: string_scanner
167 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
168 | url: "https://pub.dev"
169 | source: hosted
170 | version: "1.2.0"
171 | term_glyph:
172 | dependency: transitive
173 | description:
174 | name: term_glyph
175 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
176 | url: "https://pub.dev"
177 | source: hosted
178 | version: "1.2.1"
179 | test_api:
180 | dependency: transitive
181 | description:
182 | name: test_api
183 | sha256: daadc9baabec998b062c9091525aa95786508b1c48e9c30f1f891b8bf6ff2e64
184 | url: "https://pub.dev"
185 | source: hosted
186 | version: "0.5.2"
187 | vector_math:
188 | dependency: transitive
189 | description:
190 | name: vector_math
191 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
192 | url: "https://pub.dev"
193 | source: hosted
194 | version: "2.1.4"
195 | sdks:
196 | dart: ">=3.0.0-417 <4.0.0"
197 | flutter: ">=1.17.0"
198 |
--------------------------------------------------------------------------------
/test/glassmorphism_widgets_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_test/flutter_test.dart';
3 | import 'package:glassmorphism_widgets/glassmorphism_widgets.dart';
4 | import 'package:golden_toolkit/golden_toolkit.dart';
5 |
6 | class MyApp extends StatelessWidget {
7 | const MyApp({Key? key}) : super(key: key);
8 |
9 | // This widget is the root of your application.
10 | @override
11 | Widget build(BuildContext context) {
12 | return GlassApp(
13 | theme: GlassThemeData(
14 | blur: 10,
15 | linearGradient: LinearGradient(
16 | colors: [
17 | Colors.yellowAccent.withOpacity(0.4),
18 | Colors.yellow.withOpacity(0.2),
19 | ],
20 | ),
21 | ),
22 | home: MaterialApp(
23 | title: 'Flutter Demo',
24 | theme: ThemeData(
25 | primarySwatch: Colors.blue,
26 | ),
27 | home: const MyHomePage(title: 'Flutter Demo Home Page'),
28 | ),
29 | );
30 | }
31 | }
32 |
33 | class MyHomePage extends StatefulWidget {
34 | const MyHomePage({Key? key, required this.title}) : super(key: key);
35 |
36 | final String title;
37 |
38 | @override
39 | State createState() => _MyHomePageState();
40 | }
41 |
42 | class _MyHomePageState extends State {
43 | int index = 0;
44 |
45 | @override
46 | Widget build(BuildContext context) {
47 | // This method is rerun every time setState is called, for instance as done
48 | // by the _incrementCounter method above.
49 | //
50 | // The Flutter framework has been optimized to make rerunning build methods
51 | // fast, so that you can just rebuild anything that needs updating rather
52 | // than having to individually change instances of widgets.
53 | return Scaffold(
54 | backgroundColor: Colors.pinkAccent,
55 | appBar: GlassAppBar(
56 | title: const GlassText(
57 | 'Glassmorphic Golden Test',
58 | fontWeight: FontWeight.bold,
59 | color: Colors.white,
60 | ),
61 | actions: [
62 | IconButton(
63 | icon: const GlassIcon(Icons.search),
64 | onPressed: () {},
65 | ),
66 | IconButton(
67 | icon: const GlassIcon(Icons.more_vert),
68 | onPressed: () {},
69 | ),
70 | ],
71 | ),
72 | body: Column(
73 | mainAxisAlignment: MainAxisAlignment.center,
74 | children: [
75 | GlassListTile(
76 | leading: const GlassIcon(Icons.search),
77 | title: TextField(
78 | decoration: InputDecoration(
79 | hintText: 'Search',
80 | border: InputBorder.none,
81 | hintStyle: glassTextStyle,
82 | ),
83 | style: glassTextStyle,
84 | ),
85 | onTap: () {},
86 | ),
87 | const GlassIcon(Icons.add),
88 | const Center(
89 | child: Center(
90 | child: GlassContainer(
91 | child: Padding(
92 | padding: EdgeInsets.all(8),
93 | child: GlassText("Hello World"),
94 | ),
95 | ),
96 | ),
97 | ),
98 | const GlassIcon(Icons.add),
99 | GlassButton(
100 | blur: 10,
101 | linearGradient: LinearGradient(
102 | colors: [
103 | Colors.blue.withOpacity(0.5),
104 | Colors.blue.withOpacity(0.4),
105 | ],
106 | ),
107 | onPressed: () {
108 | showGlassBottomSheet(
109 | blur: 2,
110 | context: context,
111 | child: const Center(
112 | child: GlassText("Hello World", fontSize: 20),
113 | ),
114 | );
115 | },
116 | child: const GlassText("Button")),
117 | ],
118 | ),
119 | floatingActionButton: GlassFloatingActionButton(
120 | onPressed: () {
121 | setState(() {
122 | index++;
123 | });
124 | },
125 | child: GlassText("$index"),
126 | ),
127 | bottomNavigationBar: GlassBottomBar(
128 | items: [
129 | GlassBottomBarItem(
130 | icon: const Icon(Icons.home),
131 | title: const GlassText("Home"),
132 | selectedGradient: LinearGradient(
133 | colors: [
134 | Colors.blue.withOpacity(0.5),
135 | Colors.yellow.withOpacity(0.5),
136 | Colors.red.withOpacity(0.5),
137 | ],
138 | ),
139 | ),
140 | GlassBottomBarItem(
141 | icon: const Icon(Icons.security),
142 | title: const GlassText("Search"),
143 | ),
144 | GlassBottomBarItem(
145 | icon: const Icon(Icons.settings),
146 | title: const GlassText("Settings"),
147 | ),
148 | ],
149 | onTap: (i) {
150 | setState(() {
151 | index = i;
152 | });
153 | },
154 | currentIndex: index,
155 | ),
156 | );
157 | }
158 | }
159 |
160 | void main() {
161 | const targetWidget = MyApp();
162 |
163 | testGoldens(
164 | 'basic golden test',
165 | (WidgetTester tester) async {
166 | await loadAppFonts();
167 | await tester.pumpWidgetBuilder(targetWidget);
168 | await multiScreenGolden(tester, 'my_app_screen_test', devices: [
169 | Device.iphone11,
170 | Device.phone,
171 | ]);
172 | },
173 | );
174 | testGoldens('bottom sheet golden test', (WidgetTester tester) async {
175 | await loadAppFonts();
176 | await tester.pumpWidgetBuilder(targetWidget);
177 | await tester.tap(find.text('Button'));
178 | await tester.pumpAndSettle();
179 | await multiScreenGolden(tester, 'my_app_screen_test_bottom_sheet',
180 | devices: [
181 | Device.iphone11,
182 | Device.phone,
183 | ]);
184 | });
185 |
186 | testGoldens('text field golden test', (WidgetTester tester) async {
187 | await loadAppFonts();
188 | await tester.pumpWidgetBuilder(targetWidget);
189 | await tester.enterText(find.byType(TextField), 'Hello World');
190 | await tester.pumpAndSettle();
191 | await multiScreenGolden(tester, 'my_app_screen_test_text_field', devices: [
192 | Device.iphone11,
193 | Device.phone,
194 | ]);
195 | });
196 |
197 | testGoldens('bottom bar golden test', (WidgetTester tester) async {
198 | await loadAppFonts();
199 | await tester.pumpWidgetBuilder(targetWidget);
200 | await tester.tap(find.byIcon(Icons.security));
201 | await tester.pumpAndSettle();
202 | await multiScreenGolden(tester, 'my_app_screen_test_bottom_bar_security',
203 | devices: [
204 | Device.iphone11,
205 | Device.phone,
206 | ]);
207 | await tester.tap(find.byIcon(Icons.settings));
208 | await tester.pumpAndSettle();
209 | await multiScreenGolden(tester, 'my_app_screen_test_bottom_bar_settings',
210 | devices: [
211 | Device.iphone11,
212 | Device.phone,
213 | ]);
214 | });
215 |
216 | testGoldens('floating action button golden test',
217 | (WidgetTester tester) async {
218 | await loadAppFonts();
219 | await tester.pumpWidgetBuilder(targetWidget);
220 | await tester.tap(find.byType(GlassFloatingActionButton));
221 | await tester.pumpAndSettle();
222 | await multiScreenGolden(tester, 'my_app_screen_test_floating_action_button',
223 | devices: [
224 | Device.iphone11,
225 | Device.phone,
226 | ]);
227 | });
228 | }
229 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------