├── .gitignore ├── .metadata ├── .vscode ├── launch.json └── settings.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── custom_widgets │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets └── icons │ ├── OpenAi.svg │ ├── basket.svg │ ├── cart.png │ ├── claude.svg │ ├── gemini.svg │ ├── grocery-bag.png │ ├── lifting.png │ ├── medical.png │ ├── meta.svg │ ├── restaurant.png │ └── ticket.png ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings ├── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h └── RunnerTests │ └── RunnerTests.swift ├── lib ├── data │ └── card_splitting_data.dart ├── main.dart ├── models │ └── splitting_item_model.dart ├── pages │ └── home_page.dart ├── style.dart ├── utils │ └── constants.dart └── widgets │ ├── angular_gradient_button.dart │ ├── blurred_list.dart │ ├── card_box.dart │ ├── card_fan_out_animation.dart │ ├── card_splitting.dart │ ├── cards_cascade_out.dart │ ├── cards_stack.dart │ ├── dots_loading.dart │ ├── dropdown_item.dart │ ├── dropdown_menu.dart │ ├── gradient_border.dart │ ├── jump_slide.dart │ ├── loading_animation.dart │ ├── rotating_arcs.dart │ ├── rotating_gradient_arc.dart │ ├── stack_item.dart │ └── stack_list.dart ├── linux ├── .gitignore ├── CMakeLists.txt ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake ├── main.cc ├── my_application.cc └── my_application.h ├── macos ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ ├── Base.lproj │ │ └── MainMenu.xib │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ ├── DebugProfile.entitlements │ ├── Info.plist │ ├── MainFlutterWindow.swift │ └── Release.entitlements └── RunnerTests │ └── RunnerTests.swift ├── pubspec.lock ├── pubspec.yaml ├── test └── widget_test.dart ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── index.html └── manifest.json └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Symbolication related 35 | app.*.symbols 36 | 37 | # Obfuscation related 38 | app.*.map.json 39 | 40 | # Android Studio will place build artifacts here 41 | /android/app/debug 42 | /android/app/profile 43 | /android/app/release 44 | 45 | #not finished 46 | /lib/widgets/bubles.dart -------------------------------------------------------------------------------- /.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: "2663184aa79047d0a33a14a3b607954f8fdd8730" 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: 2663184aa79047d0a33a14a3b607954f8fdd8730 17 | base_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730 18 | - platform: android 19 | create_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730 20 | base_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730 21 | 22 | # User provided section 23 | 24 | # List of Local paths (relative to this file) that should be 25 | # ignored by the migrate tool. 26 | # 27 | # Files that are not part of the templates will be ignored by default. 28 | unmanaged_files: 29 | - 'lib/main.dart' 30 | - 'ios/Runner.xcodeproj/project.pbxproj' 31 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "custom_widgets", 9 | "request": "launch", 10 | "type": "dart" 11 | }, 12 | { 13 | "name": "custom_widgets (profile mode)", 14 | "request": "launch", 15 | "type": "dart", 16 | "flutterMode": "profile" 17 | }, 18 | { 19 | "name": "custom_widgets (release mode)", 20 | "request": "launch", 21 | "type": "dart", 22 | "flutterMode": "release" 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "interactive" 3 | } -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | [prosperamebe14@gmail.com]. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Flutter Custom Widgets 2 | Thank you for considering contributing to Flutter Custom Widgets! Contributions are welcome and appreciated, whether they are bug reports, feature requests, code contributions, or documentation improvements. 3 | 4 | Please follow the guidelines outlined below to ensure quality contribution. 5 | 6 | ## How to contribute 7 | 8 | ### 1. Fork The Repository 9 | 10 | Create a fork of the repository on GitHub by clicking the **"Fork"** button. 11 | 12 | ### 2. Clone Your Fork 13 | 14 | ```bash 15 | git clone https://github.com/your-username/flutter_custom_widgets.git 16 | cd flutter_custom_widgets 17 | ``` 18 | 19 | ### 3. Create a Branch 20 | Use a descriptive name for your branch: 21 | 22 | ```bash 23 | git checkout -b my-widget-name 24 | ``` 25 | 26 | ### 4. Make Your Changes 27 | 28 | Implement your changes or fixes locally. Ensure your code follows the project's coding standards. 29 | 30 | **For a New Widget:** 31 | 32 | - Navigate to `lib/widgets` 33 | 34 | - Add a new Dart file for your widget. The file name should follow Dart naming convention (e.g. `my_widget.dart`) 35 | 36 | - Define your widget in the new file, ensuring proper documentation and reusability. 37 | 38 | ```dart 39 | // lib/widgets/my_widget.dart 40 | import 'package:flutter/material.dart'; 41 | 42 | class MyWidget extends StatelessWidget { 43 | @override 44 | Widget build(BuildContext context) { 45 | return Container( 46 | child: Text('Hello, this is MyWidget!'), 47 | ); 48 | } 49 | } 50 | ``` 51 | 52 | - Open `lib/pages/home_page.dart` 53 | 54 | - Import your new file : 55 | 56 | ```dart 57 | import '../widgets/my_widget.dart'; 58 | ``` 59 | - Add your widget to the `widgetsDemo` list: 60 | 61 | ```dart 62 | List widgetsDemo = [ 63 | ... 64 | Demo(builder: (context) => const MyWidget(), name: "MyWidget"), 65 | ]; 66 | ``` 67 | ### 5. Commit Your Changes 68 | 69 | Add and commit your changes with a clear commit message: 70 | 71 | ```bash 72 | git add . 73 | git commit -m "Feat: Add MyWidget for displaying custom text" 74 | ``` 75 | 76 | ### 6. Push to Your Fork 77 | Push the changes to your forked repository: 78 | 79 | ```bash 80 | git push origin my-widget-name 81 | ``` 82 | 83 | ### 7. Open a Pull Request 84 | Open a pull request (PR) from your fork to the main branch of this repository. Add a clear desciption of your changes. 85 | 86 | Happy coding, and may your widgets always render flawlessly! 😄✨ 87 | 88 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 AMEBE Yao Prosper Mawufemo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # custom_widgets 2 | Flutter Custom Widgets is a collection of custom widgets inspired by innovative designs and components I’ve discovered on various platforms. Some were originaly created with other frameworks while others are based on simple design. All have been reproduced with Flutter to showcase its versatility and creative potential. 3 | 4 | ### What You'll Find 5 | 6 | - A growing list of unique widgets, each with its own GIF demo for quick preview. 7 | - Inspiration for your own Flutter projects. 8 | - Modular and reusable components that follow best practices. 9 | 10 | ### Want to Join? 11 | 12 | Have you seen something awesome you'd like to replicate in Flutter or you have an idea of a cool widget? Contributions are welcome! 13 | 14 | Check out the [[Contributing Guidelines](CONTRIBUTING.md)] to get started. Whether you’re reporting a bug, suggesting a feature, or submitting a new widget, your input is invaluable to making this project even better. 15 | 16 | 17 | | Card Splitting | | | 18 | | :---------------------------------------------------------------------------------------------------------------------: |:------------------------------------------------------------------------------------------------------------------------:| :----------------------------------------------------------------------------------------------------------------------:| 19 | | ![card_splitting](https://github.com/user-attachments/assets/f4e4b7c6-834d-413b-9202-2087024cd40f) | | | 20 | | [[SOURCE](lib/widgets/card_splitting.dart)] [[Inspiration](https://x.com/nitishkmrk/status/1860935449713557924)] | | | 21 | 22 | 23 | | Stack List | Stack cards | Dropdown interaction | 24 | | :---------------------------------------------------------------------------------------------------------------------: |:------------------------------------------------------------------------------------------------------------------------:| :----------------------------------------------------------------------------------------------------------------------:| 25 | | ![stack_listt](https://github.com/user-attachments/assets/153d6fb0-ab78-4905-89e3-5c5e1712b695) | ![stack_cards](https://github.com/user-attachments/assets/81fa81ed-6d5a-4859-809d-e20ab2c9155f) | ![dropdown_menu](https://github.com/user-attachments/assets/e9025e6b-1b27-4ea1-a072-f200a1de91c3) | 26 | | [[SOURCE](lib/widgets/stack_list.dart)] [[Inspiration](https://x.com/iamarunabh/status/1824870055974518986)] | [[SOURCE](lib/widgets/cards_stack.dart)] [[Inspiration](https://x.com/nitishkmrk/status/1822884723485708550)] | [[SOURCE](lib/widgets/dropdown_menu.dart)] [[Inspiration](https://x.com/nitishkmrk/status/1845717423808225665)] | 27 | 28 | | Blurred List | Fane out animation | Cascade out animation | 29 | | :---------------------------------------------------------------------------------------------------------------------: |:-----------------------------------------------------------------------------------------------------------------------:| :----------------------------------------------------------------------------------------------------------------------:| 30 | | ![blurred_list](https://github.com/user-attachments/assets/4b297c77-7043-4cdc-bcc7-1200daab3619) | ![fan_out](https://github.com/user-attachments/assets/ee0e2c27-0fb4-4f43-bc49-d9fd64db90ff) | ![casacade_out](https://github.com/user-attachments/assets/a41065c2-5eb8-4bc4-bc7e-fb8d242b35a1) | 31 | | [[SOURCE](lib/widgets/blurred_list.dart)] [[Inspiration](https://x.com/reactiive_/status/1841040359549239518)] | [[SOURCE](lib/widgets/card_fan_out_animation.dart)] [[Inspiration](https://x.com/jmtrivedi/status/1510014145126612993)] | [[SOURCE](lib/widgets/cards_cascade_out.dart)] [[Inspiration](https://x.com/jmtrivedi/status/1510358859424034818)] | 32 | 33 | | Loading Animation | Dots Loading | Rotating Arcs | 34 | | :---------------------------------------------------------------------------------------------------------------------: |:-----------------------------------------------------------------------------------------------------------------------:| :----------------------------------------------------------------------------------------------------------------------:| 35 | | ![loading-animation](https://github.com/user-attachments/assets/b57e3cc6-c09a-4f55-9a16-bcb403852d00) | ![dots_loading](https://github.com/user-attachments/assets/aa3a9185-06d0-47ce-900b-5a4ee6e571cb) | ![rotating-arcs](https://github.com/user-attachments/assets/556031ca-ea3e-45f8-8f27-96e8e316180d) | 36 | | [[SOURCE](lib/widgets/loading_animation.dart)] [[Inspiration](https://x.com/sucodeee/status/1814638797331570854)] | [[SOURCE](lib/widgets/dots_loading.dart)] [[Inspiration](Bank of America mobile app)] | [[SOURCE](lib/widgets/rotating_arcs.dart)] [[Inspiration](https://x.com/sucodeee/status/1815337886880878790)] | 37 | 38 | | Rotating gradient arc | Angular gradient butoon | Jump and slide | 39 | | :---------------------------------------------------------------------------------------------------------------------: |:-----------------------------------------------------------------------------------------------------------------------:| :----------------------------------------------------------------------------------------------------------------------:| 40 | | ![rot-grad](https://github.com/user-attachments/assets/ebc6df6d-e2cd-4751-bd40-fa221ef8dd58) | ![angular-grad](https://github.com/user-attachments/assets/01405162-dfb6-4203-b5c5-87661d749a64) | ![jump_slide](https://github.com/user-attachments/assets/31e8ba2e-6600-44da-9cb8-acae827ade70) | 41 | | [[SOURCE](lib/widgets/rotating_gradient_arc.dart)] [[Inspiration](https://x.com/sucodeee/status/1813555751656518037)] | [[SOURCE](lib/widgets/angular_gradient_button.dart)] [[Inspiration](https://x.com/sucodeee/status/1813193366596644994)] | [[SOURCE](lib/widgets/jump_slide.dart)] [[Inspiration](https://x.com/CodePen/status/1820523679387689166)] | 42 | 43 | 44 | 45 | A new Flutter project. 46 | 47 | ## Getting Started 48 | 49 | 50 | 51 | This project is a starting point for a Flutter application. 52 | 53 | A few resources to get you started if this is your first Flutter project: 54 | 55 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) 56 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) 57 | 58 | For help getting started with Flutter development, view the 59 | [online documentation](https://docs.flutter.dev/), which offers tutorials, 60 | samples, guidance on mobile development, and a full API reference. 61 | -------------------------------------------------------------------------------- /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 https://dart.dev/lints. 17 | # 18 | # Instead of disabling a lint rule for the entire project in the 19 | # section below, it can also be suppressed for a single line of code 20 | # or a specific dart file by using the `// ignore: name_of_lint` and 21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 22 | # producing the lint. 23 | rules: 24 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 25 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 26 | 27 | # Additional information about this file can be found at 28 | # https://dart.dev/guides/language/analysis-options 29 | -------------------------------------------------------------------------------- /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/to/reference-keystore 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. 5 | id "dev.flutter.flutter-gradle-plugin" 6 | } 7 | 8 | android { 9 | namespace = "com.example.custom_widgets" 10 | compileSdk = flutter.compileSdkVersion 11 | ndkVersion = flutter.ndkVersion 12 | 13 | compileOptions { 14 | sourceCompatibility = JavaVersion.VERSION_1_8 15 | targetCompatibility = JavaVersion.VERSION_1_8 16 | } 17 | 18 | kotlinOptions { 19 | jvmTarget = JavaVersion.VERSION_1_8 20 | } 21 | 22 | defaultConfig { 23 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 24 | applicationId = "com.example.custom_widgets" 25 | // You can update the following values to match your application needs. 26 | // For more information, see: https://flutter.dev/to/review-gradle-config. 27 | minSdk = flutter.minSdkVersion 28 | targetSdk = flutter.targetSdkVersion 29 | versionCode = flutter.versionCode 30 | versionName = flutter.versionName 31 | } 32 | 33 | buildTypes { 34 | release { 35 | // TODO: Add your own signing config for the release build. 36 | // Signing with the debug keys for now, so `flutter run --release` works. 37 | signingConfig = signingConfigs.debug 38 | } 39 | } 40 | } 41 | 42 | flutter { 43 | source = "../.." 44 | } 45 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/custom_widgets/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.custom_widgets 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() 6 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = "../build" 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(":app") 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } 19 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip 6 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "8.1.0" apply false 22 | id "org.jetbrains.kotlin.android" version "1.8.22" apply false 23 | } 24 | 25 | include ":app" 26 | -------------------------------------------------------------------------------- /assets/icons/OpenAi.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/icons/basket.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /assets/icons/cart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/assets/icons/cart.png -------------------------------------------------------------------------------- /assets/icons/claude.svg: -------------------------------------------------------------------------------- 1 | Claude -------------------------------------------------------------------------------- /assets/icons/gemini.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/icons/grocery-bag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/assets/icons/grocery-bag.png -------------------------------------------------------------------------------- /assets/icons/lifting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/assets/icons/lifting.png -------------------------------------------------------------------------------- /assets/icons/medical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/assets/icons/medical.png -------------------------------------------------------------------------------- /assets/icons/meta.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /assets/icons/restaurant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/assets/icons/restaurant.png -------------------------------------------------------------------------------- /assets/icons/ticket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/assets/icons/ticket.png -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Custom Widgets 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | custom_widgets 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 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /lib/data/card_splitting_data.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../models/splitting_Item_model.dart'; 4 | 5 | final List items = [ 6 | SplittingItemModel( 7 | title: "What is Interacting Design?", 8 | detail: "Designing how users interact with digital interfaces with" 9 | "intuitive experiences.", 10 | icon: Icons.ads_click, 11 | ), 12 | SplittingItemModel( 13 | title: "Principles & Patterns", 14 | detail: "Fundamental guidelines and repeated solutions that ensure" 15 | "consistency and usability in design.", 16 | icon: Icons.layers_outlined, 17 | ), 18 | SplittingItemModel( 19 | title: "Usability & Accessibility", 20 | detail: "Focusing on making digital designs easy to use and accessible" 21 | "for everyone, including those with disabilities.", 22 | icon: Icons.touch_app_outlined, 23 | ), 24 | SplittingItemModel( 25 | title: "Prototyping & Testing", 26 | detail: "Designing how users interact with digital interfaces with" 27 | "intuitive experiences.", 28 | icon: Icons.send_outlined, 29 | ), 30 | SplittingItemModel( 31 | title: "UX Optimization", 32 | detail: "Improving the overall user experience by enhancing usability" 33 | "and satisfaction.", 34 | icon: Icons.speed_outlined, 35 | ), 36 | ]; 37 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_widgets/pages/home_page.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | void main() { 5 | runApp(const MyApp()); 6 | } 7 | 8 | class MyApp extends StatelessWidget { 9 | const MyApp({super.key}); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return MaterialApp( 14 | theme: ThemeData( 15 | colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), 16 | useMaterial3: true, 17 | ), 18 | home: const HomePage(), 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/models/splitting_item_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SplittingItemModel { 4 | String title, detail; 5 | IconData icon; 6 | 7 | SplittingItemModel({ 8 | required this.title, 9 | required this.detail, 10 | required this.icon, 11 | }); 12 | } 13 | -------------------------------------------------------------------------------- /lib/pages/home_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_widgets/widgets/angular_gradient_button.dart'; 2 | import 'package:custom_widgets/widgets/blurred_list.dart'; 3 | import 'package:custom_widgets/widgets/card_fan_out_animation.dart'; 4 | import 'package:custom_widgets/widgets/card_splitting.dart'; 5 | import 'package:custom_widgets/widgets/cards_cascade_out.dart'; 6 | import 'package:custom_widgets/widgets/cards_stack.dart'; 7 | import 'package:custom_widgets/widgets/dots_loading.dart'; 8 | import 'package:custom_widgets/widgets/dropdown_menu.dart'; 9 | import 'package:custom_widgets/widgets/jump_slide.dart'; 10 | import 'package:custom_widgets/widgets/loading_animation.dart'; 11 | import 'package:custom_widgets/widgets/rotating_arcs.dart'; 12 | import 'package:custom_widgets/widgets/rotating_gradient_arc.dart'; 13 | import 'package:custom_widgets/widgets/stack_list.dart'; 14 | import 'package:flutter/material.dart'; 15 | 16 | class HomePage extends StatefulWidget { 17 | const HomePage({super.key}); 18 | 19 | @override 20 | State createState() => _HomePageState(); 21 | } 22 | 23 | class _HomePageState extends State { 24 | @override 25 | Widget build(BuildContext context) { 26 | return Scaffold( 27 | appBar: AppBar( 28 | title: const Text( 29 | "Custom widgets", 30 | ), 31 | ), 32 | body: ListView.builder( 33 | itemCount: widgetsDemo.length, 34 | itemBuilder: (context, index) => ListTile( 35 | title: Text(widgetsDemo[index].name), 36 | onTap: () { 37 | Navigator.push(context, 38 | MaterialPageRoute(builder: widgetsDemo[index].builder)); 39 | }, 40 | trailing: const Icon(Icons.arrow_forward_ios), 41 | ))); 42 | } 43 | } 44 | 45 | class Demo { 46 | String name; 47 | WidgetBuilder builder; 48 | 49 | Demo({required this.builder, required this.name}); 50 | } 51 | 52 | List widgetsDemo = [ 53 | Demo(builder: (context) => const CustomDropdownMenu(), name: "Dropdown Menu"), 54 | Demo( 55 | builder: (context) => const RotatingGradientArc(), 56 | name: "Rotating Gradient Arc"), 57 | Demo( 58 | builder: (context) => const AngularGradientButton(), 59 | name: "Angular Gragient Button"), 60 | Demo(builder: (context) => const RotatingArcs(), name: "Rotating Arcs"), 61 | Demo( 62 | builder: (context) => const LoadingAnimation(), 63 | name: "Loading Animation"), 64 | Demo(builder: (context) => const DotsLoading(), name: "Dots Loading"), 65 | Demo(builder: (context) => const JumpSlide(), name: "Jump and Slide"), 66 | Demo(builder: (context) => const FanOutAnimation(), name: "Fane out Cards"), 67 | Demo( 68 | builder: (context) => const CardsCascadeOut(), name: "Cascade out cards"), 69 | Demo(builder: (context) => const CardsStack(), name: "Stack cards"), 70 | Demo(builder: (context) => const CardSplitting(), name: "Card Splitting"), 71 | Demo(builder: (context) => const StackList(), name: "Stack List"), 72 | Demo(builder: (context) => const BlurredList(), name: "Blurred List"), 73 | ]; 74 | -------------------------------------------------------------------------------- /lib/style.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class BaseColors { 4 | static const List grad1 = [ 5 | Colors.red, 6 | Colors.orange, 7 | Colors.yellow, 8 | Colors.green, 9 | Colors.blue, 10 | Colors.purple, 11 | Colors.pink 12 | ]; 13 | static const List arcsColors = [ 14 | Colors.blue, 15 | Colors.yellow, 16 | Colors.red 17 | ]; 18 | } 19 | -------------------------------------------------------------------------------- /lib/utils/constants.dart: -------------------------------------------------------------------------------- 1 | class Constants { 2 | List> blurredListComponent = [ 3 | {"icon": "assets/icons/cart.png", "cost": 2341.19, "ref": "0x836..c6"}, 4 | {"icon": "assets/icons/medical.png", "cost": 4568.67, "ref": "0x767..y6"}, 5 | { 6 | "icon": "assets/icons/restaurant.png", 7 | "cost": 3669.58, 8 | "ref": "0x983..e4" 9 | }, 10 | {"icon": "assets/icons/ticket.png", "cost": 5678.48, "ref": "0x4h5..k4"}, 11 | {"icon": "assets/icons/lifting.png", "cost": 7413.23, "ref": "0x34l..x6"}, 12 | { 13 | "icon": "assets/icons/grocery-bag.png", 14 | "cost": 4368.29, 15 | "ref": "0x38h..8u" 16 | }, 17 | {"icon": "assets/icons/cart.png", "cost": 2468.94, "ref": "0x23h..d3"}, 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /lib/widgets/angular_gradient_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_widgets/style.dart'; 2 | import 'package:custom_widgets/widgets/gradient_border.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'dart:math' as math; 5 | 6 | class AngularGradientButton extends StatefulWidget { 7 | const AngularGradientButton({ 8 | super.key, 9 | }); 10 | 11 | @override 12 | State createState() => _AngularGradientButtonState(); 13 | } 14 | 15 | class _AngularGradientButtonState extends State 16 | with TickerProviderStateMixin { 17 | late final AnimationController _animationController = AnimationController( 18 | duration: const Duration(seconds: 4), 19 | vsync: this, 20 | )..repeat(); 21 | 22 | Gradient get borderGradient => LinearGradient( 23 | colors: BaseColors.grad1, 24 | transform: GradientRotation(_animationController.value * 2 * math.pi)); 25 | @override 26 | void dispose() { 27 | _animationController.dispose(); 28 | super.dispose(); 29 | } 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | return Scaffold( 34 | backgroundColor: Colors.black, 35 | appBar: AppBar( 36 | backgroundColor: Colors.black, 37 | automaticallyImplyLeading: true, 38 | title: const Text( 39 | "Angular Gradient button", 40 | style: TextStyle(color: Colors.white), 41 | ), 42 | ), 43 | body: Center( 44 | child: Stack( 45 | children: [ 46 | const SizedBox( 47 | height: 65, 48 | width: 280, 49 | ), 50 | Positioned( 51 | top: 5, 52 | child: AnimatedBuilder( 53 | animation: _animationController, 54 | builder: (context, child) { 55 | return GradientBorder( 56 | gradient: borderGradient, 57 | radius: 20, 58 | size: const Size(280, 60), 59 | strokeWidth: 5, 60 | ); 61 | })), 62 | Positioned( 63 | top: 0, 64 | child: Container( 65 | height: 60, 66 | width: 280, 67 | decoration: BoxDecoration( 68 | borderRadius: BorderRadius.circular(20), 69 | border: Border.all( 70 | color: Colors.black, 71 | width: 3, 72 | strokeAlign: BorderSide.strokeAlignOutside), 73 | gradient: const LinearGradient(colors: [ 74 | Colors.black, 75 | Colors.black, 76 | Colors.black, 77 | Colors.transparent 78 | ], transform: GradientRotation(math.pi / 2))), 79 | ), 80 | ), 81 | Positioned( 82 | top: 5, 83 | child: FilledButton( 84 | onPressed: () {}, 85 | style: ButtonStyle( 86 | backgroundColor: const WidgetStatePropertyAll( 87 | Color.fromARGB(255, 58, 56, 56)), 88 | fixedSize: 89 | const WidgetStatePropertyAll(Size(280, 60)), 90 | shape: WidgetStatePropertyAll( 91 | RoundedRectangleBorder( 92 | borderRadius: BorderRadius.circular(20)))), 93 | child: const Text( 94 | "Get started", 95 | style: TextStyle( 96 | color: Colors.white, 97 | fontWeight: FontWeight.bold, 98 | fontSize: 20), 99 | )), 100 | ) 101 | ], 102 | ), 103 | ), 104 | ); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /lib/widgets/card_box.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class CardBox extends StatelessWidget { 4 | const CardBox( 5 | {super.key, 6 | required this.angle, 7 | required this.height, 8 | required this.width}); 9 | 10 | final double angle; 11 | final double height, width; 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Transform.rotate( 16 | angle: angle, 17 | child: Container( 18 | height: height, 19 | width: width, 20 | decoration: BoxDecoration( 21 | border: Border.all( 22 | color: const Color.fromARGB(255, 83, 80, 80), 23 | width: 1, 24 | ), 25 | color: Colors.white, 26 | borderRadius: BorderRadius.circular(20), 27 | boxShadow: const [ 28 | BoxShadow( 29 | offset: Offset(0, 5), 30 | color: Color.fromARGB(255, 209, 203, 203), 31 | spreadRadius: 1, 32 | blurRadius: 8) 33 | ]), 34 | ), 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/widgets/card_fan_out_animation.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_widgets/widgets/card_box.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class FanOutAnimation extends StatefulWidget { 5 | const FanOutAnimation({super.key}); 6 | 7 | @override 8 | State createState() => _FanOutAnimationState(); 9 | } 10 | 11 | class _FanOutAnimationState extends State 12 | with TickerProviderStateMixin { 13 | late AnimationController cardsAnimation = AnimationController( 14 | vsync: this, duration: const Duration(milliseconds: 300)); 15 | List cardsMoves = List.filled(4, -75); 16 | List endAngles = [-0.3, -0.2, -0.1, 0]; 17 | List beginAngles = [-0.3, -0.2, -0.1, 0]; 18 | int pressCount = 0; 19 | 20 | void _onLongPress() { 21 | if (pressCount < 1) { 22 | pressCount = 1; 23 | setState(() { 24 | cardsMoves[3] = -95; 25 | for (int i = 2; i >= 0; i--) { 26 | cardsMoves[i] = cardsMoves[i + 1] + 30; 27 | endAngles[i] = endAngles[i + 1] + 0.2; 28 | } 29 | }); 30 | } else if (pressCount == 1) { 31 | setState(() { 32 | cardsMoves[3] = -150; 33 | for (int i = 2; i >= 0; i--) { 34 | cardsMoves[i] = cardsMoves[i + 1] + 95; 35 | } 36 | for (int i = 0; i < endAngles.length - 1; i++) { 37 | endAngles[i] = 0.2; 38 | } 39 | }); 40 | } 41 | } 42 | 43 | @override 44 | Widget build(BuildContext context) { 45 | double width = MediaQuery.of(context).size.width; 46 | return Scaffold( 47 | appBar: AppBar( 48 | title: const Text("Fane out Cards"), 49 | ), 50 | body: Center( 51 | child: GestureDetector( 52 | onLongPress: _onLongPress, 53 | onLongPressEnd: (details) { 54 | Future.delayed( 55 | const Duration(milliseconds: 300), 56 | () => setState(() { 57 | cardsMoves = List.filled(4, -75); 58 | endAngles = [-0.3, -0.2, -0.1, 0]; 59 | })); 60 | Future.delayed( 61 | const Duration(milliseconds: 900), 62 | () => setState(() { 63 | pressCount = 0; 64 | })); 65 | }, 66 | child: SizedBox( 67 | width: width, 68 | height: 300, 69 | child: Stack( 70 | alignment: Alignment.center, 71 | children: List.generate( 72 | 4, 73 | (index) => TweenAnimationBuilder( 74 | tween: Tween( 75 | begin: (width / 2) - 75, 76 | end: (width / 2) + cardsMoves[index]), 77 | duration: const Duration(milliseconds: 300), 78 | builder: (context, left, child) { 79 | return Positioned( 80 | left: left, 81 | child: TweenAnimationBuilder( 82 | tween: Tween( 83 | begin: beginAngles[index], 84 | end: endAngles[index]), 85 | duration: const Duration(milliseconds: 300), 86 | builder: (context, angle, child) { 87 | return GestureDetector( 88 | child: CardBox( 89 | height: 200, 90 | width: 150, 91 | angle: angle, 92 | ), 93 | ); 94 | }), 95 | ); 96 | }), 97 | )), 98 | ), 99 | ), 100 | ), 101 | ); 102 | } 103 | } 104 | 105 | class FlowCardDelegate extends FlowDelegate { 106 | final Animation cardsAnimation; 107 | FlowCardDelegate({required this.cardsAnimation}) 108 | : super(repaint: cardsAnimation); 109 | @override 110 | void paintChildren(FlowPaintingContext context) { 111 | int childCount = context.childCount; 112 | double baseX = 113 | (context.size.width / 2) - context.getChildSize(0)!.width / 2; 114 | double y = (context.size.height / 2) - context.getChildSize(0)!.height; 115 | 116 | if (cardsAnimation.status == AnimationStatus.forward) { 117 | double firstx = (context.size.width / 2) - 5; 118 | double firstz = 0.6; 119 | 120 | for (int i = 0; i < childCount; i++) { 121 | context.paintChild(i, 122 | transform: Matrix4.translationValues( 123 | (firstx - (30 * i)) * cardsAnimation.value, 124 | y, 125 | (firstz - (0.2 * i) * cardsAnimation.value))); 126 | } 127 | } else { 128 | double firstz = -0.3; 129 | for (int i = 0; i < childCount; i++) { 130 | context.paintChild(i, 131 | transform: Matrix4.translationValues((baseX) * cardsAnimation.value, 132 | y, (firstz + (0.1 * i) * cardsAnimation.value))); 133 | } 134 | } 135 | } 136 | 137 | @override 138 | bool shouldRepaint(FlowCardDelegate oldDelegate) { 139 | return cardsAnimation != oldDelegate.cardsAnimation; 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /lib/widgets/card_splitting.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_widgets/data/card_splitting_data.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter/physics.dart'; 4 | 5 | class CardSplitting extends StatefulWidget { 6 | const CardSplitting({super.key}); 7 | 8 | @override 9 | State createState() => _CardSplittingState(); 10 | } 11 | 12 | class _CardSplittingState extends State 13 | with TickerProviderStateMixin { 14 | int itemSelected = -1; 15 | int lastSlected = -1; 16 | 17 | late AnimationController controller = AnimationController(vsync: this); 18 | 19 | SpringSimulation springSimulation = SpringSimulation( 20 | const SpringDescription(mass: 1, stiffness: 150, damping: 5.0), 21 | 0.0, 22 | 1.0, 23 | 0.0); 24 | 25 | //space between item title and detail 26 | Animation spaceTween = const AlwaysStoppedAnimation(0); 27 | //angle of the arrow icon 28 | Animation angleTween = const AlwaysStoppedAnimation(0); 29 | 30 | void onItemClicked(bool isExpanded, int index) { 31 | if (isExpanded) { 32 | //collapse the selected item 33 | setState(() { 34 | spaceTween = Tween(begin: 10.0, end: 0.0).animate(controller); 35 | angleTween = Tween(begin: 3.14, end: 0.0).animate(controller); 36 | 37 | controller.animateWith(springSimulation); 38 | 39 | lastSlected = itemSelected; 40 | itemSelected = -1; 41 | }); 42 | } else { 43 | //expand the selected item 44 | setState(() { 45 | lastSlected = itemSelected; 46 | itemSelected = index; 47 | 48 | controller.animateWith(springSimulation); 49 | }); 50 | } 51 | } 52 | 53 | @override 54 | void dispose() { 55 | controller.dispose(); 56 | super.dispose(); 57 | } 58 | 59 | @override 60 | Widget build(BuildContext context) { 61 | double width = MediaQuery.of(context).size.width; 62 | return Scaffold( 63 | appBar: AppBar( 64 | title: const Text("Card Splitting"), 65 | ), 66 | body: AnimatedBuilder( 67 | animation: controller, 68 | builder: (context, child) { 69 | return Center( 70 | child: SizedBox( 71 | width: width * 0.9, 72 | child: Column( 73 | mainAxisSize: MainAxisSize.min, 74 | children: List.generate(items.length, (index) { 75 | //expand the selected item 76 | bool isExpanded = index == itemSelected; 77 | 78 | //isFirst is used to set the top border color 79 | bool isFirst = index == 0 || //first item 80 | index == 81 | itemSelected + 1 || //item below the selected item 82 | index == itemSelected; //selected item 83 | 84 | //isLast is used to set the bottom border color 85 | bool isLast = index == items.length - 1 || 86 | index == itemSelected - 1 || 87 | index == itemSelected; 88 | 89 | //update space and angle tween for the selected item 90 | if (itemSelected == index) { 91 | spaceTween = 92 | Tween(begin: 0.0, end: 10.0).animate(controller); 93 | angleTween = 94 | Tween(begin: 0.0, end: 3.14).animate(controller); 95 | } else if (index == lastSlected) { 96 | //update space and angle tween for the last selected item 97 | spaceTween = 98 | Tween(begin: 10.0, end: 0.0).animate(controller); 99 | angleTween = 100 | Tween(begin: 3.14, end: 0.0).animate(controller); 101 | } else { 102 | //set space and angle tween to default 103 | spaceTween = const AlwaysStoppedAnimation(0); 104 | angleTween = const AlwaysStoppedAnimation(0); 105 | } 106 | return GestureDetector( 107 | onTap: () { 108 | onItemClicked(isExpanded, index); 109 | }, 110 | child: SplittingItem( 111 | title: items[index].title, 112 | detail: items[index].detail, 113 | icon: items[index].icon, 114 | isExpanded: isExpanded, 115 | isFirst: isFirst, 116 | isLast: isLast, 117 | space: spaceTween.value, 118 | angle: angleTween.value, 119 | ), 120 | ); 121 | }), 122 | ), 123 | ), 124 | ); 125 | }), 126 | ); 127 | } 128 | } 129 | 130 | class SplittingItem extends StatelessWidget { 131 | final String title, detail; 132 | final IconData icon; 133 | final bool isExpanded, isFirst, isLast; 134 | final double space, angle; 135 | const SplittingItem( 136 | {super.key, 137 | required this.title, 138 | required this.isExpanded, 139 | required this.detail, 140 | required this.icon, 141 | required this.isFirst, 142 | required this.isLast, 143 | required this.angle, 144 | required this.space}); 145 | 146 | @override 147 | Widget build(BuildContext context) { 148 | return Container( 149 | padding: const EdgeInsets.all(15), 150 | margin: isExpanded ? const EdgeInsets.symmetric(vertical: 10) : null, 151 | decoration: BoxDecoration( 152 | borderRadius: BorderRadius.only( 153 | topLeft: Radius.circular(isFirst ? 20 : 0), 154 | topRight: Radius.circular(isFirst ? 20 : 0), 155 | bottomLeft: Radius.circular(isLast ? 20 : 0), 156 | bottomRight: Radius.circular(isLast ? 20 : 0)), 157 | border: Border( 158 | left: const BorderSide(color: Colors.grey), 159 | right: const BorderSide(color: Colors.grey), 160 | top: isFirst 161 | ? const BorderSide(color: Colors.grey) 162 | : BorderSide.none, 163 | bottom: isLast 164 | ? const BorderSide(color: Colors.grey) 165 | : BorderSide.none), 166 | color: const Color.fromARGB(255, 252, 252, 252)), 167 | child: Column( 168 | children: [ 169 | Row( 170 | children: [ 171 | Icon( 172 | icon, 173 | size: 30, 174 | color: const Color.fromARGB(255, 133, 132, 137), 175 | ), 176 | const SizedBox(width: 5), 177 | Text( 178 | title, 179 | style: 180 | const TextStyle(fontWeight: FontWeight.bold, fontSize: 20), 181 | ), 182 | Expanded( 183 | child: Align( 184 | alignment: Alignment.centerRight, 185 | child: Transform.rotate( 186 | angle: angle, 187 | child: const Icon( 188 | Icons.keyboard_arrow_down, 189 | size: 30, 190 | color: Color.fromARGB(255, 133, 132, 137), 191 | ), 192 | ), 193 | ), 194 | ) 195 | ], 196 | ), 197 | SizedBox(height: space), 198 | isExpanded 199 | ? Text( 200 | detail, 201 | style: const TextStyle( 202 | fontSize: 18, 203 | fontWeight: FontWeight.w500, 204 | color: Color.fromARGB(255, 94, 94, 96)), 205 | ) 206 | : const SizedBox(), 207 | ], 208 | ), 209 | ); 210 | } 211 | } 212 | -------------------------------------------------------------------------------- /lib/widgets/cards_cascade_out.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_widgets/widgets/card_box.dart'; 2 | import 'package:flutter/material.dart'; 3 | //import 'dart:math' as math; 4 | 5 | class CardsCascadeOut extends StatefulWidget { 6 | const CardsCascadeOut({super.key}); 7 | 8 | @override 9 | State createState() => _CardsCascadeOutState(); 10 | } 11 | 12 | class _CardsCascadeOutState extends State 13 | with TickerProviderStateMixin { 14 | List cardsLeftMoves = List.filled(5, -75); 15 | List endAngles = [-0.4, -0.3, -0.2, -0.1, 0]; 16 | List beginAngles = [-0.4, -0.3, -0.2, -0.1, 0]; 17 | List cardsTopMoves = List.filled(5, -200); 18 | List cardsSize = List.filled( 19 | 5, 20 | const Size(150, 200), 21 | ); 22 | 23 | void _onLongPress(double width, double height) { 24 | setState(() { 25 | cardsLeftMoves[3] = (-width / 2) + 10; 26 | cardsTopMoves[4] = -220; 27 | for (int i = 2; i >= 0; i--) { 28 | cardsLeftMoves[i] = cardsLeftMoves[i + 1] + 110; 29 | } 30 | for (int i = 0; i < endAngles.length - 1; i++) { 31 | endAngles[i] = 0; 32 | } 33 | for (int i = 0; i < cardsTopMoves.length - 1; i++) { 34 | cardsTopMoves[i] = 10; 35 | } 36 | for (int i = 0; i < cardsSize.length - 1; i++) { 37 | cardsSize[i] = const Size(100, 150); 38 | } 39 | }); 40 | } 41 | 42 | @override 43 | Widget build(BuildContext context) { 44 | double width = MediaQuery.of(context).size.width; 45 | double height = MediaQuery.of(context).size.height; 46 | return Scaffold( 47 | appBar: AppBar( 48 | title: const Text("Cascade out Cards"), 49 | ), 50 | body: Center( 51 | child: GestureDetector( 52 | onLongPress: () { 53 | _onLongPress(width, height); 54 | }, 55 | onLongPressEnd: (details) { 56 | setState(() { 57 | cardsLeftMoves = List.filled(5, -75); 58 | endAngles = [-0.4, -0.3, -0.2, -0.1, 0]; 59 | cardsTopMoves = List.filled(5, -200); 60 | cardsSize = List.filled( 61 | 5, 62 | const Size(150, 200), 63 | ); 64 | }); 65 | }, 66 | child: SizedBox( 67 | width: width, 68 | height: height, 69 | child: Stack( 70 | alignment: Alignment.center, 71 | children: List.generate( 72 | cardsLeftMoves.length, 73 | (index) => TweenAnimationBuilder( 74 | tween: Tween( 75 | begin: (height / 2) - 200, 76 | end: (height / 2) + cardsTopMoves[index]), 77 | duration: const Duration(milliseconds: 300), 78 | builder: (context, top, child) { 79 | return TweenAnimationBuilder( 80 | tween: Tween( 81 | begin: (width / 2) - 75, 82 | end: (width / 2) + cardsLeftMoves[index]), 83 | duration: const Duration(milliseconds: 300), 84 | builder: (context, left, child) { 85 | return Positioned( 86 | left: left, 87 | top: top, 88 | child: TweenAnimationBuilder( 89 | tween: Tween( 90 | begin: beginAngles[index], 91 | end: endAngles[index]), 92 | duration: const Duration(milliseconds: 300), 93 | builder: (context, angle, child) { 94 | return TweenAnimationBuilder( 95 | tween: Tween( 96 | begin: const Size(150, 200), 97 | end: cardsSize[index]), 98 | duration: 99 | const Duration(milliseconds: 300), 100 | builder: (context, size, child) { 101 | return CardBox( 102 | height: size.height, 103 | width: size.width, 104 | angle: angle, 105 | ); 106 | }); 107 | }), 108 | ); 109 | }); 110 | }), 111 | )), 112 | ), 113 | ), 114 | ), 115 | ); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /lib/widgets/cards_stack.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/physics.dart'; 3 | 4 | class CardsStack extends StatefulWidget { 5 | const CardsStack({super.key}); 6 | 7 | @override 8 | State createState() => _CardsStackState(); 9 | } 10 | 11 | class _CardsStackState extends State with TickerProviderStateMixin { 12 | late AnimationController controller = AnimationController(vsync: this); 13 | bool expand = false; 14 | double cardHeight = 100; 15 | 16 | @override 17 | void dispose() { 18 | controller.dispose(); 19 | super.dispose(); 20 | } 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | double width = MediaQuery.of(context).size.width; 25 | double cardWidth = width * 0.8; 26 | return Scaffold( 27 | appBar: AppBar( 28 | title: const Text("Stack cards"), 29 | ), 30 | body: GestureDetector( 31 | onTap: onCardTap, 32 | child: Center( 33 | child: SizedBox( 34 | width: width, 35 | height: double.infinity, 36 | child: Align( 37 | alignment: Alignment.center, 38 | child: Flow( 39 | delegate: FlowStackDelegate( 40 | animation: controller, 41 | screnWidth: width, 42 | expand: expand, 43 | ), 44 | children: List.generate(3, (index) { 45 | return Container( 46 | height: cardHeight, 47 | width: expand ? cardWidth : cardWidth - (index * 10), 48 | decoration: BoxDecoration( 49 | color: Colors.white, 50 | border: Border.all( 51 | color: const Color.fromARGB(255, 83, 80, 80), 52 | ), 53 | borderRadius: BorderRadius.circular(20), 54 | boxShadow: const [ 55 | BoxShadow( 56 | offset: Offset(0, 5), 57 | color: Color.fromARGB(255, 209, 203, 203), 58 | spreadRadius: 1, 59 | blurRadius: 8) 60 | ]), 61 | ); 62 | }), 63 | ), 64 | ), 65 | ), 66 | ), 67 | )); 68 | } 69 | 70 | void onCardTap() { 71 | if (expand) { 72 | setState(() { 73 | expand = false; 74 | }); 75 | final SpringSimulation springSimulation = SpringSimulation( 76 | const SpringDescription(mass: 1, stiffness: 90, damping: 8.0), 77 | 1.0, 78 | 0.0, 79 | 0.0); 80 | controller.animateWith(springSimulation); 81 | } else if (!expand) { 82 | setState(() { 83 | expand = true; 84 | }); 85 | final SpringSimulation springSimulation = SpringSimulation( 86 | const SpringDescription(mass: 1, stiffness: 90, damping: 8.0), 87 | 0.0, 88 | 1.0, 89 | 0.0); 90 | controller.animateWith(springSimulation); 91 | } 92 | } 93 | } 94 | 95 | class FlowStackDelegate extends FlowDelegate { 96 | Animation animation; 97 | double screnWidth; 98 | bool expand; 99 | 100 | FlowStackDelegate( 101 | {required this.animation, required this.screnWidth, required this.expand}) 102 | : super(repaint: animation); 103 | @override 104 | void paintChildren(FlowPaintingContext context) { 105 | int childCount = context.childCount; 106 | double gap = context.getChildSize(0)!.height + 15; 107 | double childHeight = context.getChildSize(0)!.height; 108 | double height = context.size.height - 20; 109 | double firstPos = (height / 2 - (childHeight / 2)) - gap; 110 | double x, y; 111 | 112 | for (int i = childCount - 1; i >= 0; i--) { 113 | //default y 114 | double defY = (height / 2 - (childHeight / 2)) + (10 * i).toDouble(); 115 | y = defY + (firstPos + (i * gap) - defY) * animation.value; 116 | x = expand ? (screnWidth * 0.05) : (screnWidth * 0.05) + (i * 5); 117 | context.paintChild(i, transform: Matrix4.translationValues(x, y, 0)); 118 | } 119 | } 120 | 121 | @override 122 | Size getSize(BoxConstraints constraints) { 123 | //slightly widder than the children for the shadow to appear 124 | return Size(screnWidth * 0.9, double.infinity); 125 | } 126 | 127 | @override 128 | bool shouldRepaint(FlowStackDelegate oldDelegate) { 129 | return animation != oldDelegate.animation; 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /lib/widgets/dots_loading.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class DotsLoading extends StatefulWidget { 4 | const DotsLoading({super.key}); 5 | 6 | @override 7 | State createState() => _DotsLoadingState(); 8 | } 9 | 10 | class _DotsLoadingState extends State 11 | with TickerProviderStateMixin { 12 | late final AnimationController controller = AnimationController( 13 | duration: const Duration(milliseconds: 250), 14 | vsync: this, 15 | )..repeat(reverse: true); 16 | int count = 0; 17 | 18 | @override 19 | void initState() { 20 | super.initState(); 21 | controller.addStatusListener((status) { 22 | if (status == AnimationStatus.reverse && count < 2) { 23 | Future.delayed(const Duration(milliseconds: 250), () { 24 | if (mounted) { 25 | setState(() { 26 | count++; 27 | }); 28 | } 29 | }); 30 | } else if (status != AnimationStatus.reverse && count == 2) { 31 | setState(() { 32 | count = 0; 33 | }); 34 | } 35 | // print("anim count: $count"); 36 | }); 37 | } 38 | 39 | @override 40 | void dispose() { 41 | controller.removeStatusListener((status) {}); 42 | controller.dispose(); 43 | super.dispose(); 44 | } 45 | 46 | @override 47 | Widget build(BuildContext context) { 48 | //double width = MediaQuery.of(context).size.width; 49 | return Scaffold( 50 | appBar: AppBar( 51 | title: const Text("Dots Loading"), 52 | ), 53 | body: Flow( 54 | delegate: FlowDotDelegate(animation: controller, count: count), 55 | children: List.generate( 56 | 3, 57 | (index) => Container( 58 | height: 30, 59 | width: 30, 60 | decoration: const BoxDecoration( 61 | color: Colors.blue, shape: BoxShape.circle), 62 | )).toList())); 63 | } 64 | } 65 | 66 | class FlowDotDelegate extends FlowDelegate { 67 | Animation animation; 68 | int count; 69 | FlowDotDelegate({required this.animation, required this.count}) 70 | : super(repaint: animation); 71 | @override 72 | void paintChildren(FlowPaintingContext context) { 73 | //double topPosition = 10; 74 | Animation topPosition; 75 | double childWidth = context.getChildSize(0)!.width; 76 | int childCount = context.childCount; 77 | double spacing = 15 + childWidth; 78 | double width = context.size.width; 79 | double start = width / 2 - (childCount * spacing) / 2; 80 | for (int i = 0; i < context.childCount; ++i) { 81 | if (count == i) { 82 | topPosition = Tween(begin: 10, end: 0).animate(animation); 83 | } else { 84 | topPosition = Tween(begin: 10, end: 10).animate(animation); 85 | } 86 | context.paintChild(i, 87 | transform: Matrix4.translationValues( 88 | start + (i * spacing), topPosition.value, 0)); 89 | } 90 | } 91 | 92 | @override 93 | bool shouldRepaint(FlowDotDelegate oldDelegate) { 94 | return animation != oldDelegate.animation; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /lib/widgets/dropdown_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_svg/flutter_svg.dart'; 3 | 4 | class DropdownItem extends StatefulWidget { 5 | final String title, detail, icon; 6 | final bool isSelected; 7 | final bool forUpgrade; 8 | final double y, x; 9 | final bool isExpanded; 10 | const DropdownItem({ 11 | super.key, 12 | required this.title, 13 | required this.isExpanded, 14 | required this.detail, 15 | required this.y, 16 | required this.x, 17 | required this.icon, 18 | required this.isSelected, 19 | required this.forUpgrade, 20 | }); 21 | 22 | @override 23 | State createState() => _DropdownItemState(); 24 | } 25 | 26 | class _DropdownItemState extends State 27 | with TickerProviderStateMixin { 28 | @override 29 | Widget build(BuildContext context) { 30 | double width = MediaQuery.sizeOf(context).width; 31 | return InkWell( 32 | child: Visibility( 33 | child: widget.isExpanded || widget.isSelected 34 | ? SingleChildScrollView( 35 | scrollDirection: Axis.horizontal, 36 | child: Container( 37 | padding: EdgeInsets.only( 38 | top: widget.isExpanded ? 10 : 0, 39 | bottom: widget.isExpanded ? 10 : 0), 40 | width: 41 | widget.isExpanded ? (width * 0.9) - (25) : (width * 0.5), 42 | child: Row( 43 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 44 | mainAxisSize: MainAxisSize.min, 45 | children: [ 46 | Row( 47 | children: [ 48 | Transform.translate( 49 | offset: !widget.isSelected 50 | ? const Offset(0, 0) 51 | : Offset(widget.x, widget.y), 52 | child: Container( 53 | width: 50, 54 | height: 50, 55 | decoration: BoxDecoration( 56 | color: Colors.white, 57 | shape: BoxShape.circle, 58 | border: Border.all( 59 | color: Colors.grey, 60 | ), 61 | ), 62 | child: CircleAvatar( 63 | backgroundColor: Colors.white, 64 | child: SvgPicture.asset( 65 | widget.icon, 66 | fit: BoxFit.fill, 67 | height: 30, 68 | width: 30, 69 | colorFilter: const ColorFilter.mode( 70 | Colors.black, BlendMode.srcIn), 71 | ), 72 | ), 73 | ), 74 | ), 75 | const SizedBox( 76 | width: 10, 77 | ), 78 | Column( 79 | mainAxisAlignment: MainAxisAlignment.start, 80 | crossAxisAlignment: CrossAxisAlignment.start, 81 | children: [ 82 | Transform.translate( 83 | offset: !widget.isSelected 84 | ? const Offset(0, 0) 85 | : Offset(widget.x, widget.y), 86 | child: Text( 87 | widget.title, 88 | style: const TextStyle( 89 | fontWeight: FontWeight.bold, 90 | fontSize: 17.5, 91 | color: Color.fromARGB(255, 59, 58, 58)), 92 | ), 93 | ), 94 | widget.isExpanded 95 | ? Text( 96 | maxLines: 2, 97 | widget.detail, 98 | overflow: TextOverflow.clip, 99 | style: const TextStyle( 100 | fontSize: 15, 101 | color: Color.fromARGB( 102 | 255, 118, 118, 118)), 103 | ) 104 | : const SizedBox.shrink(), 105 | ], 106 | ), 107 | ], 108 | ), 109 | widget.forUpgrade 110 | ? const UpgradeButton() 111 | : widget.isExpanded 112 | ? Container( 113 | width: 23, 114 | height: 23, 115 | decoration: BoxDecoration( 116 | color: widget.isSelected 117 | ? Colors.black 118 | : Colors.white, 119 | shape: BoxShape.circle, 120 | border: Border.all( 121 | color: Colors.black, 122 | width: 2.5, 123 | strokeAlign: 124 | BorderSide.strokeAlignOutside), 125 | ), 126 | child: widget.isSelected 127 | ? const Icon( 128 | Icons.check, 129 | color: Colors.white, 130 | size: 15, 131 | ) 132 | : null, 133 | ) 134 | : const SizedBox.shrink() 135 | ], 136 | ), 137 | ), 138 | ) 139 | : const SizedBox.shrink(), 140 | ), 141 | ); 142 | } 143 | } 144 | 145 | class UpgradeButton extends StatelessWidget { 146 | const UpgradeButton({ 147 | super.key, 148 | }); 149 | 150 | @override 151 | Widget build(BuildContext context) { 152 | return Row( 153 | children: [ 154 | Container( 155 | height: 32, 156 | width: 32, 157 | decoration: BoxDecoration( 158 | color: Colors.white, 159 | borderRadius: const BorderRadius.only( 160 | topLeft: Radius.circular(10), bottomLeft: Radius.circular(10)), 161 | border: Border.all( 162 | color: Colors.grey, strokeAlign: BorderSide.strokeAlignOutside), 163 | ), 164 | child: Center( 165 | child: DecoratedBox( 166 | decoration: BoxDecoration( 167 | borderRadius: BorderRadius.circular(5), 168 | border: Border.all( 169 | color: Colors.black, 170 | strokeAlign: BorderSide.strokeAlignOutside)), 171 | child: const Icon( 172 | Icons.north_east_outlined, 173 | size: 18, 174 | )), 175 | ), 176 | ), 177 | Container( 178 | height: 32, 179 | width: 70, 180 | decoration: BoxDecoration( 181 | color: Colors.white, 182 | borderRadius: const BorderRadius.only( 183 | topRight: Radius.circular(10), 184 | bottomRight: Radius.circular(10)), 185 | border: Border.all( 186 | color: Colors.grey, strokeAlign: BorderSide.strokeAlignOutside), 187 | ), 188 | child: const Center( 189 | child: Text("Upgrade", 190 | style: TextStyle( 191 | fontWeight: FontWeight.bold, 192 | fontSize: 16, 193 | color: Colors.black)), 194 | ), 195 | ), 196 | ], 197 | ); 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /lib/widgets/gradient_border.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class GradientBorder extends StatefulWidget { 4 | const GradientBorder( 5 | {super.key, 6 | required this.gradient, 7 | required this.radius, 8 | required this.size, 9 | required this.strokeWidth}); 10 | final Gradient gradient; 11 | final double radius, strokeWidth; 12 | final Size size; 13 | @override 14 | State createState() => _HomePageState(); 15 | } 16 | 17 | class _HomePageState extends State { 18 | @override 19 | void dispose() { 20 | //_animationController.dispose(); 21 | super.dispose(); 22 | } 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return CustomPaint( 27 | size: widget.size, 28 | painter: BorderPainter( 29 | gradient: widget.gradient, 30 | radius: Radius.circular(widget.radius), 31 | strokeWidth: widget.strokeWidth, 32 | ), 33 | ); 34 | } 35 | } 36 | 37 | class BorderPainter extends CustomPainter { 38 | final Radius radius; 39 | final double strokeWidth; 40 | final Gradient gradient; 41 | final _paint = Paint()..style = PaintingStyle.stroke; 42 | 43 | BorderPainter( 44 | {required this.gradient, 45 | required this.radius, 46 | required this.strokeWidth}); 47 | 48 | @override 49 | void paint(Canvas canvas, Size size) { 50 | //main bound 51 | final rect = Rect.fromLTWH(0, 0, size.width, size.height); 52 | 53 | //rounded rectangle definition 54 | final rrect = RRect.fromRectAndRadius(rect, radius); 55 | 56 | // paint definition with the gadient 57 | _paint 58 | ..strokeWidth = strokeWidth 59 | ..shader = gradient.createShader(rect); 60 | 61 | // draw the rounded rectangle with the paint 62 | canvas.drawRRect(rrect, _paint); 63 | } 64 | 65 | @override 66 | bool shouldRepaint(covariant CustomPainter oldDelegate) { 67 | return true; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/widgets/jump_slide.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'dart:math' as math; 3 | 4 | class JumpSlide extends StatefulWidget { 5 | const JumpSlide({super.key}); 6 | 7 | @override 8 | State createState() => _JumpSlideState(); 9 | } 10 | 11 | class _JumpSlideState extends State with TickerProviderStateMixin { 12 | double boxHeight = 33.0; 13 | double boxWidth = 33.0; 14 | double spacing = 15.0; 15 | int boxesNumber = 5; 16 | double radius = 33; 17 | double containerWidth = 0; 18 | int currentPos = 3; 19 | 20 | late AnimationController jumpController = AnimationController( 21 | vsync: this, duration: const Duration(milliseconds: 300)); 22 | 23 | late AnimationController slideController = AnimationController( 24 | vsync: this, duration: const Duration(milliseconds: 1500)); 25 | 26 | late AnimationController scaleController = AnimationController(vsync: this); 27 | 28 | late Animation sliderX; 29 | 30 | List> listTurns = 31 | List.filled(4, const AlwaysStoppedAnimation(-math.pi)); 32 | List> xScales = 33 | List.filled(4, const AlwaysStoppedAnimation(1)); 34 | List> yScales = 35 | List.filled(4, const AlwaysStoppedAnimation(1)); 36 | 37 | TweenSequence get xScaleTween => TweenSequence([ 38 | TweenSequenceItem( 39 | tween: Tween(begin: 1, end: 1.3), 40 | weight: 15 * (currentPos + 1)), 41 | TweenSequenceItem( 42 | tween: Tween(begin: 1.3, end: 0.8), 43 | weight: 15 * (currentPos + 1) + 10), 44 | TweenSequenceItem( 45 | tween: Tween(begin: 0.8, end: 1), 46 | weight: 15 * (currentPos + 1) + 25), 47 | ]); 48 | 49 | TweenSequence get yScaleTween => TweenSequence([ 50 | TweenSequenceItem( 51 | tween: Tween(begin: 1, end: 0.7), 52 | weight: 15 * (currentPos + 1)), 53 | TweenSequenceItem( 54 | tween: Tween(begin: 0.7, end: 1.4), 55 | weight: 15 * (currentPos + 1) + 10), 56 | TweenSequenceItem( 57 | tween: Tween(begin: 1.4, end: 1), 58 | weight: 15 * (currentPos + 1) + 25), 59 | ]); 60 | 61 | @override 62 | void initState() { 63 | super.initState(); 64 | 65 | sliderX = Tween(begin: (boxWidth + spacing) * 4, end: 0) 66 | .chain(CurveTween(curve: Curves.easeInOut)) 67 | .animate(slideController) 68 | ..addListener(() { 69 | setState(() {}); 70 | }); 71 | 72 | slideListener(); 73 | 74 | slideController.repeat(reverse: true); 75 | } 76 | 77 | void slideListener() { 78 | return slideController.addStatusListener((status) async { 79 | if (status == AnimationStatus.forward) { 80 | for (int i = (listTurns.length - 1); i >= 0; i--) { 81 | currentPos = i; 82 | listTurns[i] = Tween(begin: -math.pi, end: 0) 83 | .chain(CurveTween(curve: Curves.easeInOut)) 84 | .animate(jumpController); 85 | 86 | xScales[i] = xScaleTween 87 | .chain(CurveTween(curve: Curves.easeInOut)) 88 | .animate(jumpController); 89 | yScales[i] = yScaleTween 90 | .chain(CurveTween(curve: Curves.easeInOut)) 91 | .animate(jumpController); 92 | 93 | await jumpController.forward(from: 0); 94 | 95 | listTurns[i] = const AlwaysStoppedAnimation(0); 96 | xScales[i] = const AlwaysStoppedAnimation(1); 97 | yScales[i] = const AlwaysStoppedAnimation(1); 98 | } 99 | } else if (status == AnimationStatus.reverse) { 100 | for (int i = 0; i < listTurns.length; i++) { 101 | listTurns[i] = Tween(begin: 0, end: -math.pi) 102 | .chain(CurveTween(curve: Curves.easeInOut)) 103 | .animate(jumpController); 104 | 105 | xScales[i] = xScaleTween 106 | .chain(CurveTween(curve: Curves.easeInOut)) 107 | .animate(jumpController); 108 | yScales[i] = yScaleTween 109 | .chain(CurveTween(curve: Curves.easeInOut)) 110 | .animate(jumpController); 111 | 112 | await jumpController.forward(from: 0); 113 | 114 | listTurns[i] = const AlwaysStoppedAnimation(-math.pi); 115 | xScales[i] = const AlwaysStoppedAnimation(1); 116 | yScales[i] = const AlwaysStoppedAnimation(1); 117 | } 118 | } 119 | }); 120 | } 121 | 122 | @override 123 | void dispose() { 124 | slideController.removeStatusListener((status) {}); 125 | jumpController.dispose(); 126 | slideController.dispose(); 127 | super.dispose(); 128 | } 129 | 130 | @override 131 | Widget build(BuildContext context) { 132 | return Scaffold( 133 | appBar: AppBar( 134 | title: const Text("Jump and Slide"), 135 | ), 136 | body: Center( 137 | child: SizedBox( 138 | height: (boxHeight * 2) + 10, 139 | width: 10 + (boxWidth + spacing) * 5, 140 | child: ShaderMask( 141 | shaderCallback: (Rect bounds) { 142 | return const LinearGradient( 143 | colors: [ 144 | Color(0xFF1C9FFF), 145 | Color(0xFF1FB1FD), 146 | Color(0xFF22C7FB), 147 | Color(0xFF23D3FB), 148 | Color(0xFF23D3FB), 149 | ], 150 | ).createShader(bounds); 151 | }, 152 | child: 153 | Stack(alignment: AlignmentDirectional.bottomStart, children: [ 154 | ...List.generate(4, (index) { 155 | return Transform.translate( 156 | offset: Offset( 157 | (radius * math.cos(listTurns[index].value)) + 158 | radius + 159 | (boxWidth + spacing) * index, 160 | (radius * math.sin(listTurns[index].value))), 161 | child: Transform.rotate( 162 | angle: listTurns[index].value, 163 | child: Transform.scale( 164 | scaleX: xScales[index].value, 165 | scaleY: yScales[index].value, 166 | child: Container( 167 | width: boxWidth, //listWidth[index].value, 168 | height: boxWidth, 169 | decoration: BoxDecoration( 170 | color: Colors.white, 171 | borderRadius: BorderRadius.circular(10)), 172 | ), 173 | ), 174 | ), 175 | ); 176 | }), 177 | Container( 178 | transform: Matrix4.translationValues(sliderX.value, 0, 0), 179 | width: boxHeight, 180 | height: boxWidth, 181 | decoration: BoxDecoration( 182 | color: Colors.white, 183 | borderRadius: BorderRadius.circular(10)), 184 | ) 185 | ]), 186 | ), 187 | ), 188 | ), 189 | ); 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /lib/widgets/loading_animation.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui' as ui; //to avoid conflict 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | class LoadingAnimation extends StatefulWidget { 6 | const LoadingAnimation({super.key}); 7 | 8 | @override 9 | State createState() => _LoadingAnimationState(); 10 | } 11 | 12 | class _LoadingAnimationState extends State 13 | with TickerProviderStateMixin { 14 | //definition of the text with textPainter in order to get its width 15 | final textPainter = TextPainter( 16 | textDirection: TextDirection.ltr, 17 | text: const TextSpan( 18 | text: "Loading...", 19 | style: TextStyle(fontWeight: FontWeight.bold, fontSize: 34))) 20 | ..layout(maxWidth: 200); 21 | 22 | late final AnimationController _animationController = 23 | AnimationController(vsync: this, duration: const Duration(seconds: 1)) 24 | ..repeat(reverse: true); 25 | 26 | late final Animation animation = 27 | Tween(begin: 20, end: textPainter.width - 20) 28 | .animate(_animationController); 29 | 30 | @override 31 | void dispose() { 32 | _animationController.dispose(); 33 | super.dispose(); 34 | } 35 | 36 | @override 37 | Widget build(BuildContext context) { 38 | return Scaffold( 39 | backgroundColor: const Color.fromARGB(255, 85, 84, 84), 40 | appBar: AppBar( 41 | automaticallyImplyLeading: true, 42 | title: const Text( 43 | "Loading Animation", 44 | style: TextStyle(color: Colors.white), 45 | ), 46 | backgroundColor: const Color.fromARGB(255, 85, 84, 84), 47 | ), 48 | body: Center( 49 | child: AnimatedBuilder( 50 | animation: _animationController, 51 | builder: (context, child) { 52 | return CustomPaint( 53 | size: Size(textPainter.width, textPainter.width), 54 | painter: LoadingPainter(circleOffsetdx: animation.value), 55 | ); 56 | }), 57 | ), 58 | ); 59 | } 60 | } 61 | 62 | class LoadingPainter extends CustomPainter { 63 | final double circleOffsetdx; 64 | LoadingPainter({required this.circleOffsetdx}); 65 | 66 | @override 67 | void paint(Canvas canvas, Size size) { 68 | //background text painter 69 | final backgroundtextPainter = TextPainter( 70 | textDirection: TextDirection.ltr, 71 | text: const TextSpan( 72 | text: "Loading...", 73 | style: TextStyle( 74 | color: Colors.black, 75 | fontWeight: FontWeight.bold, 76 | fontSize: 34))); 77 | 78 | //prepare text 79 | backgroundtextPainter.layout(maxWidth: 152); 80 | //paint text 81 | backgroundtextPainter.paint(canvas, Offset.zero); 82 | 83 | //definition of the circle 84 | final Path path = Path() 85 | ..addOval( 86 | Rect.fromCircle(center: Offset(circleOffsetdx, 20), radius: 20)); 87 | // save the current layout of the canvas before cliping 88 | // the foreground text 89 | canvas.save(); 90 | 91 | //clip the circle to constraint what will follow (the foreground text) 92 | canvas.clipPath(path); 93 | 94 | // foreground text painter 95 | final foregroundTextPainter = TextPainter( 96 | textDirection: TextDirection.ltr, 97 | text: TextSpan( 98 | text: "Loading...", 99 | style: TextStyle( 100 | color: Colors.white, 101 | background: ui.Paint()..color = Colors.black, 102 | fontWeight: FontWeight.bold, 103 | fontSize: 34))); 104 | 105 | foregroundTextPainter.layout(maxWidth: 152); 106 | foregroundTextPainter.paint(canvas, Offset.zero); 107 | //restore the initial layout 108 | //useful in case there are other things to draw 109 | canvas.restore(); 110 | } 111 | 112 | @override 113 | bool shouldRepaint(covariant CustomPainter oldDelegate) { 114 | return true; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /lib/widgets/rotating_arcs.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_widgets/style.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'dart:math' as math; 4 | 5 | class RotatingArcs extends StatefulWidget { 6 | const RotatingArcs({super.key}); 7 | 8 | @override 9 | State createState() => _RotatingArcsState(); 10 | } 11 | 12 | class _RotatingArcsState extends State 13 | with TickerProviderStateMixin { 14 | // rotation duration of each arc 15 | List durations = [ 16 | const Duration(seconds: 1), 17 | const Duration(milliseconds: 900), 18 | const Duration(milliseconds: 700) 19 | ]; 20 | // list of animation controllers 21 | late final List _animationControllers = durations 22 | .map((duration) => AnimationController( 23 | duration: duration, 24 | vsync: this, 25 | )..repeat()) 26 | .toList(); 27 | 28 | //list of tween values mapped to each controller 29 | late final List> _animations = _animationControllers 30 | .map((controller) => 31 | Tween(begin: 0, end: math.pi * 2).animate(controller)) 32 | .toList(); 33 | 34 | @override 35 | void dispose() { 36 | for (int i = 0; i < _animationControllers.length; i++) { 37 | _animationControllers[i].dispose(); 38 | } 39 | super.dispose(); 40 | } 41 | 42 | @override 43 | Widget build(BuildContext context) { 44 | return Scaffold( 45 | backgroundColor: Colors.black, 46 | appBar: AppBar( 47 | automaticallyImplyLeading: true, 48 | title: const Text( 49 | "Rotating Arcs", 50 | style: TextStyle(color: Colors.white), 51 | ), 52 | backgroundColor: Colors.black, 53 | ), 54 | body: Center( 55 | child: AnimatedBuilder( 56 | animation: _animationControllers[0], 57 | builder: (context, child) { 58 | return CustomPaint( 59 | size: const Size(80, 80), 60 | painter: ArcPainter( 61 | startAngles: [ 62 | _animations[0].value, 63 | _animations[1].value, 64 | _animations[2].value 65 | ], 66 | colors: BaseColors.arcsColors, 67 | strokeWidth: 5, 68 | ), 69 | ); 70 | })), 71 | ); 72 | } 73 | } 74 | 75 | class ArcPainter extends CustomPainter { 76 | double strokeWidth; 77 | List colors; 78 | List startAngles; 79 | ArcPainter( 80 | {required this.startAngles, 81 | required this.colors, 82 | required this.strokeWidth}); 83 | 84 | @override 85 | void paint(Canvas canvas, Size size) { 86 | // definition of each rect 87 | final blueRect = Rect.fromLTWH(0, 0, size.width, size.height); 88 | final yellowRect = Rect.fromLTWH(10, 10, size.width - 20, size.height - 20); 89 | final redRect = Rect.fromLTWH(20, 20, size.width - 40, size.height - 40); 90 | 91 | // definition of each arc's paint mapped to the 92 | //corresponding color 93 | final List paints = colors 94 | .map((color) => Paint() 95 | ..style = PaintingStyle.stroke 96 | ..strokeWidth = strokeWidth 97 | ..color = color) 98 | .toList(); 99 | 100 | //draw arc with the right start angle 101 | canvas.drawArc(redRect, startAngles[2], math.pi, false, paints[2]); 102 | canvas.drawArc(yellowRect, startAngles[1], math.pi, false, paints[1]); 103 | canvas.drawArc(blueRect, startAngles[0], math.pi, false, paints[0]); 104 | } 105 | 106 | @override 107 | bool shouldRepaint(covariant CustomPainter oldDelegate) { 108 | return true; 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /lib/widgets/rotating_gradient_arc.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'dart:math' as math; 3 | import 'package:custom_widgets/style.dart'; 4 | 5 | class RotatingGradientArc extends StatefulWidget { 6 | const RotatingGradientArc({super.key}); 7 | 8 | @override 9 | State createState() => _RotatingGradientArcState(); 10 | } 11 | 12 | class _RotatingGradientArcState extends State 13 | with TickerProviderStateMixin { 14 | late final AnimationController _animationController = AnimationController( 15 | duration: const Duration(seconds: 5), 16 | vsync: this, 17 | )..repeat(); 18 | 19 | late final Animation _turnAnimation = 20 | Tween(begin: 0, end: math.pi * 2).animate(_animationController); 21 | Gradient get borderGradient => const LinearGradient(colors: BaseColors.grad1); 22 | 23 | @override 24 | void dispose() { 25 | _animationController.dispose(); 26 | super.dispose(); 27 | } 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | return Scaffold( 32 | backgroundColor: Colors.black, 33 | appBar: AppBar( 34 | automaticallyImplyLeading: true, 35 | title: const Text( 36 | "Rotating gradient arc", 37 | style: TextStyle(color: Colors.white), 38 | ), 39 | backgroundColor: Colors.black, 40 | ), 41 | body: Center( 42 | child: AnimatedBuilder( 43 | animation: _animationController, 44 | builder: (context, child) { 45 | return CustomPaint( 46 | size: const Size(200, 200), 47 | painter: GradientArcPainter( 48 | startAngle: _turnAnimation.value, gradient: borderGradient), 49 | ); 50 | }), 51 | ), 52 | ); 53 | } 54 | } 55 | 56 | class GradientArcPainter extends CustomPainter { 57 | double startAngle; 58 | Gradient gradient; 59 | GradientArcPainter({required this.startAngle, required this.gradient}); 60 | 61 | @override 62 | void paint(Canvas canvas, Size size) { 63 | const double strokeWidth = 20.0; 64 | final double radius = (size.width / 2); 65 | final Offset center = Offset(size.width / 2, size.height / 2); 66 | 67 | // Grey circle paint definition and drawing 68 | final Paint circlePaint = Paint() 69 | ..color = const Color.fromARGB(255, 81, 78, 78) 70 | ..style = PaintingStyle.stroke 71 | ..strokeWidth = strokeWidth; 72 | 73 | canvas.drawCircle(center, radius, circlePaint); 74 | 75 | // gradient paint 76 | final Paint gradientPaint = Paint() 77 | ..shader = 78 | gradient.createShader(Rect.fromCircle(center: center, radius: radius)) 79 | ..style = PaintingStyle.stroke 80 | ..strokeCap = StrokeCap.round 81 | ..strokeWidth = strokeWidth; 82 | 83 | // arc path 84 | final Path arcPath = Path() 85 | ..addArc( 86 | Rect.fromCircle(center: center, radius: radius), 87 | startAngle, 88 | 3.14 / 4, 89 | ); 90 | 91 | //draw path with the gradient paint 92 | canvas.drawPath(arcPath, gradientPaint); 93 | } 94 | 95 | @override 96 | bool shouldRepaint(CustomPainter oldDelegate) => true; 97 | } 98 | -------------------------------------------------------------------------------- /lib/widgets/stack_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/physics.dart'; 3 | 4 | class StackItem extends StatefulWidget { 5 | const StackItem({super.key}); 6 | 7 | @override 8 | State createState() => _StackListState(); 9 | } 10 | 11 | class _StackListState extends State with TickerProviderStateMixin { 12 | late AnimationController controller = AnimationController( 13 | vsync: this, 14 | ); 15 | late SpringSimulation springSimulation; 16 | bool expand = false; 17 | double cardHeight = 100; 18 | double flowHeight = 140; 19 | 20 | @override 21 | void initState() { 22 | super.initState(); 23 | controller.addListener(() { 24 | setState(() { 25 | flowHeight = 140 + (350 - 140) * controller.value; 26 | }); 27 | }); 28 | } 29 | 30 | @override 31 | void dispose() { 32 | controller.dispose(); 33 | super.dispose(); 34 | } 35 | 36 | @override 37 | Widget build(BuildContext context) { 38 | double width = MediaQuery.of(context).size.width; 39 | double cardWidth = width * 0.8; 40 | return GestureDetector( 41 | onTap: onCardTap, 42 | child: SizedBox( 43 | width: width, 44 | height: flowHeight, 45 | child: Align( 46 | alignment: Alignment.topCenter, 47 | child: Flow( 48 | delegate: FlowStackDelegate( 49 | animation: controller, 50 | screnWidth: width, 51 | expand: expand, 52 | ), 53 | children: List.generate(3, (index) { 54 | return Container( 55 | height: cardHeight, 56 | width: expand ? cardWidth : cardWidth - (index * 10), 57 | decoration: BoxDecoration( 58 | color: Colors.white, 59 | border: Border.all( 60 | color: const Color.fromARGB(255, 83, 80, 80), 61 | ), 62 | borderRadius: BorderRadius.circular(20), 63 | boxShadow: const [ 64 | BoxShadow( 65 | offset: Offset(0, 5), 66 | color: Color.fromARGB(255, 209, 203, 203), 67 | spreadRadius: 1, 68 | blurRadius: 8) 69 | ]), 70 | ); 71 | }), 72 | ), 73 | ), 74 | ), 75 | ); 76 | } 77 | 78 | void onCardTap() { 79 | if (expand) { 80 | springSimulation = SpringSimulation( 81 | const SpringDescription(mass: 1, stiffness: 90, damping: 8.0), 82 | 1.0, 83 | 0.0, 84 | 0.0); 85 | controller.animateWith(springSimulation); 86 | setState(() { 87 | expand = false; 88 | }); 89 | } else if (!expand) { 90 | setState(() { 91 | expand = true; 92 | }); 93 | springSimulation = SpringSimulation( 94 | const SpringDescription(mass: 1, stiffness: 90, damping: 8.0), 95 | 0.0, 96 | 1.0, 97 | 0.0); 98 | controller.animateWith(springSimulation); 99 | } 100 | } 101 | } 102 | 103 | class FlowStackDelegate extends FlowDelegate { 104 | Animation animation; 105 | double screnWidth; 106 | bool expand; 107 | 108 | FlowStackDelegate( 109 | {required this.animation, required this.screnWidth, required this.expand}) 110 | : super(repaint: animation); 111 | @override 112 | void paintChildren(FlowPaintingContext context) { 113 | int childCount = context.childCount; 114 | double gap = context.getChildSize(0)!.height + 10; 115 | double x, y; 116 | 117 | for (int i = childCount - 1; i >= 0; i--) { 118 | //default y 119 | double defY = (10 * i).toDouble(); 120 | 121 | y = defY + (i * gap * animation.value); 122 | x = !expand ? (screnWidth * 0.05) + (i * 5) : (screnWidth * 0.05); 123 | context.paintChild(i, transform: Matrix4.translationValues(x, y, 0)); 124 | } 125 | } 126 | 127 | @override 128 | Size getSize(BoxConstraints constraints) { 129 | //slightly widder than the children for the shadow to appear 130 | return Size(screnWidth * 0.9, double.infinity); 131 | } 132 | 133 | @override 134 | bool shouldRepaint(FlowStackDelegate oldDelegate) { 135 | return animation != oldDelegate.animation; 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /lib/widgets/stack_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_widgets/widgets/stack_item.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class StackList extends StatefulWidget { 5 | const StackList({super.key}); 6 | 7 | @override 8 | State createState() => _StackListState(); 9 | } 10 | 11 | class _StackListState extends State { 12 | @override 13 | Widget build(BuildContext context) { 14 | double width = MediaQuery.of(context).size.width; 15 | double height = MediaQuery.of(context).size.height; 16 | return Scaffold( 17 | appBar: AppBar( 18 | title: const Text("Stack List"), 19 | ), 20 | body: SizedBox( 21 | width: width, 22 | height: height, 23 | child: ListView.builder( 24 | itemCount: 5, itemBuilder: (context, index) => const StackItem()), 25 | ), 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "custom_widgets") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.example.custom_widgets") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | 90 | # Generated plugin build rules, which manage building the plugins and adding 91 | # them to the application. 92 | include(flutter/generated_plugins.cmake) 93 | 94 | 95 | # === Installation === 96 | # By default, "installing" just makes a relocatable bundle in the build 97 | # directory. 98 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 99 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 100 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 101 | endif() 102 | 103 | # Start with a clean build bundle directory every time. 104 | install(CODE " 105 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 106 | " COMPONENT Runtime) 107 | 108 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 109 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 110 | 111 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 112 | COMPONENT Runtime) 113 | 114 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 115 | COMPONENT Runtime) 116 | 117 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 118 | COMPONENT Runtime) 119 | 120 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 121 | install(FILES "${bundled_library}" 122 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 123 | COMPONENT Runtime) 124 | endforeach(bundled_library) 125 | 126 | # Copy the native assets provided by the build.dart from all packages. 127 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") 128 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 129 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 130 | COMPONENT Runtime) 131 | 132 | # Fully re-copy the assets directory on each build to avoid having stale files 133 | # from a previous install. 134 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 135 | install(CODE " 136 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 137 | " COMPONENT Runtime) 138 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 139 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 140 | 141 | # Install the AOT library on non-Debug builds only. 142 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 143 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 144 | COMPONENT Runtime) 145 | endif() 146 | -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "custom_widgets"); 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, "custom_widgets"); 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 GApplication::startup. 85 | static void my_application_startup(GApplication* application) { 86 | //MyApplication* self = MY_APPLICATION(object); 87 | 88 | // Perform any actions required at application startup. 89 | 90 | G_APPLICATION_CLASS(my_application_parent_class)->startup(application); 91 | } 92 | 93 | // Implements GApplication::shutdown. 94 | static void my_application_shutdown(GApplication* application) { 95 | //MyApplication* self = MY_APPLICATION(object); 96 | 97 | // Perform any actions required at application shutdown. 98 | 99 | G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); 100 | } 101 | 102 | // Implements GObject::dispose. 103 | static void my_application_dispose(GObject* object) { 104 | MyApplication* self = MY_APPLICATION(object); 105 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 106 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 107 | } 108 | 109 | static void my_application_class_init(MyApplicationClass* klass) { 110 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 111 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 112 | G_APPLICATION_CLASS(klass)->startup = my_application_startup; 113 | G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; 114 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 115 | } 116 | 117 | static void my_application_init(MyApplication* self) {} 118 | 119 | MyApplication* my_application_new() { 120 | return MY_APPLICATION(g_object_new(my_application_get_type(), 121 | "application-id", APPLICATION_ID, 122 | "flags", G_APPLICATION_NON_UNIQUE, 123 | nullptr)); 124 | } 125 | -------------------------------------------------------------------------------- /linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import path_provider_foundation 9 | 10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 11 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 12 | } 13 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = custom_widgets 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.customWidgets 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: custom_widgets 2 | description: "A new Flutter project." 3 | # The following line prevents the package from being accidentally published to 4 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 5 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 6 | 7 | # The following defines the version and build number for your application. 8 | # A version number is three numbers separated by dots, like 1.2.43 9 | # followed by an optional build number separated by a +. 10 | # Both the version and the builder number may be overridden in flutter 11 | # build by specifying --build-name and --build-number, respectively. 12 | # In Android, build-name is used as versionName while build-number used as versionCode. 13 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 14 | # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. 15 | # Read more about iOS versioning at 16 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 17 | # In Windows, build-name is used as the major, minor, and patch parts 18 | # of the product and file versions while build-number is used as the build suffix. 19 | version: 1.0.0+1 20 | 21 | environment: 22 | sdk: '>=3.4.3 <4.0.0' 23 | 24 | # Dependencies specify other packages that your package needs in order to work. 25 | # To automatically upgrade your package dependencies to the latest versions 26 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 27 | # dependencies can be manually updated by changing the version numbers below to 28 | # the latest version available on pub.dev. To see which dependencies have newer 29 | # versions available, run `flutter pub outdated`. 30 | dependencies: 31 | flutter: 32 | sdk: flutter 33 | 34 | 35 | # The following adds the Cupertino Icons font to your application. 36 | # Use with the CupertinoIcons class for iOS style icons. 37 | cupertino_icons: ^1.0.6 38 | flutter_svg: ^2.0.14 39 | google_fonts: ^6.2.1 40 | 41 | dev_dependencies: 42 | flutter_test: 43 | sdk: flutter 44 | 45 | # The "flutter_lints" package below contains a set of recommended lints to 46 | # encourage good coding practices. The lint set provided by the package is 47 | # activated in the `analysis_options.yaml` file located at the root of your 48 | # package. See that file for information about deactivating specific lint 49 | # rules and activating additional ones. 50 | flutter_lints: ^3.0.0 51 | 52 | # For information on the generic Dart part of this file, see the 53 | # following page: https://dart.dev/tools/pub/pubspec 54 | 55 | # The following section is specific to Flutter packages. 56 | flutter: 57 | 58 | # The following line ensures that the Material Icons font is 59 | # included with your application, so that you can use the icons in 60 | # the material Icons class. 61 | uses-material-design: true 62 | 63 | # To add assets to your application, add an assets section, like this: 64 | assets: 65 | - assets/icons/ 66 | # - images/a_dot_ham.jpeg 67 | 68 | # An image asset can refer to one or more resolution-specific "variants", see 69 | # https://flutter.dev/assets-and-images/#resolution-aware 70 | 71 | # For details regarding adding assets from package dependencies, see 72 | # https://flutter.dev/assets-and-images/#from-packages 73 | 74 | # To add custom fonts to your application, add a fonts section here, 75 | # in this "flutter" section. Each entry in this list should have a 76 | # "family" key with the font family name, and a "fonts" key with a 77 | # list giving the asset and other descriptors for the font. For 78 | # example: 79 | # fonts: 80 | # - family: Schyler 81 | # fonts: 82 | # - asset: fonts/Schyler-Regular.ttf 83 | # - asset: fonts/Schyler-Italic.ttf 84 | # style: italic 85 | # - family: Trajan Pro 86 | # fonts: 87 | # - asset: fonts/TrajanPro.ttf 88 | # - asset: fonts/TrajanPro_Bold.ttf 89 | # weight: 700 90 | # 91 | # For details regarding fonts from package dependencies, 92 | # see https://flutter.dev/custom-fonts/#from-packages 93 | -------------------------------------------------------------------------------- /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 in the flutter_test package. 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:custom_widgets/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | custom_widgets 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "custom_widgets", 3 | "short_name": "custom_widgets", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(custom_widgets LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "custom_widgets") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(VERSION 3.14...3.25) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | 56 | # Generated plugin build rules, which manage building the plugins and adding 57 | # them to the application. 58 | include(flutter/generated_plugins.cmake) 59 | 60 | 61 | # === Installation === 62 | # Support files are copied into place next to the executable, so that it can 63 | # run in place. This is done instead of making a separate bundle (as on Linux) 64 | # so that building and running from within Visual Studio will work. 65 | set(BUILD_BUNDLE_DIR "$") 66 | # Make the "install" step default, as it's required to run. 67 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 68 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 69 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 70 | endif() 71 | 72 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 73 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 74 | 75 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 76 | COMPONENT Runtime) 77 | 78 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 79 | COMPONENT Runtime) 80 | 81 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 82 | COMPONENT Runtime) 83 | 84 | if(PLUGIN_BUNDLED_LIBRARIES) 85 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 86 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 87 | COMPONENT Runtime) 88 | endif() 89 | 90 | # Copy the native assets provided by the build.dart from all packages. 91 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") 92 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 93 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 94 | COMPONENT Runtime) 95 | 96 | # Fully re-copy the assets directory on each build to avoid having stale files 97 | # from a previous install. 98 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 99 | install(CODE " 100 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 101 | " COMPONENT Runtime) 102 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 103 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 104 | 105 | # Install the AOT library on non-Debug builds only. 106 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 107 | CONFIGURATIONS Profile;Release 108 | COMPONENT Runtime) 109 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # Set fallback configurations for older versions of the flutter tool. 14 | if (NOT DEFINED FLUTTER_TARGET_PLATFORM) 15 | set(FLUTTER_TARGET_PLATFORM "windows-x64") 16 | endif() 17 | 18 | # === Flutter Library === 19 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 20 | 21 | # Published to parent scope for install step. 22 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 23 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 24 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 25 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 26 | 27 | list(APPEND FLUTTER_LIBRARY_HEADERS 28 | "flutter_export.h" 29 | "flutter_windows.h" 30 | "flutter_messenger.h" 31 | "flutter_plugin_registrar.h" 32 | "flutter_texture_registrar.h" 33 | ) 34 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 35 | add_library(flutter INTERFACE) 36 | target_include_directories(flutter INTERFACE 37 | "${EPHEMERAL_DIR}" 38 | ) 39 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 40 | add_dependencies(flutter flutter_assemble) 41 | 42 | # === Wrapper === 43 | list(APPEND CPP_WRAPPER_SOURCES_CORE 44 | "core_implementations.cc" 45 | "standard_codec.cc" 46 | ) 47 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 48 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 49 | "plugin_registrar.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 52 | list(APPEND CPP_WRAPPER_SOURCES_APP 53 | "flutter_engine.cc" 54 | "flutter_view_controller.cc" 55 | ) 56 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 57 | 58 | # Wrapper sources needed for a plugin. 59 | add_library(flutter_wrapper_plugin STATIC 60 | ${CPP_WRAPPER_SOURCES_CORE} 61 | ${CPP_WRAPPER_SOURCES_PLUGIN} 62 | ) 63 | apply_standard_settings(flutter_wrapper_plugin) 64 | set_target_properties(flutter_wrapper_plugin PROPERTIES 65 | POSITION_INDEPENDENT_CODE ON) 66 | set_target_properties(flutter_wrapper_plugin PROPERTIES 67 | CXX_VISIBILITY_PRESET hidden) 68 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 69 | target_include_directories(flutter_wrapper_plugin PUBLIC 70 | "${WRAPPER_ROOT}/include" 71 | ) 72 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 73 | 74 | # Wrapper sources needed for the runner. 75 | add_library(flutter_wrapper_app STATIC 76 | ${CPP_WRAPPER_SOURCES_CORE} 77 | ${CPP_WRAPPER_SOURCES_APP} 78 | ) 79 | apply_standard_settings(flutter_wrapper_app) 80 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 81 | target_include_directories(flutter_wrapper_app PUBLIC 82 | "${WRAPPER_ROOT}/include" 83 | ) 84 | add_dependencies(flutter_wrapper_app flutter_assemble) 85 | 86 | # === Flutter tool backend === 87 | # _phony_ is a non-existent file to force this command to run every time, 88 | # since currently there's no way to get a full input/output list from the 89 | # flutter tool. 90 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 91 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 92 | add_custom_command( 93 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 94 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 95 | ${CPP_WRAPPER_SOURCES_APP} 96 | ${PHONY_OUTPUT} 97 | COMMAND ${CMAKE_COMMAND} -E env 98 | ${FLUTTER_TOOL_ENVIRONMENT} 99 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 100 | ${FLUTTER_TARGET_PLATFORM} $ 101 | VERBATIM 102 | ) 103 | add_custom_target(flutter_assemble DEPENDS 104 | "${FLUTTER_LIBRARY}" 105 | ${FLUTTER_LIBRARY_HEADERS} 106 | ${CPP_WRAPPER_SOURCES_CORE} 107 | ${CPP_WRAPPER_SOURCES_PLUGIN} 108 | ${CPP_WRAPPER_SOURCES_APP} 109 | ) 110 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /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 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 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", "custom_widgets" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "custom_widgets" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "custom_widgets.exe" "\0" 98 | VALUE "ProductName", "custom_widgets" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | 30 | flutter_controller_->engine()->SetNextFrameCallback([&]() { 31 | this->Show(); 32 | }); 33 | 34 | // Flutter can complete the first frame before the "show window" callback is 35 | // registered. The following call ensures a frame is pending to ensure the 36 | // window is shown. It is a no-op if the first frame hasn't completed yet. 37 | flutter_controller_->ForceRedraw(); 38 | 39 | return true; 40 | } 41 | 42 | void FlutterWindow::OnDestroy() { 43 | if (flutter_controller_) { 44 | flutter_controller_ = nullptr; 45 | } 46 | 47 | Win32Window::OnDestroy(); 48 | } 49 | 50 | LRESULT 51 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 52 | WPARAM const wparam, 53 | LPARAM const lparam) noexcept { 54 | // Give Flutter, including plugins, an opportunity to handle window messages. 55 | if (flutter_controller_) { 56 | std::optional result = 57 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 58 | lparam); 59 | if (result) { 60 | return *result; 61 | } 62 | } 63 | 64 | switch (message) { 65 | case WM_FONTCHANGE: 66 | flutter_controller_->engine()->ReloadSystemFonts(); 67 | break; 68 | } 69 | 70 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 71 | } 72 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"custom_widgets", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prosmaw/flutter_custom_widgets/088ac375e192a749a98b5eaaafa5b0dddc4726cd/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | unsigned int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr) 51 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length == 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /windows/runner/win32_window.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 a win32 window with |title| that is positioned and sized 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 this function will scale the inputted width and height as 35 | // as appropriate for the default monitor. The window is invisible until 36 | // |Show| is called. Returns true if the window was created successfully. 37 | bool Create(const std::wstring& title, const Point& origin, const Size& size); 38 | 39 | // Show the current window. Returns true if the window was successfully shown. 40 | bool Show(); 41 | 42 | // Release OS resources associated with window. 43 | void Destroy(); 44 | 45 | // Inserts |content| into the window tree. 46 | void SetChildContent(HWND content); 47 | 48 | // Returns the backing Window handle to enable clients to set icon and other 49 | // window properties. Returns nullptr if the window has been destroyed. 50 | HWND GetHandle(); 51 | 52 | // If true, closing this window will quit the application. 53 | void SetQuitOnClose(bool quit_on_close); 54 | 55 | // Return a RECT representing the bounds of the current client area. 56 | RECT GetClientArea(); 57 | 58 | protected: 59 | // Processes and route salient window messages for mouse handling, 60 | // size change and DPI. Delegates handling of these to member overloads that 61 | // inheriting classes can handle. 62 | virtual LRESULT MessageHandler(HWND window, 63 | UINT const message, 64 | WPARAM const wparam, 65 | LPARAM const lparam) noexcept; 66 | 67 | // Called when CreateAndShow is called, allowing subclass window-related 68 | // setup. Subclasses should return false if setup fails. 69 | virtual bool OnCreate(); 70 | 71 | // Called when Destroy is called. 72 | virtual void OnDestroy(); 73 | 74 | private: 75 | friend class WindowClassRegistrar; 76 | 77 | // OS callback called by message pump. Handles the WM_NCCREATE message which 78 | // is passed when the non-client area is being created and enables automatic 79 | // non-client DPI scaling so that the non-client area automatically 80 | // responds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | --------------------------------------------------------------------------------