├── .fvmrc ├── .gitignore ├── .metadata ├── .vscode └── settings.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── demo ├── grid_view.gif ├── list_view2.gif └── sliver_demo.gif ├── example ├── .fvmrc ├── .gitignore ├── .metadata ├── .vscode │ └── settings.json ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle.kts │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── example │ │ │ │ │ └── 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.kts │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle.kts ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ ├── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ └── LaunchImage.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ └── README.md │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h │ └── RunnerTests │ │ └── RunnerTests.swift ├── lib │ ├── data │ │ ├── models │ │ │ └── note.dart │ │ └── note_repository.dart │ ├── main.dart │ ├── pages │ │ ├── grid_view_page.dart │ │ ├── list_view_page.dart │ │ └── sliver_app_bar_list_view_page.dart │ └── widgets │ │ ├── note_grid_widget.dart │ │ └── note_widget.dart ├── linux │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ └── runner │ │ ├── CMakeLists.txt │ │ ├── main.cc │ │ ├── my_application.cc │ │ └── my_application.h ├── macos │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── app_icon_1024.png │ │ │ │ ├── app_icon_128.png │ │ │ │ ├── app_icon_16.png │ │ │ │ ├── app_icon_256.png │ │ │ │ ├── app_icon_32.png │ │ │ │ ├── app_icon_512.png │ │ │ │ └── app_icon_64.png │ │ ├── Base.lproj │ │ │ └── MainMenu.xib │ │ ├── Configs │ │ │ ├── AppInfo.xcconfig │ │ │ ├── Debug.xcconfig │ │ │ ├── Release.xcconfig │ │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements │ └── RunnerTests │ │ └── RunnerTests.swift ├── pubspec.lock ├── pubspec.yaml ├── test │ └── widget_test.dart ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── index.html │ └── manifest.json └── windows │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake │ └── runner │ ├── CMakeLists.txt │ ├── Runner.rc │ ├── flutter_window.cpp │ ├── flutter_window.h │ ├── main.cpp │ ├── resource.h │ ├── resources │ └── app_icon.ico │ ├── runner.exe.manifest │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h ├── lib ├── fl_paging.dart └── src │ ├── datasource │ ├── data_source.dart │ ├── index_data_source.dart │ ├── item_keyed_data_source.dart │ ├── offset_data_source.dart │ └── page_keyed_data_source.dart │ └── widgets │ ├── base_widget.dart │ ├── builder.dart │ ├── default │ ├── empty_widget.dart │ ├── load_more_widget.dart │ └── paging_default_loading.dart │ ├── paging_grid_view.dart │ ├── paging_list_view.dart │ ├── paging_state.dart │ └── paging_state.freezed.dart ├── pubspec.lock ├── pubspec.yaml └── test └── paging_test.dart /.fvmrc: -------------------------------------------------------------------------------- 1 | { 2 | "flutter": "3.32.0" 3 | } -------------------------------------------------------------------------------- /.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 | # Android related 34 | **/android/**/gradle-wrapper.jar 35 | **/android/.gradle 36 | **/android/captures/ 37 | **/android/gradlew 38 | **/android/gradlew.bat 39 | **/android/local.properties 40 | **/android/**/GeneratedPluginRegistrant.java 41 | 42 | # iOS/XCode related 43 | **/ios/**/*.mode1v3 44 | **/ios/**/*.mode2v3 45 | **/ios/**/*.moved-aside 46 | **/ios/**/*.pbxuser 47 | **/ios/**/*.perspectivev3 48 | **/ios/**/*sync/ 49 | **/ios/**/.sconsign.dblite 50 | **/ios/**/.tags* 51 | **/ios/**/.vagrant/ 52 | **/ios/**/DerivedData/ 53 | **/ios/**/Icon? 54 | **/ios/**/Pods/ 55 | **/ios/**/.symlinks/ 56 | **/ios/**/profile 57 | **/ios/**/xcuserdata 58 | **/ios/.generated/ 59 | **/ios/Flutter/App.framework 60 | **/ios/Flutter/Flutter.framework 61 | **/ios/Flutter/Flutter.podspec 62 | **/ios/Flutter/Generated.xcconfig 63 | **/ios/Flutter/app.flx 64 | **/ios/Flutter/app.zip 65 | **/ios/Flutter/flutter_assets/ 66 | **/ios/Flutter/flutter_export_environment.sh 67 | **/ios/ServiceDefinitions.json 68 | **/ios/Runner/GeneratedPluginRegistrant.* 69 | 70 | # Exceptions to above rules. 71 | !**/ios/**/default.mode1v3 72 | !**/ios/**/default.mode2v3 73 | !**/ios/**/default.pbxuser 74 | !**/ios/**/default.perspectivev3 75 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 76 | 77 | # FVM Version Cache 78 | .fvm/ -------------------------------------------------------------------------------- /.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: fba99f6cf9a14512e461e3122c8ddfaa25394e89 8 | channel: unknown 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "dart.flutterSdkPath": ".fvm/versions/3.32.0" 3 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.0.0 2 | 3 | - feat: `ListView`, 'GridView' with `PageKeyedDataSource` 4 | 5 | # 1.0.1 6 | 7 | -docs: Update example 8 | 9 | # 1.0.2 10 | 11 | -docs: Update example 12 | 13 | # 1.0.3 14 | 15 | -docs: Update format 16 | 17 | # 1.0.4 18 | 19 | -docs: Update format 20 | 21 | # 1.0.5 22 | 23 | -refactor: refactor list_view code. 24 | 25 | # 1.0.6 26 | 27 | -refactor: refactor list_view code. 28 | 29 | # 1.0.7 30 | 31 | -refactor: refactor list_view code. 32 | 33 | # 1.0.8 34 | 35 | -refactor: fix bug empty config list_view. 36 | 37 | # 1.0.9 38 | 39 | -refactor: fix bug loadmore list_view. 40 | 41 | # 1.0.10 42 | 43 | -refactor: feat: add handle errorWhenLoadMore. 44 | 45 | # 1.0.11 46 | 47 | -refactor: feat: add handle retry when errror. 48 | 49 | # 1.0.12 50 | 51 | -refactor: feat: add handle retry when errror. 52 | 53 | # 1.0.13 54 | 55 | -refactor: feat: get state of ListView 56 | 57 | # 1.0.14 58 | 59 | -refactor: fixbug: fixbug loadmore 60 | 61 | # 1.0.15 62 | 63 | -refactor: feat: add index for itembuilder and separatorBuilder 64 | 65 | # 1.0.16 66 | 67 | -refactor: feat add GridView builder 68 | 69 | # 1.0.17 70 | 71 | -refactor: feat handle retry GridView 72 | 73 | # 1.0.18 74 | 75 | -fixbug: fix bug loading when retry on GridView 76 | 77 | # 1.0.19 78 | 79 | -feature: reize item gridview 80 | 81 | # 1.0.20 82 | 83 | -fixbug: fix bug duplicate when loadmore + pull to refresh 84 | 85 | # 1.0.21 86 | 87 | -feat: update index gridView 88 | 89 | # 2.0.0 90 | 91 | - support null safety 92 | 93 | # 2.0.1 94 | 95 | - feat: support auto detect end of list. 96 | - feat: support default empty for list. 97 | 98 | **BREAKING**: 99 | 100 | - refactor: rename `ListView` to `PagingListView` 101 | - refactor: rename `GridView` to `PagingGridView` 102 | - refactor: added params `pageSize` for method `loadInitial` in `PageKeyedDataSource` 103 | - refactor: added params `pageSize` for method `loadPageAfter` in `PageKeyedDataSource` 104 | 105 | # 2.0.2 106 | 107 | - feat: support enable pull to refresh 108 | 109 | # 2.1.0 110 | 111 | - feat: support style for pull to refresh (Material|Cupertino) 112 | 113 | # 2.1.1 114 | 115 | - fix: issue pull to refresh with short list. 116 | 117 | # 2.1.2 118 | 119 | - feat: support ScrollViewKeyboardDismissBehavior on PagingGridView. 120 | 121 | # 2.2.0 122 | 123 | - feat: support ScrollViewKeyboardDismissBehavior on PagingGridView. 124 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Dang Ngoc Duc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Paging 2 | 3 |

4 | 5 | 6 | Pub Package 7 | 8 |
9 | 10 | Star on GitHub 11 | 12 | 13 | style: effective dart 14 | 15 | 16 | MIT License 17 | 18 |

19 | 20 | --- 21 | A Flutter package that supports pagination(load infinite) for ListView, GridView 22 | 23 | ### Demo 24 | 25 | | | | | 26 | |---|---|---| 27 | |![](./demo/list_view2.gif) |![](./demo/grid_view.gif) |![](./demo/sliver_demo.gif) | 28 | 29 | 30 | ### DataSource 31 | #### PageKeyedDataSource 32 | 33 | To create a `PagingListView` or `PagingGridView` you will need create class which extended from `PageKeyedDataSource`. 34 | 35 | When extended from `PageKeyedDataSource`, you will need `override` 2 methods is `loadInitial` and `loadPageAfter`. 36 | 37 | Output of those function is a Tuple2 with item1 is List is List of data, end item2 is next page index. 38 | 39 | Example: if your list start with page index is 0. 40 | -> on loadInitial output is Tuple2([...], 1) 1 is next page when load more item. 41 | 42 | Example: 43 | 44 | ``` 45 | class ListViewDataSource extends paging.PageKeyedDataSource { 46 | NoteRepository noteRepository; 47 | 48 | ListViewDataSource(this.noteRepository); 49 | 50 | @override 51 | Future, int>> loadInitial(int pageSize) async { 52 | return Tuple2(await noteRepository.getNotes(0), 1); 53 | } 54 | 55 | @override 56 | Future, int>> loadPageAfter(int params, int pageSize) async { 57 | return Tuple2(await noteRepository.getNotes(params), params + 1); 58 | } 59 | } 60 | ``` 61 | 62 | ### Display on UI 63 | 64 | To display on UI, currently you can use `PagingListView` or `PagingGridView`. 65 | 66 | Example: 67 | ``` 68 | ListViewDataSource dataSource = ListViewDataSource(NoteRepository()); 69 | 70 | PagingListView( 71 | itemBuilder: (context, data, child) => NoteWidget(data), 72 | pageDataSource: dataSource, 73 | ), 74 | 75 | ``` 76 | 77 | 78 | -------------------------------------------------------------------------------- /demo/grid_view.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/demo/grid_view.gif -------------------------------------------------------------------------------- /demo/list_view2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/demo/list_view2.gif -------------------------------------------------------------------------------- /demo/sliver_demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/demo/sliver_demo.gif -------------------------------------------------------------------------------- /example/.fvmrc: -------------------------------------------------------------------------------- 1 | { 2 | "flutter": "3.29.2" 3 | } -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Exceptions to above rules. 44 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 45 | 46 | # FVM Version Cache 47 | .fvm/ -------------------------------------------------------------------------------- /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 and should not be manually edited. 5 | 6 | version: 7 | revision: "c23637390482d4cf9598c3ce3f2be31aa7332daf" 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: c23637390482d4cf9598c3ce3f2be31aa7332daf 17 | base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf 18 | - platform: android 19 | create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf 20 | base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf 21 | - platform: ios 22 | create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf 23 | base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf 24 | - platform: linux 25 | create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf 26 | base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf 27 | - platform: macos 28 | create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf 29 | base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf 30 | - platform: web 31 | create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf 32 | base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf 33 | - platform: windows 34 | create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf 35 | base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf 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/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "dart.flutterSdkPath": ".fvm/versions/3.29.2" 3 | } -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter application. 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/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at https://dart.dev/lints. 17 | # 18 | # Instead of disabling a lint rule for the entire project in the 19 | # section below, it can also be suppressed for a single line of code 20 | # or a specific dart file by using the `// ignore: name_of_lint` and 21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 22 | # producing the lint. 23 | rules: 24 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 25 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 26 | 27 | # Additional information about this file can be found at 28 | # https://dart.dev/guides/language/analysis-options 29 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | .cxx/ 9 | 10 | # Remember to never publicly share your keystore. 11 | # See https://flutter.dev/to/reference-keystore 12 | key.properties 13 | **/*.keystore 14 | **/*.jks 15 | -------------------------------------------------------------------------------- /example/android/app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.android.application") 3 | id("kotlin-android") 4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. 5 | id("dev.flutter.flutter-gradle-plugin") 6 | } 7 | 8 | android { 9 | namespace = "com.example.example" 10 | compileSdk = flutter.compileSdkVersion 11 | ndkVersion = flutter.ndkVersion 12 | 13 | compileOptions { 14 | sourceCompatibility = JavaVersion.VERSION_11 15 | targetCompatibility = JavaVersion.VERSION_11 16 | } 17 | 18 | kotlinOptions { 19 | jvmTarget = JavaVersion.VERSION_11.toString() 20 | } 21 | 22 | defaultConfig { 23 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 24 | applicationId = "com.example.example" 25 | // You can update the following values to match your application needs. 26 | // For more information, see: https://flutter.dev/to/review-gradle-config. 27 | minSdk = flutter.minSdkVersion 28 | targetSdk = flutter.targetSdkVersion 29 | versionCode = flutter.versionCode 30 | versionName = flutter.versionName 31 | } 32 | 33 | buildTypes { 34 | release { 35 | // TODO: Add your own signing config for the release build. 36 | // Signing with the debug keys for now, so `flutter run --release` works. 37 | signingConfig = signingConfigs.getByName("debug") 38 | } 39 | } 40 | } 41 | 42 | flutter { 43 | source = "../.." 44 | } 45 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle.kts: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get() 9 | rootProject.layout.buildDirectory.value(newBuildDir) 10 | 11 | subprojects { 12 | val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) 13 | project.layout.buildDirectory.value(newSubprojectBuildDir) 14 | } 15 | subprojects { 16 | project.evaluationDependsOn(":app") 17 | } 18 | 19 | tasks.register("clean") { 20 | delete(rootProject.layout.buildDirectory) 21 | } 22 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip 6 | -------------------------------------------------------------------------------- /example/android/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val flutterSdkPath = run { 3 | val properties = java.util.Properties() 4 | file("local.properties").inputStream().use { properties.load(it) } 5 | val flutterSdkPath = properties.getProperty("flutter.sdk") 6 | require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } 7 | flutterSdkPath 8 | } 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id("dev.flutter.flutter-plugin-loader") version "1.0.0" 21 | id("com.android.application") version "8.7.0" apply false 22 | id("org.jetbrains.kotlin.android") version "1.8.22" apply false 23 | } 24 | 25 | include(":app") 26 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /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 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 64 | 66 | 72 | 73 | 74 | 75 | 81 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /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 Flutter 2 | import UIKit 3 | 4 | @main 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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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 | CFBundleDisplayName 8 | Example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | example 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /example/lib/data/models/note.dart: -------------------------------------------------------------------------------- 1 | class Note { 2 | static const TAG = 'Note'; 3 | 4 | int id; 5 | String title; 6 | String content; 7 | 8 | Note(this.id, this.title, this.content); 9 | 10 | factory Note.fakeId(int id) { 11 | return Note(id, 'This is title $id', 'A callback can be called only once, and will throw if called again.'); 12 | } 13 | } -------------------------------------------------------------------------------- /example/lib/data/note_repository.dart: -------------------------------------------------------------------------------- 1 | import 'dart:developer' as developer; 2 | 3 | import 'package:example/data/models/note.dart'; 4 | 5 | class NoteRepository { 6 | static const TAG = 'NoteRepository'; 7 | 8 | Future> getNotes(int pageIndex) async { 9 | developer.log('getNotes [pageIndex] $pageIndex', name: TAG); 10 | List datas = []; 11 | for (var i = 0; i < 20 ; i++) { 12 | datas.add(Note.fakeId(i + 20*pageIndex)); 13 | } 14 | return Future.delayed( 15 | Duration(milliseconds: 500), 16 | () => datas 17 | ); 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:developer' as developer; 2 | 3 | import 'package:example/pages/list_view_page.dart'; 4 | import 'package:example/widgets/note_widget.dart'; 5 | import 'package:fl_paging/fl_paging.dart'; 6 | import 'package:flutter/material.dart'; 7 | 8 | import 'data/models/note.dart'; 9 | import 'data/note_repository.dart'; 10 | 11 | void main() { 12 | runApp(MyApp()); 13 | } 14 | 15 | class MyApp extends StatelessWidget { 16 | @override 17 | Widget build(BuildContext context) { 18 | return MaterialApp( 19 | title: 'Flutter Demo', 20 | theme: ThemeData( 21 | scaffoldBackgroundColor: Colors.grey[200], 22 | primarySwatch: Colors.blue, 23 | visualDensity: VisualDensity.adaptivePlatformDensity, 24 | ), 25 | home: ListViewPage(), 26 | ); 27 | } 28 | } 29 | 30 | class ListViewPage extends StatefulWidget { 31 | static const ROUTE_NAME = 'ListViewPage'; 32 | @override 33 | _ListViewPageState createState() => _ListViewPageState(); 34 | } 35 | 36 | class _ListViewPageState extends State { 37 | static const TAG = 'ListViewPage'; 38 | final GlobalKey key = GlobalKey(); 39 | late ListViewDataSource dataSource; 40 | @override 41 | void initState() { 42 | super.initState(); 43 | dataSource = ListViewDataSource(NoteRepository()); 44 | } 45 | 46 | @override 47 | Widget build(BuildContext context) { 48 | developer.log('build', name: 'ListViewPage'); 49 | return Scaffold( 50 | appBar: AppBar( 51 | centerTitle: true, 52 | title: Text('Demo ListView'), 53 | ), 54 | floatingActionButton: FloatingActionButton( 55 | onPressed: () { 56 | setState(() {}); 57 | }, 58 | child: Icon(Icons.refresh), 59 | ), 60 | body: PagingListView( 61 | key: key, 62 | stylePullToRefresh: StylePullToRefresh.IOS, 63 | padding: EdgeInsets.all(16), 64 | itemBuilder: (context, data, child) { 65 | return NoteWidget(data); 66 | }, 67 | pageDataSource: dataSource, 68 | ), 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /example/lib/pages/grid_view_page.dart: -------------------------------------------------------------------------------- 1 | 2 | import '../data/models/note.dart'; 3 | import '../data/note_repository.dart'; 4 | import '../widgets/note_grid_widget.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:fl_paging/fl_paging.dart' as paging; 7 | import 'list_view_page.dart'; 8 | 9 | class GridViewPage extends StatefulWidget { 10 | static const ROUTE_NAME = 'GridViewPage'; 11 | @override 12 | _GridViewPageState createState() => _GridViewPageState(); 13 | } 14 | 15 | class _GridViewPageState extends State { 16 | static const TAG = 'GridViewPage'; 17 | final GlobalKey key = GlobalKey(); 18 | late ListViewDataSource dataSource; 19 | @override 20 | void initState() { 21 | super.initState(); 22 | dataSource = ListViewDataSource(NoteRepository()); 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return Scaffold( 28 | backgroundColor: Colors.grey[200], 29 | appBar: AppBar( 30 | centerTitle: true, 31 | title: Text('Demo GridView'), 32 | ), 33 | body: paging.PagingGridView( 34 | emptyBuilder: (context) { 35 | return Container(); 36 | }, 37 | key: key, 38 | padding: EdgeInsets.all(16), 39 | itemBuilder: (context, data, child) { 40 | return NoteGridWidget(data); 41 | }, 42 | delegate: SliverGridDelegateWithFixedCrossAxisCount( 43 | crossAxisCount: 2, 44 | mainAxisSpacing: 16, 45 | crossAxisSpacing: 16 46 | ), 47 | pageDataSource: dataSource, 48 | ), 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /example/lib/pages/list_view_page.dart: -------------------------------------------------------------------------------- 1 | import '../data/models/note.dart'; 2 | import '../data/note_repository.dart'; 3 | import 'package:tuple/tuple.dart'; 4 | import 'package:fl_paging/fl_paging.dart' as paging; 5 | class ListViewDataSource extends paging.PageKeyedDataSource { 6 | NoteRepository noteRepository; 7 | 8 | ListViewDataSource(this.noteRepository); 9 | 10 | @override 11 | Future, int>> loadInitial(int pageSize) async { 12 | return Tuple2(await noteRepository.getNotes(0), 1); 13 | } 14 | 15 | @override 16 | Future, int>> loadPageAfter(int params, int pageSize) async { 17 | return Tuple2(await noteRepository.getNotes(params), params + 1); 18 | } 19 | } -------------------------------------------------------------------------------- /example/lib/pages/sliver_app_bar_list_view_page.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:example/data/models/note.dart'; 3 | import 'package:example/data/note_repository.dart'; 4 | import 'package:example/pages/list_view_page.dart'; 5 | import 'package:example/widgets/note_widget.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:fl_paging/fl_paging.dart' as paging; 8 | 9 | class SliverAppBarListViewPage extends StatefulWidget { 10 | static const ROUTE_NAME = 'SliverAppBarListViewPage'; 11 | @override 12 | _SliverAppBarListViewPageState createState() => _SliverAppBarListViewPageState(); 13 | } 14 | 15 | class _SliverAppBarListViewPageState extends State { 16 | static const TAG = 'SliverAppBarListViewPage'; 17 | late ListViewDataSource dataSource; 18 | @override 19 | void initState() { 20 | super.initState(); 21 | dataSource = ListViewDataSource(NoteRepository()); 22 | } 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return Scaffold( 27 | body: NestedScrollView( 28 | headerSliverBuilder: (context, _) { 29 | return [ 30 | SliverAppBar( 31 | expandedHeight: 250, 32 | collapsedHeight: kToolbarHeight+1, 33 | title: Text('Sliver Appbar'), 34 | snap: false, 35 | floating: false, 36 | leading: Container( 37 | child: CircleAvatar( 38 | child: Icon(Icons.person_outline), 39 | ), 40 | padding: EdgeInsets.symmetric(vertical: 8, horizontal: 8), 41 | ), 42 | ) 43 | ]; 44 | }, 45 | body: paging.PagingListView( 46 | padding: EdgeInsets.all(16), 47 | 48 | itemBuilder: (context, data, child) { 49 | return NoteWidget(data); 50 | }, 51 | pageDataSource: dataSource, 52 | ) 53 | ), 54 | ); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /example/lib/widgets/note_grid_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/data/models/note.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class NoteGridWidget extends StatelessWidget { 5 | final Note note; 6 | 7 | NoteGridWidget(this.note); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Container( 12 | decoration: ShapeDecoration( 13 | shape: RoundedRectangleBorder( 14 | borderRadius: BorderRadius.all(Radius.circular(8))), 15 | color: Theme.of(context).cardColor), 16 | padding: EdgeInsets.symmetric(vertical: 12, horizontal: 16), 17 | child: Column( 18 | crossAxisAlignment: CrossAxisAlignment.start, 19 | children: [ 20 | Text( 21 | note.title, 22 | style: Theme.of(context) 23 | .textTheme 24 | .labelLarge! 25 | .copyWith(fontWeight: FontWeight.w800), 26 | ), 27 | SizedBox( 28 | height: 12, 29 | ), 30 | Text( 31 | note.content, 32 | style: Theme.of(context).textTheme.labelMedium, 33 | ) 34 | ], 35 | ), 36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /example/lib/widgets/note_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/data/models/note.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class NoteWidget extends StatelessWidget { 5 | final Note note; 6 | 7 | NoteWidget(this.note); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Container( 12 | decoration: ShapeDecoration( 13 | shape: RoundedRectangleBorder( 14 | borderRadius: BorderRadius.all(Radius.circular(8))), 15 | color: Theme.of(context).cardColor), 16 | padding: EdgeInsets.symmetric(vertical: 12, horizontal: 16), 17 | child: Row( 18 | children: [ 19 | CircleAvatar( 20 | child: Text('${note.id}'), 21 | ), 22 | SizedBox( 23 | width: 16, 24 | ), 25 | Expanded( 26 | child: Column( 27 | mainAxisSize: MainAxisSize.min, 28 | crossAxisAlignment: CrossAxisAlignment.start, 29 | children: [ 30 | Text( 31 | note.title, 32 | style: Theme.of(context) 33 | .textTheme 34 | .labelLarge! 35 | .copyWith(fontWeight: FontWeight.w800), 36 | ), 37 | SizedBox( 38 | height: 4, 39 | ), 40 | Text( 41 | note.content, 42 | style: Theme.of(context).textTheme.labelSmall, 43 | ) 44 | ], 45 | ), 46 | ) 47 | ], 48 | ), 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /example/linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.13) 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 | # Application build; see runner/CMakeLists.txt. 58 | add_subdirectory("runner") 59 | 60 | # Run the Flutter tool portions of the build. This must not be removed. 61 | add_dependencies(${BINARY_NAME} flutter_assemble) 62 | 63 | # Only the install-generated bundle's copy of the executable will launch 64 | # correctly, since the resources must in the right relative locations. To avoid 65 | # people trying to run the unbundled copy, put it in a subdirectory instead of 66 | # the default top-level location. 67 | set_target_properties(${BINARY_NAME} 68 | PROPERTIES 69 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 70 | ) 71 | 72 | 73 | # Generated plugin build rules, which manage building the plugins and adding 74 | # them to the application. 75 | include(flutter/generated_plugins.cmake) 76 | 77 | 78 | # === Installation === 79 | # By default, "installing" just makes a relocatable bundle in the build 80 | # directory. 81 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 82 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 83 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 84 | endif() 85 | 86 | # Start with a clean build bundle directory every time. 87 | install(CODE " 88 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 89 | " COMPONENT Runtime) 90 | 91 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 92 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 93 | 94 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 95 | COMPONENT Runtime) 96 | 97 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 98 | COMPONENT Runtime) 99 | 100 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 101 | COMPONENT Runtime) 102 | 103 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 104 | install(FILES "${bundled_library}" 105 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 106 | COMPONENT Runtime) 107 | endforeach(bundled_library) 108 | 109 | # Copy the native assets provided by the build.dart from all packages. 110 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") 111 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 112 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 113 | COMPONENT Runtime) 114 | 115 | # Fully re-copy the assets directory on each build to avoid having stale files 116 | # from a previous install. 117 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 118 | install(CODE " 119 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 120 | " COMPONENT Runtime) 121 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 122 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 123 | 124 | # Install the AOT library on non-Debug builds only. 125 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 126 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 127 | COMPONENT Runtime) 128 | endif() 129 | -------------------------------------------------------------------------------- /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/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 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} 10 | "main.cc" 11 | "my_application.cc" 12 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 13 | ) 14 | 15 | # Apply the standard set of build settings. This can be removed for applications 16 | # that need different build settings. 17 | apply_standard_settings(${BINARY_NAME}) 18 | 19 | # Add preprocessor definitions for the application ID. 20 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 21 | 22 | # Add dependency libraries. Add any application-specific dependencies here. 23 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 24 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 25 | 26 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 27 | -------------------------------------------------------------------------------- /example/linux/runner/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/runner/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 GApplication::startup. 85 | static void my_application_startup(GApplication* application) { 86 | //MyApplication* self = MY_APPLICATION(object); 87 | 88 | // Perform any actions required at application startup. 89 | 90 | G_APPLICATION_CLASS(my_application_parent_class)->startup(application); 91 | } 92 | 93 | // Implements GApplication::shutdown. 94 | static void my_application_shutdown(GApplication* application) { 95 | //MyApplication* self = MY_APPLICATION(object); 96 | 97 | // Perform any actions required at application shutdown. 98 | 99 | G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); 100 | } 101 | 102 | // Implements GObject::dispose. 103 | static void my_application_dispose(GObject* object) { 104 | MyApplication* self = MY_APPLICATION(object); 105 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 106 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 107 | } 108 | 109 | static void my_application_class_init(MyApplicationClass* klass) { 110 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 111 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 112 | G_APPLICATION_CLASS(klass)->startup = my_application_startup; 113 | G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; 114 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 115 | } 116 | 117 | static void my_application_init(MyApplication* self) {} 118 | 119 | MyApplication* my_application_new() { 120 | // Set the program name to the application ID, which helps various systems 121 | // like GTK and desktop environments map this running application to its 122 | // corresponding .desktop file. This ensures better integration by allowing 123 | // the application to be recognized beyond its binary name. 124 | g_set_prgname(APPLICATION_ID); 125 | 126 | return MY_APPLICATION(g_object_new(my_application_get_type(), 127 | "application-id", APPLICATION_ID, 128 | "flags", G_APPLICATION_NON_UNIQUE, 129 | nullptr)); 130 | } 131 | -------------------------------------------------------------------------------- /example/linux/runner/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /example/macos/.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 "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | 9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 10 | } 11 | -------------------------------------------------------------------------------- /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 | 43 | 49 | 50 | 51 | 52 | 53 | 64 | 66 | 72 | 73 | 74 | 75 | 81 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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 | @main 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | 10 | override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { 11 | return true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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 © 2025 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() 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/macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.13.0" 12 | boolean_selector: 13 | dependency: transitive 14 | description: 15 | name: boolean_selector 16 | sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.1.2" 20 | characters: 21 | dependency: transitive 22 | description: 23 | name: characters 24 | sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "1.4.0" 28 | clock: 29 | dependency: transitive 30 | description: 31 | name: clock 32 | sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "1.1.2" 36 | collection: 37 | dependency: transitive 38 | description: 39 | name: collection 40 | sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.19.1" 44 | cupertino_icons: 45 | dependency: "direct main" 46 | description: 47 | name: cupertino_icons 48 | sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "1.0.8" 52 | fake_async: 53 | dependency: transitive 54 | description: 55 | name: fake_async 56 | sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" 57 | url: "https://pub.dev" 58 | source: hosted 59 | version: "1.3.3" 60 | fl_paging: 61 | dependency: "direct main" 62 | description: 63 | path: ".." 64 | relative: true 65 | source: path 66 | version: "2.2.0" 67 | flutter: 68 | dependency: "direct main" 69 | description: flutter 70 | source: sdk 71 | version: "0.0.0" 72 | flutter_test: 73 | dependency: "direct dev" 74 | description: flutter 75 | source: sdk 76 | version: "0.0.0" 77 | freezed_annotation: 78 | dependency: transitive 79 | description: 80 | name: freezed_annotation 81 | sha256: c87ff004c8aa6af2d531668b46a4ea379f7191dc6dfa066acd53d506da6e044b 82 | url: "https://pub.dev" 83 | source: hosted 84 | version: "3.0.0" 85 | json_annotation: 86 | dependency: transitive 87 | description: 88 | name: json_annotation 89 | sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" 90 | url: "https://pub.dev" 91 | source: hosted 92 | version: "4.9.0" 93 | leak_tracker: 94 | dependency: transitive 95 | description: 96 | name: leak_tracker 97 | sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" 98 | url: "https://pub.dev" 99 | source: hosted 100 | version: "10.0.9" 101 | leak_tracker_flutter_testing: 102 | dependency: transitive 103 | description: 104 | name: leak_tracker_flutter_testing 105 | sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 106 | url: "https://pub.dev" 107 | source: hosted 108 | version: "3.0.9" 109 | leak_tracker_testing: 110 | dependency: transitive 111 | description: 112 | name: leak_tracker_testing 113 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 114 | url: "https://pub.dev" 115 | source: hosted 116 | version: "3.0.1" 117 | matcher: 118 | dependency: transitive 119 | description: 120 | name: matcher 121 | sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 122 | url: "https://pub.dev" 123 | source: hosted 124 | version: "0.12.17" 125 | material_color_utilities: 126 | dependency: transitive 127 | description: 128 | name: material_color_utilities 129 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 130 | url: "https://pub.dev" 131 | source: hosted 132 | version: "0.11.1" 133 | meta: 134 | dependency: transitive 135 | description: 136 | name: meta 137 | sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c 138 | url: "https://pub.dev" 139 | source: hosted 140 | version: "1.16.0" 141 | path: 142 | dependency: transitive 143 | description: 144 | name: path 145 | sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" 146 | url: "https://pub.dev" 147 | source: hosted 148 | version: "1.9.1" 149 | sky_engine: 150 | dependency: transitive 151 | description: flutter 152 | source: sdk 153 | version: "0.0.0" 154 | source_span: 155 | dependency: transitive 156 | description: 157 | name: source_span 158 | sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" 159 | url: "https://pub.dev" 160 | source: hosted 161 | version: "1.10.1" 162 | stack_trace: 163 | dependency: transitive 164 | description: 165 | name: stack_trace 166 | sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" 167 | url: "https://pub.dev" 168 | source: hosted 169 | version: "1.12.1" 170 | stream_channel: 171 | dependency: transitive 172 | description: 173 | name: stream_channel 174 | sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" 175 | url: "https://pub.dev" 176 | source: hosted 177 | version: "2.1.4" 178 | string_scanner: 179 | dependency: transitive 180 | description: 181 | name: string_scanner 182 | sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" 183 | url: "https://pub.dev" 184 | source: hosted 185 | version: "1.4.1" 186 | term_glyph: 187 | dependency: transitive 188 | description: 189 | name: term_glyph 190 | sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" 191 | url: "https://pub.dev" 192 | source: hosted 193 | version: "1.2.2" 194 | test_api: 195 | dependency: transitive 196 | description: 197 | name: test_api 198 | sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd 199 | url: "https://pub.dev" 200 | source: hosted 201 | version: "0.7.4" 202 | tuple: 203 | dependency: "direct main" 204 | description: 205 | name: tuple 206 | sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151 207 | url: "https://pub.dev" 208 | source: hosted 209 | version: "2.0.2" 210 | vector_math: 211 | dependency: transitive 212 | description: 213 | name: vector_math 214 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 215 | url: "https://pub.dev" 216 | source: hosted 217 | version: "2.1.4" 218 | vm_service: 219 | dependency: transitive 220 | description: 221 | name: vm_service 222 | sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 223 | url: "https://pub.dev" 224 | source: hosted 225 | version: "15.0.0" 226 | sdks: 227 | dart: ">=3.7.0-0 <4.0.0" 228 | flutter: ">=3.18.0-18.0.pre.54" 229 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter application. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.0.0+1 19 | 20 | environment: 21 | sdk: ">= 3.6.0 <4.0.0" 22 | 23 | dependencies: 24 | flutter: 25 | sdk: flutter 26 | 27 | 28 | # The following adds the Cupertino Icons font to your application. 29 | # Use with the CupertinoIcons class for iOS style icons. 30 | cupertino_icons: ^1.0.8 31 | fl_paging: 32 | path: ../../flutter_paging 33 | tuple: 34 | 35 | dev_dependencies: 36 | flutter_test: 37 | sdk: flutter 38 | 39 | # For information on the generic Dart part of this file, see the 40 | # following page: https://dart.dev/tools/pub/pubspec 41 | 42 | # The following section is specific to Flutter. 43 | flutter: 44 | 45 | # The following line ensures that the Material Icons font is 46 | # included with your application, so that you can use the icons in 47 | # the material Icons class. 48 | uses-material-design: true 49 | 50 | # To add assets to your application, add an assets section, like this: 51 | # assets: 52 | # - images/a_dot_burr.jpeg 53 | # - images/a_dot_ham.jpeg 54 | 55 | # An image asset can refer to one or more resolution-specific "variants", see 56 | # https://flutter.dev/assets-and-images/#resolution-aware. 57 | 58 | # For details regarding adding assets from package dependencies, see 59 | # https://flutter.dev/assets-and-images/#from-packages 60 | 61 | # To add custom fonts to your application, add a fonts section here, 62 | # in this "flutter" section. Each entry in this list should have a 63 | # "family" key with the font family name, and a "fonts" key with a 64 | # list giving the asset and other descriptors for the font. For 65 | # example: 66 | # fonts: 67 | # - family: Schyler 68 | # fonts: 69 | # - asset: fonts/Schyler-Regular.ttf 70 | # - asset: fonts/Schyler-Italic.ttf 71 | # style: italic 72 | # - family: Trajan Pro 73 | # fonts: 74 | # - asset: fonts/TrajanPro.ttf 75 | # - asset: fonts/TrajanPro_Bold.ttf 76 | # weight: 700 77 | # 78 | # For details regarding fonts from package dependencies, 79 | # see https://flutter.dev/custom-fonts/#from-packages 80 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/example/web/favicon.png -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | example 18 | 19 | 20 | 21 | 24 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter application.", 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(VERSION 3.14...3.25) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | 56 | # Generated plugin build rules, which manage building the plugins and adding 57 | # them to the application. 58 | include(flutter/generated_plugins.cmake) 59 | 60 | 61 | # === Installation === 62 | # Support files are copied into place next to the executable, so that it can 63 | # run in place. This is done instead of making a separate bundle (as on Linux) 64 | # so that building and running from within Visual Studio will work. 65 | set(BUILD_BUNDLE_DIR "$") 66 | # Make the "install" step default, as it's required to run. 67 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 68 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 69 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 70 | endif() 71 | 72 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 73 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 74 | 75 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 76 | COMPONENT Runtime) 77 | 78 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 79 | COMPONENT Runtime) 80 | 81 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 82 | COMPONENT Runtime) 83 | 84 | if(PLUGIN_BUNDLED_LIBRARIES) 85 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 86 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 87 | COMPONENT Runtime) 88 | endif() 89 | 90 | # Copy the native assets provided by the build.dart from all packages. 91 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") 92 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 93 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 94 | COMPONENT Runtime) 95 | 96 | # Fully re-copy the assets directory on each build to avoid having stale files 97 | # from a previous install. 98 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 99 | install(CODE " 100 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 101 | " COMPONENT Runtime) 102 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 103 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 104 | 105 | # Install the AOT library on non-Debug builds only. 106 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 107 | CONFIGURATIONS Profile;Release 108 | COMPONENT Runtime) 109 | -------------------------------------------------------------------------------- /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_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /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) 2025 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 | 30 | flutter_controller_->engine()->SetNextFrameCallback([&]() { 31 | this->Show(); 32 | }); 33 | 34 | // Flutter can complete the first frame before the "show window" callback is 35 | // registered. The following call ensures a frame is pending to ensure the 36 | // window is shown. It is a no-op if the first frame hasn't completed yet. 37 | flutter_controller_->ForceRedraw(); 38 | 39 | return true; 40 | } 41 | 42 | void FlutterWindow::OnDestroy() { 43 | if (flutter_controller_) { 44 | flutter_controller_ = nullptr; 45 | } 46 | 47 | Win32Window::OnDestroy(); 48 | } 49 | 50 | LRESULT 51 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 52 | WPARAM const wparam, 53 | LPARAM const lparam) noexcept { 54 | // Give Flutter, including plugins, an opportunity to handle window messages. 55 | if (flutter_controller_) { 56 | std::optional result = 57 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 58 | lparam); 59 | if (result) { 60 | return *result; 61 | } 62 | } 63 | 64 | switch (message) { 65 | case WM_FONTCHANGE: 66 | flutter_controller_->engine()->ReloadSystemFonts(); 67 | break; 68 | } 69 | 70 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 71 | } 72 | -------------------------------------------------------------------------------- /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.Create(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/dangngocduc/flutter_paging/b932850d4ae83e757c1ea329e1edb28e64690e7a/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 | -------------------------------------------------------------------------------- /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 | unsigned int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr) 51 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length == 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /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 | #include 5 | 6 | #include "resource.h" 7 | 8 | namespace { 9 | 10 | /// Window attribute that enables dark mode window decorations. 11 | /// 12 | /// Redefined in case the developer's machine has a Windows SDK older than 13 | /// version 10.0.22000.0. 14 | /// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute 15 | #ifndef DWMWA_USE_IMMERSIVE_DARK_MODE 16 | #define DWMWA_USE_IMMERSIVE_DARK_MODE 20 17 | #endif 18 | 19 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 20 | 21 | /// Registry key for app theme preference. 22 | /// 23 | /// A value of 0 indicates apps should use dark mode. A non-zero or missing 24 | /// value indicates apps should use light mode. 25 | constexpr const wchar_t kGetPreferredBrightnessRegKey[] = 26 | L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; 27 | constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; 28 | 29 | // The number of Win32Window objects that currently exist. 30 | static int g_active_window_count = 0; 31 | 32 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 33 | 34 | // Scale helper to convert logical scaler values to physical using passed in 35 | // scale factor 36 | int Scale(int source, double scale_factor) { 37 | return static_cast(source * scale_factor); 38 | } 39 | 40 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 41 | // This API is only needed for PerMonitor V1 awareness mode. 42 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 43 | HMODULE user32_module = LoadLibraryA("User32.dll"); 44 | if (!user32_module) { 45 | return; 46 | } 47 | auto enable_non_client_dpi_scaling = 48 | reinterpret_cast( 49 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 50 | if (enable_non_client_dpi_scaling != nullptr) { 51 | enable_non_client_dpi_scaling(hwnd); 52 | } 53 | FreeLibrary(user32_module); 54 | } 55 | 56 | } // namespace 57 | 58 | // Manages the Win32Window's window class registration. 59 | class WindowClassRegistrar { 60 | public: 61 | ~WindowClassRegistrar() = default; 62 | 63 | // Returns the singleton registrar instance. 64 | static WindowClassRegistrar* GetInstance() { 65 | if (!instance_) { 66 | instance_ = new WindowClassRegistrar(); 67 | } 68 | return instance_; 69 | } 70 | 71 | // Returns the name of the window class, registering the class if it hasn't 72 | // previously been registered. 73 | const wchar_t* GetWindowClass(); 74 | 75 | // Unregisters the window class. Should only be called if there are no 76 | // instances of the window. 77 | void UnregisterWindowClass(); 78 | 79 | private: 80 | WindowClassRegistrar() = default; 81 | 82 | static WindowClassRegistrar* instance_; 83 | 84 | bool class_registered_ = false; 85 | }; 86 | 87 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 88 | 89 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 90 | if (!class_registered_) { 91 | WNDCLASS window_class{}; 92 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 93 | window_class.lpszClassName = kWindowClassName; 94 | window_class.style = CS_HREDRAW | CS_VREDRAW; 95 | window_class.cbClsExtra = 0; 96 | window_class.cbWndExtra = 0; 97 | window_class.hInstance = GetModuleHandle(nullptr); 98 | window_class.hIcon = 99 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 100 | window_class.hbrBackground = 0; 101 | window_class.lpszMenuName = nullptr; 102 | window_class.lpfnWndProc = Win32Window::WndProc; 103 | RegisterClass(&window_class); 104 | class_registered_ = true; 105 | } 106 | return kWindowClassName; 107 | } 108 | 109 | void WindowClassRegistrar::UnregisterWindowClass() { 110 | UnregisterClass(kWindowClassName, nullptr); 111 | class_registered_ = false; 112 | } 113 | 114 | Win32Window::Win32Window() { 115 | ++g_active_window_count; 116 | } 117 | 118 | Win32Window::~Win32Window() { 119 | --g_active_window_count; 120 | Destroy(); 121 | } 122 | 123 | bool Win32Window::Create(const std::wstring& title, 124 | const Point& origin, 125 | const Size& size) { 126 | Destroy(); 127 | 128 | const wchar_t* window_class = 129 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 130 | 131 | const POINT target_point = {static_cast(origin.x), 132 | static_cast(origin.y)}; 133 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 134 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 135 | double scale_factor = dpi / 96.0; 136 | 137 | HWND window = CreateWindow( 138 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW, 139 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 140 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 141 | nullptr, nullptr, GetModuleHandle(nullptr), this); 142 | 143 | if (!window) { 144 | return false; 145 | } 146 | 147 | UpdateTheme(window); 148 | 149 | return OnCreate(); 150 | } 151 | 152 | bool Win32Window::Show() { 153 | return ShowWindow(window_handle_, SW_SHOWNORMAL); 154 | } 155 | 156 | // static 157 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 158 | UINT const message, 159 | WPARAM const wparam, 160 | LPARAM const lparam) noexcept { 161 | if (message == WM_NCCREATE) { 162 | auto window_struct = reinterpret_cast(lparam); 163 | SetWindowLongPtr(window, GWLP_USERDATA, 164 | reinterpret_cast(window_struct->lpCreateParams)); 165 | 166 | auto that = static_cast(window_struct->lpCreateParams); 167 | EnableFullDpiSupportIfAvailable(window); 168 | that->window_handle_ = window; 169 | } else if (Win32Window* that = GetThisFromHandle(window)) { 170 | return that->MessageHandler(window, message, wparam, lparam); 171 | } 172 | 173 | return DefWindowProc(window, message, wparam, lparam); 174 | } 175 | 176 | LRESULT 177 | Win32Window::MessageHandler(HWND hwnd, 178 | UINT const message, 179 | WPARAM const wparam, 180 | LPARAM const lparam) noexcept { 181 | switch (message) { 182 | case WM_DESTROY: 183 | window_handle_ = nullptr; 184 | Destroy(); 185 | if (quit_on_close_) { 186 | PostQuitMessage(0); 187 | } 188 | return 0; 189 | 190 | case WM_DPICHANGED: { 191 | auto newRectSize = reinterpret_cast(lparam); 192 | LONG newWidth = newRectSize->right - newRectSize->left; 193 | LONG newHeight = newRectSize->bottom - newRectSize->top; 194 | 195 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 196 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 197 | 198 | return 0; 199 | } 200 | case WM_SIZE: { 201 | RECT rect = GetClientArea(); 202 | if (child_content_ != nullptr) { 203 | // Size and position the child window. 204 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 205 | rect.bottom - rect.top, TRUE); 206 | } 207 | return 0; 208 | } 209 | 210 | case WM_ACTIVATE: 211 | if (child_content_ != nullptr) { 212 | SetFocus(child_content_); 213 | } 214 | return 0; 215 | 216 | case WM_DWMCOLORIZATIONCOLORCHANGED: 217 | UpdateTheme(hwnd); 218 | return 0; 219 | } 220 | 221 | return DefWindowProc(window_handle_, message, wparam, lparam); 222 | } 223 | 224 | void Win32Window::Destroy() { 225 | OnDestroy(); 226 | 227 | if (window_handle_) { 228 | DestroyWindow(window_handle_); 229 | window_handle_ = nullptr; 230 | } 231 | if (g_active_window_count == 0) { 232 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 233 | } 234 | } 235 | 236 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 237 | return reinterpret_cast( 238 | GetWindowLongPtr(window, GWLP_USERDATA)); 239 | } 240 | 241 | void Win32Window::SetChildContent(HWND content) { 242 | child_content_ = content; 243 | SetParent(content, window_handle_); 244 | RECT frame = GetClientArea(); 245 | 246 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 247 | frame.bottom - frame.top, true); 248 | 249 | SetFocus(child_content_); 250 | } 251 | 252 | RECT Win32Window::GetClientArea() { 253 | RECT frame; 254 | GetClientRect(window_handle_, &frame); 255 | return frame; 256 | } 257 | 258 | HWND Win32Window::GetHandle() { 259 | return window_handle_; 260 | } 261 | 262 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 263 | quit_on_close_ = quit_on_close; 264 | } 265 | 266 | bool Win32Window::OnCreate() { 267 | // No-op; provided for subclasses. 268 | return true; 269 | } 270 | 271 | void Win32Window::OnDestroy() { 272 | // No-op; provided for subclasses. 273 | } 274 | 275 | void Win32Window::UpdateTheme(HWND const window) { 276 | DWORD light_mode; 277 | DWORD light_mode_size = sizeof(light_mode); 278 | LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, 279 | kGetPreferredBrightnessRegValue, 280 | RRF_RT_REG_DWORD, nullptr, &light_mode, 281 | &light_mode_size); 282 | 283 | if (result == ERROR_SUCCESS) { 284 | BOOL enable_dark_mode = light_mode == 0; 285 | DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, 286 | &enable_dark_mode, sizeof(enable_dark_mode)); 287 | } 288 | } 289 | -------------------------------------------------------------------------------- /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 a win32 window with |title| that is positioned and sized using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size this function will scale the inputted width and height as 35 | // as appropriate for the default monitor. The window is invisible until 36 | // |Show| is called. Returns true if the window was created successfully. 37 | bool Create(const std::wstring& title, const Point& origin, const Size& size); 38 | 39 | // Show the current window. Returns true if the window was successfully shown. 40 | bool Show(); 41 | 42 | // Release OS resources associated with window. 43 | void Destroy(); 44 | 45 | // Inserts |content| into the window tree. 46 | void SetChildContent(HWND content); 47 | 48 | // Returns the backing Window handle to enable clients to set icon and other 49 | // window properties. Returns nullptr if the window has been destroyed. 50 | HWND GetHandle(); 51 | 52 | // If true, closing this window will quit the application. 53 | void SetQuitOnClose(bool quit_on_close); 54 | 55 | // Return a RECT representing the bounds of the current client area. 56 | RECT GetClientArea(); 57 | 58 | protected: 59 | // Processes and route salient window messages for mouse handling, 60 | // size change and DPI. Delegates handling of these to member overloads that 61 | // inheriting classes can handle. 62 | virtual LRESULT MessageHandler(HWND window, 63 | UINT const message, 64 | WPARAM const wparam, 65 | LPARAM const lparam) noexcept; 66 | 67 | // Called when CreateAndShow is called, allowing subclass window-related 68 | // setup. Subclasses should return false if setup fails. 69 | virtual bool OnCreate(); 70 | 71 | // Called when Destroy is called. 72 | virtual void OnDestroy(); 73 | 74 | private: 75 | friend class WindowClassRegistrar; 76 | 77 | // OS callback called by message pump. Handles the WM_NCCREATE message which 78 | // is passed when the non-client area is being created and enables automatic 79 | // non-client DPI scaling so that the non-client area automatically 80 | // responds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | -------------------------------------------------------------------------------- /lib/fl_paging.dart: -------------------------------------------------------------------------------- 1 | library fl_paging; 2 | 3 | export 'src/datasource/page_keyed_data_source.dart'; 4 | export 'src/widgets/paging_grid_view.dart'; 5 | export 'src/widgets/paging_list_view.dart'; 6 | -------------------------------------------------------------------------------- /lib/src/datasource/data_source.dart: -------------------------------------------------------------------------------- 1 | abstract class DataSource { 2 | /// Request load page for Data Source 3 | Future> loadPage({bool isRefresh}); 4 | 5 | /// true when your list is don't have any data for next request. 6 | bool get isEndList; 7 | } 8 | 9 | const kDefaultPageSize = 20; 10 | -------------------------------------------------------------------------------- /lib/src/datasource/index_data_source.dart: -------------------------------------------------------------------------------- 1 | class IndexDataSource { 2 | static const TAG = 'IndexDataSource'; 3 | final int pageSize; 4 | final int initIndex; 5 | 6 | IndexDataSource({this.pageSize = 20, this.initIndex = 0}); 7 | } 8 | 9 | class LoadParamsIndex { 10 | int currentIndex; 11 | int pageSize; 12 | 13 | LoadParamsIndex(this.currentIndex, this.pageSize); 14 | } 15 | -------------------------------------------------------------------------------- /lib/src/datasource/item_keyed_data_source.dart: -------------------------------------------------------------------------------- 1 | class ItemKeyedDataSource { 2 | static const TAG = 'ItemKeyedDataSource'; 3 | } 4 | -------------------------------------------------------------------------------- /lib/src/datasource/offset_data_source.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class OffsetDataSource extends StatefulWidget { 4 | static const ROUTE_NAME = 'OffsetDataSource'; 5 | @override 6 | _OffsetDataSourceState createState() => _OffsetDataSourceState(); 7 | } 8 | 9 | class _OffsetDataSourceState extends State { 10 | @override 11 | Widget build(BuildContext context) { 12 | return Container(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /lib/src/datasource/page_keyed_data_source.dart: -------------------------------------------------------------------------------- 1 | import 'package:tuple/tuple.dart'; 2 | 3 | import 'data_source.dart'; 4 | import 'package:async/async.dart'; 5 | 6 | /// K is type of page index, D is type of data 7 | abstract class PageKeyedDataSource extends DataSource { 8 | static const TAG = 'PageKeyedDataSource'; 9 | 10 | /// Current Key of page loaded success 11 | K? currentKey; 12 | 13 | final bool autoDetectEndList; 14 | 15 | final int pageSize; 16 | 17 | /// true if data source is loaded all data 18 | /// false if data source is not loaded all data 19 | bool isEndList; 20 | 21 | CancelableOperation, K>>? _cancelableOperation; 22 | 23 | PageKeyedDataSource({ 24 | this.isEndList = false, 25 | this.autoDetectEndList = true, 26 | this.pageSize = kDefaultPageSize}); 27 | 28 | /// Load for first time 29 | /// Item1(List) of Tuple2 is List of Data 30 | /// Item2(K) of Tuple2 is next page when load more 31 | Future, K>> loadInitial(int pageSize); 32 | 33 | /// Load for page after page has key is param 34 | /// Item1(List) of Tuple2 is List of Data 35 | /// Item2(K) of Tuple2 is next page when load more 36 | Future, K>> loadPageAfter(K params, int pageSize); 37 | 38 | @override 39 | Future> loadPage({bool isRefresh = false}) async { 40 | if ((currentKey == null) || isRefresh) { 41 | if (_cancelableOperation != null && !_cancelableOperation!.isCompleted) 42 | _cancelableOperation!.cancel(); 43 | _cancelableOperation = CancelableOperation.fromFuture(loadInitial(pageSize)); 44 | final results = await _cancelableOperation!.valueOrCancellation(); 45 | if (autoDetectEndList) { 46 | isEndList = ((results?.item1.length ?? 0) < pageSize); 47 | } 48 | currentKey = results?.item2; 49 | return results?.item1 ?? []; 50 | } else { 51 | _cancelableOperation = CancelableOperation.fromFuture(loadPageAfter(currentKey!, pageSize)); 52 | final results = await _cancelableOperation!.valueOrCancellation(); 53 | currentKey = results?.item2; 54 | if (autoDetectEndList) { 55 | isEndList = ((results?.item1.length ?? 0) < pageSize); 56 | } 57 | return results?.item1 ?? []; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /lib/src/widgets/base_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:fl_paging/src/datasource/data_source.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import 'builder.dart'; 5 | 6 | typedef ValueIndexWidgetBuilder = Widget Function( 7 | BuildContext context, T value, int index); 8 | 9 | abstract class BaseWidget extends StatefulWidget { 10 | /// Signature for a function that creates a widget empty 11 | final WidgetBuilder? emptyBuilder; 12 | 13 | /// Signature for a function that creates a widget loading 14 | final WidgetBuilder? loadingBuilder; 15 | 16 | /// Signature for a function that creates a widget Error 17 | final ErrorBuilder? errorBuilder; 18 | 19 | /// Signature for a function that creates a widget for item 20 | final ValueIndexWidgetBuilder itemBuilder; 21 | 22 | /// DataSource for current ScrollView [ListView - GridView] 23 | final DataSource pageDataSource; 24 | 25 | final ScrollViewKeyboardDismissBehavior keyboardDismissBehavior; 26 | 27 | BaseWidget( 28 | {Key? key, 29 | this.emptyBuilder, 30 | this.loadingBuilder, 31 | this.errorBuilder, 32 | this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.onDrag, 33 | required this.itemBuilder, 34 | required this.pageDataSource}) 35 | : super(key: key); 36 | } 37 | -------------------------------------------------------------------------------- /lib/src/widgets/builder.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | typedef PaginationBuilder = Future> Function(int page); 4 | 5 | typedef ErrorBuilder = T Function(BuildContext context, Object error); 6 | -------------------------------------------------------------------------------- /lib/src/widgets/default/empty_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class EmptyWidget extends StatelessWidget { 4 | const EmptyWidget({Key? key}) : super(key: key); 5 | 6 | @override 7 | Widget build(BuildContext context) { 8 | return Center( 9 | child: Text('No Data') 10 | ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /lib/src/widgets/default/load_more_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class LoadMoreWidget extends StatelessWidget { 5 | @override 6 | Widget build(BuildContext context) { 7 | return Container( 8 | padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16), 9 | alignment: Alignment.center, 10 | child: CupertinoActivityIndicator(), 11 | ); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/src/widgets/default/paging_default_loading.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class PagingDefaultLoading extends StatelessWidget { 5 | @override 6 | Widget build(BuildContext context) { 7 | return Center( 8 | child: CupertinoActivityIndicator(), 9 | ); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib/src/widgets/paging_grid_view.dart: -------------------------------------------------------------------------------- 1 | import 'dart:developer' as developer; 2 | 3 | import 'package:fl_paging/src/datasource/data_source.dart'; 4 | import 'package:fl_paging/src/widgets/builder.dart'; 5 | import 'package:fl_paging/src/widgets/default/empty_widget.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:flutter/widgets.dart' as widgets; 8 | 9 | import 'base_widget.dart'; 10 | import 'builder.dart'; 11 | import 'default/load_more_widget.dart'; 12 | import 'default/paging_default_loading.dart'; 13 | import 'paging_state.dart'; 14 | 15 | class PagingGridView extends BaseWidget { 16 | static const ROUTE_NAME = 'GridView'; 17 | final widgets.EdgeInsets? padding; 18 | final SliverGridDelegate delegate; 19 | final bool isEnablePullToRefresh; 20 | 21 | PagingGridView( 22 | {Key? key, 23 | this.padding, 24 | required this.delegate, 25 | this.isEnablePullToRefresh = true, 26 | required ValueIndexWidgetBuilder itemBuilder, 27 | WidgetBuilder? emptyBuilder, 28 | WidgetBuilder? loadingBuilder, 29 | ErrorBuilder? errorBuilder, 30 | ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = 31 | ScrollViewKeyboardDismissBehavior.manual, 32 | required DataSource pageDataSource}) 33 | : super( 34 | itemBuilder: itemBuilder, 35 | emptyBuilder: emptyBuilder, 36 | loadingBuilder: loadingBuilder, 37 | errorBuilder: errorBuilder, 38 | keyboardDismissBehavior: keyboardDismissBehavior, 39 | pageDataSource: pageDataSource, 40 | key: key); 41 | 42 | @override 43 | GridViewState createState() => GridViewState(); 44 | } 45 | 46 | class GridViewState extends State> { 47 | static const TAG = 'GridView'; 48 | 49 | PagingState _pagingState = PagingState.loading(); 50 | 51 | void retry() { 52 | _loadPage(isRefresh: false); 53 | } 54 | 55 | Future _loadPage({bool isRefresh = false}) async { 56 | developer.log('_loadPage [isRefresh]: [$isRefresh]', name: TAG); 57 | if (isRefresh == true) { 58 | try { 59 | final value = 60 | await widget.pageDataSource.loadPage(isRefresh: isRefresh); 61 | setState(() { 62 | _pagingState = 63 | PagingState(value, false, widget.pageDataSource.isEndList); 64 | }); 65 | } catch (error) { 66 | setState(() { 67 | _pagingState = PagingState.error(error); 68 | }); 69 | } 70 | } else { 71 | if (_pagingState is PagingStateLoading) { 72 | widget.pageDataSource.loadPage().then((value) { 73 | setState(() { 74 | _pagingState = 75 | PagingState(value, false, widget.pageDataSource.isEndList); 76 | }); 77 | }, onError: (error) { 78 | setState(() { 79 | _pagingState = PagingState.error(error); 80 | }); 81 | }); 82 | } else { 83 | if (_pagingState is PagingStateError) { 84 | setState(() { 85 | _pagingState = PagingState.loading(); 86 | }); 87 | } 88 | widget.pageDataSource.loadPage().then((value) { 89 | final oldState = (_pagingState as PagingStateData); 90 | setState(() { 91 | if (value.length == 0) { 92 | _pagingState = oldState.copyWith 93 | .call(isLoadMore: false, isEndList: true) as PagingState; 94 | } else { 95 | _pagingState = oldState.copyWith.call( 96 | isLoadMore: false, 97 | isEndList: widget.pageDataSource.isEndList, 98 | datas: oldState.datas..addAll(value)) as PagingState; 99 | } 100 | }); 101 | }, onError: (error) { 102 | setState(() { 103 | _pagingState = PagingState.error(error); 104 | }); 105 | }); 106 | } 107 | } 108 | } 109 | 110 | @override 111 | void initState() { 112 | super.initState(); 113 | _loadPage(); 114 | } 115 | 116 | void refresh() { 117 | _loadPage(isRefresh: true); 118 | } 119 | 120 | @override 121 | void didUpdateWidget(PagingGridView oldWidget) { 122 | super.didUpdateWidget(oldWidget); 123 | if (widget.delegate is SliverGridDelegateWithFixedCrossAxisCount && 124 | oldWidget.delegate is SliverGridDelegateWithFixedCrossAxisCount) { 125 | if ((widget.delegate as SliverGridDelegateWithFixedCrossAxisCount) 126 | .childAspectRatio != 127 | (oldWidget.delegate as SliverGridDelegateWithFixedCrossAxisCount) 128 | .childAspectRatio) { 129 | setState(() {}); 130 | } 131 | } 132 | } 133 | 134 | @override 135 | void setState(fn) { 136 | if(mounted) { 137 | super.setState(fn); 138 | } 139 | } 140 | 141 | @override 142 | Widget build(BuildContext context) { 143 | return _pagingState.when((datas, isLoadMore, isEndList) { 144 | if (datas.length == 0) { 145 | if (widget.emptyBuilder != null) { 146 | return widget.emptyBuilder!(context); 147 | } else { 148 | return EmptyWidget(); 149 | } 150 | } else { 151 | Widget child = widgets.SliverGrid( 152 | gridDelegate: widget.delegate, 153 | delegate: SliverChildBuilderDelegate((context, index) { 154 | return widget.itemBuilder(context, datas[index], index); 155 | }, childCount: datas.length), 156 | ); 157 | final body = NotificationListener( 158 | child: CustomScrollView( 159 | keyboardDismissBehavior: widget.keyboardDismissBehavior, 160 | slivers: [ 161 | widgets.SliverPadding( 162 | padding: widget.padding ?? EdgeInsets.zero, 163 | sliver: child, 164 | ), 165 | if (!isEndList) 166 | SliverToBoxAdapter( 167 | child: LoadMoreWidget(), 168 | ) 169 | ], 170 | ), 171 | onNotification: (notification) { 172 | if (notification is ScrollEndNotification) { 173 | if (notification.metrics.pixels == 174 | notification.metrics.maxScrollExtent) { 175 | if (isEndList) return false; 176 | if (_pagingState is PagingStateData) { 177 | if (!isEndList && !isLoadMore) { 178 | _loadPage(); 179 | setState(() { 180 | _pagingState = (_pagingState as PagingStateData) 181 | .copyWith 182 | .call(isLoadMore: true); 183 | }); 184 | } 185 | } 186 | } 187 | } else if (notification is ScrollUpdateNotification) { 188 | //To show floating 189 | } 190 | return false; 191 | }, 192 | ); 193 | if (!widget.isEnablePullToRefresh) return body; 194 | return RefreshIndicator( 195 | child: body, 196 | onRefresh: () { 197 | return _loadPage(isRefresh: true); 198 | }, 199 | ); 200 | } 201 | }, loading: () { 202 | if (widget.loadingBuilder != null) { 203 | return widget.loadingBuilder!(context); 204 | } else { 205 | return PagingDefaultLoading(); 206 | } 207 | }, error: (error) { 208 | if (widget.errorBuilder != null) { 209 | return widget.errorBuilder!(context, error); 210 | } else { 211 | return ErrorWidget(error); 212 | } 213 | }); 214 | } 215 | } 216 | -------------------------------------------------------------------------------- /lib/src/widgets/paging_list_view.dart: -------------------------------------------------------------------------------- 1 | import 'dart:developer' as developer; 2 | import 'dart:io'; 3 | 4 | import 'package:async/async.dart'; 5 | import 'package:fl_paging/src/datasource/data_source.dart'; 6 | import 'package:fl_paging/src/widgets/base_widget.dart'; 7 | import 'package:fl_paging/src/widgets/default/empty_widget.dart'; 8 | import 'package:fl_paging/src/widgets/default/paging_default_loading.dart'; 9 | import 'package:fl_paging/src/widgets/paging_state.dart'; 10 | import 'package:flutter/cupertino.dart'; 11 | import 'package:flutter/gestures.dart'; 12 | import 'package:flutter/material.dart'; 13 | import 'package:flutter/widgets.dart' as widgets; 14 | 15 | import 'builder.dart'; 16 | import 'default/load_more_widget.dart'; 17 | 18 | enum StylePullToRefresh { ANDROID, IOS } 19 | 20 | class PagingListView extends BaseWidget { 21 | final widgets.EdgeInsets padding; 22 | final IndexedWidgetBuilder? separatorBuilder; 23 | final Axis scrollDirection; 24 | final bool reverse; 25 | final bool isEnablePullToRefresh; 26 | final StylePullToRefresh stylePullToRefresh; 27 | final ScrollController? controller; 28 | final bool? primary; 29 | 30 | ///In Android pull to refresh only work 31 | /// if total height height < height of screen => physics = [AlwaysScrollableScrollPhysics] 32 | /// if total height of item > height of screen => physics = [BouncingScrollPhysics] || [AlwaysScrollableScrollPhysics] 33 | /// default physics = [AlwaysScrollableScrollPhysics] 34 | final ScrollPhysics? physics; 35 | 36 | final bool shrinkWrap; 37 | final bool addAutomaticKeepAlives; 38 | final bool addRepaintBoundaries; 39 | final bool addSemanticIndexes; 40 | final double? cacheExtent; 41 | final DragStartBehavior dragStartBehavior; 42 | final ScrollViewKeyboardDismissBehavior keyboardDismissBehavior; 43 | final ValueChanged? errorWhenLoadMore; 44 | PagingListView( 45 | {Key? key, 46 | this.isEnablePullToRefresh = true, 47 | this.stylePullToRefresh = StylePullToRefresh.ANDROID, 48 | this.padding = EdgeInsets.zero, 49 | this.separatorBuilder, 50 | this.scrollDirection = Axis.vertical, 51 | this.reverse = false, 52 | this.controller, 53 | this.primary, 54 | this.physics, 55 | this.shrinkWrap = false, 56 | this.addRepaintBoundaries = true, 57 | this.addAutomaticKeepAlives = true, 58 | this.addSemanticIndexes = true, 59 | this.cacheExtent, 60 | this.dragStartBehavior = DragStartBehavior.start, 61 | this.errorWhenLoadMore, 62 | this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, 63 | required ValueIndexWidgetBuilder itemBuilder, 64 | WidgetBuilder? emptyBuilder, 65 | WidgetBuilder? loadingBuilder, 66 | ErrorBuilder? errorBuilder, 67 | required DataSource pageDataSource}) 68 | : super( 69 | itemBuilder: itemBuilder, 70 | emptyBuilder: emptyBuilder, 71 | loadingBuilder: loadingBuilder, 72 | errorBuilder: errorBuilder, 73 | pageDataSource: pageDataSource, 74 | key: key); 75 | @override 76 | ListViewState createState() => ListViewState(); 77 | } 78 | 79 | class ListViewState extends State> { 80 | static const TAG = 'ListView'; 81 | CancelableOperation? cancelableOperation; 82 | PagingState _pagingState = PagingState.loading(); 83 | PagingState get pagingState => _pagingState; 84 | 85 | List getData() { 86 | return _pagingState.maybeWhen((datas, isLoadMore, isEndList) => datas, 87 | orElse: () => []); 88 | } 89 | 90 | @override 91 | void dispose() { 92 | cancelableOperation?.cancel(); 93 | super.dispose(); 94 | } 95 | 96 | void emit(PagingState state) { 97 | if (mounted) { 98 | setState(() { 99 | _pagingState = state; 100 | }); 101 | } 102 | } 103 | 104 | void refresh() { 105 | _loadPage(isRefresh: true); 106 | } 107 | 108 | void retry() { 109 | _loadPage(isRefresh: false); 110 | } 111 | 112 | Future _loadPage({bool isRefresh = false}) async { 113 | if (cancelableOperation != null && !cancelableOperation!.isCompleted) { 114 | cancelableOperation!.cancel(); 115 | } 116 | if (isRefresh == true) { 117 | try { 118 | emit(PagingState( 119 | await widget.pageDataSource.loadPage(isRefresh: isRefresh), 120 | false, 121 | widget.pageDataSource.isEndList)); 122 | } catch (error) { 123 | emit(PagingState.error(error)); 124 | } 125 | } else { 126 | if (_pagingState is PagingStateLoading) { 127 | cancelableOperation = 128 | CancelableOperation.fromFuture(widget.pageDataSource.loadPage()); 129 | cancelableOperation!.value.then((value) { 130 | emit(PagingState(value, false, widget.pageDataSource.isEndList)); 131 | }, onError: (error) { 132 | emit(PagingState.error(error)); 133 | }); 134 | } else { 135 | if (_pagingState is PagingStateError) { 136 | emit(PagingState.loading()); 137 | } 138 | cancelableOperation = 139 | CancelableOperation.fromFuture(widget.pageDataSource.loadPage()); 140 | cancelableOperation!.value.then((value) { 141 | if (_pagingState is PagingStateData) { 142 | final oldState = (_pagingState as PagingStateData); 143 | if (value.length == 0) { 144 | emit(oldState.copyWith.call(isLoadMore: false, isEndList: true)); 145 | } else { 146 | emit(oldState.copyWith.call( 147 | isLoadMore: false, 148 | isEndList: widget.pageDataSource.isEndList, 149 | datas: oldState.datas..addAll(value))); 150 | } 151 | } else { 152 | emit(PagingState(value, false, widget.pageDataSource.isEndList)); 153 | } 154 | }, onError: (error) { 155 | if (widget.errorWhenLoadMore != null) { 156 | widget.errorWhenLoadMore!(error); 157 | } else { 158 | emit(PagingState.error(error)); 159 | } 160 | }); 161 | } 162 | } 163 | } 164 | 165 | @override 166 | void didUpdateWidget(covariant PagingListView oldWidget) { 167 | super.didUpdateWidget(oldWidget); 168 | if (oldWidget.pageDataSource != widget.pageDataSource) { 169 | developer.log( 170 | 'Your DataSource is updated. your ListView will reload, to avoid this case, we recommend define a variable for \n' 171 | 'Datasource on `initState`', 172 | name: 'ListViewState'); 173 | emit(PagingState.loading()); 174 | _loadPage(); 175 | } 176 | } 177 | 178 | @override 179 | void initState() { 180 | super.initState(); 181 | _loadPage(); 182 | } 183 | 184 | @override 185 | Widget build(BuildContext context) { 186 | return _pagingState.when((datas, isLoadMore, isEndList) { 187 | if (datas.length == 0) { 188 | if (widget.emptyBuilder == null) { 189 | return EmptyWidget(); 190 | } 191 | return widget.emptyBuilder!(context); 192 | } else { 193 | //region child 194 | Widget child; 195 | child = widgets.ListView.separated( 196 | padding: widget.padding, 197 | cacheExtent: widget.cacheExtent, 198 | scrollDirection: widget.scrollDirection, 199 | reverse: widget.reverse, 200 | primary: widget.primary, 201 | physics: widget.physics, 202 | controller: widget.controller, 203 | addAutomaticKeepAlives: widget.addAutomaticKeepAlives, 204 | addRepaintBoundaries: widget.addRepaintBoundaries, 205 | addSemanticIndexes: widget.addSemanticIndexes, 206 | dragStartBehavior: widget.dragStartBehavior, 207 | shrinkWrap: widget.shrinkWrap, 208 | keyboardDismissBehavior: widget.keyboardDismissBehavior, 209 | separatorBuilder: (context, index) { 210 | return widget.separatorBuilder != null 211 | ? widget.separatorBuilder!(context, index) 212 | : const SizedBox( 213 | height: 16, 214 | ); 215 | }, 216 | itemBuilder: (context, index) { 217 | return index == datas.length 218 | ? LoadMoreWidget() 219 | : widget.itemBuilder(context, datas[index], index); 220 | }, 221 | itemCount: !isEndList ? datas.length + 1 : datas.length, 222 | ); 223 | if (widget.isEnablePullToRefresh) { 224 | if (widget.stylePullToRefresh == StylePullToRefresh.ANDROID) { 225 | return RefreshIndicator( 226 | child: NotificationListener( 227 | child: child, 228 | onNotification: (notification) { 229 | if (!isEndList && 230 | notification is ScrollEndNotification && 231 | (notification.metrics.pixels == 232 | notification.metrics.maxScrollExtent)) { 233 | if (_pagingState is PagingStateData && 234 | (!isEndList && !isLoadMore)) { 235 | _loadPage(); 236 | emit((_pagingState as PagingStateData) 237 | .copyWith(isLoadMore: true)); 238 | } 239 | } 240 | return false; 241 | }, 242 | ), 243 | onRefresh: () { 244 | return _loadPage(isRefresh: true); 245 | }, 246 | ); 247 | } 248 | else { 249 | 250 | Widget childListUpdate = SliverSafeArea( 251 | sliver: SliverList( 252 | delegate: SliverChildBuilderDelegate( 253 | (context, index) { 254 | final int itemIndex = index ~/ 2; 255 | if (index.isEven) { 256 | return itemIndex == datas.length 257 | ? LoadMoreWidget() 258 | : widget.itemBuilder(context, datas[itemIndex], itemIndex); 259 | } 260 | return widget.separatorBuilder != null 261 | ? widget.separatorBuilder!(context, itemIndex) 262 | : const SizedBox(height: 16,); 263 | }, 264 | semanticIndexCallback: (Widget widget, int localIndex) { 265 | if (localIndex.isEven) { 266 | return localIndex ~/ 2; 267 | } 268 | return null; 269 | }, 270 | addAutomaticKeepAlives: widget.addAutomaticKeepAlives, 271 | addRepaintBoundaries: widget.addRepaintBoundaries, 272 | addSemanticIndexes: widget.addSemanticIndexes, 273 | childCount: !isEndList ? datas.length * 2 + 2 : datas.length * 2, 274 | ), 275 | ), 276 | ); 277 | 278 | // ScrollPhysics physics = Platform.isIOS ? AlwaysScrollableScrollPhysics() : BouncingScrollPhysics(); 279 | return NotificationListener( 280 | child: Padding( 281 | padding: widget.padding, 282 | child: ScrollConfiguration( 283 | behavior: CupertinoScrollBehavior(), 284 | child: CustomScrollView( 285 | shrinkWrap: widget.shrinkWrap, 286 | physics:widget.physics ?? AlwaysScrollableScrollPhysics(), 287 | cacheExtent: widget.cacheExtent, 288 | scrollDirection: widget.scrollDirection, 289 | reverse: widget.reverse, 290 | primary: widget.primary, 291 | controller: widget.controller, 292 | dragStartBehavior: widget.dragStartBehavior, 293 | keyboardDismissBehavior: widget.keyboardDismissBehavior, 294 | slivers: [ 295 | CupertinoSliverRefreshControl( 296 | refreshTriggerPullDistance: 100.0, 297 | refreshIndicatorExtent: 60.0, 298 | onRefresh: () async { 299 | return _loadPage(isRefresh: true); 300 | }, 301 | ), 302 | childListUpdate 303 | ], 304 | ), 305 | ), 306 | ), 307 | onNotification: (notification) { 308 | if (!isEndList && 309 | notification is ScrollEndNotification && 310 | (notification.metrics.pixels == 311 | notification.metrics.maxScrollExtent)) { 312 | if (_pagingState is PagingStateData && 313 | (!isEndList && !isLoadMore)) { 314 | _loadPage(); 315 | emit((_pagingState as PagingStateData) 316 | .copyWith(isLoadMore: true)); 317 | } 318 | } 319 | return false; 320 | }, 321 | ); 322 | } 323 | } else { 324 | return NotificationListener( 325 | child: child, 326 | onNotification: (notification) { 327 | if (!isEndList && 328 | notification is ScrollEndNotification && 329 | (notification.metrics.pixels == 330 | notification.metrics.maxScrollExtent)) { 331 | if (_pagingState is PagingStateData && 332 | (!isEndList && !isLoadMore)) { 333 | _loadPage(); 334 | emit((_pagingState as PagingStateData) 335 | .copyWith(isLoadMore: true)); 336 | } 337 | } 338 | return false; 339 | }, 340 | ); 341 | } 342 | 343 | //endregion 344 | 345 | } 346 | }, 347 | loading: () => (widget.loadingBuilder != null) 348 | ? widget.loadingBuilder!(context) 349 | : PagingDefaultLoading(), 350 | error: (error) => widget.errorBuilder != null 351 | ? widget.errorBuilder!(context, error) 352 | : ErrorWidget(error)); 353 | } 354 | } 355 | -------------------------------------------------------------------------------- /lib/src/widgets/paging_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | 3 | part 'paging_state.freezed.dart'; 4 | 5 | @freezed 6 | abstract class PagingState with _$PagingState { 7 | const factory PagingState(List datas, bool isLoadMore, bool isEndList) = 8 | PagingStateData; 9 | 10 | const factory PagingState.loading() = PagingStateLoading; 11 | 12 | const factory PagingState.error(dynamic error) = PagingStateError; 13 | } 14 | -------------------------------------------------------------------------------- /lib/src/widgets/paging_state.freezed.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides 3 | 4 | part of 'paging_state.dart'; 5 | 6 | // ************************************************************************** 7 | // FreezedGenerator 8 | // ************************************************************************** 9 | 10 | T _$identity(T value) => value; 11 | 12 | final _privateConstructorUsedError = UnsupportedError( 13 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 14 | 15 | /// @nodoc 16 | class _$PagingStateTearOff { 17 | const _$PagingStateTearOff(); 18 | 19 | PagingStateData call(List datas, bool isLoadMore, bool isEndList) { 20 | return PagingStateData( 21 | datas, 22 | isLoadMore, 23 | isEndList, 24 | ); 25 | } 26 | 27 | PagingStateLoading loading() { 28 | return PagingStateLoading(); 29 | } 30 | 31 | PagingStateError error(dynamic error) { 32 | return PagingStateError( 33 | error, 34 | ); 35 | } 36 | } 37 | 38 | /// @nodoc 39 | const $PagingState = _$PagingStateTearOff(); 40 | 41 | /// @nodoc 42 | mixin _$PagingState { 43 | @optionalTypeArgs 44 | TResult when( 45 | TResult Function(List datas, bool isLoadMore, bool isEndList) $default, { 46 | required TResult Function() loading, 47 | required TResult Function(dynamic error) error, 48 | }) => 49 | throw _privateConstructorUsedError; 50 | @optionalTypeArgs 51 | TResult maybeWhen( 52 | TResult Function(List datas, bool isLoadMore, bool isEndList)? 53 | $default, { 54 | TResult Function()? loading, 55 | TResult Function(dynamic error)? error, 56 | required TResult orElse(), 57 | }) => 58 | throw _privateConstructorUsedError; 59 | @optionalTypeArgs 60 | TResult map( 61 | TResult Function(PagingStateData value) $default, { 62 | required TResult Function(PagingStateLoading value) loading, 63 | required TResult Function(PagingStateError value) error, 64 | }) => 65 | throw _privateConstructorUsedError; 66 | @optionalTypeArgs 67 | TResult maybeMap( 68 | TResult Function(PagingStateData value)? $default, { 69 | TResult Function(PagingStateLoading value)? loading, 70 | TResult Function(PagingStateError value)? error, 71 | required TResult orElse(), 72 | }) => 73 | throw _privateConstructorUsedError; 74 | } 75 | 76 | /// @nodoc 77 | abstract class $PagingStateCopyWith { 78 | factory $PagingStateCopyWith( 79 | PagingState value, $Res Function(PagingState) then) = 80 | _$PagingStateCopyWithImpl; 81 | } 82 | 83 | /// @nodoc 84 | class _$PagingStateCopyWithImpl 85 | implements $PagingStateCopyWith { 86 | _$PagingStateCopyWithImpl(this._value, this._then); 87 | 88 | final PagingState _value; 89 | // ignore: unused_field 90 | final $Res Function(PagingState) _then; 91 | } 92 | 93 | /// @nodoc 94 | abstract class $PagingStateDataCopyWith { 95 | factory $PagingStateDataCopyWith( 96 | PagingStateData value, $Res Function(PagingStateData) then) = 97 | _$PagingStateDataCopyWithImpl; 98 | $Res call({List datas, bool isLoadMore, bool isEndList}); 99 | } 100 | 101 | /// @nodoc 102 | class _$PagingStateDataCopyWithImpl 103 | extends _$PagingStateCopyWithImpl 104 | implements $PagingStateDataCopyWith { 105 | _$PagingStateDataCopyWithImpl( 106 | PagingStateData _value, $Res Function(PagingStateData) _then) 107 | : super(_value, (v) => _then(v as PagingStateData)); 108 | 109 | @override 110 | PagingStateData get _value => super._value as PagingStateData; 111 | 112 | @override 113 | $Res call({ 114 | Object? datas = freezed, 115 | Object? isLoadMore = freezed, 116 | Object? isEndList = freezed, 117 | }) { 118 | return _then(PagingStateData( 119 | datas == freezed 120 | ? _value.datas 121 | : datas // ignore: cast_nullable_to_non_nullable 122 | as List, 123 | isLoadMore == freezed 124 | ? _value.isLoadMore 125 | : isLoadMore // ignore: cast_nullable_to_non_nullable 126 | as bool, 127 | isEndList == freezed 128 | ? _value.isEndList 129 | : isEndList // ignore: cast_nullable_to_non_nullable 130 | as bool, 131 | )); 132 | } 133 | } 134 | 135 | /// @nodoc 136 | class _$PagingStateData implements PagingStateData { 137 | const _$PagingStateData(this.datas, this.isLoadMore, this.isEndList); 138 | 139 | @override 140 | final List datas; 141 | @override 142 | final bool isLoadMore; 143 | @override 144 | final bool isEndList; 145 | 146 | @override 147 | String toString() { 148 | return 'PagingState<$D>(datas: $datas, isLoadMore: $isLoadMore, isEndList: $isEndList)'; 149 | } 150 | 151 | @override 152 | bool operator ==(dynamic other) { 153 | return identical(this, other) || 154 | (other is PagingStateData && 155 | (identical(other.datas, datas) || 156 | const DeepCollectionEquality().equals(other.datas, datas)) && 157 | (identical(other.isLoadMore, isLoadMore) || 158 | const DeepCollectionEquality() 159 | .equals(other.isLoadMore, isLoadMore)) && 160 | (identical(other.isEndList, isEndList) || 161 | const DeepCollectionEquality() 162 | .equals(other.isEndList, isEndList))); 163 | } 164 | 165 | @override 166 | int get hashCode => 167 | runtimeType.hashCode ^ 168 | const DeepCollectionEquality().hash(datas) ^ 169 | const DeepCollectionEquality().hash(isLoadMore) ^ 170 | const DeepCollectionEquality().hash(isEndList); 171 | 172 | @JsonKey(ignore: true) 173 | @override 174 | $PagingStateDataCopyWith> get copyWith => 175 | _$PagingStateDataCopyWithImpl>(this, _$identity); 176 | 177 | @override 178 | @optionalTypeArgs 179 | TResult when( 180 | TResult Function(List datas, bool isLoadMore, bool isEndList) $default, { 181 | required TResult Function() loading, 182 | required TResult Function(dynamic error) error, 183 | }) { 184 | return $default(datas, isLoadMore, isEndList); 185 | } 186 | 187 | @override 188 | @optionalTypeArgs 189 | TResult maybeWhen( 190 | TResult Function(List datas, bool isLoadMore, bool isEndList)? 191 | $default, { 192 | TResult Function()? loading, 193 | TResult Function(dynamic error)? error, 194 | required TResult orElse(), 195 | }) { 196 | if ($default != null) { 197 | return $default(datas, isLoadMore, isEndList); 198 | } 199 | return orElse(); 200 | } 201 | 202 | @override 203 | @optionalTypeArgs 204 | TResult map( 205 | TResult Function(PagingStateData value) $default, { 206 | required TResult Function(PagingStateLoading value) loading, 207 | required TResult Function(PagingStateError value) error, 208 | }) { 209 | return $default(this); 210 | } 211 | 212 | @override 213 | @optionalTypeArgs 214 | TResult maybeMap( 215 | TResult Function(PagingStateData value)? $default, { 216 | TResult Function(PagingStateLoading value)? loading, 217 | TResult Function(PagingStateError value)? error, 218 | required TResult orElse(), 219 | }) { 220 | if ($default != null) { 221 | return $default(this); 222 | } 223 | return orElse(); 224 | } 225 | } 226 | 227 | abstract class PagingStateData implements PagingState { 228 | const factory PagingStateData( 229 | List datas, bool isLoadMore, bool isEndList) = _$PagingStateData; 230 | 231 | List get datas => throw _privateConstructorUsedError; 232 | bool get isLoadMore => throw _privateConstructorUsedError; 233 | bool get isEndList => throw _privateConstructorUsedError; 234 | @JsonKey(ignore: true) 235 | $PagingStateDataCopyWith> get copyWith => 236 | throw _privateConstructorUsedError; 237 | } 238 | 239 | /// @nodoc 240 | abstract class $PagingStateLoadingCopyWith { 241 | factory $PagingStateLoadingCopyWith(PagingStateLoading value, 242 | $Res Function(PagingStateLoading) then) = 243 | _$PagingStateLoadingCopyWithImpl; 244 | } 245 | 246 | /// @nodoc 247 | class _$PagingStateLoadingCopyWithImpl 248 | extends _$PagingStateCopyWithImpl 249 | implements $PagingStateLoadingCopyWith { 250 | _$PagingStateLoadingCopyWithImpl( 251 | PagingStateLoading _value, $Res Function(PagingStateLoading) _then) 252 | : super(_value, (v) => _then(v as PagingStateLoading)); 253 | 254 | @override 255 | PagingStateLoading get _value => super._value as PagingStateLoading; 256 | } 257 | 258 | /// @nodoc 259 | class _$PagingStateLoading implements PagingStateLoading { 260 | const _$PagingStateLoading(); 261 | 262 | @override 263 | String toString() { 264 | return 'PagingState<$D>.loading()'; 265 | } 266 | 267 | @override 268 | bool operator ==(dynamic other) { 269 | return identical(this, other) || (other is PagingStateLoading); 270 | } 271 | 272 | @override 273 | int get hashCode => runtimeType.hashCode; 274 | 275 | @override 276 | @optionalTypeArgs 277 | TResult when( 278 | TResult Function(List datas, bool isLoadMore, bool isEndList) $default, { 279 | required TResult Function() loading, 280 | required TResult Function(dynamic error) error, 281 | }) { 282 | return loading(); 283 | } 284 | 285 | @override 286 | @optionalTypeArgs 287 | TResult maybeWhen( 288 | TResult Function(List datas, bool isLoadMore, bool isEndList)? 289 | $default, { 290 | TResult Function()? loading, 291 | TResult Function(dynamic error)? error, 292 | required TResult orElse(), 293 | }) { 294 | if (loading != null) { 295 | return loading(); 296 | } 297 | return orElse(); 298 | } 299 | 300 | @override 301 | @optionalTypeArgs 302 | TResult map( 303 | TResult Function(PagingStateData value) $default, { 304 | required TResult Function(PagingStateLoading value) loading, 305 | required TResult Function(PagingStateError value) error, 306 | }) { 307 | return loading(this); 308 | } 309 | 310 | @override 311 | @optionalTypeArgs 312 | TResult maybeMap( 313 | TResult Function(PagingStateData value)? $default, { 314 | TResult Function(PagingStateLoading value)? loading, 315 | TResult Function(PagingStateError value)? error, 316 | required TResult orElse(), 317 | }) { 318 | if (loading != null) { 319 | return loading(this); 320 | } 321 | return orElse(); 322 | } 323 | } 324 | 325 | abstract class PagingStateLoading implements PagingState { 326 | const factory PagingStateLoading() = _$PagingStateLoading; 327 | } 328 | 329 | /// @nodoc 330 | abstract class $PagingStateErrorCopyWith { 331 | factory $PagingStateErrorCopyWith( 332 | PagingStateError value, $Res Function(PagingStateError) then) = 333 | _$PagingStateErrorCopyWithImpl; 334 | $Res call({dynamic error}); 335 | } 336 | 337 | /// @nodoc 338 | class _$PagingStateErrorCopyWithImpl 339 | extends _$PagingStateCopyWithImpl 340 | implements $PagingStateErrorCopyWith { 341 | _$PagingStateErrorCopyWithImpl( 342 | PagingStateError _value, $Res Function(PagingStateError) _then) 343 | : super(_value, (v) => _then(v as PagingStateError)); 344 | 345 | @override 346 | PagingStateError get _value => super._value as PagingStateError; 347 | 348 | @override 349 | $Res call({ 350 | Object? error = freezed, 351 | }) { 352 | return _then(PagingStateError( 353 | error == freezed 354 | ? _value.error 355 | : error // ignore: cast_nullable_to_non_nullable 356 | as dynamic, 357 | )); 358 | } 359 | } 360 | 361 | /// @nodoc 362 | class _$PagingStateError implements PagingStateError { 363 | const _$PagingStateError(this.error); 364 | 365 | @override 366 | final dynamic error; 367 | 368 | @override 369 | String toString() { 370 | return 'PagingState<$D>.error(error: $error)'; 371 | } 372 | 373 | @override 374 | bool operator ==(dynamic other) { 375 | return identical(this, other) || 376 | (other is PagingStateError && 377 | (identical(other.error, error) || 378 | const DeepCollectionEquality().equals(other.error, error))); 379 | } 380 | 381 | @override 382 | int get hashCode => 383 | runtimeType.hashCode ^ const DeepCollectionEquality().hash(error); 384 | 385 | @JsonKey(ignore: true) 386 | @override 387 | $PagingStateErrorCopyWith> get copyWith => 388 | _$PagingStateErrorCopyWithImpl>(this, _$identity); 389 | 390 | @override 391 | @optionalTypeArgs 392 | TResult when( 393 | TResult Function(List datas, bool isLoadMore, bool isEndList) $default, { 394 | required TResult Function() loading, 395 | required TResult Function(dynamic error) error, 396 | }) { 397 | return error(this.error); 398 | } 399 | 400 | @override 401 | @optionalTypeArgs 402 | TResult maybeWhen( 403 | TResult Function(List datas, bool isLoadMore, bool isEndList)? 404 | $default, { 405 | TResult Function()? loading, 406 | TResult Function(dynamic error)? error, 407 | required TResult orElse(), 408 | }) { 409 | if (error != null) { 410 | return error(this.error); 411 | } 412 | return orElse(); 413 | } 414 | 415 | @override 416 | @optionalTypeArgs 417 | TResult map( 418 | TResult Function(PagingStateData value) $default, { 419 | required TResult Function(PagingStateLoading value) loading, 420 | required TResult Function(PagingStateError value) error, 421 | }) { 422 | return error(this); 423 | } 424 | 425 | @override 426 | @optionalTypeArgs 427 | TResult maybeMap( 428 | TResult Function(PagingStateData value)? $default, { 429 | TResult Function(PagingStateLoading value)? loading, 430 | TResult Function(PagingStateError value)? error, 431 | required TResult orElse(), 432 | }) { 433 | if (error != null) { 434 | return error(this); 435 | } 436 | return orElse(); 437 | } 438 | } 439 | 440 | abstract class PagingStateError implements PagingState { 441 | const factory PagingStateError(dynamic error) = _$PagingStateError; 442 | 443 | dynamic get error => throw _privateConstructorUsedError; 444 | @JsonKey(ignore: true) 445 | $PagingStateErrorCopyWith> get copyWith => 446 | throw _privateConstructorUsedError; 447 | } 448 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _fe_analyzer_shared: 5 | dependency: transitive 6 | description: 7 | name: _fe_analyzer_shared 8 | sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab" 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "76.0.0" 12 | _macros: 13 | dependency: transitive 14 | description: dart 15 | source: sdk 16 | version: "0.3.3" 17 | analyzer: 18 | dependency: transitive 19 | description: 20 | name: analyzer 21 | sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e" 22 | url: "https://pub.dev" 23 | source: hosted 24 | version: "6.11.0" 25 | args: 26 | dependency: transitive 27 | description: 28 | name: args 29 | sha256: "37a4264b0b7fb930e94c0c47558f3b6c4f4e9cb7e655a3ea373131d79b2dc0cc" 30 | url: "https://pub.dev" 31 | source: hosted 32 | version: "2.0.0" 33 | async: 34 | dependency: "direct main" 35 | description: 36 | name: async 37 | sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" 38 | url: "https://pub.dev" 39 | source: hosted 40 | version: "2.13.0" 41 | boolean_selector: 42 | dependency: transitive 43 | description: 44 | name: boolean_selector 45 | sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" 46 | url: "https://pub.dev" 47 | source: hosted 48 | version: "2.1.2" 49 | build: 50 | dependency: transitive 51 | description: 52 | name: build 53 | sha256: cef23f1eda9b57566c81e2133d196f8e3df48f244b317368d65c5943d91148f0 54 | url: "https://pub.dev" 55 | source: hosted 56 | version: "2.4.2" 57 | build_config: 58 | dependency: transitive 59 | description: 60 | name: build_config 61 | sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 62 | url: "https://pub.dev" 63 | source: hosted 64 | version: "1.1.1" 65 | build_daemon: 66 | dependency: transitive 67 | description: 68 | name: build_daemon 69 | sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" 70 | url: "https://pub.dev" 71 | source: hosted 72 | version: "4.0.0" 73 | build_resolvers: 74 | dependency: transitive 75 | description: 76 | name: build_resolvers 77 | sha256: b9e4fda21d846e192628e7a4f6deda6888c36b5b69ba02ff291a01fd529140f0 78 | url: "https://pub.dev" 79 | source: hosted 80 | version: "2.4.4" 81 | build_runner: 82 | dependency: "direct dev" 83 | description: 84 | name: build_runner 85 | sha256: "058fe9dce1de7d69c4b84fada934df3e0153dd000758c4d65964d0166779aa99" 86 | url: "https://pub.dev" 87 | source: hosted 88 | version: "2.4.15" 89 | build_runner_core: 90 | dependency: transitive 91 | description: 92 | name: build_runner_core 93 | sha256: "22e3aa1c80e0ada3722fe5b63fd43d9c8990759d0a2cf489c8c5d7b2bdebc021" 94 | url: "https://pub.dev" 95 | source: hosted 96 | version: "8.0.0" 97 | built_collection: 98 | dependency: transitive 99 | description: 100 | name: built_collection 101 | sha256: f5a2a975d3da1ca46579d2f173bea1c766f0044cff40889c8df8009bf6ea0d0c 102 | url: "https://pub.dev" 103 | source: hosted 104 | version: "5.0.0" 105 | built_value: 106 | dependency: transitive 107 | description: 108 | name: built_value 109 | sha256: "59e08b0079bb75f7e27392498e26339387c1089c6bd58525a14eb8508637277b" 110 | url: "https://pub.dev" 111 | source: hosted 112 | version: "8.4.2" 113 | characters: 114 | dependency: transitive 115 | description: 116 | name: characters 117 | sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 118 | url: "https://pub.dev" 119 | source: hosted 120 | version: "1.4.0" 121 | charcode: 122 | dependency: transitive 123 | description: 124 | name: charcode 125 | sha256: "8e36feea6de5ea69f2199f29cf42a450a855738c498b57c0b980e2d3cca9c362" 126 | url: "https://pub.dev" 127 | source: hosted 128 | version: "1.2.0" 129 | checked_yaml: 130 | dependency: transitive 131 | description: 132 | name: checked_yaml 133 | sha256: dd007e4fb8270916820a0d66e24f619266b60773cddd082c6439341645af2659 134 | url: "https://pub.dev" 135 | source: hosted 136 | version: "2.0.1" 137 | clock: 138 | dependency: transitive 139 | description: 140 | name: clock 141 | sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b 142 | url: "https://pub.dev" 143 | source: hosted 144 | version: "1.1.2" 145 | code_builder: 146 | dependency: transitive 147 | description: 148 | name: code_builder 149 | sha256: "02ce3596b459c666530f045ad6f96209474e8fee6e4855940a3cee65fb872ec5" 150 | url: "https://pub.dev" 151 | source: hosted 152 | version: "4.3.0" 153 | collection: 154 | dependency: transitive 155 | description: 156 | name: collection 157 | sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" 158 | url: "https://pub.dev" 159 | source: hosted 160 | version: "1.19.1" 161 | convert: 162 | dependency: transitive 163 | description: 164 | name: convert 165 | sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 166 | url: "https://pub.dev" 167 | source: hosted 168 | version: "3.1.2" 169 | crypto: 170 | dependency: transitive 171 | description: 172 | name: crypto 173 | sha256: cf75650c66c0316274e21d7c43d3dea246273af5955bd94e8184837cd577575c 174 | url: "https://pub.dev" 175 | source: hosted 176 | version: "3.0.1" 177 | dart_style: 178 | dependency: transitive 179 | description: 180 | name: dart_style 181 | sha256: "7306ab8a2359a48d22310ad823521d723acfed60ee1f7e37388e8986853b6820" 182 | url: "https://pub.dev" 183 | source: hosted 184 | version: "2.3.8" 185 | fake_async: 186 | dependency: transitive 187 | description: 188 | name: fake_async 189 | sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" 190 | url: "https://pub.dev" 191 | source: hosted 192 | version: "1.3.3" 193 | file: 194 | dependency: transitive 195 | description: 196 | name: file 197 | sha256: "9fd2163d866769f60f4df8ac1dc59f52498d810c356fe78022e383dd3c57c0e1" 198 | url: "https://pub.dev" 199 | source: hosted 200 | version: "6.1.0" 201 | fixnum: 202 | dependency: transitive 203 | description: 204 | name: fixnum 205 | sha256: "6a2ef17156f4dc49684f9d99aaf4a93aba8ac49f5eac861755f5730ddf6e2e4e" 206 | url: "https://pub.dev" 207 | source: hosted 208 | version: "1.0.0" 209 | flutter: 210 | dependency: "direct main" 211 | description: flutter 212 | source: sdk 213 | version: "0.0.0" 214 | flutter_test: 215 | dependency: "direct dev" 216 | description: flutter 217 | source: sdk 218 | version: "0.0.0" 219 | freezed: 220 | dependency: "direct dev" 221 | description: 222 | name: freezed 223 | sha256: "6022db4c7bfa626841b2a10f34dd1e1b68e8f8f9650db6112dcdeeca45ca793c" 224 | url: "https://pub.dev" 225 | source: hosted 226 | version: "3.0.6" 227 | freezed_annotation: 228 | dependency: "direct main" 229 | description: 230 | name: freezed_annotation 231 | sha256: c87ff004c8aa6af2d531668b46a4ea379f7191dc6dfa066acd53d506da6e044b 232 | url: "https://pub.dev" 233 | source: hosted 234 | version: "3.0.0" 235 | frontend_server_client: 236 | dependency: transitive 237 | description: 238 | name: frontend_server_client 239 | sha256: "82715f8041a85a534a7bf64400b2ee0bb3d594ccf695d97c0bb017259657ff5d" 240 | url: "https://pub.dev" 241 | source: hosted 242 | version: "3.1.0" 243 | glob: 244 | dependency: transitive 245 | description: 246 | name: glob 247 | sha256: dda85ce2aefce16f7e75586acbcb1e8320bf176f69fd94082e31945d6de67f3e 248 | url: "https://pub.dev" 249 | source: hosted 250 | version: "2.0.1" 251 | graphs: 252 | dependency: transitive 253 | description: 254 | name: graphs 255 | sha256: f9e130f3259f52d26f0cfc0e964513796dafed572fa52e45d2f8d6ca14db39b2 256 | url: "https://pub.dev" 257 | source: hosted 258 | version: "2.2.0" 259 | http: 260 | dependency: transitive 261 | description: 262 | name: http 263 | sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b" 264 | url: "https://pub.dev" 265 | source: hosted 266 | version: "1.4.0" 267 | http_multi_server: 268 | dependency: transitive 269 | description: 270 | name: http_multi_server 271 | sha256: ac10cae1b9a06fb638a92a72b00570bac856f524f7ee0d9a13eaed4960c7fd43 272 | url: "https://pub.dev" 273 | source: hosted 274 | version: "3.0.0" 275 | http_parser: 276 | dependency: transitive 277 | description: 278 | name: http_parser 279 | sha256: e362d639ba3bc07d5a71faebb98cde68c05bfbcfbbb444b60b6f60bb67719185 280 | url: "https://pub.dev" 281 | source: hosted 282 | version: "4.0.0" 283 | io: 284 | dependency: transitive 285 | description: 286 | name: io 287 | sha256: "15a5436d2a02dc60e6dc2fb5d7dfaac08b7b137cff3d4bf3158d38ecab656b69" 288 | url: "https://pub.dev" 289 | source: hosted 290 | version: "1.0.0" 291 | js: 292 | dependency: transitive 293 | description: 294 | name: js 295 | sha256: d9bdfd70d828eeb352390f81b18d6a354ef2044aa28ef25682079797fa7cd174 296 | url: "https://pub.dev" 297 | source: hosted 298 | version: "0.6.3" 299 | json_annotation: 300 | dependency: transitive 301 | description: 302 | name: json_annotation 303 | sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" 304 | url: "https://pub.dev" 305 | source: hosted 306 | version: "4.9.0" 307 | leak_tracker: 308 | dependency: transitive 309 | description: 310 | name: leak_tracker 311 | sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" 312 | url: "https://pub.dev" 313 | source: hosted 314 | version: "10.0.9" 315 | leak_tracker_flutter_testing: 316 | dependency: transitive 317 | description: 318 | name: leak_tracker_flutter_testing 319 | sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 320 | url: "https://pub.dev" 321 | source: hosted 322 | version: "3.0.9" 323 | leak_tracker_testing: 324 | dependency: transitive 325 | description: 326 | name: leak_tracker_testing 327 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 328 | url: "https://pub.dev" 329 | source: hosted 330 | version: "3.0.1" 331 | logging: 332 | dependency: transitive 333 | description: 334 | name: logging 335 | sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 336 | url: "https://pub.dev" 337 | source: hosted 338 | version: "1.3.0" 339 | macros: 340 | dependency: transitive 341 | description: 342 | name: macros 343 | sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656" 344 | url: "https://pub.dev" 345 | source: hosted 346 | version: "0.1.3-main.0" 347 | matcher: 348 | dependency: transitive 349 | description: 350 | name: matcher 351 | sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 352 | url: "https://pub.dev" 353 | source: hosted 354 | version: "0.12.17" 355 | material_color_utilities: 356 | dependency: transitive 357 | description: 358 | name: material_color_utilities 359 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 360 | url: "https://pub.dev" 361 | source: hosted 362 | version: "0.11.1" 363 | meta: 364 | dependency: transitive 365 | description: 366 | name: meta 367 | sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c 368 | url: "https://pub.dev" 369 | source: hosted 370 | version: "1.16.0" 371 | mime: 372 | dependency: transitive 373 | description: 374 | name: mime 375 | sha256: a7a98ea7f366e2cc9d2b20873815aebec5e2bc124fe0da9d3f7f59b0625ea180 376 | url: "https://pub.dev" 377 | source: hosted 378 | version: "1.0.0" 379 | package_config: 380 | dependency: transitive 381 | description: 382 | name: package_config 383 | sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc 384 | url: "https://pub.dev" 385 | source: hosted 386 | version: "2.2.0" 387 | path: 388 | dependency: transitive 389 | description: 390 | name: path 391 | sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" 392 | url: "https://pub.dev" 393 | source: hosted 394 | version: "1.9.1" 395 | pedantic: 396 | dependency: transitive 397 | description: 398 | name: pedantic 399 | sha256: "8f6460c77a98ad2807cd3b98c67096db4286f56166852d0ce5951bb600a63594" 400 | url: "https://pub.dev" 401 | source: hosted 402 | version: "1.11.0" 403 | pool: 404 | dependency: transitive 405 | description: 406 | name: pool 407 | sha256: "05955e3de2683e1746222efd14b775df7131139e07695dc8e24650f6b4204504" 408 | url: "https://pub.dev" 409 | source: hosted 410 | version: "1.5.0" 411 | pub_semver: 412 | dependency: transitive 413 | description: 414 | name: pub_semver 415 | sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" 416 | url: "https://pub.dev" 417 | source: hosted 418 | version: "2.2.0" 419 | pubspec_parse: 420 | dependency: transitive 421 | description: 422 | name: pubspec_parse 423 | sha256: "358c5ce09744e0e08b3f5f38c53d7d26a8219dd641718f8500f49cfa56240358" 424 | url: "https://pub.dev" 425 | source: hosted 426 | version: "1.0.0" 427 | shelf: 428 | dependency: transitive 429 | description: 430 | name: shelf 431 | sha256: c2f658d28ec86857657dec3579e2db4dc5a6c477b6aecde870e77f0682258901 432 | url: "https://pub.dev" 433 | source: hosted 434 | version: "1.1.0" 435 | shelf_web_socket: 436 | dependency: transitive 437 | description: 438 | name: shelf_web_socket 439 | sha256: fd84910bf7d58db109082edf7326b75322b8f186162028482f53dc892f00332d 440 | url: "https://pub.dev" 441 | source: hosted 442 | version: "1.0.1" 443 | sky_engine: 444 | dependency: transitive 445 | description: flutter 446 | source: sdk 447 | version: "0.0.0" 448 | source_gen: 449 | dependency: transitive 450 | description: 451 | name: source_gen 452 | sha256: "35c8150ece9e8c8d263337a265153c3329667640850b9304861faea59fc98f6b" 453 | url: "https://pub.dev" 454 | source: hosted 455 | version: "2.0.0" 456 | source_span: 457 | dependency: transitive 458 | description: 459 | name: source_span 460 | sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" 461 | url: "https://pub.dev" 462 | source: hosted 463 | version: "1.10.1" 464 | stack_trace: 465 | dependency: transitive 466 | description: 467 | name: stack_trace 468 | sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" 469 | url: "https://pub.dev" 470 | source: hosted 471 | version: "1.12.1" 472 | stream_channel: 473 | dependency: transitive 474 | description: 475 | name: stream_channel 476 | sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" 477 | url: "https://pub.dev" 478 | source: hosted 479 | version: "2.1.4" 480 | stream_transform: 481 | dependency: transitive 482 | description: 483 | name: stream_transform 484 | sha256: ed464977cb26a1f41537e177e190c67223dbd9f4f683489b6ab2e5d211ec564e 485 | url: "https://pub.dev" 486 | source: hosted 487 | version: "2.0.0" 488 | string_scanner: 489 | dependency: transitive 490 | description: 491 | name: string_scanner 492 | sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" 493 | url: "https://pub.dev" 494 | source: hosted 495 | version: "1.4.1" 496 | term_glyph: 497 | dependency: transitive 498 | description: 499 | name: term_glyph 500 | sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" 501 | url: "https://pub.dev" 502 | source: hosted 503 | version: "1.2.2" 504 | test_api: 505 | dependency: transitive 506 | description: 507 | name: test_api 508 | sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd 509 | url: "https://pub.dev" 510 | source: hosted 511 | version: "0.7.4" 512 | timing: 513 | dependency: transitive 514 | description: 515 | name: timing 516 | sha256: c386d07d7f5efc613479a7c4d9d64b03710b03cfaa7e8ad5f2bfb295a1f0dfad 517 | url: "https://pub.dev" 518 | source: hosted 519 | version: "1.0.0" 520 | tuple: 521 | dependency: "direct main" 522 | description: 523 | name: tuple 524 | sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151 525 | url: "https://pub.dev" 526 | source: hosted 527 | version: "2.0.2" 528 | typed_data: 529 | dependency: transitive 530 | description: 531 | name: typed_data 532 | sha256: "53bdf7e979cfbf3e28987552fd72f637e63f3c8724c9e56d9246942dc2fa36ee" 533 | url: "https://pub.dev" 534 | source: hosted 535 | version: "1.3.0" 536 | vector_math: 537 | dependency: transitive 538 | description: 539 | name: vector_math 540 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 541 | url: "https://pub.dev" 542 | source: hosted 543 | version: "2.1.4" 544 | vm_service: 545 | dependency: transitive 546 | description: 547 | name: vm_service 548 | sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 549 | url: "https://pub.dev" 550 | source: hosted 551 | version: "15.0.0" 552 | watcher: 553 | dependency: transitive 554 | description: 555 | name: watcher 556 | sha256: "69da27e49efa56a15f8afe8f4438c4ec02eff0a117df1b22ea4aad194fe1c104" 557 | url: "https://pub.dev" 558 | source: hosted 559 | version: "1.1.1" 560 | web: 561 | dependency: transitive 562 | description: 563 | name: web 564 | sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" 565 | url: "https://pub.dev" 566 | source: hosted 567 | version: "1.1.1" 568 | web_socket_channel: 569 | dependency: transitive 570 | description: 571 | name: web_socket_channel 572 | sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b 573 | url: "https://pub.dev" 574 | source: hosted 575 | version: "2.4.0" 576 | yaml: 577 | dependency: transitive 578 | description: 579 | name: yaml 580 | sha256: "3cee79b1715110341012d27756d9bae38e650588acd38d3f3c610822e1337ace" 581 | url: "https://pub.dev" 582 | source: hosted 583 | version: "3.1.0" 584 | sdks: 585 | dart: ">=3.7.0-0 <4.0.0" 586 | flutter: ">=3.18.0-18.0.pre.54" 587 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: fl_paging 2 | description: A new Flutter package support paginating for Listview, Gridview and NestedScrollView 3 | version: 2.2.0 4 | homepage: https://github.com/dangngocduc/flutter_paging 5 | repository: https://github.com/dangngocduc/flutter_paging 6 | issue_tracker: https://github.com/dangngocduc/flutter_paging/issues 7 | documentation: https://github.com/dangngocduc/flutter_paging 8 | 9 | environment: 10 | sdk: ">= 3.6.0 <4.0.0" 11 | 12 | 13 | dependencies: 14 | flutter: 15 | sdk: flutter 16 | freezed_annotation: ^3.0.0 17 | tuple: ^2.0.2 18 | async: 2.13.0 19 | 20 | dev_dependencies: 21 | flutter_test: 22 | sdk: flutter 23 | build_runner: ^2.4.15 24 | freezed: ^3.0.6 25 | flutter: 26 | -------------------------------------------------------------------------------- /test/paging_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | 3 | import 'package:fl_paging/fl_paging.dart'; 4 | 5 | void main() { 6 | test('adds one to input values', () { 7 | 8 | }); 9 | } 10 | --------------------------------------------------------------------------------