├── .gitignore
├── .metadata
├── README.md
├── analysis_options.yaml
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── widget_utils
│ │ │ │ └── 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
├── audio
│ └── Chogada.mp3
├── fonts
│ ├── BeautifulLovina-Regular.ttf
│ ├── Campton_Light.ttf
│ └── CoralPen.ttf
├── gif
│ ├── ganesha.json
│ └── krishna.gif
├── icons
│ ├── insta.gif
│ ├── linkedin.gif
│ └── services.gif
└── images
│ ├── 1.jpg
│ ├── 2.jpg
│ ├── 3.jpg
│ ├── 4.jpg
│ ├── 5.jpg
│ ├── burger.png
│ ├── chandler
│ ├── c1.jpg
│ ├── c2.jpg
│ ├── c3.jpg
│ ├── c4.jpg
│ ├── c5.jpg
│ ├── c6.jpg
│ ├── c7.jpg
│ ├── c8.jpg
│ └── c9.jpeg
│ ├── darshan_raval.jpg
│ ├── darshan_raval_3.png
│ ├── darshan_raval_first_song.jpg
│ ├── inner.png
│ ├── outer.png
│ └── parallerX
│ ├── p1.jpg
│ ├── p2.jpg
│ ├── p3.jpg
│ ├── p4.jpg
│ ├── p5.jpg
│ ├── p6.jpg
│ └── p7.jpg
├── 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
├── extensions
│ ├── date_time_utils.dart
│ ├── int_utils.dart
│ └── string_utils.dart
├── main.dart
├── main2.dart
├── provider
│ ├── font_size_provider.dart
│ ├── password_provider.dart
│ ├── theme_config.dart
│ └── theme_provider.dart
├── ui
│ ├── ext_demo
│ │ ├── date_util_demo.dart
│ │ ├── int_util_demo.dart
│ │ └── string_util_demo.dart
│ ├── extra
│ │ ├── advance_stepper.dart
│ │ └── basic_stepper.dart
│ ├── package
│ │ ├── scratch_card_exp.dart
│ │ └── showcase.dart
│ ├── screens
│ │ ├── burger.dart
│ │ ├── custom_app_theme.dart
│ │ ├── dynamic_fontsize.dart
│ │ ├── feastival.dart
│ │ ├── indian_flag_animation.dart
│ │ ├── lazy_loading_example.dart
│ │ ├── music_list.dart
│ │ ├── music_player.dart
│ │ ├── parallerx_effect.dart
│ │ ├── password_validator.dart
│ │ └── polariod_photo.dart
│ └── widgets
│ │ ├── buttons.dart
│ │ ├── dropdown.dart
│ │ ├── res_bottom.dart
│ │ ├── slides.dart
│ │ ├── stepper.dart
│ │ └── tab_bar.dart
└── utils
│ ├── data.dart
│ └── font_size_helper.dart
├── 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 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Symbolication related
36 | app.*.symbols
37 |
38 | # Obfuscation related
39 | app.*.map.json
40 |
41 | # Android Studio will place build artifacts here
42 | /android/app/debug
43 | /android/app/profile
44 | /android/app/release
45 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: f92f44110e87bad5ff168335c36da6f6053036e6
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: f92f44110e87bad5ff168335c36da6f6053036e6
17 | base_revision: f92f44110e87bad5ff168335c36da6f6053036e6
18 | - platform: android
19 | create_revision: f92f44110e87bad5ff168335c36da6f6053036e6
20 | base_revision: f92f44110e87bad5ff168335c36da6f6053036e6
21 | - platform: ios
22 | create_revision: f92f44110e87bad5ff168335c36da6f6053036e6
23 | base_revision: f92f44110e87bad5ff168335c36da6f6053036e6
24 | - platform: linux
25 | create_revision: f92f44110e87bad5ff168335c36da6f6053036e6
26 | base_revision: f92f44110e87bad5ff168335c36da6f6053036e6
27 | - platform: macos
28 | create_revision: f92f44110e87bad5ff168335c36da6f6053036e6
29 | base_revision: f92f44110e87bad5ff168335c36da6f6053036e6
30 | - platform: web
31 | create_revision: f92f44110e87bad5ff168335c36da6f6053036e6
32 | base_revision: f92f44110e87bad5ff168335c36da6f6053036e6
33 | - platform: windows
34 | create_revision: f92f44110e87bad5ff168335c36da6f6053036e6
35 | base_revision: f92f44110e87bad5ff168335c36da6f6053036e6
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # Flutter CheatSheet 2023
3 |
4 | Welcome to the All-in-One Flutter Widgets repository or Flutter CheatSheet! This repository aims to provide a comprehensive collection of various widgets and extensions to enhance your Flutter development experience and it inncluding the latest 3.10 update.🚀✨
5 |
6 | ## Features
7 |
8 | - **10 Types of Tab Bar:** Explore different tab bar implementations to add versatile navigation options to your Flutter apps.
9 | - **8 Types of Sliders:** Explore different Slider implementations to add versatile experiance to your Flutter apps.
10 | - **11 Types of Buttons:** Explore different type of button implementations.
11 | - **6 Types of DropDown:** Explore different types of dropdowns.
12 | - **2 Types of Stepper:** Explore different types of steppers-basic one and one with help of external package.
13 |
14 | - **Extensions Galore:** I believe in making your Flutter development experience smoother, which is why i have included a set of useful extensions for String,Integer,date&time and more for your convenience. These extensions cover various aspects of Flutter development and have been updated to the latest version 3.10.
15 |
16 | - **Dynamic Font Size:** Explore the code for how to dynamically change the font size in entire Flutter Application.
17 |
18 | - **Custom Themeing:** Explore the code for how to dynamically apply custom multithemeing in flutter application.
19 |
20 | ## Installation
21 |
22 | To use the widgets and extensions from this repository in your Flutter project, follow these steps:
23 |
24 | 1. Clone the repository to your local machine:
25 | ```
26 | git clone https://github.com/vaidehi2701/widget_utils_2023.git
27 | ```
28 |
29 | 2. Import the desired widgets or extensions into your Flutter project by referencing the appropriate files.
30 |
31 | ## Contributions
32 |
33 | I welcome contributions from the Flutter community to make this All-in-One Widgets repository even more comprehensive and diverse. If you have any widgets, extensions, or improvements to share, feel free to open a pull request.
34 |
35 | Let's make Flutter development easier and more enjoyable together!
36 |
37 | Happy Fluttering! 💙💙💙
38 |
39 | ### ⚡ Social Media
40 |
41 | [
](https://www.youtube.com/DevDiariesWithVee?sub_confirmation=1) YouTube: [@DevDiariesWithVee](https://www.youtube.com/DevDiariesWithVee?sub_confirmation=1 "YouTube DevDiariesWithVee")
42 |
43 | [
](https://instagram.com/devdiaries_with_vee) Instagram: [@DevDiariesWithVee](https://instagram.com/devdiaries_with_vee "Instagram DevDiariesWithVee")
44 |
45 | [
](https://linkedin.com/in/vaidehi-shah-a2102217a) LinkedIn: [@Vaidehi Shah](https://linkedin.com/in/vaidehi-shah-a2102217a "LinkedIn Vaidehi Shah")
46 |
47 |
48 |
49 |
50 |
51 | ## Demo!!!
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | namespace "com.example.widget_utils"
30 | compileSdkVersion flutter.compileSdkVersion
31 | ndkVersion flutter.ndkVersion
32 |
33 | compileOptions {
34 | sourceCompatibility JavaVersion.VERSION_1_8
35 | targetCompatibility JavaVersion.VERSION_1_8
36 | }
37 |
38 | kotlinOptions {
39 | jvmTarget = '1.8'
40 | }
41 |
42 | sourceSets {
43 | main.java.srcDirs += 'src/main/kotlin'
44 | }
45 |
46 | defaultConfig {
47 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
48 | applicationId "com.example.widget_utils"
49 | // You can update the following values to match your application needs.
50 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
51 | minSdkVersion flutter.minSdkVersion
52 | targetSdkVersion flutter.targetSdkVersion
53 | versionCode flutterVersionCode.toInteger()
54 | versionName flutterVersionName
55 | }
56 |
57 | buildTypes {
58 | release {
59 | // TODO: Add your own signing config for the release build.
60 | // Signing with the debug keys for now, so `flutter run --release` works.
61 | signingConfig signingConfigs.debug
62 | }
63 | }
64 | }
65 |
66 | flutter {
67 | source '../..'
68 | }
69 |
70 | dependencies {
71 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
72 | }
73 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
14 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
29 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/widget_utils/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.widget_utils
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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 | buildscript {
2 | ext.kotlin_version = '1.7.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.3.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | tasks.register("clean", Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | 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-7.5-all.zip
6 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/assets/audio/Chogada.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/audio/Chogada.mp3
--------------------------------------------------------------------------------
/assets/fonts/BeautifulLovina-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/fonts/BeautifulLovina-Regular.ttf
--------------------------------------------------------------------------------
/assets/fonts/Campton_Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/fonts/Campton_Light.ttf
--------------------------------------------------------------------------------
/assets/fonts/CoralPen.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/fonts/CoralPen.ttf
--------------------------------------------------------------------------------
/assets/gif/krishna.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/gif/krishna.gif
--------------------------------------------------------------------------------
/assets/icons/insta.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/icons/insta.gif
--------------------------------------------------------------------------------
/assets/icons/linkedin.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/icons/linkedin.gif
--------------------------------------------------------------------------------
/assets/icons/services.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/icons/services.gif
--------------------------------------------------------------------------------
/assets/images/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/1.jpg
--------------------------------------------------------------------------------
/assets/images/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/2.jpg
--------------------------------------------------------------------------------
/assets/images/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/3.jpg
--------------------------------------------------------------------------------
/assets/images/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/4.jpg
--------------------------------------------------------------------------------
/assets/images/5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/5.jpg
--------------------------------------------------------------------------------
/assets/images/burger.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/burger.png
--------------------------------------------------------------------------------
/assets/images/chandler/c1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/chandler/c1.jpg
--------------------------------------------------------------------------------
/assets/images/chandler/c2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/chandler/c2.jpg
--------------------------------------------------------------------------------
/assets/images/chandler/c3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/chandler/c3.jpg
--------------------------------------------------------------------------------
/assets/images/chandler/c4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/chandler/c4.jpg
--------------------------------------------------------------------------------
/assets/images/chandler/c5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/chandler/c5.jpg
--------------------------------------------------------------------------------
/assets/images/chandler/c6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/chandler/c6.jpg
--------------------------------------------------------------------------------
/assets/images/chandler/c7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/chandler/c7.jpg
--------------------------------------------------------------------------------
/assets/images/chandler/c8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/chandler/c8.jpg
--------------------------------------------------------------------------------
/assets/images/chandler/c9.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/chandler/c9.jpeg
--------------------------------------------------------------------------------
/assets/images/darshan_raval.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/darshan_raval.jpg
--------------------------------------------------------------------------------
/assets/images/darshan_raval_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/darshan_raval_3.png
--------------------------------------------------------------------------------
/assets/images/darshan_raval_first_song.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/darshan_raval_first_song.jpg
--------------------------------------------------------------------------------
/assets/images/inner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/inner.png
--------------------------------------------------------------------------------
/assets/images/outer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/outer.png
--------------------------------------------------------------------------------
/assets/images/parallerX/p1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/parallerX/p1.jpg
--------------------------------------------------------------------------------
/assets/images/parallerX/p2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/parallerX/p2.jpg
--------------------------------------------------------------------------------
/assets/images/parallerX/p3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/parallerX/p3.jpg
--------------------------------------------------------------------------------
/assets/images/parallerX/p4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/parallerX/p4.jpg
--------------------------------------------------------------------------------
/assets/images/parallerX/p5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/parallerX/p5.jpg
--------------------------------------------------------------------------------
/assets/images/parallerX/p6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/parallerX/p6.jpg
--------------------------------------------------------------------------------
/assets/images/parallerX/p7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/assets/images/parallerX/p7.jpg
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 11.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "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 UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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 | Widget Utils
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | widget_utils
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | UIViewControllerBasedStatusBarAppearance
45 |
46 | CADisableMinimumFrameDurationOnPhone
47 |
48 | UIApplicationSupportsIndirectInputEvents
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/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/extensions/date_time_utils.dart:
--------------------------------------------------------------------------------
1 | import 'package:intl/intl.dart';
2 |
3 | extension DateTimeExtensions on DateTime {
4 | String format(String pattern) {
5 | return DateFormat(pattern).format(this);
6 | }
7 |
8 | String newFormat() {
9 | final day = this.day;
10 | final month = DateFormat('MMMM').format(this);
11 | final year = this.year;
12 |
13 | String suffix;
14 | if (day >= 11 && day <= 13) {
15 | suffix = 'th';
16 | } else {
17 | switch (day % 10) {
18 | case 1:
19 | suffix = 'st';
20 | break;
21 | case 2:
22 | suffix = 'nd';
23 | break;
24 | case 3:
25 | suffix = 'rd';
26 | break;
27 | default:
28 | suffix = 'th';
29 | }
30 | }
31 |
32 | return '$day$suffix $month $year';
33 | }
34 |
35 | bool isSameDay(DateTime other) {
36 | return year == other.year && month == other.month && day == other.day;
37 | }
38 |
39 | bool isToday() {
40 | final now = DateTime.now();
41 | return isSameDay(now);
42 | }
43 |
44 | bool isTomorrow() {
45 | final tomorrow = DateTime.now().add(const Duration(days: 1));
46 | return isSameDay(tomorrow);
47 | }
48 |
49 | bool isYesterday() {
50 | final yesterday = DateTime.now().subtract(const Duration(days: 1));
51 | return isSameDay(yesterday);
52 | }
53 |
54 | bool isFuture() {
55 | return isAfter(DateTime.now());
56 | }
57 |
58 | bool isPast() {
59 | return isBefore(DateTime.now());
60 | }
61 |
62 | int calculateAge() {
63 | final now = DateTime.now();
64 | int age = now.year - year;
65 | if (now.month < month || (now.month == month && now.day < day)) {
66 | age--;
67 | }
68 | return age;
69 | }
70 |
71 | String getWeekdayName() {
72 | return DateFormat('EEEE').format(this);
73 | }
74 |
75 | bool isWeekend() {
76 | return weekday == DateTime.saturday || weekday == DateTime.sunday;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/lib/extensions/int_utils.dart:
--------------------------------------------------------------------------------
1 | import 'package:intl/intl.dart';
2 |
3 | extension IntExtension on int {
4 | bool isEven() {
5 | return this % 2 == 0;
6 | }
7 |
8 | bool isOdd() {
9 | return this % 2 != 0;
10 | }
11 |
12 | bool isNegative() {
13 | return this < 0;
14 | }
15 |
16 | bool isPositive() {
17 | return this > 0;
18 | }
19 |
20 | double toDouble() {
21 | return this.toDouble();
22 | }
23 |
24 | List digits() {
25 | return toString().split('').map((char) => int.parse(char)).toList();
26 | }
27 |
28 | times(Function(int index) action) {
29 | for (int i = 0; i < this; i++) {
30 | action(i);
31 | }
32 | }
33 |
34 | String toOrdinalString() {
35 | if (this % 100 >= 11 && this % 100 <= 13) {
36 | return '${this}th';
37 | }
38 | switch (this % 10) {
39 | case 1:
40 | return '${this}st';
41 | case 2:
42 | return '${this}nd';
43 | case 3:
44 | return '${this}rd';
45 | default:
46 | return '${this}th';
47 | }
48 | }
49 |
50 | String toCurrencyString(int decimalPlaces) {
51 | final formatter = NumberFormat.currency(
52 | decimalDigits: decimalPlaces,
53 | symbol: '\$',
54 | );
55 | return formatter.format(this / 100);
56 | }
57 |
58 | bool isInRange(int start, int end) {
59 | return this >= start && this <= end;
60 | }
61 |
62 | String toHexString() {
63 | return toRadixString(16);
64 | }
65 |
66 | String toBinaryString() {
67 | return toRadixString(2);
68 | }
69 |
70 | String toCurrencySymbol(String currencyCode) {
71 | return NumberFormat.simpleCurrency(
72 | locale: 'en_US',
73 | name: currencyCode,
74 | ).currencySymbol;
75 | }
76 |
77 | String toFormattedString() {
78 | final formatter = NumberFormat('#,###');
79 | return formatter.format(this);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/lib/extensions/string_utils.dart:
--------------------------------------------------------------------------------
1 | extension StringExtension on String {
2 | String capitalizeFirstLetter() {
3 | return "${this[0].toUpperCase()}${substring(1)}";
4 | }
5 |
6 | String toCamelCase() {
7 | return split(' ').map((word) => word.capitalizeFirstLetter()).join('');
8 | }
9 |
10 | String capitalizeAll() {
11 | return toUpperCase();
12 | }
13 |
14 | bool containsIgnoreCase(String other) {
15 | return toLowerCase().contains(other.toLowerCase());
16 | }
17 |
18 | String removeWhitespace() {
19 | return replaceAll(RegExp(r'\s+'), '');
20 | }
21 |
22 | bool isNumeric() {
23 | return double.tryParse(this) != null;
24 | }
25 |
26 | String limit(int maxLength) {
27 | if (length <= maxLength) {
28 | return this;
29 | } else {
30 | return '${substring(0, maxLength)}...';
31 | }
32 | }
33 |
34 | bool startsWithIgnoreCase(String other) {
35 | return toLowerCase().startsWith(other.toLowerCase());
36 | }
37 |
38 | bool endsWithIgnoreCase(String other) {
39 | return toLowerCase().endsWith(other.toLowerCase());
40 | }
41 |
42 | String replaceAllIgnoreCase(String from, String to) {
43 | final regex = RegExp(from, caseSensitive: false);
44 | return replaceAll(regex, to);
45 | }
46 |
47 | bool isEmail() {
48 | final emailRegex = RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
49 | return emailRegex.hasMatch(this);
50 | }
51 |
52 | bool isUrl() {
53 | final urlRegex = RegExp(
54 | r'^(https?:\/\/)?([a-z0-9-]+\.)+[a-z]{2,}(\/[a-z0-9\-._~:/?#[\]@!$&\()*+,;=]*)?$',
55 | caseSensitive: false);
56 | return urlRegex.hasMatch(this);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:provider/provider.dart';
3 | import 'package:widget_utils/provider/font_size_provider.dart';
4 | import 'package:widget_utils/provider/password_provider.dart';
5 | import 'package:widget_utils/provider/theme_provider.dart';
6 | import 'package:widget_utils/ui/screens/polariod_photo.dart';
7 |
8 | void main() {
9 | runApp(
10 | MultiProvider(
11 | providers: [
12 | ChangeNotifierProvider(create: (_) => ThemeProvider()),
13 | ChangeNotifierProvider(create: (_) => FontType()),
14 | ChangeNotifierProvider(create: (_) => PasswordStrengthProvider()),
15 | ],
16 | child: const MyApp(),
17 | ),
18 | );
19 | }
20 |
21 | class MyApp extends StatelessWidget {
22 | const MyApp({super.key});
23 |
24 | //devDiariesWithVee on Instagram
25 | //devDiariesWithVee on Youtube
26 | //vaidehi2701 on Github/Linkedin
27 |
28 | @override
29 | Widget build(BuildContext context) {
30 | return Consumer(
31 | builder: (BuildContext context, themeProvider, widget) {
32 | return MaterialApp(
33 | debugShowCheckedModeBanner: false,
34 | title: 'Flutter CheatSheet 2023',
35 | theme: themeProvider.themeData,
36 | home: const PolariodPhoto(),
37 | );
38 | });
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/lib/main2.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:animated_theme_switcher/animated_theme_switcher.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:flutter/scheduler.dart' show timeDilation;
6 | import 'package:widget_utils/provider/theme_config.dart';
7 |
8 |
9 |
10 | void main() => runApp(const MyApp());
11 |
12 | class MyApp extends StatelessWidget {
13 | const MyApp({Key? key}) : super(key: key);
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | final isPlatformDark =
18 | PlatformDispatcher.instance.platformBrightness == Brightness.dark;
19 | final initTheme = isPlatformDark ? darkTheme : lightTheme;
20 | return ThemeProvider(
21 | initTheme: initTheme,
22 | builder: (_, myTheme) {
23 | return MaterialApp(
24 | debugShowCheckedModeBanner: false,
25 | title: 'Flutter Demo',
26 | theme: myTheme,
27 | home: const MyHomePage(),
28 | );
29 | },
30 | );
31 | }
32 | }
33 |
34 | class MyHomePage extends StatefulWidget {
35 | const MyHomePage({Key? key}) : super(key: key);
36 |
37 | @override
38 | State createState() => _MyHomePageState();
39 | }
40 |
41 | class _MyHomePageState extends State {
42 | @override
43 | Widget build(BuildContext context) {
44 | return ThemeSwitchingArea(
45 | child: Scaffold(
46 | drawer: Drawer(
47 | child: SafeArea(
48 | child: Stack(
49 | children: [
50 | Align(
51 | alignment: Alignment.topRight,
52 | child: ThemeSwitcher.withTheme(
53 | builder: (_, switcher, theme) {
54 | return IconButton(
55 | onPressed: () => switcher.changeTheme(
56 | theme: theme.brightness == Brightness.light
57 | ? darkTheme
58 | : lightTheme,
59 | ),
60 | icon: const Icon(Icons.brightness_3, size: 25),
61 | );
62 | },
63 | ),
64 | ),
65 | ],
66 | ),
67 | ),
68 | ),
69 | appBar: AppBar(
70 | title: const Text(
71 | 'Animated Switch Theme',
72 | ),
73 | ),
74 | body: Center(
75 | child: Column(
76 | mainAxisAlignment: MainAxisAlignment.center,
77 | children: [
78 | const Text(
79 | 'DevDiariesWithVee',
80 | style: TextStyle(fontSize: 20),
81 | ),
82 | const SizedBox(
83 | height: 100,
84 | ),
85 | Column(
86 | mainAxisAlignment: MainAxisAlignment.center,
87 | children: [
88 | SizedBox(
89 | width: 250,
90 | child: CheckboxListTile(
91 | title: const Text('Slow Animation'),
92 | value: timeDilation == 5.0,
93 | onChanged: (value) {
94 | setState(() {
95 | timeDilation = value != null && value ? 5.0 : 1.0;
96 | });
97 | },
98 | ),
99 | ),
100 | const SizedBox(
101 | height: 20,
102 | ),
103 | ThemeSwitcher.switcher(
104 | clipper: const ThemeSwitcherBoxClipper(),
105 | builder: (context, switcher) {
106 | return OutlinedButton(
107 | child: const Text('Box Animation'),
108 | onPressed: () {
109 | switcher.changeTheme(
110 | theme: ThemeModelInheritedNotifier.of(context)
111 | .theme
112 | .brightness ==
113 | Brightness.light
114 | ? darkTheme
115 | : lightTheme,
116 | );
117 | },
118 | );
119 | },
120 | ),
121 | const SizedBox(
122 | height: 20,
123 | ),
124 | ThemeSwitcher(
125 | clipper: const ThemeSwitcherCircleClipper(),
126 | builder: (context) {
127 | return OutlinedButton(
128 | child: const Text('Circle Animation'),
129 | onPressed: () {
130 | ThemeSwitcher.of(context).changeTheme(
131 | theme: ThemeModelInheritedNotifier.of(context)
132 | .theme
133 | .brightness ==
134 | Brightness.light
135 | ? darkTheme
136 | : lightTheme,
137 | );
138 | },
139 | );
140 | },
141 | ),
142 | ],
143 | ),
144 | ],
145 | ),
146 | ),
147 | ),
148 | );
149 | }
150 | }
151 |
--------------------------------------------------------------------------------
/lib/provider/font_size_provider.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'package:flutter/material.dart';
3 |
4 | class FontType extends ChangeNotifier {
5 | FontTypeValue _value = FontTypeValue.medium;
6 |
7 | FontTypeValue get value => _value;
8 |
9 | set value(FontTypeValue newValue) {
10 | _value = newValue;
11 | notifyListeners();
12 | }
13 | }
14 |
15 | enum FontTypeValue { small, medium, large }
--------------------------------------------------------------------------------
/lib/provider/password_provider.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class PasswordStrengthProvider extends ChangeNotifier {
4 | String _password = '';
5 | double _strength = 0;
6 | String _displayText = 'Please enter a password';
7 |
8 | RegExp numReg = RegExp(r".*[0-9].*");
9 | RegExp letterReg = RegExp(r".*[A-Za-z].*");
10 |
11 | void checkPassword(String value) {
12 | _password = value.trim();
13 |
14 | if (_password.isEmpty) {
15 | _strength = 0;
16 | _displayText = 'Please enter you password ☹️';
17 | } else if (_password.length < 4) {
18 | _strength = 1 / 4;
19 | _displayText = 'Your password is too short ❌';
20 | } else if (_password.length < 6) {
21 | _strength = 2 / 4;
22 | _displayText = 'Your password is acceptable but not strong 😿';
23 | } else {
24 | if (!letterReg.hasMatch(_password) || !numReg.hasMatch(_password)) {
25 | _strength = 3 / 4;
26 | _displayText = 'Your password is strong ✅';
27 | } else {
28 | _strength = 1;
29 | _displayText = 'Your password is great 💯';
30 | }
31 | }
32 | notifyListeners();
33 | }
34 |
35 | get strength => _strength;
36 | get displayText => _displayText;
37 | }
38 |
--------------------------------------------------------------------------------
/lib/provider/theme_config.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | ThemeData lightTheme = ThemeData.light();
4 |
5 | ThemeData darkTheme = ThemeData.dark();
6 |
--------------------------------------------------------------------------------
/lib/provider/theme_provider.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:google_fonts/google_fonts.dart';
3 |
4 | class ThemeProvider with ChangeNotifier {
5 | ThemeData _themeData = ThemeDataCollection.baseTheme;
6 |
7 | ThemeData get themeData => _themeData;
8 |
9 | void changeTheme(Color baseColor) {
10 | _themeData = ThemeDataCollection.getThemeData(baseColor);
11 | notifyListeners();
12 | }
13 | }
14 |
15 | class ThemeDataCollection {
16 | static final baseTheme = _getThemeData(Colors.blue);
17 | static final orangeTheme = _getThemeData(Colors.orange);
18 | static final greenTheme = _getThemeData(Colors.green);
19 | static final redTheme = _getThemeData(Colors.red);
20 | static final brownTheme = _getThemeData(Colors.brown);
21 | static final purpleTheme = _getThemeData(Colors.purple);
22 |
23 | static ThemeData _getThemeData(MaterialColor color) {
24 | return ThemeData(
25 | useMaterial3: true,
26 | primarySwatch: color,
27 | fontFamily: GoogleFonts.poppins().fontFamily,
28 | );
29 | }
30 |
31 | static ThemeData getThemeData(Color baseColor) {
32 | switch (baseColor) {
33 | case Colors.orange:
34 | return orangeTheme;
35 | case Colors.green:
36 | return greenTheme;
37 | case Colors.red:
38 | return redTheme;
39 | case Colors.brown:
40 | return brownTheme;
41 | case Colors.purple:
42 | return purpleTheme;
43 | default:
44 | return baseTheme;
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/lib/ui/ext_demo/date_util_demo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:widget_utils/extensions/date_time_utils.dart';
3 |
4 | class DateUtilDemo extends StatefulWidget {
5 | const DateUtilDemo({super.key});
6 |
7 | @override
8 | State createState() => _DateUtilDemoState();
9 | }
10 |
11 | class _DateUtilDemoState extends State {
12 | final date = DateTime(1997, 7, 01);
13 | @override
14 | Widget build(BuildContext context) {
15 | return Scaffold(
16 | appBar: AppBar(
17 | title: const Text("Date Time Extension"),
18 | backgroundColor: Colors.purple[200],
19 | ),
20 | body: Center(
21 | child: Column(
22 | mainAxisAlignment: MainAxisAlignment.center,
23 | children: [
24 | Text("Date Format-----> ${date.format('yyyy-MM-dd')}"),
25 | Text("Different Format-----> ${date.newFormat()}"),
26 | Text(
27 | "Check same day or not?-----> ${date.isSameDay(DateTime(2023, 5, 28))}"),
28 | Text("Check today or not?-----> ${date.isToday()}"),
29 | Text("Check tomorrow or not?-----> ${date.isTomorrow()}"),
30 | Text("Check yesterday or not?-----> ${date.isYesterday()}"),
31 | Text("Check future or not?-----> ${date.isFuture()}"),
32 | Text("Check past or not?-----> ${date.isPast()}"),
33 | Text("Calculate age-----> ${date.calculateAge()}"),
34 | Text("Get weekday name-----> ${date.getWeekdayName()}"),
35 | Text(
36 | "Check its in this week or not-----> ${date.isWeekend().toString()}"), // Output: true
37 | ],
38 | ),
39 | ),
40 | );
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/lib/ui/ext_demo/int_util_demo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:google_fonts/google_fonts.dart';
3 | import 'package:widget_utils/extensions/int_utils.dart';
4 |
5 | class IntUtilDemo extends StatefulWidget {
6 | const IntUtilDemo({super.key});
7 |
8 | @override
9 | State createState() => _IntUtilDemoState();
10 | }
11 |
12 | class _IntUtilDemoState extends State {
13 | int number = 56743;
14 | int price = 300;
15 | int price2 = 2;
16 | int itemLength = 5;
17 |
18 | @override
19 | Widget build(BuildContext context) {
20 | String formattedString = number.toFormattedString();
21 | String ordinalString = price.toOrdinalString();
22 | String ordinalString2 = price2.toOrdinalString();
23 |
24 | var style = GoogleFonts.poppins(fontSize: 16);
25 | return Scaffold(
26 | appBar: AppBar(
27 | title: const Text("Int Extension"),
28 | backgroundColor: Colors.purple[200],
29 | ),
30 | body: Center(
31 | child: Column(
32 | mainAxisAlignment: MainAxisAlignment.center,
33 | children: [
34 | Text(
35 | "Check its even or not------${number.isEven}",
36 | style: style,
37 | ),
38 | Text(
39 | "Check its odd or not------${number.isOdd}",
40 | style: style,
41 | ),
42 | Text(
43 | "Add suffix after number------$ordinalString",
44 | style: style,
45 | ),
46 | Text(
47 | "Add suffix after number------$ordinalString2",
48 | style: style,
49 | ),
50 | Text(
51 | "Change to currenency------${price.toCurrencyString(2)}",
52 | style: style,
53 | ),
54 | Text(
55 | "Format the number------$formattedString",
56 | style: style,
57 | ),
58 | ],
59 | ),
60 | ),
61 | );
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/lib/ui/ext_demo/string_util_demo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:google_fonts/google_fonts.dart';
3 | import 'package:widget_utils/extensions/string_utils.dart';
4 |
5 | class StringUtilDemo extends StatefulWidget {
6 | const StringUtilDemo({super.key});
7 |
8 | @override
9 | State createState() => _StringUtilDemoState();
10 | }
11 |
12 | class _StringUtilDemoState extends State {
13 | String name = "devdiariesWithVee";
14 | String name2 = "Vee";
15 | String email = "vaidehi2701@gmail.com";
16 |
17 | @override
18 | Widget build(BuildContext context) {
19 | var style = GoogleFonts.poppins(fontSize: 16);
20 | return Scaffold(
21 | appBar: AppBar(
22 | title: const Text("String Extension"),
23 | backgroundColor: Colors.purple[200],
24 | ),
25 | body: Center(
26 | child: Column(
27 | mainAxisAlignment: MainAxisAlignment.center,
28 | children: [
29 | Text(
30 | name,
31 | style: style,
32 | ),
33 | Text(name.capitalizeFirstLetter(), style: style),
34 | Text(name.capitalizeAll(), style: style),
35 | Text(name.toCamelCase(), style: style),
36 | Text(name.removeWhitespace(), style: style),
37 | Text("IsNumeric-------${name.isNumeric()}", style: style),
38 | Text("limit upto 8 letter-------${name.limit(8)}", style: style),
39 | Text(
40 | "Check start with ignore case-----${name.startsWithIgnoreCase(name2)}",
41 | style: style),
42 | Text(
43 | "Check End with ignore case------${name.endsWithIgnoreCase(name2)}",
44 | style: style),
45 | Text("Check if its email id or not------${email.isEmail()}",
46 | style: style),
47 | ],
48 | ),
49 | ),
50 | );
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/lib/ui/extra/basic_stepper.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class BasicStepper extends StatefulWidget {
4 | const BasicStepper({super.key});
5 |
6 | @override
7 | // ignore: library_private_types_in_public_api
8 | _BasicStepperState createState() => _BasicStepperState();
9 | }
10 |
11 | class _BasicStepperState extends State {
12 | int _currentStep = 0;
13 | StepperType stepperType = StepperType.vertical;
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | return Scaffold(
18 | appBar: AppBar(
19 | title: const Text('Flutter Stepper Demo'),
20 | centerTitle: true,
21 | ),
22 | body: Column(
23 | children: [
24 | Expanded(
25 | child: Stepper(
26 | type: stepperType,
27 | physics: const ScrollPhysics(),
28 | currentStep: _currentStep,
29 | onStepTapped: (step) => tapped(step),
30 | onStepContinue: continued,
31 | onStepCancel: cancel,
32 | elevation: 0,
33 | steps: [
34 | Step(
35 | title: const Text('Name'),
36 | content: Column(
37 | children: [
38 | TextFormField(
39 | decoration: const InputDecoration(labelText: 'Name'),
40 | ),
41 | ],
42 | ),
43 | isActive: _currentStep >= 0,
44 | state: _currentStep >= 0
45 | ? StepState.complete
46 | : StepState.disabled,
47 | ),
48 | Step(
49 | title: const Text('Email'),
50 | content: Column(
51 | children: [
52 | TextFormField(
53 | decoration: const InputDecoration(labelText: 'Email'),
54 | ),
55 | ],
56 | ),
57 | isActive: _currentStep >= 0,
58 | state: _currentStep >= 1
59 | ? StepState.complete
60 | : StepState.disabled,
61 | ),
62 | Step(
63 | title: const Text('Number'),
64 | content: Column(
65 | children: [
66 | TextFormField(
67 | decoration: const InputDecoration(labelText: 'Number'),
68 | ),
69 | ],
70 | ),
71 | isActive: _currentStep >= 0,
72 | state: _currentStep >= 2
73 | ? StepState.complete
74 | : StepState.disabled,
75 | ),
76 | ],
77 | ),
78 | ),
79 | ],
80 | ),
81 | floatingActionButton: FloatingActionButton(
82 | onPressed: switchStepsType,
83 | child: const Icon(Icons.list),
84 | ),
85 | );
86 | }
87 |
88 | switchStepsType() {
89 | setState(() => stepperType == StepperType.vertical
90 | ? stepperType = StepperType.horizontal
91 | : stepperType = StepperType.vertical);
92 | }
93 |
94 | tapped(int step) {
95 | setState(() => _currentStep = step);
96 | }
97 |
98 | continued() {
99 | _currentStep < 2 ? setState(() => _currentStep += 1) : null;
100 | }
101 |
102 | cancel() {
103 | _currentStep > 0 ? setState(() => _currentStep -= 1) : null;
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/lib/ui/package/scratch_card_exp.dart:
--------------------------------------------------------------------------------
1 | import 'package:confetti/confetti.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:scratcher/widgets.dart';
4 |
5 | class ScratchCardExample extends StatefulWidget {
6 | const ScratchCardExample({super.key});
7 |
8 | @override
9 | // ignore: library_private_types_in_public_api
10 | _ScratchCardExampleState createState() => _ScratchCardExampleState();
11 | }
12 |
13 | class _ScratchCardExampleState extends State {
14 | ConfettiController _controller = ConfettiController();
15 |
16 | @override
17 | void initState() {
18 | super.initState();
19 | _controller = ConfettiController(
20 | duration: const Duration(seconds: 2),
21 | );
22 | }
23 |
24 | @override
25 | Widget build(BuildContext context) {
26 | return Scaffold(
27 | backgroundColor: Colors.blueGrey.withOpacity(0.5),
28 | body: Center(
29 | child: Scratcher(
30 | brushSize: 50,
31 | threshold: 75,
32 | color: Colors.transparent,
33 | image: Image.asset(
34 | "assets/images/outer.png",
35 | fit: BoxFit.fill,
36 | ),
37 | onThreshold: () => _controller.play(),
38 | child: Container(
39 | height: 300,
40 | width: 300,
41 | color: Colors.transparent,
42 | child: Column(
43 | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
44 | crossAxisAlignment: CrossAxisAlignment.center,
45 | children: [
46 | Column(
47 | children: [
48 | ConfettiWidget(
49 | blastDirectionality: BlastDirectionality.explosive,
50 | confettiController: _controller,
51 | particleDrag: 0.05,
52 | emissionFrequency: 0.05,
53 | numberOfParticles: 50,
54 | gravity: 0.05,
55 | shouldLoop: false,
56 | colors: const [
57 | Colors.green,
58 | Colors.red,
59 | Colors.yellow,
60 | Colors.blue,
61 | ],
62 | ),
63 | Image.asset(
64 | "assets/images/inner.png",
65 | fit: BoxFit.fill,
66 | width: 300,
67 | height: 300,
68 | ),
69 | ],
70 | ),
71 | ],
72 | ),
73 | ),
74 | ),
75 | ),
76 | );
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/lib/ui/package/showcase.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:showcaseview/showcaseview.dart';
3 |
4 | class ShowscaseDemo extends StatelessWidget {
5 | const ShowscaseDemo({Key? key}) : super(key: key);
6 |
7 | @override
8 | Widget build(BuildContext context) {
9 | return MaterialApp(
10 | title: 'Flutter ShowCase Demo',
11 | debugShowCheckedModeBanner: false,
12 | home: Scaffold(
13 | body: ShowCaseWidget(
14 | builder: Builder(builder: (context) => const ShowcaseDemo()),
15 | ),
16 | ),
17 | );
18 | }
19 | }
20 |
21 | class ShowcaseDemo extends StatefulWidget {
22 | const ShowcaseDemo({Key? key}) : super(key: key);
23 |
24 | @override
25 | // ignore: library_private_types_in_public_api
26 | _ShowcaseDemoState createState() => _ShowcaseDemoState();
27 | }
28 |
29 | class _ShowcaseDemoState extends State {
30 | final GlobalKey _scaffoldKey = GlobalKey();
31 | final GlobalKey first = GlobalKey();
32 | final GlobalKey second = GlobalKey();
33 | final GlobalKey third = GlobalKey();
34 | final GlobalKey fourth = GlobalKey();
35 | final GlobalKey fifth = GlobalKey();
36 | final GlobalKey six = GlobalKey();
37 | List chatUsers = [];
38 |
39 | @override
40 | void initState() {
41 | super.initState();
42 | loadData();
43 | WidgetsBinding.instance.addPostFrameCallback(
44 | (_) => ShowCaseWidget.of(context)
45 | .startShowCase([first, second, third, fourth, six,fifth]),
46 | );
47 | }
48 |
49 | @override
50 | Widget build(BuildContext context) {
51 | return Scaffold(
52 | key: _scaffoldKey,
53 | drawer: Drawer(
54 | child: ListView(
55 | padding: EdgeInsets.zero,
56 | children: [
57 | DrawerHeader(
58 | decoration: BoxDecoration(
59 | color: Colors.purple.withOpacity(0.6),
60 | ),
61 | child: const Text(
62 | 'Drawer Header',
63 | style: TextStyle(
64 | color: Colors.white,
65 | fontSize: 24,
66 | ),
67 | ),
68 | ),
69 | const ListTile(
70 | leading: Icon(Icons.account_circle),
71 | title: Text('Profile'),
72 | ),
73 | const ListTile(
74 | leading: Icon(Icons.settings),
75 | title: Text('Settings'),
76 | ),
77 | ],
78 | ),
79 | ),
80 | appBar: AppBar(
81 | backgroundColor: Colors.purple.withOpacity(0.6),
82 | leading: Showcase(
83 | key: first,
84 | description: 'Press here to open drawer',
85 | child: IconButton(
86 | onPressed: () {
87 | _scaffoldKey.currentState!.openDrawer();
88 | },
89 | icon: const Icon(Icons.menu),
90 | ),
91 | ),
92 | actions: [
93 | Showcase(
94 | key: third,
95 | description: 'Press to see notification',
96 | child: IconButton(
97 | onPressed: () {},
98 | icon: const Icon(Icons.notifications_active)))
99 | ],
100 | title: Showcase(
101 | key: second,
102 | description: 'This is a demo app title',
103 | child: const Text('DevDiariesWithVee')),
104 | centerTitle: true,
105 | automaticallyImplyLeading: false,
106 | ),
107 | body: ListView.builder(
108 | itemCount: chatUsers.length,
109 | shrinkWrap: true,
110 | padding: const EdgeInsets.only(top: 16),
111 | physics: const NeverScrollableScrollPhysics(),
112 | itemBuilder: (context, index) {
113 | return GestureDetector(
114 | onTap: () {},
115 | child: Container(
116 | padding: const EdgeInsets.only(
117 | left: 16, right: 16, top: 10, bottom: 10),
118 | child: Row(
119 | children: [
120 | Expanded(
121 | child: Row(
122 | children: [
123 | index == 0
124 | ? Showcase(
125 | key: fourth,
126 | description: 'This is sender\'s Profile',
127 | child: CircleAvatar(
128 | backgroundImage:
129 | AssetImage(chatUsers[index].imageURL),
130 | maxRadius: 30,
131 | ),
132 | )
133 | : CircleAvatar(
134 | backgroundImage:
135 | AssetImage(chatUsers[index].imageURL),
136 | maxRadius: 30,
137 | ),
138 | const SizedBox(
139 | width: 16,
140 | ),
141 | Expanded(
142 | child: Container(
143 | color: Colors.transparent,
144 | child: Column(
145 | crossAxisAlignment: CrossAxisAlignment.start,
146 | children: [
147 | Text(
148 | chatUsers[index].name,
149 | style: const TextStyle(fontSize: 16),
150 | ),
151 | const SizedBox(
152 | height: 6,
153 | ),
154 | index == 0
155 | ? Showcase(
156 | key: six,
157 | description:
158 | 'This is sender\'s Message',
159 | child: Text(
160 | chatUsers[index].messageText,
161 | style: TextStyle(
162 | fontSize: 13,
163 | color: Colors.grey.shade600,
164 | fontWeight: FontWeight.bold),
165 | ),
166 | )
167 | : Text(
168 | chatUsers[index].messageText,
169 | style: TextStyle(
170 | fontSize: 13,
171 | color: Colors.grey.shade600,
172 | fontWeight: FontWeight.bold),
173 | ),
174 | ],
175 | ),
176 | ),
177 | ),
178 | ],
179 | ),
180 | ),
181 | Text(
182 | chatUsers[index].time,
183 | style: const TextStyle(
184 | fontSize: 12, fontWeight: FontWeight.bold),
185 | ),
186 | ],
187 | ),
188 | ),
189 | );
190 | },
191 | ),
192 | floatingActionButton: Showcase(
193 | key: fifth,
194 | title: 'Add Image',
195 | description: 'Click here to add new Item',
196 | child: FloatingActionButton(
197 | onPressed: () {},
198 | backgroundColor: Colors.purple.withOpacity(0.6),
199 | child: const Icon(
200 | Icons.add,
201 | ),
202 | ),
203 | ),
204 | );
205 | }
206 |
207 | loadData() {
208 | chatUsers.add(ChatUsers(
209 | name: "Jane Russel",
210 | messageText: "Awesome Setup",
211 | imageURL: "assets/images/1.jpg",
212 | time: "Now"));
213 | chatUsers.add(
214 | ChatUsers(
215 | name: "Jorge Henry",
216 | messageText: "Hey where are you?",
217 | imageURL: "assets/images/2.jpg",
218 | time: "31 Mar"),
219 | );
220 | chatUsers.add(
221 | ChatUsers(
222 | name: "Philip Fox",
223 | messageText: "Busy! Call me in 20 mins",
224 | imageURL: "assets/images/3.jpg",
225 | time: "28 Mar"),
226 | );
227 | chatUsers.add(
228 | ChatUsers(
229 | name: "John Wick",
230 | messageText: "How are you?",
231 | imageURL: "assets/images/4.jpg",
232 | time: "18 Feb"),
233 | );
234 | }
235 | }
236 |
237 | class ChatUsers {
238 | String name;
239 | String messageText;
240 | String imageURL;
241 | String time;
242 | ChatUsers(
243 | {required this.name,
244 | required this.messageText,
245 | required this.imageURL,
246 | required this.time});
247 | }
248 |
--------------------------------------------------------------------------------
/lib/ui/screens/burger.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class ImageSizeAnimation extends StatefulWidget {
4 | const ImageSizeAnimation({super.key});
5 |
6 | @override
7 | _ImageSizeAnimationState createState() => _ImageSizeAnimationState();
8 | }
9 |
10 | class _ImageSizeAnimationState extends State
11 | with SingleTickerProviderStateMixin {
12 | double imageSize = 100.0;
13 | AnimationController? _controller;
14 | int selectedButtonIndex = 0;
15 | double buttonSize = 45;
16 | Color btnColor = Colors.white;
17 | String price = "15.20";
18 |
19 | @override
20 | void initState() {
21 | super.initState();
22 | _controller = AnimationController(
23 | duration: const Duration(milliseconds: 500),
24 | vsync: this,
25 | );
26 | }
27 |
28 | @override
29 | void dispose() {
30 | _controller!.dispose();
31 | super.dispose();
32 | }
33 |
34 | void animateToSize(double size) {
35 | _controller!.reset();
36 | _controller!.forward();
37 | setState(() {
38 | imageSize = size;
39 | });
40 | }
41 |
42 | @override
43 | Widget build(BuildContext context) {
44 | return Scaffold(
45 | backgroundColor: Colors.black,
46 | body: Padding(
47 | padding: const EdgeInsets.all(15.0),
48 | child: Column(
49 | crossAxisAlignment: CrossAxisAlignment.start,
50 | children: [
51 | const SizedBox(height: 20.0),
52 | const SetAppbar(),
53 | const SizedBox(
54 | height: 20,
55 | ),
56 | const Center(
57 | child: Text("Bacon Burger",
58 | style: TextStyle(
59 | color: Colors.white,
60 | fontSize: 26,
61 | fontWeight: FontWeight.bold)),
62 | ),
63 | const SizedBox(
64 | height: 45,
65 | ),
66 | const Center(
67 | child: Text(
68 | "A Signature flame-grill beaf patty\ntopped with smoked bacon.",
69 | textAlign: TextAlign.center,
70 | style: TextStyle(
71 | color: Colors.white,
72 | fontSize: 18,
73 | ),
74 | ),
75 | ),
76 | const SizedBox(
77 | height: 20,
78 | ),
79 | Stack(
80 | children: [
81 | SizedBox(
82 | height: 250,
83 | child: Center(
84 | child: AnimatedContainer(
85 | alignment: Alignment.center,
86 | decoration: const BoxDecoration(
87 | image: DecorationImage(
88 | image: AssetImage('assets/images/burger.png'),
89 | fit: BoxFit.cover,
90 | ),
91 | ),
92 | duration: const Duration(milliseconds: 500),
93 | width: imageSize,
94 | height: imageSize,
95 | ),
96 | ),
97 | ),
98 | ],
99 | ),
100 | const SizedBox(height: 16.0),
101 | Padding(
102 | padding: const EdgeInsets.symmetric(horizontal: 50),
103 | child: Row(
104 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
105 | children: [
106 | RoundedSquareButton(
107 | text: "S",
108 | size: selectedButtonIndex == 0 ? 55 : buttonSize,
109 | color: selectedButtonIndex == 0 ? Colors.yellow : btnColor,
110 | onPressed: () {
111 | animateToSize(100.0);
112 | selectedButtonIndex = 0;
113 | price = "15.20";
114 | setState(() {});
115 | },
116 | ),
117 | const SizedBox(width: 8.0),
118 | RoundedSquareButton(
119 | text: "M",
120 | size: selectedButtonIndex == 1 ? 55 : buttonSize,
121 | color:
122 | selectedButtonIndex == 1 ? Colors.yellow : btnColor,
123 | onPressed: () {
124 | animateToSize(150.0);
125 | selectedButtonIndex = 1;
126 | price = "25.30";
127 | setState(() {});
128 | }),
129 | const SizedBox(width: 8.0),
130 | RoundedSquareButton(
131 | text: "L",
132 | size: selectedButtonIndex == 2 ? 55 : buttonSize,
133 | color:
134 | selectedButtonIndex == 2 ? Colors.yellow : btnColor,
135 | onPressed: () {
136 | animateToSize(200.0);
137 | selectedButtonIndex = 2;
138 | price = "35.10";
139 | setState(() {});
140 | }),
141 | ],
142 | ),
143 | ),
144 | const SizedBox(height: 20.0),
145 | const Text("Price",
146 | style: TextStyle(
147 | color: Colors.white,
148 | fontSize: 18,
149 | )),
150 | Text(
151 | "\$$price",
152 | textAlign: TextAlign.center,
153 | style: const TextStyle(
154 | color: Colors.white,
155 | fontSize: 22,
156 | fontWeight: FontWeight.bold),
157 | ),
158 | const SizedBox(
159 | height: 45,
160 | ),
161 | Container(
162 | width: double.infinity,
163 | height: 50,
164 | decoration: const BoxDecoration(
165 | color: Colors.yellow,
166 | borderRadius: BorderRadius.all(
167 | Radius.circular(12),
168 | ),
169 | ),
170 | child: const Center(
171 | child: Text(
172 | "Buy now",
173 | style: TextStyle(
174 | fontSize: 18.0,
175 | fontWeight: FontWeight.bold,
176 | color: Colors.black,
177 | ),
178 | ),
179 | ),
180 | )
181 | ],
182 | ),
183 | ),
184 | );
185 | }
186 | }
187 |
188 | class RoundedSquareButton extends StatelessWidget {
189 | final String text;
190 | final double size;
191 | final VoidCallback onPressed;
192 | final Color color;
193 |
194 | const RoundedSquareButton(
195 | {super.key,
196 | required this.text,
197 | required this.onPressed,
198 | required this.size,
199 | required this.color});
200 |
201 | @override
202 | Widget build(BuildContext context) {
203 | return GestureDetector(
204 | onTap: onPressed,
205 | child: Container(
206 | width: size,
207 | height: size,
208 | decoration: BoxDecoration(
209 | borderRadius: BorderRadius.circular(13),
210 | color: color,
211 | boxShadow: [
212 | BoxShadow(
213 | color: color,
214 | blurRadius: 6,
215 | offset: const Offset(0, 2),
216 | ),
217 | ],
218 | ),
219 | child: Center(
220 | child: Text(
221 | text,
222 | style: const TextStyle(
223 | fontSize: 18,
224 | fontWeight: FontWeight.bold,
225 | color: Colors.black,
226 | ),
227 | ),
228 | ),
229 | ),
230 | );
231 | }
232 | }
233 |
234 | class SetAppbar extends StatelessWidget {
235 | const SetAppbar({super.key});
236 |
237 | @override
238 | Widget build(BuildContext context) {
239 | return Row(
240 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
241 | children: [
242 | Container(
243 | width: 40,
244 | height: 40,
245 | decoration: const BoxDecoration(
246 | color: Colors.white,
247 | borderRadius: BorderRadius.all(
248 | Radius.circular(12),
249 | ),
250 | ),
251 | child: const Center(
252 | child: Icon(
253 | Icons.arrow_back,
254 | color: Colors.black,
255 | size: 27.0,
256 | ),
257 | ),
258 | ),
259 | const Icon(
260 | Icons.more_vert_rounded,
261 | color: Colors.white,
262 | size: 35,
263 | ),
264 | ],
265 | );
266 | }
267 | }
268 |
--------------------------------------------------------------------------------
/lib/ui/screens/custom_app_theme.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:google_fonts/google_fonts.dart';
3 | import 'package:provider/provider.dart';
4 | import 'package:widget_utils/provider/theme_provider.dart';
5 |
6 | class CustomAppTheme extends StatelessWidget {
7 | const CustomAppTheme({super.key});
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return Scaffold(
12 | appBar: AppBar(
13 | title: const Text('Custom Themes'),
14 | ),
15 | body: SingleChildScrollView(
16 | child: Padding(
17 | padding: const EdgeInsets.all(15.0),
18 | child: Column(
19 | mainAxisAlignment: MainAxisAlignment.center,
20 | children: [
21 | TextFormField(
22 | initialValue: "DevDiariesWithVee",
23 | ),
24 | const SizedBox(
25 | height: 50,
26 | ),
27 | Row(
28 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
29 | children: [
30 | ElevatedButton(
31 | onPressed: () {},
32 | child: const Text(
33 | "Sample",
34 | )),
35 | Container(
36 | height: 60,
37 | width: 130,
38 | color: Theme.of(context).primaryColor,
39 | ),
40 | ],
41 | ),
42 | const SizedBox(
43 | height: 50,
44 | ),
45 | Text(
46 | "Select Your Custom App Theme Color",
47 | style: GoogleFonts.poppins(
48 | fontWeight: FontWeight.bold, fontSize: 16),
49 | ),
50 | const SizedBox(
51 | height: 20,
52 | ),
53 | const Row(
54 | children: [
55 | ColorButton(Colors.blue),
56 | ColorButton(Colors.orange),
57 | ColorButton(Colors.green),
58 | ],
59 | ),
60 | const Row(
61 | mainAxisAlignment: MainAxisAlignment.end,
62 | children: [
63 | ColorButton(Colors.red),
64 | ColorButton(Colors.brown),
65 | ColorButton(Colors.purple),
66 | ],
67 | )
68 | ],
69 | ),
70 | ),
71 | ),
72 | );
73 | }
74 | }
75 |
76 | class ColorButton extends StatelessWidget {
77 | final Color color;
78 |
79 | const ColorButton(this.color, {super.key});
80 |
81 | @override
82 | Widget build(BuildContext context) {
83 | return Padding(
84 | padding: const EdgeInsets.all(10.0),
85 | child: InkWell(
86 | onTap: () {
87 | Provider.of(context, listen: false).changeTheme(color);
88 | },
89 | child: Container(
90 | width: 70,
91 | height: 70,
92 | decoration: BoxDecoration(
93 | borderRadius: BorderRadius.circular(20),
94 | color: color,
95 | boxShadow: [
96 | BoxShadow(
97 | color: Colors.grey.withOpacity(0.4),
98 | spreadRadius: 2,
99 | blurRadius: 3,
100 | offset:
101 | const Offset(0, 3), // controls the position of the shadow
102 | ),
103 | ],
104 | ),
105 | ),
106 | ),
107 | );
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/lib/ui/screens/dynamic_fontsize.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:provider/provider.dart';
3 | import 'package:widget_utils/utils/font_size_helper.dart';
4 | import 'package:widget_utils/provider/font_size_provider.dart';
5 |
6 | //DynamicFontSize
7 | class DynamicFontSize extends StatefulWidget {
8 | const DynamicFontSize({super.key});
9 |
10 | @override
11 | State createState() => _DynamicFontSizeState();
12 | }
13 |
14 | class _DynamicFontSizeState extends State {
15 | @override
16 | Widget build(BuildContext context) {
17 | final fontType = Provider.of(context);
18 |
19 | return Scaffold(
20 | appBar: AppBar(
21 | title: const Text('Font Size Example'),
22 | ),
23 | floatingActionButton: FloatingActionButton(
24 | onPressed: () {
25 | _showFontSizeDialog(context, fontType);
26 | },
27 | child: const Icon(Icons.format_size),
28 | ),
29 | body: const Center(
30 | child: Column(
31 | mainAxisAlignment: MainAxisAlignment.center,
32 | children: [
33 | TextHandler(
34 | 'Follow Now! 🚀',
35 | TextStyle(
36 | fontSize: 14,
37 | )),
38 | SizedBox(height: 20),
39 | TextHandler('DevDiariesWithVee',
40 | TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
41 | ],
42 | ),
43 | ),
44 | );
45 | }
46 |
47 | void _showFontSizeDialog(BuildContext context, FontType fontType) {
48 | showDialog(
49 | context: context,
50 | builder: (BuildContext context) {
51 | return AlertDialog(
52 | title: const Text('Select Font Size'),
53 | content: Column(
54 | mainAxisSize: MainAxisSize.min,
55 | children: FontTypeValue.values.map((FontTypeValue value) {
56 | return RadioListTile(
57 | title: Text(value.toString().split('.').last),
58 | value: value,
59 | groupValue: fontType.value,
60 | onChanged: (FontTypeValue? newValue) {
61 | fontType.value = newValue!;
62 | Navigator.of(context).pop();
63 | },
64 | );
65 | }).toList(),
66 | ),
67 | actions: [
68 | ElevatedButton(
69 | onPressed: () {
70 | Navigator.of(context).pop();
71 | // Close the dialog
72 | },
73 | child: const Text('Close'),
74 | ),
75 | ],
76 | );
77 | },
78 | );
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/lib/ui/screens/feastival.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:confetti/confetti.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:lottie/lottie.dart';
6 |
7 |
8 |
9 | class Festival extends StatefulWidget {
10 | const Festival({super.key});
11 |
12 | @override
13 | _FestivalState createState() => _FestivalState();
14 | }
15 |
16 | class _FestivalState extends State {
17 | late ConfettiController _controllerCenter;
18 |
19 | @override
20 | void initState() {
21 | super.initState();
22 | _controllerCenter =
23 | ConfettiController(duration: const Duration(seconds: 10));
24 | _controllerCenter.play();
25 | }
26 |
27 | @override
28 | void dispose() {
29 | _controllerCenter.dispose();
30 |
31 | super.dispose();
32 | }
33 |
34 | /// A custom Path to paint stars.
35 | Path drawFlower(Size size) {
36 | double degreeToRadian(double degree) {
37 | return degree * (pi / 180);
38 | }
39 |
40 | final center = Offset(size.width / 2, size.height / 2);
41 | final petalRadius = size.width / 4;
42 | final petalLength = petalRadius * 2;
43 | final petalWidth = petalRadius / 2;
44 | final path = Path();
45 |
46 | const petalCount = 6;
47 | const petalAngle = 360 / petalCount;
48 |
49 | for (var i = 0; i < petalCount; i++) {
50 | final angle = degreeToRadian(petalAngle * i);
51 | final xPoint = center.dx + cos(angle) * petalLength;
52 | final yPoint = center.dy + sin(angle) * petalLength;
53 | final controlX1 = center.dx + cos(angle + pi / 6) * petalWidth;
54 | final controlY1 = center.dy + sin(angle + pi / 6) * petalWidth;
55 | final controlX2 = center.dx + cos(angle - pi / 6) * petalWidth;
56 | final controlY2 = center.dy + sin(angle - pi / 6) * petalWidth;
57 |
58 | if (i == 0) {
59 | path.moveTo(center.dx, center.dy);
60 | } else {
61 | path.lineTo(xPoint, yPoint);
62 | }
63 |
64 | path.cubicTo(
65 | controlX1,
66 | controlY1,
67 | controlX2,
68 | controlY2,
69 | xPoint,
70 | yPoint,
71 | );
72 |
73 | path.quadraticBezierTo(
74 | center.dx + petalWidth / 2,
75 | center.dy + petalWidth / 2,
76 | center.dx,
77 | center.dy,
78 | );
79 | }
80 |
81 | path.close();
82 | return path;
83 | }
84 |
85 | @override
86 | Widget build(BuildContext context) {
87 | return SafeArea(
88 | child: Stack(
89 | children: [
90 | //CENTER -- Blast
91 | Align(
92 | alignment: Alignment.topCenter,
93 | child: ConfettiWidget(
94 | confettiController: _controllerCenter,
95 | blastDirectionality: BlastDirectionality
96 | .explosive, // don't specify a direction, blast randomly
97 | shouldLoop:
98 | true, // start again as soon as the animation is finished
99 | colors: const [
100 | Colors.yellow,
101 | Colors.yellowAccent,
102 | Colors.orangeAccent,
103 | Colors.deepOrange,
104 | ], // manually specify the colors to be used
105 | createParticlePath: drawFlower, // define a custom shape/path.
106 | ),
107 | ),
108 | Align(
109 | alignment: Alignment.center,
110 | child: Lottie.asset('assets/gif/ganesha.json')),
111 | ],
112 | ),
113 | );
114 | }
115 |
116 | Text _display(String text) {
117 | return Text(
118 | text,
119 | style: const TextStyle(color: Colors.white, fontSize: 20),
120 | );
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/lib/ui/screens/indian_flag_animation.dart:
--------------------------------------------------------------------------------
1 | import 'package:animated_text_kit/animated_text_kit.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:google_fonts/google_fonts.dart';
4 |
5 | class IndianFlag extends StatefulWidget {
6 | const IndianFlag({super.key});
7 |
8 | @override
9 | State createState() => _IndianFlagState();
10 | }
11 |
12 | class _IndianFlagState extends State {
13 | double turnValue = 0.0;
14 |
15 | @override
16 | void initState() {
17 | // TODO: implement initState
18 | super.initState();
19 | Future.delayed(const Duration(milliseconds: 500), () {
20 | turnValue = 20;
21 | setState(() {});
22 | });
23 | }
24 |
25 | @override
26 | Widget build(BuildContext context) {
27 | return Scaffold(
28 | backgroundColor: Colors.black,
29 | body: Column(
30 | mainAxisAlignment: MainAxisAlignment.center,
31 | children: [
32 | Container(
33 | height: 100,
34 | width: MediaQuery.of(context).size.width,
35 | color: Colors.orange,
36 | ),
37 | Container(
38 | height: 100,
39 | width: MediaQuery.of(context).size.width,
40 | color: Colors.white,
41 | child: Container(
42 | height: 100,
43 | width: 100,
44 | decoration: BoxDecoration(
45 | shape: BoxShape.circle,
46 | border: Border.all(color: Colors.blue, width: 4)),
47 | child: AnimatedRotation(
48 | turns: turnValue,
49 | duration: const Duration(seconds: 10),
50 | child: Stack(
51 | children: List.generate(13, (index) {
52 | return Center(
53 | child: Transform.rotate(
54 | angle: index * 0.26,
55 | child: Container(
56 | height: 4,
57 | width: 100,
58 | color: Colors.blue,
59 | ),
60 | ),
61 | );
62 | })),
63 | ),
64 | ),
65 | ),
66 | Container(
67 | height: 100,
68 | width: MediaQuery.of(context).size.width,
69 | color: Colors.green,
70 | ),
71 | const SizedBox(height: 100),
72 | AnimatedTextKit(
73 | animatedTexts: [
74 | TypewriterAnimatedText(
75 | 'Happy Independenc Day !!!',
76 | textStyle: GoogleFonts.poppins(
77 | fontSize: 22.0,
78 | fontWeight: FontWeight.bold,
79 | color: Colors.white),
80 | speed: const Duration(milliseconds: 100),
81 | ),
82 | ],
83 | )
84 | ],
85 | ),
86 | );
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/lib/ui/screens/lazy_loading_example.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: library_private_types_in_public_api
2 |
3 | import 'dart:convert';
4 |
5 | import 'package:flutter/material.dart';
6 | import 'package:http/http.dart' as http;
7 |
8 | class PaginationExample extends StatefulWidget {
9 | const PaginationExample({Key? key}) : super(key: key);
10 |
11 | @override
12 | _PaginationExampleState createState() => _PaginationExampleState();
13 | }
14 |
15 | class _PaginationExampleState extends State {
16 | // At the beginning, we fetch the first 10 posts only
17 | int _page = 0;
18 | final int _limit = 10;
19 |
20 | // There is next page or not
21 | bool _hasNextPage = true;
22 |
23 | // Used to display loading indicators when _firstLoad function is running
24 | bool _isFirstLoadRunning = false;
25 |
26 | // Used to display loading indicators when _loadMore function is running
27 | bool _isLoadMoreRunning = false;
28 |
29 | // This holds the posts fetched from the server
30 | List _posts = [];
31 |
32 | // We will fetch data from this Rest api
33 | final _baseUrl = 'https://jsonplaceholder.typicode.com/posts';
34 |
35 | // This function will be triggered whenver the user scroll
36 | // to near the bottom of the list view
37 | void _loadMore() async {
38 | if (_hasNextPage == true &&
39 | _isFirstLoadRunning == false &&
40 | _isLoadMoreRunning == false &&
41 | _controller.position.extentAfter < 300) {
42 | setState(() {
43 | _isLoadMoreRunning = true; // Display a progress indicator at the bottom
44 | });
45 | _page += 1; // Increase _page by 1
46 | try {
47 | final res =
48 | await http.get(Uri.parse("$_baseUrl?_page=$_page&_limit=$_limit"));
49 |
50 | final List fetchedPosts = json.decode(res.body);
51 | if (fetchedPosts.isNotEmpty) {
52 | setState(() {
53 | _posts.addAll(fetchedPosts);
54 | });
55 | } else {
56 | // This means there is no more data
57 | // and therefore, we will not send another GET request
58 | setState(() {
59 | _hasNextPage = false;
60 | });
61 | }
62 | } catch (err) {
63 | var snackBar =
64 | const SnackBar(content: Text('Oops!! Something went wrong!'));
65 | ScaffoldMessenger.of(context).showSnackBar(snackBar);
66 | }
67 |
68 | setState(() {
69 | _isLoadMoreRunning = false;
70 | });
71 | }
72 | }
73 |
74 | // The controller for the ListView
75 | late ScrollController _controller;
76 |
77 | @override
78 | void initState() {
79 | super.initState();
80 | _firstLoad();
81 | _controller = ScrollController()..addListener(_loadMore);
82 | }
83 |
84 | // This function will be called when the app launches (see the initState function)
85 | void _firstLoad() async {
86 | setState(() {
87 | _isFirstLoadRunning = true;
88 | });
89 | try {
90 | //Caling api to fetch the data
91 | final res =
92 | await http.get(Uri.parse("$_baseUrl?_page=$_page&_limit=$_limit"));
93 | setState(() {
94 | _posts = json.decode(res.body);
95 | });
96 | } catch (err) {
97 | var snackBar =
98 | const SnackBar(content: Text('Oops!! Something went wrong!'));
99 | ScaffoldMessenger.of(context).showSnackBar(snackBar);
100 | }
101 |
102 | setState(() {
103 | _isFirstLoadRunning = false;
104 | });
105 | }
106 |
107 | @override
108 | void dispose() {
109 | _controller.removeListener(_loadMore);
110 | super.dispose();
111 | }
112 |
113 | @override
114 | Widget build(BuildContext context) {
115 | return Scaffold(
116 | appBar: AppBar(
117 | title: const Text('DevDiariesWithVee'),
118 | ),
119 | body: _isFirstLoadRunning
120 | ? const Center(
121 | child: CircularProgressIndicator(),
122 | )
123 | : Column(
124 | children: [
125 | Expanded(
126 | child: ListView.builder(
127 | controller: _controller,
128 | itemCount: 1,
129 | itemBuilder: (_, index) => Card(
130 | margin: const EdgeInsets.symmetric(
131 | vertical: 8, horizontal: 10),
132 | child: ListTile(
133 | title: Text(_posts[index]['titl']),
134 | subtitle: Text(_posts[index]['body']),
135 | ),
136 | ),
137 | ),
138 | ),
139 |
140 | // when the _loadMore function is running
141 | if (_isLoadMoreRunning == true)
142 | const Padding(
143 | padding: EdgeInsets.only(top: 10, bottom: 40),
144 | child: Center(
145 | child: CircularProgressIndicator(),
146 | ),
147 | ),
148 |
149 | // When nothing else to load
150 | if (_hasNextPage == false)
151 | Container(
152 | padding: const EdgeInsets.only(top: 30, bottom: 40),
153 | color: Colors.amber,
154 | child: const Center(
155 | child: Text('You have fetched all of the content'),
156 | ),
157 | ),
158 | ],
159 | ),
160 | );
161 | }
162 | }
163 |
--------------------------------------------------------------------------------
/lib/ui/screens/music_list.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:widget_utils/ui/screens/music_player.dart';
3 |
4 | GlobalKey scaffoldState = GlobalKey();
5 |
6 | class MusicList extends StatefulWidget {
7 | const MusicList({super.key});
8 |
9 | @override
10 | // ignore: library_private_types_in_public_api
11 | _MusicListState createState() => _MusicListState();
12 | }
13 |
14 | class _MusicListState extends State {
15 | List? listSong = [];
16 |
17 | @override
18 | void initState() {
19 | loadSongs();
20 | super.initState();
21 | }
22 |
23 | @override
24 | Widget build(BuildContext context) {
25 | var mediaQuery = MediaQuery.of(context);
26 |
27 | return Scaffold(
28 | key: scaffoldState,
29 | body: Stack(
30 | children: [
31 | setAlbumCover(mediaQuery),
32 | setActionAppBar(mediaQuery),
33 | setName(mediaQuery),
34 | setFAB(mediaQuery),
35 | setSongList(mediaQuery),
36 | ],
37 | ),
38 | );
39 | }
40 |
41 | Widget setName(MediaQueryData mediaQuery) {
42 | return SizedBox(
43 | height: mediaQuery.size.height / 1.8,
44 | child: Padding(
45 | padding: const EdgeInsets.only(left: 20.0),
46 | child: LayoutBuilder(
47 | builder: (BuildContext context, BoxConstraints constraints) {
48 | return Stack(
49 | children: [
50 | Positioned(
51 | top: constraints.maxHeight - 100.0,
52 | child: const Text(
53 | "Raval",
54 | style: TextStyle(
55 | color: Colors.white,
56 | fontFamily: "CoralPen",
57 | fontSize: 72.0,
58 | ),
59 | ),
60 | ),
61 | Positioned(
62 | top: constraints.maxHeight - 140.0,
63 | child: const Text(
64 | "Darshan",
65 | style: TextStyle(
66 | color: Colors.white,
67 | fontFamily: "CoralPen",
68 | fontSize: 72.0,
69 | ),
70 | ),
71 | ),
72 | Positioned(
73 | top: constraints.maxHeight - 160.0,
74 | child: const Text(
75 | "Trending",
76 | style: TextStyle(
77 | color: Color(0xFFC82623),
78 | fontSize: 14.0,
79 | fontFamily: "Campton_Light",
80 | fontWeight: FontWeight.w800,
81 | ),
82 | ),
83 | ),
84 | ],
85 | );
86 | },
87 | ),
88 | ),
89 | );
90 | }
91 |
92 | Widget setSongList(MediaQueryData mediaQuery) {
93 | return Padding(
94 | padding: EdgeInsets.only(
95 | left: 20.0,
96 | top: mediaQuery.size.height / 1.8 + 48.0,
97 | right: 20.0,
98 | bottom: mediaQuery.padding.bottom + 16.0,
99 | ),
100 | child: Column(
101 | children: [
102 | _buildWidgetHeaderSong(),
103 | const SizedBox(height: 16.0),
104 | Expanded(
105 | child: ListView.separated(
106 | padding: EdgeInsets.zero,
107 | separatorBuilder: (BuildContext context, int index) {
108 | return const Opacity(
109 | opacity: 0.5,
110 | child: Padding(
111 | padding: EdgeInsets.only(top: 2.0),
112 | child: Divider(
113 | color: Colors.grey,
114 | ),
115 | ),
116 | );
117 | },
118 | itemCount: listSong!.length,
119 | itemBuilder: (BuildContext context, int index) {
120 | Song song = listSong![index];
121 | return GestureDetector(
122 | onTap: () {
123 | _navigatorToMusicPlayerScreen(song.title!);
124 | },
125 | child: Row(
126 | children: [
127 | Expanded(
128 | child: Text(
129 | song.title!,
130 | style: const TextStyle(
131 | fontWeight: FontWeight.w600,
132 | fontFamily: "Campton_Light",
133 | ),
134 | overflow: TextOverflow.ellipsis,
135 | ),
136 | ),
137 | Text(
138 | song.duration!,
139 | style: const TextStyle(
140 | color: Colors.grey,
141 | ),
142 | ),
143 | const SizedBox(width: 24.0),
144 | const Icon(
145 | Icons.more_horiz,
146 | color: Colors.grey,
147 | ),
148 | ],
149 | ),
150 | );
151 | },
152 | ),
153 | ),
154 | ],
155 | ),
156 | );
157 | }
158 |
159 | Widget _buildWidgetHeaderSong() {
160 | return const Row(
161 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
162 | children: [
163 | Text(
164 | "Popular",
165 | style: TextStyle(
166 | color: Colors.black,
167 | fontWeight: FontWeight.w600,
168 | fontSize: 24.0,
169 | fontFamily: "Campton_Light",
170 | ),
171 | ),
172 | Text(
173 | "Show all",
174 | style: TextStyle(
175 | color: Color(0xFFC82623),
176 | fontWeight: FontWeight.w600,
177 | fontFamily: "Campton_Light",
178 | ),
179 | ),
180 | ],
181 | );
182 | }
183 |
184 | Widget setFAB(MediaQueryData mediaQuery) {
185 | return Align(
186 | alignment: Alignment.topRight,
187 | child: Padding(
188 | padding: EdgeInsets.only(
189 | top: mediaQuery.size.height / 1.8 - 32.0,
190 | right: 32.0,
191 | ),
192 | child: FloatingActionButton(
193 | backgroundColor: const Color(0xFFC82623),
194 | onPressed: () {
195 | _navigatorToMusicPlayerScreen(listSong![0].title!);
196 | },
197 | child: const Icon(
198 | Icons.play_arrow,
199 | color: Colors.white,
200 | ),
201 | ),
202 | ),
203 | );
204 | }
205 |
206 | void _navigatorToMusicPlayerScreen(String title) {
207 | Navigator.of(context).push(MaterialPageRoute(builder: (context) {
208 | return MusicPlayerScreen(title);
209 | }));
210 | }
211 |
212 | Widget setActionAppBar(MediaQueryData mediaQuery) {
213 | return Padding(
214 | padding: EdgeInsets.only(
215 | left: 16.0,
216 | top: mediaQuery.padding.top + 16.0,
217 | right: 16.0,
218 | ),
219 | child: const Row(
220 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
221 | children: [
222 | Icon(
223 | Icons.menu,
224 | color: Colors.white,
225 | ),
226 | Icon(
227 | Icons.info_outline,
228 | color: Colors.white,
229 | ),
230 | ],
231 | ),
232 | );
233 | }
234 |
235 | Widget setAlbumCover(MediaQueryData mediaQuery) {
236 | return Container(
237 | width: double.infinity,
238 | height: mediaQuery.size.height / 1.8,
239 | decoration: const BoxDecoration(
240 | shape: BoxShape.rectangle,
241 | borderRadius: BorderRadius.only(
242 | bottomLeft: Radius.circular(48.0),
243 | ),
244 | image: DecorationImage(
245 | image: AssetImage("assets/images/darshan_raval_first_song.jpg"),
246 | fit: BoxFit.cover,
247 | ),
248 | ),
249 | );
250 | }
251 |
252 | void loadSongs() {
253 | listSong!.add(Song(title: "Teri Aankhon Mein", duration: "5:20"));
254 | listSong!.add(Song(title: "Chogada", duration: "3:20"));
255 | listSong!.add(Song(title: "Ek Tarfa", duration: "4:12"));
256 | listSong!.add(Song(title: "Jannat Ve", duration: "4:40"));
257 | listSong!.add(Song(title: "Muje Peene do", duration: "2:58"));
258 | listSong!.add(Song(title: "Rabba Mehr Kari", duration: "3:27"));
259 | listSong!.add(Song(title: "Tere Naal", duration: "3:10"));
260 | }
261 | }
262 |
263 | class Song {
264 | String? title;
265 | String? duration;
266 |
267 | Song({this.title, this.duration});
268 |
269 | @override
270 | String toString() {
271 | return 'Song{title: $title, duration: $duration}';
272 | }
273 | }
274 |
--------------------------------------------------------------------------------
/lib/ui/screens/password_validator.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:provider/provider.dart';
3 | import 'package:widget_utils/provider/password_provider.dart';
4 |
5 | class PwdValidationExample extends StatelessWidget {
6 | const PwdValidationExample({super.key});
7 |
8 | @override
9 | Widget build(BuildContext context) {
10 | var provider = context.watch();
11 | return Scaffold(
12 | appBar: AppBar(
13 | automaticallyImplyLeading: false,
14 | title: const Text('Password Validation'),
15 | ),
16 | body: Padding(
17 | padding: const EdgeInsets.all(30),
18 | child: Column(
19 | children: [
20 | const SizedBox(
21 | height: 30,
22 | ),
23 | TextField(
24 | onChanged: (value) => context
25 | .read()
26 | .checkPassword(value),
27 | obscureText: true,
28 | decoration: const InputDecoration(
29 | border: OutlineInputBorder(),
30 | hintText: 'Password',
31 | enabledBorder: OutlineInputBorder(
32 | borderRadius: BorderRadius.all(Radius.circular(12.0)),
33 | borderSide: BorderSide(color: Colors.teal),
34 | ),
35 | focusedBorder: OutlineInputBorder(
36 | borderRadius: BorderRadius.all(Radius.circular(12.0)),
37 | borderSide: BorderSide(color: Colors.teal),
38 | ),
39 | ),
40 | ),
41 | const SizedBox(
42 | height: 30,
43 | ),
44 | // The strength indicator bar
45 | LinearProgressIndicator(
46 | value: provider.strength,
47 | backgroundColor: Colors.grey[300],
48 | color: provider.strength <= 1 / 4
49 | ? Colors.red
50 | : provider.strength == 2 / 4
51 | ? Colors.yellow
52 | : provider.strength == 3 / 4
53 | ? Colors.blue
54 | : Colors.green,
55 | minHeight: 15,
56 | ),
57 | const SizedBox(
58 | height: 20,
59 | ),
60 |
61 | // The message about the strength of the entered password
62 | Text(
63 | provider.displayText,
64 | style: const TextStyle(fontSize: 18),
65 | ),
66 | const SizedBox(
67 | height: 50,
68 | ),
69 | // This button will be enabled if the password strength is medium or beyond
70 | ElevatedButton(
71 | style: ButtonStyle(
72 | backgroundColor: MaterialStateProperty.all(
73 | provider.strength < 1 / 2
74 | ? Colors.grey.shade300
75 | : Colors.tealAccent)),
76 | onPressed: provider.strength < 1 / 2 ? null : () {},
77 | child: const Text('Continue'),
78 | )
79 | ],
80 | ),
81 | ));
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/lib/ui/screens/polariod_photo.dart:
--------------------------------------------------------------------------------
1 | import 'package:animated_text_kit/animated_text_kit.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:google_fonts/google_fonts.dart';
4 | import 'package:polaroid_carousel/polaroid_carousel.dart';
5 |
6 | class PolariodPhoto extends StatelessWidget {
7 | const PolariodPhoto({Key? key}) : super(key: key);
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | List list = [
12 | Image.asset(
13 | "assets/images/chandler/c1.jpg",
14 | ),
15 | Image.asset("assets/images/chandler/c2.jpg"),
16 | Image.asset("assets/images/chandler/c3.jpg"),
17 | Image.asset(
18 | "assets/images/chandler/c4.jpg",
19 | height: 200,
20 | fit: BoxFit.cover,
21 | ),
22 | Image.asset("assets/images/chandler/c5.jpg"),
23 | Image.asset("assets/images/chandler/c6.jpg"),
24 | Image.asset("assets/images/chandler/c7.jpg"),
25 | Image.asset(
26 | "assets/images/chandler/c8.jpg",
27 | ),
28 | Image.asset(
29 | "assets/images/chandler/c9.jpeg",
30 | ),
31 | ];
32 |
33 | return Scaffold(
34 | backgroundColor: Colors.black54,
35 | body: Padding(
36 | padding: const EdgeInsets.all(15),
37 | child: Column(
38 | crossAxisAlignment: CrossAxisAlignment.center,
39 | mainAxisAlignment: MainAxisAlignment.center,
40 | children: [
41 | PolaroidCarousel(
42 | //these to property are necessary
43 |
44 | // value to which list item translate
45 | // advice : if the children are rotated like the example and you are not able to specify the translateFactor
46 | // then the max translateFactor should be √((childHeight^2, childWidth^2)) of child with maximum size
47 | //but try to adjust translateFactor according to your need
48 | translateFactor: 360,
49 |
50 | // these properties are optional
51 |
52 | // duration: const Duration(seconds: 1),
53 | rotate: const Rotate(x: 0.001, y: 0.02, z: 0.001),
54 | // curve: Curves.easeInOut,
55 | //order: Order.frontToBack,
56 |
57 | children: list,
58 | // translate: Translate.top,
59 | ),
60 | const SizedBox(
61 | height: 40,
62 | ),
63 | AnimatedTextKit(
64 | animatedTexts: [
65 | TypewriterAnimatedText(
66 | 'We Will Miss You Chandler Bing !!!',
67 | textAlign: TextAlign.center,
68 | textStyle: GoogleFonts.poppins(
69 | fontSize: 22.0,
70 | fontWeight: FontWeight.bold,
71 | color: Colors.white),
72 | speed: const Duration(milliseconds: 100),
73 | ),
74 | ],
75 | )
76 | ]),
77 | ));
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/lib/ui/widgets/buttons.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:widget_utils/utils/data.dart';
3 |
4 | class Buttons extends StatelessWidget {
5 | const Buttons({super.key});
6 |
7 | @override
8 | Widget build(BuildContext context) {
9 | return Scaffold(
10 | body: Center(
11 | child: Padding(
12 | padding: const EdgeInsets.all(15.0),
13 | child: Column(
14 | mainAxisAlignment: MainAxisAlignment.center,
15 | children: [
16 | Row(
17 | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
18 | children: [
19 | regularButton(),
20 | iconOnRight(),
21 | ],
22 | ),
23 | const SizedBox(
24 | height: 20,
25 | ),
26 | Row(
27 | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
28 | children: [
29 | outlinedButton(),
30 | textButton(),
31 | ],
32 | ),
33 | const SizedBox(
34 | height: 20,
35 | ),
36 | Row(
37 | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
38 | children: [imageButton(), onlyImage()],
39 | ),
40 | const SizedBox(
41 | height: 20,
42 | ),
43 | Row(
44 | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
45 | children: [backColor(), fabbutton()],
46 | ),
47 | const SizedBox(
48 | height: 20,
49 | ),
50 | Row(
51 | mainAxisAlignment: MainAxisAlignment.spaceEvenly,
52 | children: [
53 | gradientutton(),
54 | shadowbutton(),
55 | ],
56 | ),
57 | const SizedBox(
58 | height: 20,
59 | ),
60 | fullWidth()
61 | ],
62 | ),
63 | ),
64 | ),
65 | );
66 | }
67 | }
68 |
69 | Widget regularButton() {
70 | return ElevatedButton.icon(
71 | onPressed: () {},
72 | icon: const Icon(
73 | Icons.download,
74 | size: 24.0,
75 | ),
76 | label: const Text('Download'),
77 | );
78 | }
79 |
80 | Widget outlinedButton() {
81 | return OutlinedButton.icon(
82 | onPressed: () {},
83 | icon: const Icon(
84 | Icons.download,
85 | size: 24.0,
86 | ),
87 | label: const Text('Download'),
88 | );
89 | }
90 |
91 | Widget textButton() {
92 | return TextButton.icon(
93 | onPressed: () {},
94 | icon: const Icon(
95 | Icons.download,
96 | size: 24.0,
97 | ),
98 | label: const Text('Download'),
99 | );
100 | }
101 |
102 | Widget iconOnRight() {
103 | return ElevatedButton(
104 | onPressed: () {},
105 | child: const Row(
106 | mainAxisSize: MainAxisSize.min,
107 | children: [
108 | Text('Download'), // <-- Text
109 | SizedBox(
110 | width: 5,
111 | ),
112 | Icon(
113 | // <-- Icon
114 | Icons.download,
115 | size: 24.0,
116 | ),
117 | ],
118 | ),
119 | );
120 | }
121 |
122 | Widget imageButton() {
123 | return SizedBox.fromSize(
124 | size: const Size(60, 60),
125 | child: ClipOval(
126 | child: Material(
127 | color: Colors.purpleAccent[100],
128 | child: InkWell(
129 | splashColor: selectedColor,
130 | onTap: () {},
131 | child: const Column(
132 | mainAxisAlignment: MainAxisAlignment.center,
133 | children: [
134 | Icon(
135 | Icons.download,
136 | size: 25,
137 | ),
138 | Text("Tap"),
139 | ],
140 | ),
141 | ),
142 | ),
143 | ),
144 | );
145 | }
146 |
147 | Widget gradientutton() {
148 | return GestureDetector(
149 | child: Container(
150 | width: 160,
151 | decoration: BoxDecoration(
152 | gradient: const LinearGradient(
153 | colors: [Colors.purpleAccent, selectedColor],
154 | begin: Alignment.centerLeft,
155 | end: Alignment.centerRight,
156 | ),
157 | borderRadius: BorderRadius.circular(8),
158 | ),
159 | child: const Padding(
160 | padding: EdgeInsets.all(16.0),
161 | child: Center(
162 | child: Text(
163 | "Download",
164 | style: TextStyle(
165 | color: Colors.white,
166 | fontSize: 16,
167 | fontWeight: FontWeight.bold,
168 | ),
169 | ),
170 | ),
171 | ),
172 | ),
173 | );
174 | }
175 |
176 | Widget shadowbutton() {
177 | return ElevatedButton(
178 | onPressed: () {},
179 | style: ElevatedButton.styleFrom(
180 | elevation: 15, // Adjust the elevation value as per your preference
181 | shadowColor: Colors.black.withOpacity(0.8), // Set the shadow color
182 | shape: RoundedRectangleBorder(
183 | borderRadius: BorderRadius.circular(8),
184 | ),
185 | ),
186 | child: const Padding(
187 | padding: EdgeInsets.all(16.0),
188 | child: Text(
189 | "Download",
190 | style: TextStyle(
191 | fontSize: 16,
192 | fontWeight: FontWeight.bold,
193 | ),
194 | ),
195 | ),
196 | );
197 | }
198 |
199 | Widget fabbutton() {
200 | return FloatingActionButton.extended(
201 | onPressed: () {},
202 | icon: const Icon(Icons.download),
203 | label: const Text('Download'),
204 | );
205 | }
206 |
207 | Widget backColor() {
208 | return ElevatedButton.icon(
209 | onPressed: () {},
210 | style: ElevatedButton.styleFrom(
211 | shape: RoundedRectangleBorder(
212 | borderRadius: BorderRadius.circular(4.0),
213 | ),
214 | backgroundColor: selectedColor, // Set the background color
215 | ),
216 | icon:
217 | const Icon(Icons.download, color: Colors.white), // Set the button icon
218 | label: const Text(
219 | 'Download',
220 | style: TextStyle(color: Colors.white),
221 | ), // Set the button label
222 | );
223 | }
224 |
225 | Widget fullWidth() {
226 | return SizedBox(
227 | width: double.infinity,
228 | child: ElevatedButton(
229 | onPressed: () {
230 | // Add your button functionality here
231 | },
232 | child: const Text('Download'),
233 | ),
234 | );
235 | }
236 |
237 | Widget onlyImage() {
238 | return SizedBox.fromSize(
239 | size: const Size(60, 60),
240 | child: ClipOval(
241 | child: Material(
242 | color: Colors.purpleAccent[100],
243 | child: InkWell(
244 | splashColor: selectedColor,
245 | onTap: () {},
246 | child: const Icon(
247 | Icons.download,
248 | size: 35,
249 | ),
250 | ),
251 | ),
252 | ),
253 | );
254 | }
255 |
--------------------------------------------------------------------------------
/lib/ui/widgets/dropdown.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:google_fonts/google_fonts.dart';
3 | import 'package:widget_utils/utils/data.dart';
4 |
5 | class DropDownDemo extends StatefulWidget {
6 | const DropDownDemo({super.key});
7 |
8 | @override
9 | State createState() => _DropDownDemoState();
10 | }
11 |
12 | class _DropDownDemoState extends State {
13 | String _selectedOption = "Dog";
14 | String _selectedOption1 = "Option 1";
15 | String _selectedOption2 = "Flash";
16 | String _selectedFruit = "🍎 Apple";
17 | String? selectedModelId;
18 | String? categoryValue;
19 |
20 | @override
21 | Widget build(BuildContext context) {
22 | return Scaffold(
23 | appBar: AppBar(
24 | title: const Text("Dropdown"),
25 | ),
26 | body: Padding(
27 | padding: const EdgeInsets.all(25.0),
28 | child: Center(
29 | child: Column(
30 | mainAxisAlignment: MainAxisAlignment.center,
31 | children: [
32 | simple(),
33 | const SizedBox(
34 | height: 30,
35 | ),
36 | withIcon(),
37 | const SizedBox(
38 | height: 30,
39 | ),
40 | formField(),
41 | const SizedBox(
42 | height: 30,
43 | ),
44 | customDropDown(),
45 | const SizedBox(
46 | height: 30,
47 | ),
48 | modelDropDown(),
49 | const SizedBox(
50 | height: 30,
51 | ),
52 | uiDropDown()
53 | ],
54 | ),
55 | ),
56 | ),
57 | );
58 | }
59 |
60 | Widget simple() {
61 | return DropdownButton(
62 | value: _selectedOption,
63 | isExpanded: true,
64 | items: ['Dog', 'Cat', 'Lion', 'Tiger'].map((String value) {
65 | return DropdownMenuItem(
66 | value: value,
67 | child: Text(value),
68 | );
69 | }).toList(),
70 | onChanged: (String? newValue) {
71 | setState(() {
72 | _selectedOption = newValue!;
73 | });
74 | },
75 | );
76 | }
77 |
78 | Widget withIcon() {
79 | return DropdownButton(
80 | value: _selectedOption1,
81 | isExpanded: true,
82 | items: ['Option 1', 'Option 2', 'Option 3', 'Option 4']
83 | .map((String value) {
84 | return DropdownMenuItem(
85 | value: value,
86 | child: ListTile(
87 | leading: const Icon(Icons.label),
88 | title: Text(value),
89 | ),
90 | );
91 | }).toList(),
92 | onChanged: (String? newValue) {
93 | setState(() {
94 | _selectedOption1 = newValue!;
95 | });
96 | },
97 | );
98 | }
99 |
100 | Widget formField() {
101 | return DropdownButtonFormField(
102 | value: _selectedOption2,
103 | isExpanded: true,
104 | items:
105 | ['Flash', 'Arrow', 'Batman', 'Superman'].map((String value) {
106 | return DropdownMenuItem(
107 | value: value,
108 | child: Text(value),
109 | );
110 | }).toList(),
111 | onChanged: (String? newValue) {
112 | setState(() {
113 | _selectedOption2 = newValue!;
114 | });
115 | },
116 | decoration: const InputDecoration(
117 | labelText: 'Dropdown FormField',
118 | border: OutlineInputBorder(),
119 | ),
120 | );
121 | }
122 |
123 | Widget customDropDown() {
124 | return Container(
125 | padding: const EdgeInsets.all(8.0),
126 | decoration: BoxDecoration(
127 | color: Colors.red.withOpacity(0.2),
128 | // border: Border.all(color: Colors.grey),
129 | borderRadius: BorderRadius.circular(8.0)),
130 | child: DropdownButton(
131 | value: _selectedFruit,
132 | underline: Container(),
133 | iconEnabledColor: Colors.black,
134 | onChanged: (String? newValue) {
135 | setState(() {
136 | _selectedFruit = newValue!;
137 | });
138 | },
139 | hint: Text(
140 | "Select a fruit",
141 | style: GoogleFonts.poppins(color: Colors.white),
142 | ),
143 | items: fruits
144 | .map((fruit) =>
145 | DropdownMenuItem(value: fruit, child: Text(fruit)))
146 | .toList()));
147 | }
148 |
149 | Widget modelDropDown() {
150 | final selectedModel = selectedModelId == null
151 | ? null
152 | : models.firstWhere((model) => model.id == selectedModelId);
153 |
154 | return DropdownButton(
155 | value: selectedModel,
156 | items: models
157 | .map((model) => DropdownMenuItem(
158 | value: model,
159 | child: Text(model.name),
160 | ))
161 | .toList(),
162 | hint: const Text("Custom model Type"),
163 | onChanged: (Model? newValue) {
164 | setState(() {
165 | selectedModelId = newValue?.id;
166 | });
167 | },
168 | );
169 | }
170 |
171 | Widget uiDropDown() {
172 | return Container(
173 | padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 5),
174 | decoration: BoxDecoration(
175 | borderRadius: BorderRadius.circular(50).copyWith(
176 | bottomRight: const Radius.circular(0),
177 | topLeft: const Radius.circular(0)),
178 | color: Colors.red.shade200),
179 | child: DropdownButtonHideUnderline(
180 | child: DropdownButton(
181 | iconSize: 30,
182 | borderRadius: BorderRadius.circular(20)
183 | .copyWith(topLeft: const Radius.circular(0)),
184 | isExpanded: true,
185 | hint: Text('Custom UI ', style: GoogleFonts.poppins(fontSize: 15)),
186 | value: categoryValue,
187 | style: GoogleFonts.poppins(color: Colors.black),
188 | iconEnabledColor: Colors.black,
189 | items: [
190 | DropdownMenuItem(
191 | value: 'Anime',
192 | child: Text('Anime',
193 | style: GoogleFonts.poppins(
194 | fontSize: 15, color: Colors.black))),
195 | DropdownMenuItem(
196 | value: 'Tech',
197 | child: Text('Tech',
198 | style: GoogleFonts.poppins(
199 | fontSize: 15, color: Colors.black))),
200 | ],
201 | onChanged: (val) {
202 | setState(() {
203 | categoryValue = val.toString();
204 | });
205 | }),
206 | ),
207 | );
208 | }
209 | }
210 |
--------------------------------------------------------------------------------
/lib/ui/widgets/res_bottom.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:google_fonts/google_fonts.dart';
3 | import 'package:widget_utils/utils/data.dart';
4 |
5 | class ResponsiveBottom extends StatefulWidget {
6 | const ResponsiveBottom({super.key});
7 |
8 | @override
9 | State createState() => _ResponsiveBottomState();
10 | }
11 |
12 | class _ResponsiveBottomState extends State {
13 |
14 |
15 | int _selectedIndex = 0;
16 |
17 | @override
18 | Widget build(BuildContext context) {
19 | final width = MediaQuery.of(context).size.width;
20 | final bool isSmallScreen = width < 600;
21 | final bool isLargeScreen = width > 800;
22 |
23 | return Scaffold(
24 | bottomNavigationBar: isSmallScreen
25 | ? BottomNavigationBar(
26 | items: navBarItems,
27 | currentIndex: _selectedIndex,
28 | onTap: (int index) {
29 | setState(() {
30 | _selectedIndex = index;
31 | });
32 | })
33 | : null,
34 | body: Row(
35 | children: [
36 | if (!isSmallScreen)
37 | NavigationRail(
38 | selectedIndex: _selectedIndex,
39 | onDestinationSelected: (int index) {
40 | setState(() {
41 | _selectedIndex = index;
42 | });
43 | },
44 | extended: isLargeScreen,
45 | destinations: navBarItems
46 | .map((item) => NavigationRailDestination(
47 | icon: item.icon,
48 | selectedIcon: item.activeIcon,
49 | label: Text(item.label!,
50 | style: GoogleFonts.adamina(
51 | fontSize: 14,
52 | ))))
53 | .toList(),
54 | ),
55 | const VerticalDivider(thickness: 1, width: 1),
56 | // This is the main content.
57 | Expanded(
58 | child: Center(
59 | child: Text(
60 | "${navBarItems[_selectedIndex].label} Page",
61 | style: GoogleFonts.adamina(
62 | fontSize: 20, fontWeight: FontWeight.bold),
63 | ),
64 | ),
65 | )
66 | ],
67 | ),
68 | );
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/lib/ui/widgets/slides.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:flutter/cupertino.dart';
4 | import 'package:flutter/material.dart';
5 |
6 | class CustomSlidersPage extends StatelessWidget {
7 | const CustomSlidersPage({Key? key}) : super(key: key);
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return Scaffold(
12 | appBar: AppBar(title: const Text('Sliders')),
13 | body: Center(
14 | child: Container(
15 | constraints: const BoxConstraints(maxWidth: 400),
16 | padding: const EdgeInsets.all(8.0),
17 | child: SingleChildScrollView(
18 | child: Column(
19 | mainAxisAlignment: MainAxisAlignment.center,
20 | children: [
21 | _buildSlider("Default iOS Slider", const IosSlider()),
22 | _buildSlider(
23 | "Default Material Slider", const _SimpleSlider()),
24 | _buildSlider(
25 | "Custom Colors",
26 | const _SimpleSlider(
27 | thumbColor: Colors.redAccent,
28 | activeColor: Colors.deepPurpleAccent,
29 | inactiveColor: Colors.grey)),
30 | _buildSlider("Default Slider with divisions",
31 | const _SimpleSlider(divisions: 5)),
32 | _buildSlider(
33 | "Paddle Thumb Overlay",
34 | const CustomThumbShape(
35 | valueIndicatorShape:
36 | PaddleSliderValueIndicatorShape())),
37 | _buildSlider(
38 | "Rectangular Thumb Overlay",
39 | const CustomThumbShape(
40 | valueIndicatorShape:
41 | RectangularSliderValueIndicatorShape())),
42 | _buildSlider("Poligon Slider Thumb ", const PolygonSlider()),
43 | _buildSlider(
44 | "Range Slider",
45 | RangeSliderExample(
46 | activeColor: Colors.deepPurpleAccent,
47 | inactiveColor: Colors.purpleAccent,
48 | startValue: 20.0,
49 | endValue: 90.0,
50 | )),
51 | ]),
52 | ),
53 | ),
54 | ),
55 | );
56 | }
57 |
58 | Widget _buildSlider(String title, Widget child) {
59 | return SizedBox(
60 | width: double.infinity,
61 | child: Column(
62 | mainAxisAlignment: MainAxisAlignment.center,
63 | mainAxisSize: MainAxisSize.min,
64 | children: [Text(title), child, const Divider()]),
65 | );
66 | }
67 | }
68 |
69 | class _SimpleSlider extends StatefulWidget {
70 | final Color? thumbColor, activeColor, inactiveColor;
71 | final int? divisions;
72 |
73 | const _SimpleSlider(
74 | {Key? key,
75 | this.thumbColor,
76 | this.activeColor,
77 | this.inactiveColor,
78 | this.divisions})
79 | : super(key: key);
80 |
81 | @override
82 | __SimpleSliderState createState() => __SimpleSliderState();
83 | }
84 |
85 | class __SimpleSliderState extends State<_SimpleSlider> {
86 | double _currentSliderValue = 10;
87 |
88 | @override
89 | Widget build(BuildContext context) {
90 | return Slider(
91 | value: _currentSliderValue,
92 | min: 0,
93 | max: 100,
94 | label: _currentSliderValue.toInt().toString(),
95 | thumbColor: widget.thumbColor,
96 | activeColor: widget.activeColor,
97 | inactiveColor: widget.inactiveColor,
98 | divisions: widget.divisions,
99 | onChanged: (double value) {
100 | setState(() {
101 | _currentSliderValue = value;
102 | });
103 | },
104 | );
105 | }
106 | }
107 |
108 | class IosSlider extends StatefulWidget {
109 | const IosSlider({super.key});
110 |
111 | @override
112 | State createState() => _IosSliderState();
113 | }
114 |
115 | class _IosSliderState extends State {
116 | double _currentSliderValue = 20;
117 |
118 | @override
119 | Widget build(BuildContext context) {
120 | return CupertinoSlider(
121 | value: _currentSliderValue,
122 | min: 0,
123 | max: 100,
124 | onChanged: (double value) {
125 | setState(() {
126 | _currentSliderValue = value;
127 | });
128 | },
129 | );
130 | }
131 | }
132 |
133 | // ignore: must_be_immutable
134 | class RangeSliderExample extends StatefulWidget {
135 | final Color activeColor, inactiveColor;
136 | double startValue, endValue;
137 | RangeSliderExample(
138 | {super.key,
139 | required this.activeColor,
140 | required this.inactiveColor,
141 | required this.startValue,
142 | required this.endValue});
143 |
144 | @override
145 | State createState() => _RangeSliderExampleState();
146 | }
147 |
148 | class _RangeSliderExampleState extends State {
149 | @override
150 | Widget build(BuildContext context) {
151 | return RangeSlider(
152 | min: 0.0,
153 | max: 100.0,
154 | activeColor: widget.activeColor,
155 | inactiveColor: widget.inactiveColor,
156 | values: RangeValues(widget.startValue, widget.endValue),
157 | onChanged: (values) {
158 | setState(() {
159 | widget.startValue = values.start;
160 | widget.endValue = values.end;
161 | });
162 | },
163 | );
164 | }
165 | }
166 |
167 | class CustomThumbShape extends StatelessWidget {
168 | final SliderComponentShape valueIndicatorShape;
169 | const CustomThumbShape({Key? key, required this.valueIndicatorShape})
170 | : super(key: key);
171 |
172 | @override
173 | Widget build(BuildContext context) {
174 | return SliderTheme(
175 | data: SliderTheme.of(context)
176 | .copyWith(valueIndicatorShape: valueIndicatorShape),
177 | child: const _SimpleSlider(divisions: 100));
178 | }
179 | }
180 |
181 | class PolygonSlider extends StatefulWidget {
182 | const PolygonSlider({super.key});
183 |
184 | @override
185 | State createState() => _PolygonSliderState();
186 | }
187 |
188 | class _PolygonSliderState extends State {
189 | double _currentSliderValue = 10.0;
190 | @override
191 | Widget build(BuildContext context) {
192 | return SliderTheme(
193 | data: SliderTheme.of(context).copyWith(
194 | thumbShape: PolygonSliderThumb(),
195 | ),
196 | child: Slider(
197 | value: _currentSliderValue,
198 | min: 0,
199 | max: 100,
200 | onChanged: (newValue) {
201 | setState(() {
202 | _currentSliderValue = newValue;
203 | });
204 | },
205 | ),
206 | );
207 | }
208 | }
209 |
210 | class PolygonSliderThumb extends SliderComponentShape {
211 | @override
212 | Size getPreferredSize(bool isEnabled, bool isDiscrete) {
213 | // Define the preferred size of the thumb here
214 | return const Size(30, 30); // Customize the size as needed
215 | }
216 |
217 | @override
218 | void paint(
219 | PaintingContext context,
220 | Offset center, {
221 | required Animation activationAnimation,
222 | required Animation enableAnimation,
223 | required bool isDiscrete,
224 | required TextPainter labelPainter,
225 | required RenderBox parentBox,
226 | required SliderThemeData sliderTheme,
227 | required TextDirection textDirection,
228 | required double value,
229 | required double textScaleFactor,
230 | required Size sizeWithOverflow,
231 | }) {
232 | // Define the polygon shape for the slider thumb here
233 | final canvas = context.canvas;
234 | final thumbRadius = getPreferredSize(true, isDiscrete).width / 2;
235 |
236 | final path = Path();
237 | path.moveTo(
238 | center.dx + thumbRadius * cos(0), center.dy + thumbRadius * sin(0));
239 | for (int i = 1; i <= 6; i++) {
240 | final angle = i * 2 * pi / 6;
241 | final x = center.dx + thumbRadius * cos(angle);
242 | final y = center.dy + thumbRadius * sin(angle);
243 | path.lineTo(x, y);
244 | }
245 | path.close();
246 |
247 | final paint = Paint()
248 | ..color = Colors.redAccent
249 | ..style = PaintingStyle.fill;
250 |
251 | canvas.drawPath(path, paint);
252 | }
253 | }
254 |
--------------------------------------------------------------------------------
/lib/ui/widgets/stepper.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:google_fonts/google_fonts.dart';
3 | import 'package:widget_utils/ui/extra/advance_stepper.dart';
4 | import 'package:widget_utils/ui/extra/basic_stepper.dart';
5 |
6 | class StepperDemo extends StatefulWidget {
7 | const StepperDemo({super.key});
8 |
9 | @override
10 | State createState() => _StepperDemoState();
11 | }
12 |
13 | class _StepperDemoState extends State {
14 | @override
15 | Widget build(BuildContext context) {
16 | return Center(
17 | child: Column(
18 | mainAxisAlignment: MainAxisAlignment.center,
19 | children: [
20 | ElevatedButton(
21 | onPressed: () {
22 | Navigator.push(
23 | context,
24 | MaterialPageRoute(
25 | builder: (context) => const BasicStepper()));
26 | },
27 | child: Text(
28 | "Basic Stepper",
29 | style: GoogleFonts.poppins(fontSize: 18),
30 | )),
31 | const SizedBox(
32 | height: 20,
33 | ),
34 | ElevatedButton(
35 | onPressed: () {
36 | Navigator.push(
37 | context,
38 | MaterialPageRoute(
39 | builder: (context) => const AdvanceStepper()));
40 | },
41 | child: Text("Advance Stepper",
42 | style: GoogleFonts.poppins(fontSize: 18)))
43 | ],
44 | ),
45 | );
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/lib/ui/widgets/tab_bar.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:widget_utils/utils/data.dart';
3 |
4 | class TabBarDemo extends StatefulWidget {
5 | const TabBarDemo({super.key});
6 |
7 | @override
8 | State createState() => TabBarDemoState();
9 | }
10 |
11 | class TabBarDemoState extends State
12 | with SingleTickerProviderStateMixin {
13 | late TabController tabController;
14 |
15 | @override
16 | void initState() {
17 | tabController = TabController(length: 3, vsync: this);
18 | super.initState();
19 | }
20 |
21 | @override
22 | void dispose() {
23 | super.dispose();
24 | tabController.dispose();
25 | }
26 |
27 | @override
28 | Widget build(BuildContext context) {
29 | return Scaffold(
30 | body: Padding(
31 | padding: const EdgeInsets.all(8.0),
32 | child: ListView(
33 | children: [
34 | const SizedBox(
35 | height: 15,
36 | ),
37 | // 1.Default Tabbar with full width tabbar indicator
38 | TabBar(
39 | controller: tabController,
40 | tabs: tabs,
41 | labelColor: selectedColor,
42 | indicatorColor: selectedColor,
43 | unselectedLabelColor: unselectedColor,
44 | indicatorSize: TabBarIndicatorSize.tab,
45 | ),
46 |
47 | // 2.Default Tabbar with text and icon
48 | TabBar(
49 | controller: tabController,
50 | tabs: iconTextTabs,
51 | labelColor: selectedColor,
52 | indicatorColor: selectedColor,
53 | unselectedLabelColor: unselectedColor,
54 | indicatorSize: TabBarIndicatorSize.tab,
55 | dividerColor: Colors.transparent,
56 | ),
57 |
58 | // 3. Tabbar with text and images/gif
59 | Container(
60 | height: kToolbarHeight - 8.0,
61 | decoration: BoxDecoration(
62 | color: Colors.white,
63 | borderRadius: BorderRadius.circular(8.0),
64 | ),
65 | child: TabBar(
66 | controller: tabController,
67 | tabs: imageTabs,
68 | labelColor: selectedColor,
69 | indicatorColor: selectedColor,
70 | unselectedLabelColor: unselectedColor,
71 | indicatorSize: TabBarIndicatorSize.tab,
72 | dividerColor: Colors.transparent,
73 | ),
74 | ),
75 |
76 | // 4. Custom Material Design tabbar used in google's products
77 | TabBar(
78 | controller: tabController,
79 | labelColor: selectedColor,
80 | unselectedLabelColor: unselectedColor,
81 | indicatorSize: TabBarIndicatorSize.label,
82 | indicator: const MaterialDesignIndicator(
83 | indicatorHeight: 4, indicatorColor: selectedColor),
84 | tabs: tabs,
85 | ),
86 |
87 | // 5.Default Tabbar with indicator width of the label
88 | TabBar(
89 | controller: tabController,
90 | tabs: tabs,
91 | labelColor: selectedColor,
92 | indicatorColor: selectedColor,
93 | unselectedLabelColor: unselectedColor,
94 | indicatorSize: TabBarIndicatorSize.label,
95 | dividerColor: Colors.transparent,
96 | ),
97 |
98 | // 6.Custom Tabbar with solid selected bg and transparent tabbar bg
99 | Container(
100 | height: kToolbarHeight - 8.0,
101 | decoration: BoxDecoration(
102 | color: Colors.grey.shade200,
103 | borderRadius: BorderRadius.circular(8.0),
104 | ),
105 | child: TabBar(
106 | controller: tabController,
107 | indicator: BoxDecoration(
108 | borderRadius: BorderRadius.circular(8.0),
109 | color: selectedColor),
110 | labelColor: Colors.white,
111 | unselectedLabelColor: Colors.black,
112 | indicatorSize: TabBarIndicatorSize.tab,
113 | tabs: tabs,
114 | ),
115 | ),
116 |
117 | // 7.Custom Tabbar with solid selected bg and transparent tabbar bg
118 | Container(
119 | height: kToolbarHeight + 8.0,
120 | padding:
121 | const EdgeInsets.only(top: 16.0, right: 16.0, left: 16.0),
122 | decoration: const BoxDecoration(
123 | color: selectedColor,
124 | borderRadius: BorderRadius.only(
125 | topLeft: Radius.circular(8.0),
126 | topRight: Radius.circular(8.0)),
127 | ),
128 | child: TabBar(
129 | controller: tabController,
130 | indicator: const BoxDecoration(
131 | borderRadius: BorderRadius.only(
132 | topLeft: Radius.circular(8.0),
133 | topRight: Radius.circular(8.0)),
134 | color: Colors.white),
135 | labelColor: Colors.black,
136 | unselectedLabelColor: Colors.white,
137 | indicatorSize: TabBarIndicatorSize.tab,
138 | tabs: tabs,
139 | ),
140 | ),
141 |
142 | // 8.Custom Tabbar with transparent selected bg and solid selected icon
143 | TabBar(
144 | controller: tabController,
145 | tabs: iconTabs,
146 | indicatorSize: TabBarIndicatorSize.tab,
147 | unselectedLabelColor: Colors.black,
148 | labelColor: selectedColor,
149 | indicator: BoxDecoration(
150 | borderRadius: BorderRadius.circular(12.0),
151 | color: selectedColor.withOpacity(0.2),
152 | ),
153 | ),
154 |
155 | // 9.Custom Tabbar with transparent selected bg and solid selected text
156 | TabBar(
157 | controller: tabController,
158 | tabs: tabs,
159 | indicatorSize: TabBarIndicatorSize.tab,
160 | unselectedLabelColor: Colors.black,
161 | labelColor: selectedColor,
162 | dividerColor: Colors.transparent,
163 | indicator: BoxDecoration(
164 | borderRadius: BorderRadius.circular(40.0),
165 | color: selectedColor.withOpacity(0.2),
166 | ),
167 | ),
168 |
169 | // 10.Custom Tabbar with transparent selected bg and solid selected text
170 | TabBar(
171 | controller: tabController,
172 | tabs: tabs,
173 | indicatorSize: TabBarIndicatorSize.tab,
174 | unselectedLabelColor: Colors.black,
175 | labelColor: selectedColor,
176 | dividerColor: Colors.transparent,
177 | indicator: BoxDecoration(
178 | gradient: LinearGradient(colors: [
179 | Colors.lightBlue.withOpacity(0.6),
180 | Colors.greenAccent.withOpacity(0.6)
181 | ]),
182 | borderRadius: BorderRadius.circular(15),
183 | color: Colors.redAccent),
184 | ),
185 | ]
186 | .map((item) => Column(
187 | /// Added a divider after each item to let the tabbars have room to breathe
188 | children: [
189 | item,
190 | const Divider(
191 | color: Colors.transparent,
192 | )
193 | ],
194 | ))
195 | .toList(),
196 | ),
197 | ),
198 | );
199 | }
200 | }
201 |
202 | class MaterialDesignIndicator extends Decoration {
203 | final double indicatorHeight;
204 | final Color indicatorColor;
205 |
206 | const MaterialDesignIndicator({
207 | required this.indicatorHeight,
208 | required this.indicatorColor,
209 | });
210 |
211 | @override
212 | BoxPainter createBoxPainter([VoidCallback? onChanged]) {
213 | return MaterialDesignIndicatorPainter(
214 | indicatorHeight: indicatorHeight,
215 | indicatorColor: indicatorColor,
216 | );
217 | }
218 | }
219 |
220 | class MaterialDesignIndicatorPainter extends BoxPainter {
221 | final double indicatorHeight;
222 | final Color indicatorColor;
223 |
224 | MaterialDesignIndicatorPainter({
225 | required this.indicatorHeight,
226 | required this.indicatorColor,
227 | });
228 |
229 | @override
230 | void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) {
231 | final Rect rect = Offset(
232 | offset.dx,
233 | (configuration.size!.height - indicatorHeight) + offset.dy,
234 | ) &
235 | Size(configuration.size!.width, indicatorHeight);
236 | final Paint paint = Paint()..color = indicatorColor;
237 | canvas.drawRect(rect, paint);
238 | }
239 | }
240 |
--------------------------------------------------------------------------------
/lib/utils/data.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | const selectedColor = Color.fromARGB(255, 231, 63, 63);
4 | const unselectedColor = Color(0xff5f6368);
5 | final tabs = [
6 | const Tab(text: 'Home'),
7 | const Tab(text: 'Search'),
8 | const Tab(text: 'Settings'),
9 | ];
10 |
11 | final iconTabs = [
12 | const Tab(icon: Icon(Icons.home)),
13 | const Tab(icon: Icon(Icons.search)),
14 | const Tab(icon: Icon(Icons.settings)),
15 | ];
16 |
17 | final imageTabs = [
18 | Tab(
19 | icon: Padding(
20 | padding: const EdgeInsets.all(8.0),
21 | child: Image.asset("assets/icons/services.gif"),
22 | )),
23 | Tab(
24 | icon: Padding(
25 | padding: const EdgeInsets.all(8.0),
26 | child: Image.asset(
27 | "assets/icons/insta.gif",
28 | ),
29 | )),
30 | Tab(
31 | icon: Padding(
32 | padding: const EdgeInsets.all(8.0),
33 | child: Image.asset("assets/icons/linkedin.gif"),
34 | )),
35 |
36 | ];
37 |
38 | final secondTabs = [
39 | const Tab(text: 'Like'),
40 | const Tab(text: 'Follow'),
41 | const Tab(text: 'Share'),
42 | ];
43 |
44 | final iconTextTabs = [
45 | const Tab(icon: Icon(Icons.home), text: "Home"),
46 | const Tab(
47 | icon: Icon(Icons.search),
48 | text: "Search",
49 | ),
50 | const Tab(
51 | icon: Icon(Icons.settings),
52 | text: "Settings",
53 | ),
54 | ];
55 |
56 | final navBarItems = [
57 | const BottomNavigationBarItem(
58 | icon: Icon(Icons.home_outlined),
59 | activeIcon: Icon(Icons.home_rounded),
60 | label: 'Home',
61 | ),
62 | const BottomNavigationBarItem(
63 | icon: Icon(Icons.access_alarm_outlined),
64 | activeIcon: Icon(Icons.access_alarm_rounded),
65 | label: 'Search',
66 | ),
67 | const BottomNavigationBarItem(
68 | icon: Icon(Icons.person_outline_rounded),
69 | activeIcon: Icon(Icons.person_rounded),
70 | label: 'Profile',
71 | ),
72 | ];
73 |
74 | class Model {
75 | final String id;
76 | final String name;
77 |
78 | Model({required this.id, required this.name});
79 | }
80 |
81 |
82 | List models = [
83 | Model(id: '12', name: 'Vaidehi'),
84 | Model(id: '34', name: 'John'),
85 | Model(id: '56', name: 'Emily'),
86 | // Add more models as needed
87 | ];
88 |
89 | final List fruits = [
90 | '🍎 Apple',
91 | '🍋 Mango',
92 | '🍌 Banana',
93 | '🍉 Watermelon',
94 | '🍇 Grapes',
95 | '🍓 Strawberry',
96 | '🍒 Cherries',
97 | '🍑 Peach',
98 | ];
99 |
--------------------------------------------------------------------------------
/lib/utils/font_size_helper.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:provider/provider.dart';
3 | import 'package:widget_utils/provider/font_size_provider.dart';
4 |
5 | class TextHandler extends StatelessWidget {
6 | final String text;
7 | final TextStyle style;
8 |
9 | const TextHandler(this.text, this.style, {super.key});
10 |
11 | @override
12 | Widget build(BuildContext context) {
13 | final fontType = Provider.of(context);
14 |
15 | return Text(
16 | text,
17 | style: style.copyWith(fontSize: _getFontSize(fontType.value)),
18 | );
19 | }
20 |
21 | double _getFontSize(FontTypeValue value) {
22 | switch (value) {
23 | case FontTypeValue.small:
24 | return style.fontSize! - 5;
25 | case FontTypeValue.medium:
26 | return style.fontSize!;
27 | case FontTypeValue.large:
28 | return style.fontSize! + 5;
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: widget_utils
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 | version: 1.0.0+1
8 |
9 | environment:
10 | sdk: '>=3.0.3 <4.0.0'
11 |
12 | dependencies:
13 | flutter:
14 | sdk: flutter
15 |
16 |
17 | # The following adds the Cupertino Icons font to your application.
18 | # Use with the CupertinoIcons class for iOS style icons.
19 | cupertino_icons: ^1.0.2
20 | google_fonts: ^4.0.0
21 | intl:
22 | provider:
23 | easy_stepper: ^0.7.2
24 | animated_theme_switcher:
25 | http:
26 | scratcher: ^2.3.0
27 | confetti: ^0.7.0
28 | audioplayers: ^4.1.0
29 | animated_text_kit: ^4.2.2
30 | showcaseview: ^2.0.3
31 | lottie: ^2.6.0
32 | polaroid_carousel:
33 |
34 | #devDiariesWithVee on Instagram
35 | #devDiariesWithVee on Youtube
36 | #vaidehi2701 on Github/Linkedin
37 |
38 |
39 | dev_dependencies:
40 | flutter_test:
41 | sdk: flutter
42 |
43 |
44 | flutter_lints: ^2.0.0
45 |
46 | # For information on the generic Dart part of this file, see the
47 | # following page: https://dart.dev/tools/pub/pubspec
48 |
49 | # The following section is specific to Flutter packages.
50 | flutter:
51 |
52 | # The following line ensures that the Material Icons font is
53 | # included with your application, so that you can use the icons in
54 | # the material Icons class.
55 | uses-material-design: true
56 |
57 | # To add assets to your application, add an assets section, like this:
58 | assets:
59 | - assets/icons/
60 | - assets/images/
61 | - assets/images/parallerX/
62 | - assets/audio/
63 | - assets/gif/
64 | - assets/images/chandler/
65 | # - images/a_dot_ham.jpeg
66 |
67 | fonts:
68 | - family: Lovina
69 | fonts:
70 | - asset: assets/fonts/BeautifulLovina-Regular.ttf
71 | - family: CoralPen
72 | fonts:
73 | - asset: assets/fonts/CoralPen.ttf
74 | - family: Campton_Light
75 | fonts:
76 | - asset: assets/fonts/Campton_Light.ttf
77 |
--------------------------------------------------------------------------------
/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:widget_utils/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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/web/favicon.png
--------------------------------------------------------------------------------
/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/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 | widget_utils
33 |
34 |
35 |
39 |
40 |
41 |
42 |
43 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/web/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "widget_utils",
3 | "short_name": "widget_utils",
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(widget_utils 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 "widget_utils")
8 |
9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
10 | # versions of CMake.
11 | cmake_policy(SET CMP0063 NEW)
12 |
13 | # Define build configuration option.
14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
15 | if(IS_MULTICONFIG)
16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
17 | CACHE STRING "" FORCE)
18 | else()
19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
20 | set(CMAKE_BUILD_TYPE "Debug" CACHE
21 | STRING "Flutter build mode" FORCE)
22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
23 | "Debug" "Profile" "Release")
24 | endif()
25 | endif()
26 | # Define settings for the Profile build mode.
27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
31 |
32 | # Use Unicode for all projects.
33 | add_definitions(-DUNICODE -D_UNICODE)
34 |
35 | # Compilation settings that should be applied to most targets.
36 | #
37 | # Be cautious about adding new options here, as plugins use this function by
38 | # default. In most cases, you should add new options to specific targets instead
39 | # of modifying this function.
40 | function(APPLY_STANDARD_SETTINGS TARGET)
41 | target_compile_features(${TARGET} PUBLIC cxx_std_17)
42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
43 | target_compile_options(${TARGET} PRIVATE /EHsc)
44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")
46 | endfunction()
47 |
48 | # Flutter library and tool build rules.
49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
50 | add_subdirectory(${FLUTTER_MANAGED_DIR})
51 |
52 | # Application build; see runner/CMakeLists.txt.
53 | add_subdirectory("runner")
54 |
55 |
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 | # Fully re-copy the assets directory on each build to avoid having stale files
91 | # from a previous install.
92 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
93 | install(CODE "
94 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
95 | " COMPONENT Runtime)
96 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
97 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
98 |
99 | # Install the AOT library on non-Debug builds only.
100 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
101 | CONFIGURATIONS Profile;Release
102 | COMPONENT Runtime)
103 |
--------------------------------------------------------------------------------
/windows/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file controls Flutter-level build steps. It should not be edited.
2 | cmake_minimum_required(VERSION 3.14)
3 |
4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5 |
6 | # Configuration provided via flutter tool.
7 | include(${EPHEMERAL_DIR}/generated_config.cmake)
8 |
9 | # TODO: Move the rest of this into files in ephemeral. See
10 | # https://github.com/flutter/flutter/issues/57146.
11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
12 |
13 | # === Flutter Library ===
14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
15 |
16 | # Published to parent scope for install step.
17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
21 |
22 | list(APPEND FLUTTER_LIBRARY_HEADERS
23 | "flutter_export.h"
24 | "flutter_windows.h"
25 | "flutter_messenger.h"
26 | "flutter_plugin_registrar.h"
27 | "flutter_texture_registrar.h"
28 | )
29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
30 | add_library(flutter INTERFACE)
31 | target_include_directories(flutter INTERFACE
32 | "${EPHEMERAL_DIR}"
33 | )
34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
35 | add_dependencies(flutter flutter_assemble)
36 |
37 | # === Wrapper ===
38 | list(APPEND CPP_WRAPPER_SOURCES_CORE
39 | "core_implementations.cc"
40 | "standard_codec.cc"
41 | )
42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
44 | "plugin_registrar.cc"
45 | )
46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
47 | list(APPEND CPP_WRAPPER_SOURCES_APP
48 | "flutter_engine.cc"
49 | "flutter_view_controller.cc"
50 | )
51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
52 |
53 | # Wrapper sources needed for a plugin.
54 | add_library(flutter_wrapper_plugin STATIC
55 | ${CPP_WRAPPER_SOURCES_CORE}
56 | ${CPP_WRAPPER_SOURCES_PLUGIN}
57 | )
58 | apply_standard_settings(flutter_wrapper_plugin)
59 | set_target_properties(flutter_wrapper_plugin PROPERTIES
60 | POSITION_INDEPENDENT_CODE ON)
61 | set_target_properties(flutter_wrapper_plugin PROPERTIES
62 | CXX_VISIBILITY_PRESET hidden)
63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
64 | target_include_directories(flutter_wrapper_plugin PUBLIC
65 | "${WRAPPER_ROOT}/include"
66 | )
67 | add_dependencies(flutter_wrapper_plugin flutter_assemble)
68 |
69 | # Wrapper sources needed for the runner.
70 | add_library(flutter_wrapper_app STATIC
71 | ${CPP_WRAPPER_SOURCES_CORE}
72 | ${CPP_WRAPPER_SOURCES_APP}
73 | )
74 | apply_standard_settings(flutter_wrapper_app)
75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter)
76 | target_include_directories(flutter_wrapper_app PUBLIC
77 | "${WRAPPER_ROOT}/include"
78 | )
79 | add_dependencies(flutter_wrapper_app flutter_assemble)
80 |
81 | # === Flutter tool backend ===
82 | # _phony_ is a non-existent file to force this command to run every time,
83 | # since currently there's no way to get a full input/output list from the
84 | # flutter tool.
85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
87 | add_custom_command(
88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
90 | ${CPP_WRAPPER_SOURCES_APP}
91 | ${PHONY_OUTPUT}
92 | COMMAND ${CMAKE_COMMAND} -E env
93 | ${FLUTTER_TOOL_ENVIRONMENT}
94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
95 | windows-x64 $
96 | VERBATIM
97 | )
98 | add_custom_target(flutter_assemble DEPENDS
99 | "${FLUTTER_LIBRARY}"
100 | ${FLUTTER_LIBRARY_HEADERS}
101 | ${CPP_WRAPPER_SOURCES_CORE}
102 | ${CPP_WRAPPER_SOURCES_PLUGIN}
103 | ${CPP_WRAPPER_SOURCES_APP}
104 | )
105 |
--------------------------------------------------------------------------------
/windows/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 | #include
10 |
11 | void RegisterPlugins(flutter::PluginRegistry* registry) {
12 | AudioplayersWindowsPluginRegisterWithRegistrar(
13 | registry->GetRegistrarForPlugin("AudioplayersWindowsPlugin"));
14 | }
15 |
--------------------------------------------------------------------------------
/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 | audioplayers_windows
7 | )
8 |
9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
10 | )
11 |
12 | set(PLUGIN_BUNDLED_LIBRARIES)
13 |
14 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
19 | endforeach(plugin)
20 |
21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
24 | endforeach(ffi_plugin)
25 |
--------------------------------------------------------------------------------
/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", "widget_utils" "\0"
94 | VALUE "FileVersion", VERSION_AS_STRING "\0"
95 | VALUE "InternalName", "widget_utils" "\0"
96 | VALUE "LegalCopyright", "Copyright (C) 2023 com.example. All rights reserved." "\0"
97 | VALUE "OriginalFilename", "widget_utils.exe" "\0"
98 | VALUE "ProductName", "widget_utils" "\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"widget_utils", 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/vaidehi2701/Flutter_Cheatsheet_2023/7ec8796cd9425028c789fc89dc1b0af9efc3f28e/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/windows/runner/utils.cpp:
--------------------------------------------------------------------------------
1 | #include "utils.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | void CreateAndAttachConsole() {
11 | if (::AllocConsole()) {
12 | FILE *unused;
13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
14 | _dup2(_fileno(stdout), 1);
15 | }
16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
17 | _dup2(_fileno(stdout), 2);
18 | }
19 | std::ios::sync_with_stdio();
20 | FlutterDesktopResyncOutputStreams();
21 | }
22 | }
23 |
24 | std::vector GetCommandLineArguments() {
25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
26 | int argc;
27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
28 | if (argv == nullptr) {
29 | return std::vector();
30 | }
31 |
32 | std::vector command_line_arguments;
33 |
34 | // Skip the first argument as it's the binary name.
35 | for (int i = 1; i < argc; i++) {
36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
37 | }
38 |
39 | ::LocalFree(argv);
40 |
41 | return command_line_arguments;
42 | }
43 |
44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) {
45 | if (utf16_string == nullptr) {
46 | return std::string();
47 | }
48 | int target_length = ::WideCharToMultiByte(
49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
50 | -1, nullptr, 0, nullptr, nullptr)
51 | -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.cpp:
--------------------------------------------------------------------------------
1 | #include "win32_window.h"
2 |
3 | #include
4 | #include
5 |
6 | #include "resource.h"
7 |
8 | namespace {
9 |
10 | /// Window attribute that enables dark mode window decorations.
11 | ///
12 | /// Redefined in case the developer's machine has a Windows SDK older than
13 | /// version 10.0.22000.0.
14 | /// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute
15 | #ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
16 | #define DWMWA_USE_IMMERSIVE_DARK_MODE 20
17 | #endif
18 |
19 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW";
20 |
21 | /// Registry key for app theme preference.
22 | ///
23 | /// A value of 0 indicates apps should use dark mode. A non-zero or missing
24 | /// value indicates apps should use light mode.
25 | constexpr const wchar_t kGetPreferredBrightnessRegKey[] =
26 | L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize";
27 | constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme";
28 |
29 | // The number of Win32Window objects that currently exist.
30 | static int g_active_window_count = 0;
31 |
32 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd);
33 |
34 | // Scale helper to convert logical scaler values to physical using passed in
35 | // scale factor
36 | int Scale(int source, double scale_factor) {
37 | return static_cast(source * scale_factor);
38 | }
39 |
40 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module.
41 | // This API is only needed for PerMonitor V1 awareness mode.
42 | void EnableFullDpiSupportIfAvailable(HWND hwnd) {
43 | HMODULE user32_module = LoadLibraryA("User32.dll");
44 | if (!user32_module) {
45 | return;
46 | }
47 | auto enable_non_client_dpi_scaling =
48 | reinterpret_cast(
49 | GetProcAddress(user32_module, "EnableNonClientDpiScaling"));
50 | if (enable_non_client_dpi_scaling != nullptr) {
51 | enable_non_client_dpi_scaling(hwnd);
52 | }
53 | FreeLibrary(user32_module);
54 | }
55 |
56 | } // namespace
57 |
58 | // Manages the Win32Window's window class registration.
59 | class WindowClassRegistrar {
60 | public:
61 | ~WindowClassRegistrar() = default;
62 |
63 | // Returns the singleton registrar instance.
64 | static WindowClassRegistrar* GetInstance() {
65 | if (!instance_) {
66 | instance_ = new WindowClassRegistrar();
67 | }
68 | return instance_;
69 | }
70 |
71 | // Returns the name of the window class, registering the class if it hasn't
72 | // previously been registered.
73 | const wchar_t* GetWindowClass();
74 |
75 | // Unregisters the window class. Should only be called if there are no
76 | // instances of the window.
77 | void UnregisterWindowClass();
78 |
79 | private:
80 | WindowClassRegistrar() = default;
81 |
82 | static WindowClassRegistrar* instance_;
83 |
84 | bool class_registered_ = false;
85 | };
86 |
87 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr;
88 |
89 | const wchar_t* WindowClassRegistrar::GetWindowClass() {
90 | if (!class_registered_) {
91 | WNDCLASS window_class{};
92 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW);
93 | window_class.lpszClassName = kWindowClassName;
94 | window_class.style = CS_HREDRAW | CS_VREDRAW;
95 | window_class.cbClsExtra = 0;
96 | window_class.cbWndExtra = 0;
97 | window_class.hInstance = GetModuleHandle(nullptr);
98 | window_class.hIcon =
99 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
100 | window_class.hbrBackground = 0;
101 | window_class.lpszMenuName = nullptr;
102 | window_class.lpfnWndProc = Win32Window::WndProc;
103 | RegisterClass(&window_class);
104 | class_registered_ = true;
105 | }
106 | return kWindowClassName;
107 | }
108 |
109 | void WindowClassRegistrar::UnregisterWindowClass() {
110 | UnregisterClass(kWindowClassName, nullptr);
111 | class_registered_ = false;
112 | }
113 |
114 | Win32Window::Win32Window() {
115 | ++g_active_window_count;
116 | }
117 |
118 | Win32Window::~Win32Window() {
119 | --g_active_window_count;
120 | Destroy();
121 | }
122 |
123 | bool Win32Window::Create(const std::wstring& title,
124 | const Point& origin,
125 | const Size& size) {
126 | Destroy();
127 |
128 | const wchar_t* window_class =
129 | WindowClassRegistrar::GetInstance()->GetWindowClass();
130 |
131 | const POINT target_point = {static_cast(origin.x),
132 | static_cast(origin.y)};
133 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST);
134 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor);
135 | double scale_factor = dpi / 96.0;
136 |
137 | HWND window = CreateWindow(
138 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW,
139 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor),
140 | Scale(size.width, scale_factor), Scale(size.height, scale_factor),
141 | nullptr, nullptr, GetModuleHandle(nullptr), this);
142 |
143 | if (!window) {
144 | return false;
145 | }
146 |
147 | UpdateTheme(window);
148 |
149 | return OnCreate();
150 | }
151 |
152 | bool Win32Window::Show() {
153 | return ShowWindow(window_handle_, SW_SHOWNORMAL);
154 | }
155 |
156 | // static
157 | LRESULT CALLBACK Win32Window::WndProc(HWND const window,
158 | UINT const message,
159 | WPARAM const wparam,
160 | LPARAM const lparam) noexcept {
161 | if (message == WM_NCCREATE) {
162 | auto window_struct = reinterpret_cast(lparam);
163 | SetWindowLongPtr(window, GWLP_USERDATA,
164 | reinterpret_cast(window_struct->lpCreateParams));
165 |
166 | auto that = static_cast(window_struct->lpCreateParams);
167 | EnableFullDpiSupportIfAvailable(window);
168 | that->window_handle_ = window;
169 | } else if (Win32Window* that = GetThisFromHandle(window)) {
170 | return that->MessageHandler(window, message, wparam, lparam);
171 | }
172 |
173 | return DefWindowProc(window, message, wparam, lparam);
174 | }
175 |
176 | LRESULT
177 | Win32Window::MessageHandler(HWND hwnd,
178 | UINT const message,
179 | WPARAM const wparam,
180 | LPARAM const lparam) noexcept {
181 | switch (message) {
182 | case WM_DESTROY:
183 | window_handle_ = nullptr;
184 | Destroy();
185 | if (quit_on_close_) {
186 | PostQuitMessage(0);
187 | }
188 | return 0;
189 |
190 | case WM_DPICHANGED: {
191 | auto newRectSize = reinterpret_cast(lparam);
192 | LONG newWidth = newRectSize->right - newRectSize->left;
193 | LONG newHeight = newRectSize->bottom - newRectSize->top;
194 |
195 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth,
196 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE);
197 |
198 | return 0;
199 | }
200 | case WM_SIZE: {
201 | RECT rect = GetClientArea();
202 | if (child_content_ != nullptr) {
203 | // Size and position the child window.
204 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left,
205 | rect.bottom - rect.top, TRUE);
206 | }
207 | return 0;
208 | }
209 |
210 | case WM_ACTIVATE:
211 | if (child_content_ != nullptr) {
212 | SetFocus(child_content_);
213 | }
214 | return 0;
215 |
216 | case WM_DWMCOLORIZATIONCOLORCHANGED:
217 | UpdateTheme(hwnd);
218 | return 0;
219 | }
220 |
221 | return DefWindowProc(window_handle_, message, wparam, lparam);
222 | }
223 |
224 | void Win32Window::Destroy() {
225 | OnDestroy();
226 |
227 | if (window_handle_) {
228 | DestroyWindow(window_handle_);
229 | window_handle_ = nullptr;
230 | }
231 | if (g_active_window_count == 0) {
232 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass();
233 | }
234 | }
235 |
236 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept {
237 | return reinterpret_cast(
238 | GetWindowLongPtr(window, GWLP_USERDATA));
239 | }
240 |
241 | void Win32Window::SetChildContent(HWND content) {
242 | child_content_ = content;
243 | SetParent(content, window_handle_);
244 | RECT frame = GetClientArea();
245 |
246 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left,
247 | frame.bottom - frame.top, true);
248 |
249 | SetFocus(child_content_);
250 | }
251 |
252 | RECT Win32Window::GetClientArea() {
253 | RECT frame;
254 | GetClientRect(window_handle_, &frame);
255 | return frame;
256 | }
257 |
258 | HWND Win32Window::GetHandle() {
259 | return window_handle_;
260 | }
261 |
262 | void Win32Window::SetQuitOnClose(bool quit_on_close) {
263 | quit_on_close_ = quit_on_close;
264 | }
265 |
266 | bool Win32Window::OnCreate() {
267 | // No-op; provided for subclasses.
268 | return true;
269 | }
270 |
271 | void Win32Window::OnDestroy() {
272 | // No-op; provided for subclasses.
273 | }
274 |
275 | void Win32Window::UpdateTheme(HWND const window) {
276 | DWORD light_mode;
277 | DWORD light_mode_size = sizeof(light_mode);
278 | LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey,
279 | kGetPreferredBrightnessRegValue,
280 | RRF_RT_REG_DWORD, nullptr, &light_mode,
281 | &light_mode_size);
282 |
283 | if (result == ERROR_SUCCESS) {
284 | BOOL enable_dark_mode = light_mode == 0;
285 | DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE,
286 | &enable_dark_mode, sizeof(enable_dark_mode));
287 | }
288 | }
289 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------