├── .github ├── FUNDING.yml ├── dependabot.yml └── workflows │ └── dart.yml ├── .gitignore ├── .metadata ├── .vscode └── launch.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── assets ├── FlutterIconPicker3.jpg ├── bitrise.png ├── empty_packs │ ├── Cupertino.dart │ ├── FontAwesome.dart │ ├── LineIcons.dart │ ├── Material.dart │ ├── MaterialDefault.dart │ ├── MaterialOutlined.dart │ ├── MaterialRounded.dart │ └── MaterialSharp.dart └── generated_packs │ ├── Cupertino.dart │ ├── FontAwesome.dart │ ├── LineIcons.dart │ ├── Material.dart │ ├── MaterialDefault.dart │ ├── MaterialOutlined.dart │ ├── MaterialRounded.dart │ └── MaterialSharp.dart ├── bin └── generate_packs.dart ├── example ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── .gitignore │ ├── .project │ ├── .settings │ │ └── org.eclipse.buildship.core.prefs │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ ├── example │ │ │ │ │ └── MainActivity.kt │ │ │ │ │ └── fluttericonpickerexample │ │ │ │ │ └── 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 ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── .last_build_id │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ ├── app │ │ ├── app.dart │ │ ├── app_brightness.dart │ │ └── icon_notifier.dart │ ├── custom_icon_pack.dart │ ├── home │ │ └── home_screen.dart │ ├── main.dart │ └── multiple_pickers │ │ └── home_2.dart ├── linux │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ ├── main.cc │ ├── my_application.cc │ └── my_application.h ├── log.txt ├── macos │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ │ ├── Base.lproj │ │ └── MainMenu.xib │ │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements ├── pubspec.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 ├── fonts ├── LineAwesome.ttf ├── fa-brands-400.ttf ├── fa-regular-400.ttf └── fa-solid-900.ttf ├── lib ├── Dialogs │ ├── adaptive_dialog.dart │ ├── default_dialog.dart │ └── fullscreen_dialog.dart ├── Helpers │ ├── color_brightness.dart │ └── icon_pack_manager.dart ├── IconPicker │ ├── Packs │ │ ├── Cupertino.dart │ │ ├── FontAwesome.dart │ │ ├── LineIcons.dart │ │ ├── Material.dart │ │ ├── MaterialDefault.dart │ │ ├── MaterialOutlined.dart │ │ ├── MaterialRounded.dart │ │ └── MaterialSharp.dart │ ├── icon_picker.dart │ ├── multiple_icon_picker.dart │ └── search_bar.dart ├── Models │ ├── configuration.dart │ ├── icon_pack.dart │ └── icon_picker_icon.dart ├── Serialization │ └── icondata_serialization.dart ├── controllers │ └── icon_controller.dart ├── extensions │ ├── list_extensions.dart │ ├── map_extensions.dart │ └── string_extensions.dart └── flutter_iconpicker.dart └── pubspec.yaml /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | custom: ['https://www.buymeacoffee.com/wyXvWnH'] 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "pub" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "monthly" 12 | -------------------------------------------------------------------------------- /.github/workflows/dart.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v3 15 | - uses: actions/setup-java@v1 16 | with: 17 | java-version: '12.x' 18 | - uses: subosito/flutter-action@v2 19 | with: 20 | channel: stable 21 | - run: flutter pub get 22 | - run: dart analyze 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | build/ 32 | .fvm 33 | example/.fvm 34 | 35 | # Android related 36 | **/android/**/gradle-wrapper.jar 37 | **/android/.gradle 38 | **/android/captures/ 39 | **/android/gradlew 40 | **/android/gradlew.bat 41 | **/android/local.properties 42 | **/android/**/GeneratedPluginRegistrant.java 43 | 44 | # iOS/XCode related 45 | **/ios/**/*.mode1v3 46 | **/ios/**/*.mode2v3 47 | **/ios/**/*.moved-aside 48 | **/ios/**/*.pbxuser 49 | **/ios/**/*.perspectivev3 50 | **/ios/**/*sync/ 51 | **/ios/**/.sconsign.dblite 52 | **/ios/**/.tags* 53 | **/ios/**/.vagrant/ 54 | **/ios/**/DerivedData/ 55 | **/ios/**/Icon? 56 | **/ios/**/Pods/ 57 | **/ios/**/.symlinks/ 58 | **/ios/**/profile 59 | **/ios/**/xcuserdata 60 | **/ios/.generated/ 61 | **/ios/Flutter/App.framework 62 | **/ios/Flutter/Flutter.framework 63 | **/ios/Flutter/Flutter.podspec 64 | **/ios/Flutter/Generated.xcconfig 65 | **/ios/Flutter/app.flx 66 | **/ios/Flutter/app.zip 67 | **/ios/Flutter/flutter_assets/ 68 | **/ios/Flutter/flutter_export_environment.sh 69 | **/ios/ServiceDefinitions.json 70 | **/ios/Runner/GeneratedPluginRegistrant.* 71 | 72 | # Exceptions to above rules. 73 | !**/ios/**/default.mode1v3 74 | !**/ios/**/default.mode2v3 75 | !**/ios/**/default.pbxuser 76 | !**/ios/**/default.perspectivev3 77 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 78 | example/pubspec.lock 79 | pubspec.lock 80 | example/pubspec.lock 81 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 354f80b84a9b30ec3b49d8fed81bce772a1bc8e8 8 | channel: master 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Flutter VM", 9 | "cwd": "example", 10 | "request": "launch", 11 | "type": "dart" 12 | }, 13 | { 14 | "name": "Flutter Web", 15 | "cwd": "example", 16 | "request": "launch", 17 | "type": "dart", 18 | "args": ["-d", "chrome"] 19 | }, 20 | { 21 | "name": "Test generate icon packs", 22 | "request": "launch", 23 | "type": "dart", 24 | "program": "bin/generate_packs.dart", 25 | "args": ["-p", "cupertino"] 26 | }, 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Rebar Ahmad 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | analyzer: 2 | exclude: [build/**, lib/**.freezed.dart, lib/**.g.dart, assets/**] -------------------------------------------------------------------------------- /assets/FlutterIconPicker3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/assets/FlutterIconPicker3.jpg -------------------------------------------------------------------------------- /assets/bitrise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/assets/bitrise.png -------------------------------------------------------------------------------- /assets/empty_packs/Cupertino.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 6 | 7 | const Map cupertinoIcons = {}; 8 | -------------------------------------------------------------------------------- /assets/empty_packs/FontAwesome.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 2 | 3 | const Map fontAwesomeIcons = {}; 4 | -------------------------------------------------------------------------------- /assets/empty_packs/LineIcons.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 2 | 3 | const Map lineAwesomeIcons = {}; 4 | -------------------------------------------------------------------------------- /assets/empty_packs/Material.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 2 | 3 | const Map allIcons = {}; 4 | -------------------------------------------------------------------------------- /assets/empty_packs/MaterialDefault.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 2 | 3 | const Map defaultIcons = {}; 4 | -------------------------------------------------------------------------------- /assets/empty_packs/MaterialOutlined.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 2 | 3 | const Map outlinedIcons = {}; 4 | -------------------------------------------------------------------------------- /assets/empty_packs/MaterialRounded.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 2 | 3 | const Map roundedIcons = {}; 4 | -------------------------------------------------------------------------------- /assets/empty_packs/MaterialSharp.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 2 | 3 | const Map sharpIcons = {}; 4 | -------------------------------------------------------------------------------- /bin/generate_packs.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'dart:isolate'; 3 | 4 | import 'package:args/args.dart'; 5 | import 'package:dcli/dcli.dart'; 6 | import 'package:flutter_iconpicker/Models/icon_pack.dart'; 7 | import 'package:flutter_iconpicker/extensions/string_extensions.dart'; 8 | import 'package:path/path.dart' as path; 9 | 10 | const packs = 'packs'; 11 | const all = 'all'; 12 | const help = 'help'; 13 | const clear = 'clear'; 14 | 15 | Future main(List arguments) async { 16 | exitCode = 0; // Presume success 17 | 18 | final parser = ArgParser() 19 | ..addFlag(help, help: 'Shows how to use generate_packs command', abbr: 'h') 20 | ..addFlag(clear, help: 'Clears all generated packs', abbr: 'c') 21 | ..addFlag(all, help: 'Generates all icon packs', abbr: 'a') 22 | ..addOption( 23 | packs, 24 | help: 25 | 'Defines which packs to generate for your project (comma separated)', 26 | allowedHelp: IconPack.values 27 | .where((p) => p.description.isNotNullOrBlank) 28 | .toList() 29 | .asMap() 30 | .map((key, value) => MapEntry(value.name, value.description!)), 31 | valueHelp: 'material,cupertino,...', 32 | defaultsTo: 'material', 33 | abbr: 'p', 34 | ); 35 | 36 | if (arguments.contains('--help') || arguments.contains('-h')) { 37 | print(parser.usage); 38 | return; 39 | } 40 | 41 | ArgResults argResults = parser.parse(arguments); 42 | 43 | /// Get path of users FlutterIconPicker instance for code generation 44 | final basePackagePath = await getBasePackagePath(); 45 | 46 | final generateAll = argResults[all] as bool; 47 | 48 | if (argResults[clear] as bool) { 49 | print('🛠️ Removing generated Packs'); 50 | } 51 | 52 | /// 1. Reset Packs to initial state (no packs available) 53 | emptyIconPacks(packagePath: basePackagePath); 54 | 55 | if (argResults[clear] as bool) { 56 | print('⚠️ Removed all generated Packs'); 57 | return; 58 | } 59 | 60 | print('🛠️ Start generating Packs'); 61 | 62 | if (generateAll) { 63 | generateAllIconPacks(packagePath: basePackagePath); 64 | } else { 65 | /// 2. Get requiredPacks as List from CLI 66 | final requiredPacks = 67 | parseIconPacks((argResults[packs] as String).split(',')); 68 | 69 | /// 3. Generate Icons which the developer needs 70 | for (var pack in requiredPacks) { 71 | generateIconPack(packagePath: basePackagePath, pack: pack); 72 | } 73 | } 74 | 75 | print('✅ Finished generating Packs'); 76 | } 77 | 78 | void emptyIconPacks({ 79 | required String packagePath, 80 | }) => 81 | copyTree( 82 | '$packagePath/assets/empty_packs', 83 | '$packagePath/lib/IconPicker/Packs', 84 | overwrite: true, 85 | ); 86 | 87 | void generateIconPack({ 88 | required String packagePath, 89 | required IconPack pack, 90 | }) { 91 | assert(pack.path.isNotNullOrBlank, 92 | 'Path must be specified if you want to generate ${pack.name} IconPack'); 93 | 94 | copy( 95 | '$packagePath/assets/generated_packs/${pack.path}.dart', 96 | '$packagePath/lib/IconPicker/Packs/${pack.path}.dart', 97 | overwrite: true, 98 | ); 99 | 100 | print('📦 Generated ${pack.name} IconPack'); 101 | } 102 | 103 | Future getBasePackagePath() async { 104 | final packageUri = 105 | Uri.parse('package:flutter_iconpicker/flutter_iconpicker.dart'); 106 | final packagePath = (await Isolate.resolvePackageUri(packageUri)); 107 | String resultPath = path.dirname(packagePath!.path.replaceAll('lib', '')); 108 | if (Platform.isWindows) { 109 | resultPath = resultPath 110 | .replaceAll(Platform.pathSeparator, '/') 111 | .replaceFirst('/', '') 112 | .replaceAll('%20', ' '); 113 | } 114 | return resultPath; 115 | } 116 | 117 | List parseIconPacks(List rawPacks) { 118 | List result = []; 119 | List inputPacks = 120 | rawPacks.map((name) => name.toLowerCase().trim()).toList(); 121 | 122 | for (var pack in IconPack.values) { 123 | if (inputPacks.contains(pack.name.toLowerCase().trim())) { 124 | result.add(pack); 125 | } 126 | } 127 | 128 | return result; 129 | } 130 | 131 | void generateAllIconPacks({required String packagePath}) => IconPack.values 132 | .where((p) => p.path.isNotNullOrBlank) 133 | .forEach((pack) => generateIconPack(packagePath: packagePath, pack: pack)); 134 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | build/ 32 | 33 | # Web related 34 | 35 | # Exceptions to above rules. 36 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 37 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 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: ee4e09cce01d6f2d7f4baebd247fde02e5008851 17 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 18 | - platform: android 19 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 20 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 21 | - platform: ios 22 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 23 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 24 | - platform: linux 25 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 26 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 27 | - platform: macos 28 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 29 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 30 | - platform: web 31 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 32 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 33 | - platform: windows 34 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 35 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # fluttericonpickerexample 2 | 3 | Example project for FlutterIconPicker 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /example/android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | android_______ 4 | Project android_______ created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.buildship.core.gradleprojectbuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.buildship.core.gradleprojectnature 16 | 17 | 18 | 19 | 1735855663430 20 | 21 | 30 22 | 23 | org.eclipse.core.resources.regexFilterMatcher 24 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /example/android/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | arguments= 2 | auto.sync=false 3 | build.scans.enabled=false 4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 5 | connection.project.dir= 6 | eclipse.preferences.version=1 7 | gradle.user.home= 8 | java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home 9 | jvm.arguments= 10 | offline.mode=false 11 | override.workspace.settings=true 12 | show.console.view=true 13 | show.executions.view=true 14 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 32 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | 36 | defaultConfig { 37 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 38 | applicationId "com.example.fluttericonpickerexample" 39 | minSdkVersion 16 40 | targetSdkVersion 32 41 | versionCode flutterVersionCode.toInteger() 42 | versionName flutterVersionName 43 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 44 | } 45 | 46 | buildTypes { 47 | release { 48 | // TODO: Add your own signing config for the release build. 49 | // Signing with the debug keys for now, so `flutter run --release` works. 50 | signingConfig signingConfigs.debug 51 | } 52 | } 53 | lint { 54 | disable 'InvalidPackage' 55 | } 56 | namespace 'com.example.fluttericonpickerexample' 57 | } 58 | 59 | flutter { 60 | source '../..' 61 | } 62 | 63 | dependencies { 64 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 65 | testImplementation 'junit:junit:4.13.2' 66 | androidTestImplementation 'androidx.test:runner:1.4.0' 67 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' 68 | } 69 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/fluttericonpickerexample/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.fluttericonpickerexample 2 | 3 | import androidx.annotation.NonNull; 4 | import io.flutter.embedding.android.FlutterActivity 5 | import io.flutter.embedding.engine.FlutterEngine 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { 10 | GeneratedPluginRegistrant.registerWith(flutterEngine); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.21' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.2.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir} /${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /example/ios/Flutter/.last_build_id: -------------------------------------------------------------------------------- 1 | 669e1bf4e240eb3ab55927035171adba -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | fluttericonpickerexample 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/lib/app/app.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluttericonpickerexample/app/icon_notifier.dart'; 3 | import 'package:fluttericonpickerexample/home/home_screen.dart'; 4 | import 'package:provider/provider.dart'; 5 | 6 | class FlutterIconPickerExample extends StatefulWidget { 7 | const FlutterIconPickerExample({ 8 | super.key, 9 | this.notifier, 10 | }); 11 | 12 | final IconNotifier? notifier; 13 | 14 | @override 15 | FlutterIconPickerExampleState createState() => 16 | FlutterIconPickerExampleState(); 17 | } 18 | 19 | class FlutterIconPickerExampleState extends State { 20 | bool isDarkTheme = false; 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return ChangeNotifierProvider.value( 25 | value: widget.notifier, 26 | builder: (BuildContext ctx, Widget? w) => Consumer( 27 | builder: (BuildContext iconCtx, dynamic d, Widget? iconW) => 28 | MaterialApp( 29 | home: const HomeScreen(), 30 | debugShowCheckedModeBanner: false, 31 | themeMode: widget.notifier!.brightness.mode, 32 | darkTheme: ThemeData(brightness: Brightness.dark), 33 | theme: ThemeData(brightness: Brightness.light), 34 | ), 35 | ), 36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /example/lib/app/app_brightness.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class AppBrightness { 4 | const AppBrightness._(this.value, this.mode, this.icon, this.label); 5 | 6 | static const light = 7 | AppBrightness._('light', ThemeMode.light, Icons.brightness_high, 'Light'); 8 | static const dark = 9 | AppBrightness._('dark', ThemeMode.dark, Icons.brightness_3, 'Dark'); 10 | static const system = AppBrightness._( 11 | 'system', ThemeMode.system, Icons.brightness_auto, 'Auto'); 12 | static const values = [light, dark, system]; 13 | 14 | final String value; 15 | final ThemeMode mode; 16 | final IconData icon; 17 | final String label; 18 | 19 | static AppBrightness from(String? value) { 20 | return values.singleWhere( 21 | (el) => el.value == value, 22 | orElse: () => AppBrightness.system, 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /example/lib/app/icon_notifier.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter_iconpicker/flutter_iconpicker.dart'; 3 | import 'package:hive/hive.dart'; 4 | import 'package:path_provider/path_provider.dart'; 5 | 6 | import 'app_brightness.dart'; 7 | 8 | class IconNotifier extends ChangeNotifier { 9 | static final starterPacks = [IconPack.cupertino]; 10 | 11 | IconNotifier._( 12 | IconPickerIcon? iconData, 13 | List? iconsData, 14 | AppBrightness brightness, 15 | ) : _icon = iconData, 16 | _icons = iconsData ?? [], 17 | _brightness = brightness; 18 | 19 | static late Box box; 20 | 21 | List _icons = []; 22 | 23 | IconPickerIcon? _icon; 24 | 25 | AppBrightness _brightness; 26 | 27 | IconPickerIcon? get icon => _icon; 28 | 29 | void setIconData(IconPickerIcon value) { 30 | if (_icon == value) { 31 | return; 32 | } 33 | 34 | _icon = value; 35 | 36 | box.put( 37 | 'iconData', 38 | serializeIcon(_icon!), 39 | ); 40 | notifyListeners(); 41 | } 42 | 43 | Future clearIconData() async { 44 | await box.delete('iconData'); 45 | _icon = null; 46 | notifyListeners(); 47 | } 48 | 49 | List get icons => _icons; 50 | 51 | void setIconsData(List value) { 52 | _icons = value; 53 | 54 | box.put( 55 | 'iconsData', 56 | serializeIcons(_icons), 57 | ); 58 | notifyListeners(); 59 | } 60 | 61 | Future clearIconsData() async { 62 | await box.delete('iconsData'); 63 | _icons = []; 64 | notifyListeners(); 65 | } 66 | 67 | AppBrightness get brightness => _brightness; 68 | 69 | set brightness(AppBrightness value) { 70 | if (_brightness == value) { 71 | return; 72 | } 73 | _brightness = value; 74 | box.put('app.brightness', _brightness.value); 75 | notifyListeners(); 76 | } 77 | 78 | static Future init() async { 79 | /// Wrapped in Try/Catch because of known bugs in hive 80 | try { 81 | if (!kIsWeb) Hive.init((await getApplicationDocumentsDirectory()).path); 82 | } catch (e) { 83 | debugPrint( 84 | 'Hive has already been initialized. Skipping this step for now.'); 85 | } 86 | 87 | if (!Hive.isBoxOpen('FLIPBox')) { 88 | box = await Hive.openBox('FLIPBox'); 89 | } else { 90 | box = Hive.box('FLIPBox'); 91 | } 92 | 93 | final cachedIcon = await box.get('iconData') != null 94 | ? deserializeIcon(Map.from(await box.get('iconData'))) 95 | : null; 96 | 97 | final cachedIcons = await box.get('iconsData') != null 98 | ? deserializeIcons(await box.get('iconsData')) 99 | : null; 100 | 101 | final brightness = AppBrightness.from(await box.get('app.brightness')); 102 | 103 | return IconNotifier._( 104 | cachedIcon, 105 | cachedIcons, 106 | brightness, 107 | ); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /example/lib/custom_icon_pack.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 3 | 4 | const Map myCustomIcons = { 5 | 'threesixty': IconPickerIcon( 6 | name: 'threesixty', data: Icons.threesixty, pack: 'custom'), 7 | 'threed_rotation': IconPickerIcon( 8 | name: 'threed_rotation', data: Icons.threed_rotation, pack: 'custom'), 9 | 'four_k': IconPickerIcon(name: 'four_k', data: Icons.four_k, pack: 'custom'), 10 | 'ac_unit': 11 | IconPickerIcon(name: 'ac_unit', data: Icons.ac_unit, pack: 'custom'), 12 | 'access_alarm': IconPickerIcon( 13 | name: 'access_alarm', data: Icons.access_alarm, pack: 'custom'), 14 | 'access_alarms': IconPickerIcon( 15 | name: 'access_alarms', data: Icons.access_alarms, pack: 'custom'), 16 | 'access_time': IconPickerIcon( 17 | name: 'access_time', data: Icons.access_time, pack: 'custom'), 18 | 'accessibility': IconPickerIcon( 19 | name: 'accessibility', data: Icons.accessibility, pack: 'custom'), 20 | 'accessibility_new': IconPickerIcon( 21 | name: 'accessibility_new', data: Icons.accessibility_new, pack: 'custom'), 22 | 'accessible': IconPickerIcon( 23 | name: 'accessible', data: Icons.accessible, pack: 'custom'), 24 | 'accessible_forward': IconPickerIcon( 25 | name: 'accessible_forward', 26 | data: Icons.accessible_forward, 27 | pack: 'custom'), 28 | 'account_balance': IconPickerIcon( 29 | name: 'account_balance', data: Icons.account_balance, pack: 'custom'), 30 | 'account_balance_wallet': IconPickerIcon( 31 | name: 'account_balance_wallet', 32 | data: Icons.account_balance_wallet, 33 | pack: 'custom'), 34 | 'account_box': IconPickerIcon( 35 | name: 'account_box', data: Icons.account_box, pack: 'custom'), 36 | 'account_circle': IconPickerIcon( 37 | name: 'account_circle', data: Icons.account_circle, pack: 'custom'), 38 | }; 39 | -------------------------------------------------------------------------------- /example/lib/home/home_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_iconpicker/Models/configuration.dart'; 3 | import 'package:flutter_iconpicker/flutter_iconpicker.dart'; 4 | import 'package:fluttericonpickerexample/app/app_brightness.dart'; 5 | import 'package:fluttericonpickerexample/app/icon_notifier.dart'; 6 | import 'package:fluttericonpickerexample/multiple_pickers/home_2.dart'; 7 | import 'package:provider/provider.dart'; 8 | 9 | class HomeScreen extends StatefulWidget { 10 | const HomeScreen({ 11 | super.key, 12 | }); 13 | 14 | @override 15 | _HomeScreenState createState() => _HomeScreenState(); 16 | } 17 | 18 | class _HomeScreenState extends State { 19 | bool isAdaptive = true; 20 | bool showTooltips = false; 21 | bool showSearch = true; 22 | 23 | @override 24 | void initState() { 25 | super.initState(); 26 | } 27 | 28 | Future _pickIcon() async { 29 | IconPickerIcon? icon = await showIconPicker( 30 | context, 31 | configuration: SinglePickerConfiguration( 32 | preSelected: Provider.of(context, listen: false).icon, 33 | adaptiveDialog: isAdaptive, 34 | showTooltips: showTooltips, 35 | showSearchBar: showSearch, 36 | iconPickerShape: 37 | RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)), 38 | iconPackModes: IconNotifier.starterPacks, 39 | searchComparator: (String search, IconPickerIcon icon) => 40 | search 41 | .toLowerCase() 42 | .contains(icon.name.replaceAll('_', ' ').toLowerCase()) || 43 | icon.name.toLowerCase().contains(search.toLowerCase()), 44 | ), 45 | ); 46 | 47 | if (icon != null) { 48 | Provider.of(context, listen: false).setIconData(icon); 49 | setState(() {}); 50 | 51 | debugPrint( 52 | 'Picked Icon: $icon and saved it successfully in local hive db.'); 53 | } 54 | } 55 | 56 | @override 57 | Widget build(BuildContext context) { 58 | return Scaffold( 59 | appBar: AppBar( 60 | title: const Text('Flutter Icon Picker Demo'), 61 | actions: [ 62 | Consumer(builder: (context, notifier, _) { 63 | return IconButton( 64 | icon: Icon(notifier.brightness.icon), 65 | onPressed: () { 66 | switch (notifier.brightness.mode) { 67 | case ThemeMode.dark: 68 | notifier.brightness = AppBrightness.light; 69 | break; 70 | case ThemeMode.light: 71 | notifier.brightness = AppBrightness.system; 72 | break; 73 | case ThemeMode.system: 74 | notifier.brightness = AppBrightness.dark; 75 | break; 76 | } 77 | setState(() {}); 78 | }, 79 | tooltip: 'Switch brightness', 80 | ); 81 | }), 82 | IconButton( 83 | onPressed: () => Navigator.of(context).push( 84 | MaterialPageRoute( 85 | builder: (ctx) => const HomeScreen2(), 86 | ), 87 | ), 88 | icon: const Icon(Icons.arrow_forward_rounded), 89 | tooltip: 'Show next picker', 90 | ), 91 | ], 92 | ), 93 | body: Center( 94 | child: Column( 95 | mainAxisAlignment: MainAxisAlignment.center, 96 | crossAxisAlignment: CrossAxisAlignment.center, 97 | children: [ 98 | Consumer(builder: (context, notifier, _) { 99 | return OverflowBar( 100 | alignment: MainAxisAlignment.center, 101 | children: [ 102 | ElevatedButton( 103 | onPressed: _pickIcon, 104 | child: AnimatedSize( 105 | duration: const Duration(milliseconds: 300), 106 | child: Text(notifier.icon != null 107 | ? 'Change Icon' 108 | : 'Open IconPicker'), 109 | ), 110 | ), 111 | AnimatedSwitcher( 112 | duration: const Duration(milliseconds: 300), 113 | child: notifier.icon != null 114 | ? ElevatedButton( 115 | onPressed: () async { 116 | await notifier.clearIconData(); 117 | setState(() {}); 118 | }, 119 | child: const Text('Clear Icon'), 120 | ) 121 | : const SizedBox.shrink(), 122 | ), 123 | ], 124 | ); 125 | }), 126 | const SizedBox(height: 10), 127 | Consumer( 128 | builder: (ctx, iconNotifier, _) => AnimatedSwitcher( 129 | duration: const Duration(milliseconds: 300), 130 | child: iconNotifier.icon != null 131 | ? Column( 132 | children: [ 133 | Icon(iconNotifier.icon?.data), 134 | const SizedBox( 135 | height: 15, 136 | ), 137 | Text( 138 | 'Database Entry:\n${serializeIcon(iconNotifier.icon!).toString()}', 139 | ), 140 | ], 141 | ) 142 | : Container(), 143 | ), 144 | ), 145 | ], 146 | ), 147 | ), 148 | bottomSheet: Container( 149 | color: Colors.blue.shade500, 150 | child: Row( 151 | children: [ 152 | Flexible( 153 | child: SwitchListTile.adaptive( 154 | title: const Text('Show search-bar', 155 | style: TextStyle(color: Colors.white)), 156 | value: showSearch, 157 | onChanged: (val) => setState(() => showSearch = val), 158 | ), 159 | ), 160 | Flexible( 161 | child: SwitchListTile.adaptive( 162 | title: const Text('Show tooltips', 163 | style: TextStyle(color: Colors.white)), 164 | value: showTooltips, 165 | onChanged: (val) => setState(() => showTooltips = val), 166 | ), 167 | ), 168 | Flexible( 169 | child: SwitchListTile.adaptive( 170 | title: const Text('Adaptive dialog', 171 | style: TextStyle(color: Colors.white)), 172 | value: isAdaptive, 173 | onChanged: (val) => setState(() => isAdaptive = val), 174 | ), 175 | ), 176 | ], 177 | ), 178 | ), 179 | ); 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluttericonpickerexample/app/icon_notifier.dart'; 3 | 4 | import 'app/app.dart'; 5 | 6 | Future main() async { 7 | WidgetsFlutterBinding.ensureInitialized(); 8 | final notifier = await IconNotifier.init(); 9 | 10 | runApp(FlutterIconPickerExample( 11 | notifier: notifier, 12 | )); 13 | } 14 | -------------------------------------------------------------------------------- /example/lib/multiple_pickers/home_2.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_iconpicker/Models/configuration.dart'; 3 | import 'package:flutter_iconpicker/extensions/list_extensions.dart'; 4 | import 'package:flutter_iconpicker/flutter_iconpicker.dart'; 5 | import 'package:fluttericonpickerexample/app/app_brightness.dart'; 6 | import 'package:fluttericonpickerexample/app/icon_notifier.dart'; 7 | import 'package:provider/provider.dart'; 8 | 9 | class HomeScreen2 extends StatefulWidget { 10 | const HomeScreen2({ 11 | super.key, 12 | }); 13 | 14 | @override 15 | _HomeScreen2State createState() => _HomeScreen2State(); 16 | } 17 | 18 | class _HomeScreen2State extends State { 19 | late IconNotifier notifier; 20 | 21 | bool isAdaptive = true; 22 | bool showTooltips = false; 23 | bool showSearch = true; 24 | 25 | @override 26 | void initState() { 27 | super.initState(); 28 | notifier = Provider.of(context, listen: false); 29 | } 30 | 31 | _pickIcon() async { 32 | List? icons = await showMultipleIconPicker( 33 | context, 34 | configuration: MultiplePickerConfiguration( 35 | preSelected: Provider.of(context, listen: false).icons, 36 | adaptiveDialog: isAdaptive, 37 | showTooltips: showTooltips, 38 | showSearchBar: showSearch, 39 | iconPickerShape: 40 | RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)), 41 | iconPackModes: IconNotifier.starterPacks, 42 | searchComparator: (String search, IconPickerIcon icon) => 43 | search 44 | .toLowerCase() 45 | .contains(icon.name.replaceAll('_', ' ').toLowerCase()) || 46 | icon.name.toLowerCase().contains(search.toLowerCase()), 47 | ), 48 | ); 49 | 50 | if (icons != null) { 51 | notifier.setIconsData(icons); 52 | setState(() {}); 53 | 54 | debugPrint( 55 | 'Picked Icons: $icons and saved it successfully in local hive db.'); 56 | } 57 | } 58 | 59 | @override 60 | Widget build(BuildContext context) { 61 | return Scaffold( 62 | appBar: AppBar( 63 | title: const Text('Multiple Pickers'), 64 | actions: [ 65 | IconButton( 66 | icon: Icon(notifier.brightness.icon), 67 | onPressed: () { 68 | switch (notifier.brightness.mode) { 69 | case ThemeMode.dark: 70 | notifier.brightness = AppBrightness.light; 71 | break; 72 | case ThemeMode.light: 73 | notifier.brightness = AppBrightness.system; 74 | break; 75 | case ThemeMode.system: 76 | notifier.brightness = AppBrightness.dark; 77 | break; 78 | } 79 | setState(() {}); 80 | }, 81 | tooltip: 'Switch brightness', 82 | ), 83 | ], 84 | ), 85 | body: Center( 86 | child: Column( 87 | mainAxisAlignment: MainAxisAlignment.center, 88 | crossAxisAlignment: CrossAxisAlignment.center, 89 | children: [ 90 | OverflowBar( 91 | alignment: MainAxisAlignment.center, 92 | children: [ 93 | ElevatedButton( 94 | onPressed: _pickIcon, 95 | child: AnimatedSize( 96 | duration: const Duration(milliseconds: 300), 97 | child: Text(notifier.icons.isNotNullOrEmpty 98 | ? 'Change Icons' 99 | : 'Open Multiple IconPicker'), 100 | ), 101 | ), 102 | AnimatedSwitcher( 103 | duration: const Duration(milliseconds: 300), 104 | child: notifier.icons.isNotNullOrEmpty 105 | ? ElevatedButton( 106 | onPressed: () async { 107 | await notifier.clearIconsData(); 108 | setState(() {}); 109 | }, 110 | child: const Text('Clear Icons'), 111 | ) 112 | : const SizedBox.shrink(), 113 | ), 114 | ], 115 | ), 116 | const SizedBox(height: 10), 117 | Consumer( 118 | builder: (BuildContext ctx, dynamic d, Widget? w) => 119 | AnimatedSwitcher( 120 | duration: const Duration(milliseconds: 300), 121 | child: AnimatedSwitcher( 122 | duration: const Duration(milliseconds: 300), 123 | child: notifier.icons.isNotNullOrEmpty 124 | ? Column( 125 | children: [ 126 | Wrap( 127 | children: notifier.icons 128 | .map((item) => Icon(item.data)) 129 | .toList(), 130 | ), 131 | const SizedBox( 132 | height: 15, 133 | ), 134 | Text( 135 | 'Database Entries:\n${notifier.icons.map((item) => serializeIcon(item)).toString()}', 136 | ), 137 | ], 138 | ) 139 | : Container(), 140 | ), 141 | ), 142 | ), 143 | ], 144 | ), 145 | ), 146 | bottomSheet: Container( 147 | color: Colors.blue.shade500, 148 | child: Row( 149 | children: [ 150 | Flexible( 151 | child: SwitchListTile.adaptive( 152 | title: const Text('Show search-bar', 153 | style: TextStyle(color: Colors.white)), 154 | value: showSearch, 155 | onChanged: (val) => setState(() => showSearch = val), 156 | ), 157 | ), 158 | Flexible( 159 | child: SwitchListTile.adaptive( 160 | title: const Text('Show tooltips', 161 | style: TextStyle(color: Colors.white)), 162 | value: showTooltips, 163 | onChanged: (val) => setState(() => showTooltips = val), 164 | ), 165 | ), 166 | Flexible( 167 | child: SwitchListTile.adaptive( 168 | title: const Text('Adaptive dialog', 169 | style: TextStyle(color: Colors.white)), 170 | value: isAdaptive, 171 | onChanged: (val) => setState(() => isAdaptive = val), 172 | ), 173 | ), 174 | ], 175 | ), 176 | ), 177 | ); 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /example/linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "example") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.example.example") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | # Generated plugin build rules, which manage building the plugins and adding 90 | # them to the application. 91 | include(flutter/generated_plugins.cmake) 92 | 93 | 94 | # === Installation === 95 | # By default, "installing" just makes a relocatable bundle in the build 96 | # directory. 97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 100 | endif() 101 | 102 | # Start with a clean build bundle directory every time. 103 | install(CODE " 104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 105 | " COMPONENT Runtime) 106 | 107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 109 | 110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 111 | COMPONENT Runtime) 112 | 113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 114 | COMPONENT Runtime) 115 | 116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 117 | COMPONENT Runtime) 118 | 119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 120 | install(FILES "${bundled_library}" 121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 122 | COMPONENT Runtime) 123 | endforeach(bundled_library) 124 | 125 | # Fully re-copy the assets directory on each build to avoid having stale files 126 | # from a previous install. 127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 128 | install(CODE " 129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 130 | " COMPONENT Runtime) 131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 133 | 134 | # Install the AOT library on non-Debug builds only. 135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 137 | COMPONENT Runtime) 138 | endif() 139 | -------------------------------------------------------------------------------- /example/linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /example/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /example/linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "example"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "example"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /example/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /example/log.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/log.txt -------------------------------------------------------------------------------- /example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import path_provider_foundation 9 | 10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 11 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 12 | } 13 | -------------------------------------------------------------------------------- /example/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /example/macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - FlutterMacOS (1.0.0) 3 | - path_provider_foundation (0.0.1): 4 | - Flutter 5 | - FlutterMacOS 6 | 7 | DEPENDENCIES: 8 | - FlutterMacOS (from `Flutter/ephemeral`) 9 | - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos`) 10 | 11 | EXTERNAL SOURCES: 12 | FlutterMacOS: 13 | :path: Flutter/ephemeral 14 | path_provider_foundation: 15 | :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos 16 | 17 | SPEC CHECKSUMS: 18 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 19 | path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852 20 | 21 | PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 22 | 23 | COCOAPODS: 1.11.3 24 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: fluttericonpickerexample 2 | description: A new Flutter project. 3 | publish_to: "none" 4 | 5 | version: 1.0.0+1 6 | 7 | environment: 8 | sdk: ">=3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | flutter_iconpicker: 14 | path: ../ 15 | hive: ^2.2.3 16 | path_provider: ^2.1.2 17 | provider: ^6.1.2 18 | 19 | dev_dependencies: 20 | flutter_test: 21 | sdk: flutter 22 | flutter_lints: ^2.0.1 23 | 24 | flutter: 25 | uses-material-design: true 26 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter_test/flutter_test.dart'; 9 | 10 | void main() { 11 | testWidgets('example', (WidgetTester tester) async {}); 12 | } 13 | -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/web/favicon.png -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fluttericonpickerexample 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "minimal-ui", 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 | } 24 | -------------------------------------------------------------------------------- /example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /example/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(example 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 "example") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(SET CMP0063 NEW) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | # Generated plugin build rules, which manage building the plugins and adding 56 | # them to the application. 57 | include(flutter/generated_plugins.cmake) 58 | 59 | 60 | # === Installation === 61 | # Support files are copied into place next to the executable, so that it can 62 | # run in place. This is done instead of making a separate bundle (as on Linux) 63 | # so that building and running from within Visual Studio will work. 64 | set(BUILD_BUNDLE_DIR "$") 65 | # Make the "install" step default, as it's required to run. 66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 69 | endif() 70 | 71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 73 | 74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 75 | COMPONENT Runtime) 76 | 77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 78 | COMPONENT Runtime) 79 | 80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 81 | COMPONENT Runtime) 82 | 83 | if(PLUGIN_BUNDLED_LIBRARIES) 84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 86 | COMPONENT Runtime) 87 | endif() 88 | 89 | # Fully re-copy the assets directory on each build to avoid having stale files 90 | # from a previous install. 91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 92 | install(CODE " 93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 94 | " COMPONENT Runtime) 95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 97 | 98 | # Install the AOT library on non-Debug builds only. 99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 100 | CONFIGURATIONS Profile;Release 101 | COMPONENT Runtime) 102 | -------------------------------------------------------------------------------- /example/windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # Set fallback configurations for older versions of the flutter tool. 14 | if (NOT DEFINED FLUTTER_TARGET_PLATFORM) 15 | set(FLUTTER_TARGET_PLATFORM "windows-x64") 16 | endif() 17 | 18 | # === Flutter Library === 19 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 20 | 21 | # Published to parent scope for install step. 22 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 23 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 24 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 25 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 26 | 27 | list(APPEND FLUTTER_LIBRARY_HEADERS 28 | "flutter_export.h" 29 | "flutter_windows.h" 30 | "flutter_messenger.h" 31 | "flutter_plugin_registrar.h" 32 | "flutter_texture_registrar.h" 33 | ) 34 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 35 | add_library(flutter INTERFACE) 36 | target_include_directories(flutter INTERFACE 37 | "${EPHEMERAL_DIR}" 38 | ) 39 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 40 | add_dependencies(flutter flutter_assemble) 41 | 42 | # === Wrapper === 43 | list(APPEND CPP_WRAPPER_SOURCES_CORE 44 | "core_implementations.cc" 45 | "standard_codec.cc" 46 | ) 47 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 48 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 49 | "plugin_registrar.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 52 | list(APPEND CPP_WRAPPER_SOURCES_APP 53 | "flutter_engine.cc" 54 | "flutter_view_controller.cc" 55 | ) 56 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 57 | 58 | # Wrapper sources needed for a plugin. 59 | add_library(flutter_wrapper_plugin STATIC 60 | ${CPP_WRAPPER_SOURCES_CORE} 61 | ${CPP_WRAPPER_SOURCES_PLUGIN} 62 | ) 63 | apply_standard_settings(flutter_wrapper_plugin) 64 | set_target_properties(flutter_wrapper_plugin PROPERTIES 65 | POSITION_INDEPENDENT_CODE ON) 66 | set_target_properties(flutter_wrapper_plugin PROPERTIES 67 | CXX_VISIBILITY_PRESET hidden) 68 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 69 | target_include_directories(flutter_wrapper_plugin PUBLIC 70 | "${WRAPPER_ROOT}/include" 71 | ) 72 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 73 | 74 | # Wrapper sources needed for the runner. 75 | add_library(flutter_wrapper_app STATIC 76 | ${CPP_WRAPPER_SOURCES_CORE} 77 | ${CPP_WRAPPER_SOURCES_APP} 78 | ) 79 | apply_standard_settings(flutter_wrapper_app) 80 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 81 | target_include_directories(flutter_wrapper_app PUBLIC 82 | "${WRAPPER_ROOT}/include" 83 | ) 84 | add_dependencies(flutter_wrapper_app flutter_assemble) 85 | 86 | # === Flutter tool backend === 87 | # _phony_ is a non-existent file to force this command to run every time, 88 | # since currently there's no way to get a full input/output list from the 89 | # flutter tool. 90 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 91 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 92 | add_custom_command( 93 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 94 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 95 | ${CPP_WRAPPER_SOURCES_APP} 96 | ${PHONY_OUTPUT} 97 | COMMAND ${CMAKE_COMMAND} -E env 98 | ${FLUTTER_TOOL_ENVIRONMENT} 99 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 100 | ${FLUTTER_TARGET_PLATFORM} $ 101 | VERBATIM 102 | ) 103 | add_custom_target(flutter_assemble DEPENDS 104 | "${FLUTTER_LIBRARY}" 105 | ${FLUTTER_LIBRARY_HEADERS} 106 | ${CPP_WRAPPER_SOURCES_CORE} 107 | ${CPP_WRAPPER_SOURCES_PLUGIN} 108 | ${CPP_WRAPPER_SOURCES_APP} 109 | ) 110 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /example/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_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 37 | 38 | # Run the Flutter tool portions of the build. This must not be removed. 39 | add_dependencies(${BINARY_NAME} flutter_assemble) 40 | -------------------------------------------------------------------------------- /example/windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #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", "example" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "example" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "example.exe" "\0" 98 | VALUE "ProductName", "example" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /example/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /example/windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | 5 | #include "resource.h" 6 | 7 | namespace { 8 | 9 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 10 | 11 | // The number of Win32Window objects that currently exist. 12 | static int g_active_window_count = 0; 13 | 14 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 15 | 16 | // Scale helper to convert logical scaler values to physical using passed in 17 | // scale factor 18 | int Scale(int source, double scale_factor) { 19 | return static_cast(source * scale_factor); 20 | } 21 | 22 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 23 | // This API is only needed for PerMonitor V1 awareness mode. 24 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 25 | HMODULE user32_module = LoadLibraryA("User32.dll"); 26 | if (!user32_module) { 27 | return; 28 | } 29 | auto enable_non_client_dpi_scaling = 30 | reinterpret_cast( 31 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 32 | if (enable_non_client_dpi_scaling != nullptr) { 33 | enable_non_client_dpi_scaling(hwnd); 34 | FreeLibrary(user32_module); 35 | } 36 | } 37 | 38 | } // namespace 39 | 40 | // Manages the Win32Window's window class registration. 41 | class WindowClassRegistrar { 42 | public: 43 | ~WindowClassRegistrar() = default; 44 | 45 | // Returns the singleton registar instance. 46 | static WindowClassRegistrar* GetInstance() { 47 | if (!instance_) { 48 | instance_ = new WindowClassRegistrar(); 49 | } 50 | return instance_; 51 | } 52 | 53 | // Returns the name of the window class, registering the class if it hasn't 54 | // previously been registered. 55 | const wchar_t* GetWindowClass(); 56 | 57 | // Unregisters the window class. Should only be called if there are no 58 | // instances of the window. 59 | void UnregisterWindowClass(); 60 | 61 | private: 62 | WindowClassRegistrar() = default; 63 | 64 | static WindowClassRegistrar* instance_; 65 | 66 | bool class_registered_ = false; 67 | }; 68 | 69 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 70 | 71 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 72 | if (!class_registered_) { 73 | WNDCLASS window_class{}; 74 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 75 | window_class.lpszClassName = kWindowClassName; 76 | window_class.style = CS_HREDRAW | CS_VREDRAW; 77 | window_class.cbClsExtra = 0; 78 | window_class.cbWndExtra = 0; 79 | window_class.hInstance = GetModuleHandle(nullptr); 80 | window_class.hIcon = 81 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 82 | window_class.hbrBackground = 0; 83 | window_class.lpszMenuName = nullptr; 84 | window_class.lpfnWndProc = Win32Window::WndProc; 85 | RegisterClass(&window_class); 86 | class_registered_ = true; 87 | } 88 | return kWindowClassName; 89 | } 90 | 91 | void WindowClassRegistrar::UnregisterWindowClass() { 92 | UnregisterClass(kWindowClassName, nullptr); 93 | class_registered_ = false; 94 | } 95 | 96 | Win32Window::Win32Window() { 97 | ++g_active_window_count; 98 | } 99 | 100 | Win32Window::~Win32Window() { 101 | --g_active_window_count; 102 | Destroy(); 103 | } 104 | 105 | bool Win32Window::CreateAndShow(const std::wstring& title, 106 | const Point& origin, 107 | const Size& size) { 108 | Destroy(); 109 | 110 | const wchar_t* window_class = 111 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 112 | 113 | const POINT target_point = {static_cast(origin.x), 114 | static_cast(origin.y)}; 115 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 116 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 117 | double scale_factor = dpi / 96.0; 118 | 119 | HWND window = CreateWindow( 120 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, 121 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 122 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 123 | nullptr, nullptr, GetModuleHandle(nullptr), this); 124 | 125 | if (!window) { 126 | return false; 127 | } 128 | 129 | return OnCreate(); 130 | } 131 | 132 | // static 133 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 134 | UINT const message, 135 | WPARAM const wparam, 136 | LPARAM const lparam) noexcept { 137 | if (message == WM_NCCREATE) { 138 | auto window_struct = reinterpret_cast(lparam); 139 | SetWindowLongPtr(window, GWLP_USERDATA, 140 | reinterpret_cast(window_struct->lpCreateParams)); 141 | 142 | auto that = static_cast(window_struct->lpCreateParams); 143 | EnableFullDpiSupportIfAvailable(window); 144 | that->window_handle_ = window; 145 | } else if (Win32Window* that = GetThisFromHandle(window)) { 146 | return that->MessageHandler(window, message, wparam, lparam); 147 | } 148 | 149 | return DefWindowProc(window, message, wparam, lparam); 150 | } 151 | 152 | LRESULT 153 | Win32Window::MessageHandler(HWND hwnd, 154 | UINT const message, 155 | WPARAM const wparam, 156 | LPARAM const lparam) noexcept { 157 | switch (message) { 158 | case WM_DESTROY: 159 | window_handle_ = nullptr; 160 | Destroy(); 161 | if (quit_on_close_) { 162 | PostQuitMessage(0); 163 | } 164 | return 0; 165 | 166 | case WM_DPICHANGED: { 167 | auto newRectSize = reinterpret_cast(lparam); 168 | LONG newWidth = newRectSize->right - newRectSize->left; 169 | LONG newHeight = newRectSize->bottom - newRectSize->top; 170 | 171 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 172 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 173 | 174 | return 0; 175 | } 176 | case WM_SIZE: { 177 | RECT rect = GetClientArea(); 178 | if (child_content_ != nullptr) { 179 | // Size and position the child window. 180 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 181 | rect.bottom - rect.top, TRUE); 182 | } 183 | return 0; 184 | } 185 | 186 | case WM_ACTIVATE: 187 | if (child_content_ != nullptr) { 188 | SetFocus(child_content_); 189 | } 190 | return 0; 191 | } 192 | 193 | return DefWindowProc(window_handle_, message, wparam, lparam); 194 | } 195 | 196 | void Win32Window::Destroy() { 197 | OnDestroy(); 198 | 199 | if (window_handle_) { 200 | DestroyWindow(window_handle_); 201 | window_handle_ = nullptr; 202 | } 203 | if (g_active_window_count == 0) { 204 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 205 | } 206 | } 207 | 208 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 209 | return reinterpret_cast( 210 | GetWindowLongPtr(window, GWLP_USERDATA)); 211 | } 212 | 213 | void Win32Window::SetChildContent(HWND content) { 214 | child_content_ = content; 215 | SetParent(content, window_handle_); 216 | RECT frame = GetClientArea(); 217 | 218 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 219 | frame.bottom - frame.top, true); 220 | 221 | SetFocus(child_content_); 222 | } 223 | 224 | RECT Win32Window::GetClientArea() { 225 | RECT frame; 226 | GetClientRect(window_handle_, &frame); 227 | return frame; 228 | } 229 | 230 | HWND Win32Window::GetHandle() { 231 | return window_handle_; 232 | } 233 | 234 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 235 | quit_on_close_ = quit_on_close; 236 | } 237 | 238 | bool Win32Window::OnCreate() { 239 | // No-op; provided for subclasses. 240 | return true; 241 | } 242 | 243 | void Win32Window::OnDestroy() { 244 | // No-op; provided for subclasses. 245 | } 246 | -------------------------------------------------------------------------------- /example/windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | -------------------------------------------------------------------------------- /fonts/LineAwesome.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/fonts/LineAwesome.ttf -------------------------------------------------------------------------------- /fonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/fonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /fonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/fonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /fonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahmadre/FlutterIconPicker/a37d220c7da4ac05c72a5d698d726a21eff2f7cb/fonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /lib/Dialogs/adaptive_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class AdaptiveDialog extends StatelessWidget { 4 | const AdaptiveDialog({ 5 | super.key, 6 | required this.child, 7 | required this.constraints, 8 | required this.shape, 9 | }); 10 | 11 | final Widget child; 12 | final BoxConstraints? constraints; 13 | final ShapeBorder? shape; 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return LayoutBuilder( 18 | builder: (context, dimens) { 19 | if (dimens.maxWidth < constraints!.maxWidth || 20 | dimens.maxHeight < constraints!.maxHeight) { 21 | return child; 22 | } 23 | return Center( 24 | child: ConstrainedBox( 25 | constraints: constraints!, 26 | child: Dialog( 27 | clipBehavior: Clip.antiAliasWithSaveLayer, 28 | shape: shape, 29 | child: child, 30 | ), 31 | ), 32 | ); 33 | }, 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/Dialogs/default_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_iconpicker/controllers/icon_controller.dart'; 3 | import 'package:provider/provider.dart'; 4 | import '../IconPicker/multiple_icon_picker.dart'; 5 | import '../Models/icon_picker_icon.dart'; 6 | import 'fullscreen_dialog.dart'; 7 | import 'adaptive_dialog.dart'; 8 | import '../Helpers/color_brightness.dart'; 9 | import '../IconPicker/icon_picker.dart'; 10 | import '../IconPicker/search_bar.dart'; 11 | import '../Models/icon_pack.dart'; 12 | 13 | class FIPDefaultDialog extends StatelessWidget { 14 | const FIPDefaultDialog({ 15 | super.key, 16 | required this.controller, 17 | this.selectedIconBackgroundColor, 18 | this.showSearchBar, 19 | this.routedView = false, 20 | this.adaptive = false, 21 | this.showTooltips, 22 | this.barrierDismissible, 23 | this.iconSize, 24 | this.iconColor, 25 | this.mainAxisSpacing, 26 | this.crossAxisSpacing, 27 | this.iconPickerShape, 28 | this.backgroundColor, 29 | this.constraints, 30 | this.title, 31 | this.closeChild, 32 | this.searchIcon, 33 | this.searchHintText, 34 | this.searchClearIcon, 35 | this.searchComparator, 36 | this.noResultsText, 37 | this.iconPackMode, 38 | this.customIconPack, 39 | }); 40 | 41 | final FIPIconController controller; 42 | final Color? selectedIconBackgroundColor; 43 | final bool? showSearchBar; 44 | final bool routedView; 45 | final bool adaptive; 46 | final bool? showTooltips; 47 | final bool? barrierDismissible; 48 | final double? iconSize; 49 | final Color? iconColor; 50 | final double? mainAxisSpacing; 51 | final double? crossAxisSpacing; 52 | final ShapeBorder? iconPickerShape; 53 | final Color? backgroundColor; 54 | final BoxConstraints? constraints; 55 | final Widget? title; 56 | final Widget? closeChild; 57 | final Icon? searchIcon; 58 | final String? searchHintText; 59 | final Icon? searchClearIcon; 60 | final SearchComparator? searchComparator; 61 | final String? noResultsText; 62 | final List? iconPackMode; 63 | final Map? customIconPack; 64 | 65 | @override 66 | Widget build(BuildContext context) { 67 | return ChangeNotifierProvider.value( 68 | value: controller, 69 | builder: (ctx, w) { 70 | if (adaptive) { 71 | if (routedView) { 72 | return FIPFullScreenDialog( 73 | iconController: controller, 74 | selectedIconBackgroundColor: selectedIconBackgroundColor, 75 | showSearchBar: showSearchBar, 76 | showTooltips: showTooltips, 77 | backgroundColor: backgroundColor, 78 | title: title, 79 | iconPackMode: iconPackMode, 80 | customIconPack: customIconPack, 81 | searchIcon: searchIcon, 82 | searchClearIcon: searchClearIcon, 83 | searchHintText: searchHintText, 84 | iconColor: iconColor, 85 | noResultsText: noResultsText, 86 | iconSize: iconSize, 87 | mainAxisSpacing: mainAxisSpacing, 88 | crossAxisSpacing: crossAxisSpacing, 89 | searchComparator: searchComparator, 90 | ); 91 | } 92 | return AdaptiveDialog( 93 | constraints: constraints, 94 | shape: iconPickerShape, 95 | child: Scaffold( 96 | backgroundColor: backgroundColor, 97 | body: Padding( 98 | padding: const EdgeInsets.only( 99 | top: 10, 100 | bottom: 20, 101 | left: 20, 102 | right: 20, 103 | ), 104 | child: Column( 105 | children: [ 106 | SizedBox( 107 | height: kToolbarHeight, 108 | child: Row( 109 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 110 | children: [ 111 | Padding( 112 | padding: const EdgeInsets.only(left: 6), 113 | child: title!, 114 | ), 115 | IconButton( 116 | icon: Icon(Icons.close), 117 | onPressed: () => Navigator.pop(context), 118 | ), 119 | ], 120 | ), 121 | ), 122 | if (showSearchBar!) 123 | FIPSearchBar( 124 | iconController: controller, 125 | iconPack: iconPackMode, 126 | customIconPack: customIconPack, 127 | searchIcon: searchIcon, 128 | searchClearIcon: searchClearIcon, 129 | searchHintText: searchHintText, 130 | backgroundColor: backgroundColor, 131 | searchComparator: searchComparator, 132 | ), 133 | Expanded( 134 | child: controller.isMultiple 135 | ? FIPMultipleIconPicker( 136 | iconController: controller, 137 | selectedIconBackgroundColor: 138 | selectedIconBackgroundColor, 139 | showTooltips: showTooltips, 140 | iconPack: iconPackMode, 141 | customIconPack: customIconPack, 142 | iconColor: iconColor, 143 | backgroundColor: backgroundColor, 144 | noResultsText: noResultsText, 145 | iconSize: iconSize, 146 | mainAxisSpacing: mainAxisSpacing, 147 | crossAxisSpacing: crossAxisSpacing, 148 | ) 149 | : FIPIconPicker( 150 | iconController: controller, 151 | selectedIconBackgroundColor: 152 | selectedIconBackgroundColor, 153 | showTooltips: showTooltips, 154 | iconPack: iconPackMode, 155 | customIconPack: customIconPack, 156 | iconColor: iconColor, 157 | backgroundColor: backgroundColor, 158 | noResultsText: noResultsText, 159 | iconSize: iconSize, 160 | mainAxisSpacing: mainAxisSpacing, 161 | crossAxisSpacing: crossAxisSpacing, 162 | ), 163 | ), 164 | ], 165 | ), 166 | ), 167 | ), 168 | ); 169 | } else { 170 | return AlertDialog( 171 | backgroundColor: backgroundColor, 172 | shape: iconPickerShape, 173 | title: DefaultTextStyle( 174 | style: TextStyle( 175 | color: backgroundColor != null 176 | ? FIPColorBrightness(backgroundColor!).isLight() 177 | ? Colors.black 178 | : Colors.white 179 | : null, 180 | fontSize: 20, 181 | ), 182 | child: title!, 183 | ), 184 | content: Container( 185 | constraints: constraints, 186 | child: Column( 187 | children: [ 188 | if (showSearchBar!) 189 | FIPSearchBar( 190 | iconController: controller, 191 | iconPack: iconPackMode, 192 | customIconPack: customIconPack, 193 | searchIcon: searchIcon, 194 | searchClearIcon: searchClearIcon, 195 | searchHintText: searchHintText, 196 | backgroundColor: backgroundColor, 197 | searchComparator: searchComparator, 198 | ), 199 | Expanded( 200 | child: controller.isMultiple 201 | ? FIPMultipleIconPicker( 202 | iconController: controller, 203 | selectedIconBackgroundColor: 204 | selectedIconBackgroundColor, 205 | showTooltips: showTooltips, 206 | iconPack: iconPackMode, 207 | customIconPack: customIconPack, 208 | iconColor: iconColor, 209 | backgroundColor: backgroundColor, 210 | noResultsText: noResultsText, 211 | iconSize: iconSize, 212 | mainAxisSpacing: mainAxisSpacing, 213 | crossAxisSpacing: crossAxisSpacing, 214 | ) 215 | : FIPIconPicker( 216 | iconController: controller, 217 | selectedIconBackgroundColor: 218 | selectedIconBackgroundColor, 219 | showTooltips: showTooltips, 220 | iconPack: iconPackMode, 221 | customIconPack: customIconPack, 222 | iconColor: iconColor, 223 | backgroundColor: backgroundColor, 224 | noResultsText: noResultsText, 225 | iconSize: iconSize, 226 | mainAxisSpacing: mainAxisSpacing, 227 | crossAxisSpacing: crossAxisSpacing, 228 | ), 229 | ), 230 | ], 231 | ), 232 | ), 233 | actions: [ 234 | TextButton( 235 | style: ButtonStyle( 236 | padding: WidgetStateProperty.all( 237 | const EdgeInsets.symmetric(horizontal: 20), 238 | ), 239 | ), 240 | onPressed: () => Navigator.of(context).pop(), 241 | child: closeChild!, 242 | ), 243 | ], 244 | ); 245 | } 246 | }, 247 | ); 248 | } 249 | } 250 | -------------------------------------------------------------------------------- /lib/Dialogs/fullscreen_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_iconpicker/controllers/icon_controller.dart'; 3 | import '../IconPicker/icon_picker.dart'; 4 | import '../IconPicker/multiple_icon_picker.dart'; 5 | import '../IconPicker/search_bar.dart'; 6 | import '../Models/icon_pack.dart'; 7 | import '../Models/icon_picker_icon.dart'; 8 | 9 | class FIPFullScreenDialog extends StatelessWidget { 10 | const FIPFullScreenDialog({ 11 | super.key, 12 | required this.iconController, 13 | required this.showSearchBar, 14 | required this.showTooltips, 15 | required this.backgroundColor, 16 | required this.title, 17 | required this.iconPackMode, 18 | required this.customIconPack, 19 | required this.searchIcon, 20 | required this.searchClearIcon, 21 | required this.searchComparator, 22 | required this.searchHintText, 23 | required this.iconColor, 24 | required this.noResultsText, 25 | required this.iconSize, 26 | required this.mainAxisSpacing, 27 | required this.crossAxisSpacing, 28 | this.selectedIconBackgroundColor, 29 | }); 30 | 31 | final FIPIconController iconController; 32 | final Color? selectedIconBackgroundColor; 33 | final bool? showSearchBar; 34 | final bool? showTooltips; 35 | final Color? backgroundColor; 36 | final Widget? title; 37 | final List? iconPackMode; 38 | final Map? customIconPack; 39 | final Icon? searchIcon; 40 | final Icon? searchClearIcon; 41 | final SearchComparator? searchComparator; 42 | final String? searchHintText; 43 | final Color? iconColor; 44 | final String? noResultsText; 45 | final double? iconSize; 46 | final double? mainAxisSpacing; 47 | final double? crossAxisSpacing; 48 | 49 | @override 50 | Widget build(BuildContext context) { 51 | return Scaffold( 52 | backgroundColor: backgroundColor, 53 | body: SafeArea( 54 | child: Padding( 55 | padding: const EdgeInsets.only( 56 | top: 10, 57 | bottom: 20, 58 | left: 20, 59 | right: 20, 60 | ), 61 | child: Column( 62 | children: [ 63 | SizedBox( 64 | height: kToolbarHeight, 65 | child: Row( 66 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 67 | children: [ 68 | Padding( 69 | padding: const EdgeInsets.only(left: 6), 70 | child: title!, 71 | ), 72 | IconButton( 73 | icon: Icon(Icons.close), 74 | onPressed: () => Navigator.pop(context), 75 | ), 76 | ], 77 | ), 78 | ), 79 | if (showSearchBar!) 80 | FIPSearchBar( 81 | iconController: iconController, 82 | iconPack: iconPackMode, 83 | customIconPack: customIconPack, 84 | searchIcon: searchIcon, 85 | searchClearIcon: searchClearIcon, 86 | searchHintText: searchHintText, 87 | backgroundColor: backgroundColor, 88 | searchComparator: searchComparator, 89 | ), 90 | Expanded( 91 | child: iconController.isMultiple 92 | ? FIPMultipleIconPicker( 93 | iconController: iconController, 94 | selectedIconBackgroundColor: 95 | selectedIconBackgroundColor, 96 | showTooltips: showTooltips, 97 | iconPack: iconPackMode, 98 | customIconPack: customIconPack, 99 | iconColor: iconColor, 100 | backgroundColor: backgroundColor, 101 | noResultsText: noResultsText, 102 | iconSize: iconSize, 103 | mainAxisSpacing: mainAxisSpacing, 104 | crossAxisSpacing: crossAxisSpacing, 105 | ) 106 | : FIPIconPicker( 107 | iconController: iconController, 108 | selectedIconBackgroundColor: 109 | selectedIconBackgroundColor, 110 | showTooltips: showTooltips, 111 | iconPack: iconPackMode, 112 | customIconPack: customIconPack, 113 | iconColor: iconColor, 114 | backgroundColor: backgroundColor, 115 | noResultsText: noResultsText, 116 | iconSize: iconSize, 117 | mainAxisSpacing: mainAxisSpacing, 118 | crossAxisSpacing: crossAxisSpacing, 119 | ), 120 | ), 121 | ], 122 | ), 123 | ), 124 | ), 125 | ); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /lib/Helpers/color_brightness.dart: -------------------------------------------------------------------------------- 1 | // General Notice: 2 | // A port of [tinycolor2](https://github.com/bgrins/TinyColor) by [Brian Grinstead](https://github.com/bgrins) 3 | // 4 | // Copyright (c), Brian Grinstead, http://briangrinstead.com 5 | 6 | // Permission is hereby granted, free of charge, to any person obtaining 7 | // a copy of this software and associated documentation files (the 8 | // "Software"), to deal in the Software without restriction, including 9 | // without limitation the rights to use, copy, modify, merge, publish, 10 | // distribute, sublicense, and/or sell copies of the Software, and to 11 | // permit persons to whom the Software is furnished to do so, subject to 12 | // the following conditions: 13 | 14 | // The above copyright notice and this permission notice shall be 15 | // included in all copies or substantial portions of the Software. 16 | 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | // Dart/Flutter Reference: 26 | // tinycolor: [https://pub.dev/packages/tinycolor](https://pub.dev/packages/tinycolor) 27 | // Copyright 2018 Foo Studio 28 | 29 | // Permission is hereby granted, free of charge, to any person obtaining 30 | // a copy of this software and associated documentation files (the 31 | // "Software"), to deal in the Software without restriction, including 32 | // without limitation the rights to use, copy, modify, merge, publish, 33 | // distribute, sublicense, and/or sell copies of the Software, and to 34 | // permit persons to whom the Software is furnished to do so, subject to 35 | // the following conditions: 36 | 37 | // The above copyright notice and this permission notice shall be 38 | // included in all copies or substantial portions of the Software. 39 | 40 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 41 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 42 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 43 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 44 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 45 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 46 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 47 | 48 | import 'package:flutter/material.dart'; 49 | 50 | class FIPColorBrightness { 51 | late Color _color; 52 | 53 | FIPColorBrightness(Color color) { 54 | _color = 55 | Color.from(alpha: color.a, red: color.r, green: color.g, blue: color.b); 56 | } 57 | 58 | bool isDark() { 59 | return getBrightness() < 128.0; 60 | } 61 | 62 | bool isLight() { 63 | return !isDark(); 64 | } 65 | 66 | double getBrightness() { 67 | return (_color.r * 299 + _color.g * 587 + _color.b * 114) / 1000; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/Helpers/icon_pack_manager.dart: -------------------------------------------------------------------------------- 1 | import '../Models/icon_pack.dart'; 2 | import '../Models/icon_picker_icon.dart'; 3 | import '../IconPicker/Packs/Cupertino.dart'; 4 | import '../IconPicker/Packs/Material.dart'; 5 | import '../IconPicker/Packs/MaterialDefault.dart'; 6 | import '../IconPicker/Packs/MaterialOutlined.dart'; 7 | import '../IconPicker/Packs/MaterialRounded.dart'; 8 | import '../IconPicker/Packs/MaterialSharp.dart'; 9 | import '../IconPicker/Packs/FontAwesome.dart'; 10 | import '../IconPicker/Packs/LineIcons.dart'; 11 | 12 | class IconPackManager { 13 | static Map getIcons(IconPack? pack) { 14 | switch (pack) { 15 | case IconPack.material: 16 | return defaultIcons; 17 | case IconPack.allMaterial: 18 | return allIcons; 19 | case IconPack.lineAwesomeIcons: 20 | return lineAwesomeIcons; 21 | case IconPack.fontAwesomeIcons: 22 | return fontAwesomeIcons; 23 | case IconPack.sharpMaterial: 24 | return sharpIcons; 25 | case IconPack.outlinedMaterial: 26 | return outlinedIcons; 27 | case IconPack.roundedMaterial: 28 | return roundedIcons; 29 | case IconPack.cupertino: 30 | return cupertinoIcons; 31 | default: 32 | return {}; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/IconPicker/Packs/Cupertino.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 6 | 7 | const Map cupertinoIcons = {}; 8 | -------------------------------------------------------------------------------- /lib/IconPicker/Packs/FontAwesome.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 2 | 3 | const Map fontAwesomeIcons = {}; 4 | -------------------------------------------------------------------------------- /lib/IconPicker/Packs/LineIcons.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 2 | 3 | const Map lineAwesomeIcons = {}; 4 | -------------------------------------------------------------------------------- /lib/IconPicker/Packs/Material.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 2 | 3 | const Map allIcons = {}; 4 | -------------------------------------------------------------------------------- /lib/IconPicker/Packs/MaterialDefault.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 2 | 3 | const Map defaultIcons = {}; 4 | -------------------------------------------------------------------------------- /lib/IconPicker/Packs/MaterialOutlined.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 2 | 3 | const Map outlinedIcons = {}; 4 | -------------------------------------------------------------------------------- /lib/IconPicker/Packs/MaterialRounded.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 2 | 3 | const Map roundedIcons = {}; 4 | -------------------------------------------------------------------------------- /lib/IconPicker/Packs/MaterialSharp.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 2 | 3 | const Map sharpIcons = {}; 4 | -------------------------------------------------------------------------------- /lib/IconPicker/icon_picker.dart: -------------------------------------------------------------------------------- 1 | /// IconPicker 2 | /// Author Rebar Ahmad 3 | /// https://github.com/Ahmadre 4 | /// rebar.ahmad@gmail.com 5 | 6 | import 'dart:async'; 7 | 8 | import 'package:collection/collection.dart'; 9 | import 'package:flutter/material.dart'; 10 | import 'package:flutter_iconpicker/Helpers/icon_pack_manager.dart'; 11 | import 'package:flutter_iconpicker/controllers/icon_controller.dart'; 12 | import 'package:provider/provider.dart'; 13 | import 'package:scrollview_observer/scrollview_observer.dart'; 14 | import '../Models/icon_picker_icon.dart'; 15 | import '../Models/icon_pack.dart'; 16 | import '../Helpers/color_brightness.dart'; 17 | 18 | class FIPIconPicker extends StatefulWidget { 19 | final FIPIconController iconController; 20 | final Color? selectedIconBackgroundColor; 21 | final List? iconPack; 22 | final Map? customIconPack; 23 | final double? iconSize; 24 | final Color? iconColor; 25 | final String? noResultsText; 26 | final double? mainAxisSpacing; 27 | final double? crossAxisSpacing; 28 | final Color? backgroundColor; 29 | final bool? showTooltips; 30 | 31 | const FIPIconPicker({ 32 | super.key, 33 | required this.iconController, 34 | required this.iconPack, 35 | required this.iconSize, 36 | required this.noResultsText, 37 | required this.backgroundColor, 38 | this.selectedIconBackgroundColor, 39 | this.mainAxisSpacing, 40 | this.crossAxisSpacing, 41 | this.iconColor, 42 | this.showTooltips, 43 | this.customIconPack, 44 | }); 45 | 46 | @override 47 | _FIPIconPickerState createState() => _FIPIconPickerState(); 48 | } 49 | 50 | class _FIPIconPickerState extends State { 51 | ScrollController scrollController = ScrollController(); 52 | late GridObserverController observerController = 53 | GridObserverController(controller: scrollController); 54 | 55 | bool scrolledToSelectedIcon = false; 56 | int selectedIconIndex = -1; 57 | 58 | @override 59 | void initState() { 60 | super.initState(); 61 | 62 | WidgetsBinding.instance.addPostFrameCallback((_) async { 63 | if (widget.customIconPack != null) { 64 | if (mounted) widget.iconController.addAll(widget.customIconPack ?? {}); 65 | } 66 | 67 | if (widget.iconPack != null) { 68 | for (var pack in widget.iconPack!) { 69 | if (mounted) { 70 | widget.iconController.addAll(IconPackManager.getIcons(pack)); 71 | } 72 | } 73 | if (mounted && 74 | !scrolledToSelectedIcon && 75 | widget.iconController.shouldScrollToSelectedIcon && 76 | widget.iconController.isSelectedIconAvailable && 77 | widget.iconController.entries.firstWhereOrNull((item) => 78 | widget.iconController.selectedIcon == item.value) != 79 | null) { 80 | Timer.periodic(const Duration(milliseconds: 100), (timer) async { 81 | if (scrollController.hasClients) { 82 | scrolledToSelectedIcon = true; 83 | selectedIconIndex = widget.iconController.entries 84 | .toList() 85 | .indexWhere((item) => 86 | widget.iconController.selectedIcon == item.value); 87 | setState(() {}); 88 | await observerController.jumpTo( 89 | index: selectedIconIndex, 90 | offset: (_) => 24, 91 | ); 92 | timer.cancel(); 93 | } 94 | }); 95 | } 96 | } 97 | }); 98 | } 99 | 100 | Widget _getListEmptyMsg() => Container( 101 | alignment: Alignment.topCenter, 102 | child: Padding( 103 | padding: const EdgeInsets.only(top: 10), 104 | child: RichText( 105 | text: TextSpan( 106 | text: '${widget.noResultsText!} ', 107 | style: TextStyle( 108 | color: widget.backgroundColor != null 109 | ? FIPColorBrightness(widget.backgroundColor!).isLight() 110 | ? Colors.black 111 | : Colors.white 112 | : null, 113 | ), 114 | children: [ 115 | TextSpan( 116 | text: widget.iconController.searchTextController.text, 117 | style: TextStyle( 118 | fontWeight: FontWeight.bold, 119 | color: widget.backgroundColor != null 120 | ? FIPColorBrightness(widget.backgroundColor!).isLight() 121 | ? Colors.black 122 | : Colors.white 123 | : null, 124 | ), 125 | ), 126 | ], 127 | ), 128 | ), 129 | ), 130 | ); 131 | 132 | @override 133 | Widget build(BuildContext context) { 134 | return Consumer( 135 | builder: (ctx, controller, _) => Padding( 136 | padding: const EdgeInsets.only(top: 5), 137 | child: Stack( 138 | children: [ 139 | if (controller.icons.isEmpty) 140 | _getListEmptyMsg() 141 | else 142 | Positioned.fill( 143 | child: GridViewObserver( 144 | controller: observerController, 145 | child: GridView.builder( 146 | controller: scrollController, 147 | itemCount: controller.length, 148 | gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( 149 | childAspectRatio: 1 / 1, 150 | mainAxisSpacing: widget.mainAxisSpacing ?? 5, 151 | crossAxisSpacing: widget.crossAxisSpacing ?? 5, 152 | maxCrossAxisExtent: widget.iconSize != null 153 | ? widget.iconSize! + 10 154 | : 50, 155 | ), 156 | itemBuilder: (context, index) { 157 | final MapEntry item = 158 | controller.entries.elementAt(index); 159 | 160 | final isSelected = widget 161 | .iconController.isSelectedIconAvailable && 162 | widget.iconController.selectedIcon! == item.value; 163 | 164 | if (controller.iconBuilder != null) { 165 | return controller.iconBuilder!( 166 | context, 167 | item.value, 168 | isSelected, 169 | controller.onTapIcon, 170 | ); 171 | } 172 | 173 | final selectedIconColor = 174 | widget.selectedIconBackgroundColor ?? 175 | (Theme.of(context).brightness == Brightness.dark 176 | ? Colors.grey[800] 177 | : Colors.grey[400]); 178 | 179 | return ClipRRect( 180 | borderRadius: BorderRadius.circular(8), 181 | child: Container( 182 | color: isSelected ? selectedIconColor : null, 183 | child: GestureDetector( 184 | onTap: () => controller.onTapIcon( 185 | item.value, 186 | onSelected: () => 187 | Navigator.pop(context, item.value), 188 | ), 189 | child: widget.showTooltips! 190 | ? Tooltip( 191 | message: item.key, 192 | child: Icon( 193 | item.value.data, 194 | size: widget.iconSize, 195 | color: widget.iconColor, 196 | ), 197 | ) 198 | : Icon( 199 | item.value.data, 200 | size: widget.iconSize, 201 | color: widget.iconColor, 202 | ), 203 | ), 204 | ), 205 | ); 206 | }), 207 | ), 208 | ), 209 | IgnorePointer( 210 | child: Container( 211 | decoration: BoxDecoration( 212 | gradient: LinearGradient( 213 | begin: Alignment.topCenter, 214 | end: Alignment.lerp( 215 | Alignment.topCenter, Alignment.center, .05)!, 216 | colors: [ 217 | widget.backgroundColor ?? 218 | Theme.of(context).dialogTheme.backgroundColor ?? 219 | Theme.of(context).scaffoldBackgroundColor, 220 | (widget.backgroundColor ?? 221 | Theme.of(context).dialogTheme.backgroundColor ?? 222 | Theme.of(context).scaffoldBackgroundColor) 223 | .withValues(alpha: .1), 224 | ], 225 | stops: const [ 226 | 0.0, 227 | 1.0 228 | ]), 229 | ), 230 | child: Container(), 231 | ), 232 | ), 233 | IgnorePointer( 234 | child: Container( 235 | decoration: BoxDecoration( 236 | gradient: LinearGradient( 237 | begin: Alignment.bottomCenter, 238 | end: Alignment.lerp( 239 | Alignment.bottomCenter, Alignment.center, .05)!, 240 | colors: [ 241 | widget.backgroundColor ?? 242 | Theme.of(context).dialogTheme.backgroundColor ?? 243 | Theme.of(context).scaffoldBackgroundColor, 244 | (widget.backgroundColor ?? 245 | Theme.of(context).dialogTheme.backgroundColor ?? 246 | Theme.of(context).scaffoldBackgroundColor) 247 | .withValues(alpha: .1), 248 | ], 249 | stops: const [ 250 | 0.0, 251 | 1.0 252 | ]), 253 | ), 254 | child: Container(), 255 | ), 256 | ), 257 | ], 258 | ), 259 | ), 260 | ); 261 | } 262 | } 263 | -------------------------------------------------------------------------------- /lib/IconPicker/multiple_icon_picker.dart: -------------------------------------------------------------------------------- 1 | /// IconPicker 2 | /// Author Rebar Ahmad 3 | /// https://github.com/Ahmadre 4 | /// rebar.ahmad@gmail.com 5 | 6 | import 'dart:async'; 7 | 8 | import 'package:collection/collection.dart'; 9 | import 'package:flutter/material.dart'; 10 | import 'package:flutter_iconpicker/Helpers/icon_pack_manager.dart'; 11 | import 'package:flutter_iconpicker/controllers/icon_controller.dart'; 12 | import 'package:provider/provider.dart'; 13 | import 'package:scrollview_observer/scrollview_observer.dart'; 14 | import '../Models/icon_picker_icon.dart'; 15 | import '../Models/icon_pack.dart'; 16 | import '../Helpers/color_brightness.dart'; 17 | 18 | class FIPMultipleIconPicker extends StatefulWidget { 19 | final FIPIconController iconController; 20 | final Color? selectedIconBackgroundColor; 21 | final List? iconPack; 22 | final Map? customIconPack; 23 | final double? iconSize; 24 | final Color? iconColor; 25 | final String? noResultsText; 26 | final double? mainAxisSpacing; 27 | final double? crossAxisSpacing; 28 | final Color? backgroundColor; 29 | final bool? showTooltips; 30 | 31 | const FIPMultipleIconPicker({ 32 | super.key, 33 | required this.iconController, 34 | required this.iconPack, 35 | required this.iconSize, 36 | required this.noResultsText, 37 | required this.backgroundColor, 38 | this.selectedIconBackgroundColor, 39 | this.mainAxisSpacing, 40 | this.crossAxisSpacing, 41 | this.iconColor, 42 | this.showTooltips, 43 | this.customIconPack, 44 | }); 45 | 46 | @override 47 | FIPMultipleIconPickerState createState() => FIPMultipleIconPickerState(); 48 | } 49 | 50 | class FIPMultipleIconPickerState extends State { 51 | ScrollController scrollController = ScrollController(); 52 | late GridObserverController observerController = 53 | GridObserverController(controller: scrollController); 54 | 55 | bool scrolledToSelectedIcon = false; 56 | int selectedIconIndex = -1; 57 | 58 | @override 59 | void initState() { 60 | super.initState(); 61 | 62 | WidgetsBinding.instance.addPostFrameCallback((_) async { 63 | if (widget.customIconPack != null) { 64 | if (mounted) widget.iconController.addAll(widget.customIconPack ?? {}); 65 | } 66 | 67 | if (widget.iconPack != null) { 68 | for (var pack in widget.iconPack!) { 69 | if (mounted) { 70 | widget.iconController.addAll(IconPackManager.getIcons(pack)); 71 | } 72 | } 73 | if (mounted && 74 | !scrolledToSelectedIcon && 75 | widget.iconController.shouldScrollToSelectedIcon && 76 | widget.iconController.isSelectedIconAvailable && 77 | widget.iconController.entries.firstWhereOrNull((item) => 78 | widget.iconController.selectedIcon == item.value) != 79 | null) { 80 | Timer.periodic(const Duration(milliseconds: 100), (timer) async { 81 | if (scrollController.hasClients) { 82 | scrolledToSelectedIcon = true; 83 | selectedIconIndex = widget.iconController.entries 84 | .toList() 85 | .indexWhere((item) => 86 | widget.iconController.selectedIcon == item.value); 87 | setState(() {}); 88 | await observerController.jumpTo( 89 | index: selectedIconIndex, 90 | offset: (_) => 24, 91 | ); 92 | timer.cancel(); 93 | } 94 | }); 95 | } 96 | } 97 | }); 98 | } 99 | 100 | Widget _getListEmptyMsg() => Container( 101 | alignment: Alignment.topCenter, 102 | child: Padding( 103 | padding: const EdgeInsets.only(top: 10), 104 | child: RichText( 105 | text: TextSpan( 106 | text: '${widget.noResultsText!} ', 107 | style: TextStyle( 108 | color: widget.backgroundColor != null 109 | ? FIPColorBrightness(widget.backgroundColor!).isLight() 110 | ? Colors.black 111 | : Colors.white 112 | : null, 113 | ), 114 | children: [ 115 | TextSpan( 116 | text: widget.iconController.searchTextController.text, 117 | style: TextStyle( 118 | fontWeight: FontWeight.bold, 119 | color: widget.backgroundColor != null 120 | ? FIPColorBrightness(widget.backgroundColor!).isLight() 121 | ? Colors.black 122 | : Colors.white 123 | : null, 124 | ), 125 | ), 126 | ], 127 | ), 128 | ), 129 | ), 130 | ); 131 | 132 | @override 133 | Widget build(BuildContext context) { 134 | return Consumer( 135 | builder: (ctx, controller, _) => Padding( 136 | padding: const EdgeInsets.only(top: 5), 137 | child: Stack( 138 | children: [ 139 | if (controller.icons.isEmpty) 140 | _getListEmptyMsg() 141 | else 142 | Positioned.fill( 143 | child: GridViewObserver( 144 | controller: observerController, 145 | child: GridView.builder( 146 | controller: scrollController, 147 | itemCount: controller.length, 148 | gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( 149 | childAspectRatio: 1 / 1, 150 | mainAxisSpacing: widget.mainAxisSpacing ?? 5, 151 | crossAxisSpacing: widget.crossAxisSpacing ?? 5, 152 | maxCrossAxisExtent: widget.iconSize != null 153 | ? widget.iconSize! + 10 154 | : 50, 155 | ), 156 | itemBuilder: (context, index) { 157 | final MapEntry item = 158 | controller.entries.elementAt(index); 159 | 160 | final isSelected = widget.iconController.selectedIcons 161 | .contains(item.value); 162 | 163 | if (controller.iconBuilder != null) { 164 | return controller.iconBuilder!( 165 | context, 166 | item.value, 167 | isSelected, 168 | controller.onTapIcon, 169 | ); 170 | } 171 | 172 | final selectedIconColor = 173 | widget.selectedIconBackgroundColor ?? 174 | (Theme.of(context).brightness == Brightness.dark 175 | ? Colors.grey[800] 176 | : Colors.grey[400]); 177 | 178 | return ClipRRect( 179 | borderRadius: BorderRadius.circular(8), 180 | child: Container( 181 | color: isSelected ? selectedIconColor : null, 182 | child: GestureDetector( 183 | onTap: () => controller.onTapIcon(item.value), 184 | child: widget.showTooltips! 185 | ? Tooltip( 186 | message: item.key, 187 | child: Icon( 188 | item.value.data, 189 | size: widget.iconSize, 190 | color: widget.iconColor, 191 | ), 192 | ) 193 | : Icon( 194 | item.value.data, 195 | size: widget.iconSize, 196 | color: widget.iconColor, 197 | ), 198 | ), 199 | ), 200 | ); 201 | }), 202 | ), 203 | ), 204 | IgnorePointer( 205 | child: Container( 206 | decoration: BoxDecoration( 207 | gradient: LinearGradient( 208 | begin: Alignment.topCenter, 209 | end: Alignment.lerp( 210 | Alignment.topCenter, Alignment.center, .05)!, 211 | colors: [ 212 | widget.backgroundColor!, 213 | widget.backgroundColor!.withValues(alpha: .1), 214 | ], 215 | stops: const [ 216 | 0.0, 217 | 1.0 218 | ]), 219 | ), 220 | child: Container(), 221 | ), 222 | ), 223 | IgnorePointer( 224 | child: Container( 225 | decoration: BoxDecoration( 226 | gradient: LinearGradient( 227 | begin: Alignment.bottomCenter, 228 | end: Alignment.lerp( 229 | Alignment.bottomCenter, Alignment.center, .05)!, 230 | colors: [ 231 | widget.backgroundColor!, 232 | widget.backgroundColor!.withValues(alpha: .1), 233 | ], 234 | stops: const [ 235 | 0.0, 236 | 1.0 237 | ]), 238 | ), 239 | child: Container(), 240 | ), 241 | ), 242 | ], 243 | ), 244 | ), 245 | ); 246 | } 247 | } 248 | -------------------------------------------------------------------------------- /lib/IconPicker/search_bar.dart: -------------------------------------------------------------------------------- 1 | /// IconSearchbar 2 | /// Author Rebar Ahmad 3 | /// https://github.com/Ahmadre 4 | /// rebar.ahmad@gmail.com 5 | 6 | import 'package:flutter/material.dart'; 7 | import 'package:flutter_iconpicker/Helpers/icon_pack_manager.dart'; 8 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 9 | import 'package:flutter_iconpicker/controllers/icon_controller.dart'; 10 | import 'package:provider/provider.dart'; 11 | import '../Models/icon_pack.dart'; 12 | 13 | class FIPSearchBar extends StatefulWidget { 14 | const FIPSearchBar({ 15 | required this.iconController, 16 | required this.iconPack, 17 | required this.searchHintText, 18 | required this.searchIcon, 19 | required this.searchClearIcon, 20 | required this.backgroundColor, 21 | this.customIconPack, 22 | this.searchComparator, 23 | super.key, 24 | }); 25 | 26 | final FIPIconController iconController; 27 | final List? iconPack; 28 | final Map? customIconPack; 29 | final String? searchHintText; 30 | final Icon? searchIcon; 31 | final Icon? searchClearIcon; 32 | final Color? backgroundColor; 33 | final SearchComparator? searchComparator; 34 | 35 | @override 36 | _FIPSearchBarState createState() => _FIPSearchBarState(); 37 | } 38 | 39 | class _FIPSearchBarState extends State { 40 | final SearchComparator _defaultSearchComparator = 41 | (String searchValue, IconPickerIcon icon) => 42 | icon.name.toLowerCase().contains(searchValue.toLowerCase()); 43 | late final searchComparator = 44 | widget.searchComparator ?? _defaultSearchComparator; 45 | 46 | void _search(String searchValue) { 47 | List> searchResult = []; 48 | 49 | final Iterable> flatFIPPacks = widget 50 | .iconPack 51 | ?.expand((pack) => IconPackManager.getIcons(pack).entries) ?? 52 | []; 53 | final flatCustomPacks = widget.customIconPack?.entries ?? []; 54 | 55 | for (MapEntry item in flatFIPPacks) { 56 | if (searchComparator.call( 57 | searchValue, 58 | IconPickerIcon( 59 | name: item.key, data: item.value.data, pack: item.value.pack))) { 60 | searchResult.add(item); 61 | } 62 | } 63 | 64 | for (var item in flatCustomPacks) { 65 | if (searchComparator.call( 66 | searchValue, 67 | IconPickerIcon( 68 | name: item.key, 69 | data: item.value.data, 70 | pack: IconPack.custom.name))) { 71 | searchResult.add(item); 72 | } 73 | } 74 | 75 | setState(() { 76 | if (searchResult.isNotEmpty) { 77 | widget.iconController.icons = searchResult; 78 | } else { 79 | widget.iconController.removeAll(); 80 | } 81 | }); 82 | } 83 | 84 | @override 85 | Widget build(BuildContext context) { 86 | return Consumer(builder: (ctx, controller, _) { 87 | return TextField( 88 | onChanged: (val) => _search(val), 89 | controller: controller.searchTextController, 90 | decoration: InputDecoration( 91 | contentPadding: const EdgeInsets.only(top: 15), 92 | hintText: widget.searchHintText, 93 | prefixIcon: widget.searchIcon, 94 | suffixIcon: AnimatedSwitcher( 95 | duration: const Duration(milliseconds: 300), 96 | child: controller.searchTextController.text.isNotEmpty 97 | ? IconButton( 98 | icon: widget.searchClearIcon!, 99 | onPressed: () => setState(() { 100 | controller.searchTextController.clear(); 101 | if (widget.customIconPack != null) { 102 | controller.addAll(widget.customIconPack ?? {}); 103 | } 104 | 105 | if (widget.iconPack != null) { 106 | for (var pack in widget.iconPack!) { 107 | controller.addAll(IconPackManager.getIcons(pack)); 108 | } 109 | } 110 | }), 111 | ) 112 | : const SizedBox( 113 | width: 10, 114 | ), 115 | ), 116 | ), 117 | ); 118 | }); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /lib/Models/icon_pack.dart: -------------------------------------------------------------------------------- 1 | import 'package:collection/collection.dart'; 2 | 3 | /// The IconPack defines which Icons are gonna be loaded 4 | enum IconPack { 5 | /// The official Material Icons by Flutter (without rounded, outlined or sharp icons) 6 | material( 7 | path: 'MaterialDefault', 8 | description: 'Material Icons by Flutter', 9 | ), 10 | 11 | /// The official Material Icons by Flutter (including rounded, outlined or sharp icons) 12 | allMaterial( 13 | path: 'Material', 14 | description: 15 | 'All Material Icons (including rounded, outlined or sharp icons)', 16 | ), 17 | 18 | /// The official Material Sharp Icons by Flutter 19 | sharpMaterial( 20 | path: 'MaterialSharp', 21 | description: 'Material Sharp Icons', 22 | ), 23 | 24 | /// The official Material Rounded Icons by Flutter 25 | roundedMaterial( 26 | path: 'MaterialRounded', 27 | description: 'Material Rounded Icons', 28 | ), 29 | 30 | /// The official Material Outlined Icons by Flutter 31 | outlinedMaterial( 32 | path: 'MaterialOutlined', 33 | description: 'Material Outlined Icons', 34 | ), 35 | 36 | /// The official Cupertino Icons (Apple Design) 37 | cupertino( 38 | path: 'Cupertino', 39 | description: 'Cupertino Icons (Apple Design)', 40 | ), 41 | 42 | /// The official font_awesome_flutter Icons by the Flutter Community (Brian Egan) 43 | fontAwesomeIcons( 44 | path: 'FontAwesome', 45 | description: 'Font Awesome Icons', 46 | ), 47 | 48 | /// The official line_awesome_icons Icons by Phuc Chau 49 | lineAwesomeIcons( 50 | path: 'LineIcons', 51 | description: 'Line Awesome Icons', 52 | ), 53 | 54 | /// Use this to show your own custom provided IconPack 55 | custom; 56 | 57 | const IconPack({ 58 | this.path, 59 | this.description, 60 | }); 61 | 62 | final String? path; 63 | final String? description; 64 | 65 | /// Get the IconPack by its name 66 | static IconPack? byName(String? pack) { 67 | if (pack == null) return null; 68 | 69 | return IconPack.values.firstWhereOrNull((p) => p.name == pack); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/Models/icon_picker_icon.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | 4 | /// The SearchComparator is a function that is used to compare the search value with the icon 5 | typedef SearchComparator = bool Function(String search, IconPickerIcon icon); 6 | 7 | /// The IconPickerIcon is a data-class that holds the IconData and the name of the icon 8 | /// It is used to display the icon in the IconPicker 9 | /// 10 | /// or 11 | /// 12 | /// to provide it to outisde of the IconPicker to compare it 13 | class IconPickerIcon extends Equatable { 14 | /// The name of the icon represents the `key` 15 | final String name; 16 | 17 | /// The IconData of the icon like `codePoint`, `fontFamily`, `fontPackage`, `matchTextDirection` 18 | final IconData data; 19 | 20 | /// The IconData of the icon like `codePoint`, `fontFamily`, `fontPackage`, `matchTextDirection` 21 | final String pack; 22 | 23 | const IconPickerIcon({ 24 | required this.name, 25 | required this.data, 26 | required this.pack, 27 | }); 28 | 29 | IconPickerIcon copyWith({ 30 | String? name, 31 | IconData? data, 32 | String? pack, 33 | }) { 34 | return IconPickerIcon( 35 | name: name ?? this.name, 36 | data: data ?? this.data, 37 | pack: pack ?? this.pack, 38 | ); 39 | } 40 | 41 | @override 42 | List get props => [ 43 | name, 44 | data, 45 | pack, 46 | ]; 47 | } 48 | -------------------------------------------------------------------------------- /lib/Serialization/icondata_serialization.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_iconpicker/Helpers/icon_pack_manager.dart'; 3 | import 'package:flutter_iconpicker/Models/icon_pack.dart'; 4 | import 'package:flutter_iconpicker/Models/icon_picker_icon.dart'; 5 | 6 | Map serializeIcon(IconPickerIcon icon) { 7 | if (icon.pack == IconPack.custom) { 8 | return { 9 | 'pack': icon.pack, 10 | 'key': icon.name, 11 | 'iconData': { 12 | 'codePoint': icon.data.codePoint, 13 | 'fontFamily': icon.data.fontFamily, 14 | 'fontPackage': icon.data.fontPackage, 15 | 'matchTextDirection': icon.data.matchTextDirection, 16 | } 17 | }; 18 | } 19 | 20 | return { 21 | 'pack': icon.pack, 22 | 'key': icon.name, 23 | }; 24 | } 25 | 26 | IconPickerIcon? deserializeIcon(Map iconMap) { 27 | final String? pack = iconMap['pack']; 28 | final String? iconKey = iconMap['key']; 29 | 30 | if (pack == null || iconKey == null) return null; 31 | 32 | if (pack == IconPack.custom.name) { 33 | final iconData = iconMap['iconData']; 34 | return IconPickerIcon( 35 | name: iconKey, 36 | data: IconData( 37 | iconData['codePoint'], 38 | fontFamily: iconData['fontFamily'], 39 | fontPackage: iconData['fontPackage'], 40 | matchTextDirection: iconData['matchTextDirection'], 41 | ), 42 | pack: IconPack.custom.name, 43 | ); 44 | } 45 | 46 | return IconPackManager.getIcons(IconPack.byName(pack))[iconKey]; 47 | } 48 | 49 | List?> serializeIcons(List icons) => 50 | icons.map((item) => serializeIcon(item)).toList(); 51 | 52 | List? deserializeIcons(dynamic json) => json != null 53 | ? List.from(json) 54 | .map((map) => deserializeIcon(Map.from(map))) 55 | .cast() 56 | .toList() 57 | : null; 58 | -------------------------------------------------------------------------------- /lib/controllers/icon_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_iconpicker/Models/configuration.dart'; 3 | import 'package:flutter_iconpicker/extensions/list_extensions.dart'; 4 | 5 | import '../Models/icon_picker_icon.dart'; 6 | 7 | class FIPIconController with ChangeNotifier { 8 | FIPIconController({ 9 | required bool shouldScrollToSelectedIcon, 10 | IconPickerIcon? selectedIcon, 11 | IconWidgetBuilder? iconBuilder, 12 | }) : _selectedIcon = selectedIcon, 13 | _shouldScrollToSelectedIcon = shouldScrollToSelectedIcon, 14 | _isMultiple = false, 15 | _iconBuilder = iconBuilder; 16 | 17 | FIPIconController.multiple({ 18 | required bool shouldScrollToSelectedIcon, 19 | List selectedIcons = const [], 20 | IconWidgetBuilder? iconBuilder, 21 | }) : _selectedIcon = 22 | selectedIcons.isNotNullOrEmpty ? selectedIcons.first : null, 23 | _selectedIcons = selectedIcons, 24 | _shouldScrollToSelectedIcon = shouldScrollToSelectedIcon, 25 | _isMultiple = true, 26 | _iconBuilder = iconBuilder; 27 | 28 | final bool _isMultiple; 29 | 30 | bool get isMultiple => _isMultiple; 31 | 32 | final bool _shouldScrollToSelectedIcon; 33 | 34 | bool get shouldScrollToSelectedIcon => _shouldScrollToSelectedIcon; 35 | 36 | IconWidgetBuilder? _iconBuilder; 37 | 38 | IconWidgetBuilder? get iconBuilder => _iconBuilder; 39 | 40 | IconPickerIcon? _selectedIcon; 41 | 42 | IconPickerIcon? get selectedIcon => _selectedIcon; 43 | 44 | set selectedIcon(IconPickerIcon? val) { 45 | _selectedIcon = val; 46 | notifyListeners(); 47 | } 48 | 49 | List _selectedIcons = []; 50 | 51 | List get selectedIcons => _selectedIcons; 52 | 53 | set selectedIcons(List val) { 54 | _selectedIcons = val; 55 | notifyListeners(); 56 | } 57 | 58 | void onTapIcon(IconPickerIcon val, {VoidCallback? onSelected}) { 59 | if (!_isMultiple) { 60 | onSelected?.call(); 61 | } else { 62 | toggleSelectedIcon(val); 63 | } 64 | notifyListeners(); 65 | } 66 | 67 | void toggleSelectedIcon(IconPickerIcon val) { 68 | checkSelectedIconsList(); 69 | 70 | if (!_selectedIcons.contains(val)) { 71 | _addSelectedIcon(val); 72 | } else { 73 | _removeSelectedIcon(val); 74 | } 75 | } 76 | 77 | void _addSelectedIcon(IconPickerIcon val) => _selectedIcons.add(val); 78 | 79 | void _removeSelectedIcon(IconPickerIcon val) => _selectedIcons.remove(val); 80 | 81 | void checkSelectedIconsList() { 82 | if (_selectedIcons.isNullOrEmpty) { 83 | selectedIcons = []; 84 | } 85 | } 86 | 87 | bool get isSelectedIconAvailable => _selectedIcon != null; 88 | 89 | List> _icons = []; 90 | 91 | List> get icons => _icons; 92 | 93 | set icons(List> val) { 94 | _icons = val; 95 | notifyListeners(); 96 | } 97 | 98 | final TextEditingController _searchTextController = TextEditingController(); 99 | 100 | TextEditingController get searchTextController => _searchTextController; 101 | 102 | set searchTextController(TextEditingController val) { 103 | searchTextController = val; 104 | notifyListeners(); 105 | } 106 | 107 | int get length => _icons.length; 108 | 109 | Iterable> get entries => _icons; 110 | 111 | void addAll(Map pack) { 112 | _icons.addAll(pack.entries); 113 | notifyListeners(); 114 | } 115 | 116 | void removeAll() { 117 | _icons.clear(); 118 | notifyListeners(); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /lib/extensions/list_extensions.dart: -------------------------------------------------------------------------------- 1 | extension NullableListExtensions on List? { 2 | bool get isNullOrEmpty => this == null || this!.isEmpty; 3 | bool get isNotNullOrEmpty => !isNullOrEmpty; 4 | } 5 | -------------------------------------------------------------------------------- /lib/extensions/map_extensions.dart: -------------------------------------------------------------------------------- 1 | extension NullableMapExtensions on Map? { 2 | bool get isNullOrEmpty => this == null || this!.isEmpty; 3 | bool get isNotNullOrEmpty => !isNullOrEmpty; 4 | } 5 | -------------------------------------------------------------------------------- /lib/extensions/string_extensions.dart: -------------------------------------------------------------------------------- 1 | extension StringExtensions on String { 2 | bool get isBlank => trim().isEmpty; 3 | bool get isNotBlank => !isBlank; 4 | } 5 | 6 | extension NullableStringExtensions on String? { 7 | bool get isNullOrBlank => this == null || this!.trim().isEmpty; 8 | bool get isNotNullOrBlank => !isNullOrBlank; 9 | } 10 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_iconpicker 2 | description: A Dialog for picking Icons in Flutter and use them anywhere. Can be 3 | used as a default Dialog or as a Adaptive Dialog. 4 | version: 4.0.2 5 | homepage: https://github.com/Ahmadre 6 | repository: https://github.com/Ahmadre/FlutterIconPicker 7 | 8 | environment: 9 | sdk: ">=3.4.0 <4.0.0" 10 | flutter: ">=3.27.0" 11 | 12 | dependencies: 13 | args: ^2.5.0 14 | collection: ^1.19.0 15 | cupertino_icons: ^1.0.8 16 | dcli: ^6.1.0 17 | equatable: ^2.0.5 18 | flutter: 19 | sdk: flutter 20 | font_awesome_flutter: ^10.7.0 21 | path: ^1.9.0 22 | provider: ^6.1.2 23 | scrollview_observer: ^1.24.0 24 | 25 | dev_dependencies: 26 | flutter_lints: ">=4.0.0 <6.0.0" 27 | 28 | flutter: 29 | uses-material-design: true 30 | fonts: 31 | - family: LineAwesomeIcons 32 | fonts: 33 | - asset: fonts/LineAwesome.ttf 34 | style: normal 35 | - family: FontAwesomeBrands 36 | fonts: 37 | - asset: fonts/fa-brands-400.ttf 38 | style: normal 39 | - family: FontAwesomeSolid 40 | fonts: 41 | - asset: fonts/fa-solid-900.ttf 42 | style: normal 43 | - family: FontAwesomeRegular 44 | fonts: 45 | - asset: fonts/fa-regular-400.ttf 46 | style: normal 47 | --------------------------------------------------------------------------------