├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── WIDGETS.md
├── analysis_options.yaml
├── assets
└── images
│ ├── ic_empty.png
│ ├── ic_error.png
│ └── ic_image_error.png
├── example
├── .gitignore
├── README.md
├── analysis_options.yaml
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin
│ │ │ │ └── com
│ │ │ │ │ └── azhon
│ │ │ │ │ └── todo_flutter
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── res
│ │ │ │ ├── drawable-v21
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── drawable
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── values-night
│ │ │ │ └── styles.xml
│ │ │ │ └── values
│ │ │ │ └── styles.xml
│ │ │ └── profile
│ │ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ └── settings.gradle
├── assets
│ ├── iconfont
│ │ ├── iconfont.json
│ │ └── iconfont.ttf
│ └── images
│ │ ├── ic_clear.png
│ │ ├── ic_eye.png
│ │ ├── ic_police.png
│ │ └── ic_search.png
├── img
│ ├── img1.png
│ ├── img2.png
│ ├── img3.png
│ ├── img4.png
│ └── img5.png
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ │ └── WorkspaceSettings.xcsettings
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── Runner-Bridging-Header.h
├── lib
│ ├── common
│ │ ├── api
│ │ │ ├── api_convert.dart
│ │ │ └── api_provider.dart
│ │ └── route
│ │ │ └── module_route.dart
│ ├── domain
│ │ ├── bloc
│ │ │ ├── bloc
│ │ │ │ ├── test_bloc.dart
│ │ │ │ ├── test_event.dart
│ │ │ │ └── test_state.dart
│ │ │ └── net
│ │ │ │ ├── net_bloc.dart
│ │ │ │ ├── net_event.dart
│ │ │ │ └── net_state.dart
│ │ └── request
│ │ │ ├── entity
│ │ │ ├── get_entity.dart
│ │ │ └── list_data_entity.dart
│ │ │ ├── list_request.dart
│ │ │ └── net_request.dart
│ ├── generated
│ │ ├── assets
│ │ │ ├── example_assets.dart
│ │ │ └── example_icon.dart
│ │ ├── json
│ │ │ ├── base
│ │ │ │ ├── json_convert_content.dart
│ │ │ │ └── json_field.dart
│ │ │ ├── get_entity.g.dart
│ │ │ └── list_data_entity.g.dart
│ │ └── route
│ │ │ └── example_route.dart
│ ├── main.dart
│ └── view
│ │ ├── app_update_page.dart
│ │ ├── bloc_page.dart
│ │ ├── button_page.dart
│ │ ├── dialog_page.dart
│ │ ├── image_page.dart
│ │ ├── input_page.dart
│ │ ├── net_page.dart
│ │ ├── refresh_page.dart
│ │ ├── sliver_page.dart
│ │ ├── text_page.dart
│ │ └── toast_page.dart
├── pubspec.lock
├── pubspec.yaml
├── test
│ └── widget_test.dart
└── web
│ ├── favicon.png
│ ├── icons
│ ├── Icon-192.png
│ ├── Icon-512.png
│ ├── Icon-maskable-192.png
│ └── Icon-maskable-512.png
│ ├── index.html
│ └── manifest.json
├── lib
├── generated
│ └── assets
│ │ └── todo_flutter_assets.dart
├── src
│ ├── I10n
│ │ ├── text_delegate.dart
│ │ └── text_delegate_en.dart
│ ├── base
│ │ ├── base_state.dart
│ │ ├── base_stateful_widget.dart
│ │ ├── base_stateless_widget.dart
│ │ ├── bloc
│ │ │ ├── base_bloc.dart
│ │ │ └── base_event.dart
│ │ ├── loading_state.dart
│ │ ├── ui_adapter.dart
│ │ └── ui_widget.dart
│ ├── bloc
│ │ ├── data
│ │ │ ├── data_change_bloc.dart
│ │ │ └── data_change_state.dart
│ │ ├── list
│ │ │ ├── list_bloc.dart
│ │ │ ├── list_event.dart
│ │ │ └── list_state.dart
│ │ └── load
│ │ │ ├── load_bloc.dart
│ │ │ ├── load_event.dart
│ │ │ └── load_state.dart
│ ├── net
│ │ ├── base_convert.dart
│ │ ├── base_net_engine.dart
│ │ ├── base_net_provider.dart
│ │ ├── base_request.dart
│ │ ├── dio_engine.dart
│ │ └── entity
│ │ │ └── base_entity.dart
│ ├── service
│ │ ├── env
│ │ │ └── env.dart
│ │ ├── error
│ │ │ └── domain_exception.dart
│ │ ├── event
│ │ │ └── global_event_manager.dart
│ │ ├── extension
│ │ │ └── context_extension.dart
│ │ ├── route
│ │ │ ├── bundle.dart
│ │ │ ├── router_history_stack.dart
│ │ │ ├── router_util.dart
│ │ │ └── routes.dart
│ │ └── theme
│ │ │ └── toast_theme_data.dart
│ ├── ui
│ │ ├── common_button.dart
│ │ ├── common_click_widget.dart
│ │ ├── common_empty_widget.dart
│ │ ├── common_error_widget.dart
│ │ ├── common_image.dart
│ │ ├── common_input.dart
│ │ ├── common_input_area.dart
│ │ ├── common_refresh_widget.dart
│ │ ├── common_rich_text.dart
│ │ ├── common_text.dart
│ │ ├── dialog
│ │ │ ├── base_dialog.dart
│ │ │ ├── common_dialog.dart
│ │ │ └── loading_dialog.dart
│ │ └── widget
│ │ │ ├── amount_text_field_formatter.dart
│ │ │ ├── bloc_load_widget.dart
│ │ │ ├── circular_progress_widget.dart
│ │ │ ├── data_change_widget.dart
│ │ │ ├── extended_refresh_indicator.dart
│ │ │ ├── loading_dialog_widget.dart
│ │ │ ├── remove_ripple_widget.dart
│ │ │ ├── saturation_widget.dart
│ │ │ └── un_focus_widget.dart
│ └── util
│ │ ├── calculate_util.dart
│ │ ├── log_util.dart
│ │ ├── object_util.dart
│ │ ├── preference_util.dart
│ │ ├── time_util.dart
│ │ └── tip_util.dart
├── todo_app.dart
├── todo_flutter.dart
└── todo_lib.dart
├── pubspec.lock
├── pubspec.yaml
└── test
└── todo_flutter_lib_test.dart
/.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/ephemeral
64 | **/ios/Flutter/app.flx
65 | **/ios/Flutter/app.zip
66 | **/ios/Flutter/flutter_assets/
67 | **/ios/Flutter/flutter_export_environment.sh
68 | **/ios/ServiceDefinitions.json
69 | **/ios/Runner/GeneratedPluginRegistrant.*
70 |
71 | # Exceptions to above rules.
72 | !**/ios/**/default.mode1v3
73 | !**/ios/**/default.mode2v3
74 | !**/ios/**/default.pbxuser
75 | !**/ios/**/default.perspectivev3
76 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.0.7
2 | * feat CommonEmptyWidget、NetworkCapture
3 |
4 | ## 0.0.6
5 | * fix TodoApp
6 |
7 | ## 0.0.5
8 | * opt TodoApp
9 |
10 | ## 0.0.4
11 | * fix listBloc init event
12 | * opt context extension
13 |
14 | ## 0.0.3
15 | * opt listBloc result
16 |
17 | ## 0.0.2
18 | * opt listBloc result
19 |
20 | ## 0.0.1
21 | * publish first version
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## [使用例子/Sample](https://github.com/azhon/todo_flutter/tree/main/example)
2 |
3 | ## 基于Bloc状态管理、屏幕适配、路由管理、模块化、封装常用组件的Flutter项目脚手架
4 | - 使用`Flutter 3.13.0`或更高版本
5 |
6 | ### 组件库介绍
7 |
8 | [在使用前请务必先阅读一遍,以避免重复封装](https://github.com/azhon/todo_flutter/blob/main/WIDGETS.md)
9 |
10 | ### 一、依赖本库:
11 |
12 | ```dart
13 | todo_flutter: ^latest_version
14 | ```
15 | - 初始化
16 |
17 | ```dart
18 | void main() {
19 | runApp(TodoApp(home: MyHomePage()));
20 | }
21 | ```
22 | ### 二、路由模块:
23 | - 使用[fluro](https://pub.dev/packages/fluro)
24 | - 路由路径生成使用[FlutterResource插件](https://github.com/Xie-Yin/FlutterResource)
25 |
26 | ### 三、屏幕适配:
27 | - 使用[flutter_screenutil](https://pub.dev/packages/flutter_screenutil)
28 |
29 | ### 四、图片资源生成
30 | - 使用[FlutterResource插件](https://github.com/azhon/FlutterResource)
31 |
32 | ### 五、模块化开发
33 | - 使用[ModuleBridge插件](https://github.com/azhon/module_bridge)
34 |
35 | ### 六、网络模块
36 | - 实现http客户端 `BaseNetEngine`
37 | - 实现数据转换器,生成对应实体 `BaseConvert`
38 | - 实现网络请求 `BaseRequest`并指定提供一个`BaseNetProvider`
39 | - json实体插件[FlutterJsonBeanFactory](https://plugins.jetbrains.com/plugin/11415-flutterjsonbeanfactory-only-null-safety-)
--------------------------------------------------------------------------------
/WIDGETS.md:
--------------------------------------------------------------------------------
1 | ### 每一个组件的用途如下:
2 |
3 | ```text
4 | .
5 | ├── generated
6 | │ └── assets
7 | │ └── todo_flutter_assets.dart (图片资源索引)
8 | ├── src
9 | │ ├── base
10 | │ │ ├── base_state.dart (有状态组件基类)
11 | │ │ ├── base_stateful_widget.dart (有状态组件基类)
12 | │ │ ├── base_stateless_widget.dart (无状态组件基类)
13 | │ │ ├── bloc
14 | │ │ │ ├── base_bloc.dart (Bloc基类)
15 | │ │ │ └── base_event.dart (Bloc基类)
16 | │ │ ├── loading_state.dart
17 | │ │ ├── ui_adapter.dart (屏幕适配)
18 | │ │ └── ui_widget.dart (屏幕适配代理常用组件)
19 | │ ├── bloc
20 | │ │ ├── data
21 | │ │ │ ├── data_change_bloc.dart (简单Bloc)
22 | │ │ │ └── data_change_state.dart (简单Bloc)
23 | │ │ ├── list
24 | │ │ │ ├── list_bloc.dart (列表Bloc)
25 | │ │ │ ├── list_event.dart (列表Bloc)
26 | │ │ │ └── list_state.dart (列表Bloc)
27 | │ │ └── load
28 | │ │ ├── load_bloc.dart (页面加载Bloc)
29 | │ │ ├── load_event.dart (页面加载Bloc)
30 | │ │ └── load_state.dart (页面加载Bloc)
31 | │ ├── I10n
32 | │ │ ├── text_delegate.dart (国际化-默认中文)
33 | │ │ └── text_delegate_en.dart (国际化-英文)
34 | │ ├── net
35 | │ │ ├── base_convert.dart (数据转换器基类)
36 | │ │ ├── base_net_engine.dart (网络请求基类)
37 | │ │ ├── base_net_provider.dart (网络请求基类)
38 | │ │ ├── base_request.dart (网络请求对象基类)
39 | │ │ ├── dio_engine.dart (Dio网络请求)
40 | │ │ └── entity
41 | │ │ └── base_entity.dart (网络请求基类)
42 | │ ├── service
43 | │ │ ├── env
44 | │ │ │ └── env.dart (App开发环境)
45 | │ │ ├── error
46 | │ │ │ └── domain_exception.dart (异常)
47 | │ │ ├── event
48 | │ │ │ └── global_event_manager.dart (全局事件发送、订阅)
49 | │ │ ├── route
50 | │ │ │ ├── bundle.dart (路由参数包装)
51 | │ │ │ ├── router_history_stack.dart (路由历史栈管理)
52 | │ │ │ ├── router_util.dart (路由工具类)
53 | │ │ │ └── routes.dart (路由)
54 | │ │ └── theme
55 | │ │ └── toast_theme_data.dart (吐司主题)
56 | │ ├── ui
57 | │ │ ├── common_button.dart (按钮组件)
58 | │ │ ├── common_click_widget.dart (点击事件组件)
59 | │ │ ├── common_empty_widget.dart (空视图组件)
60 | │ │ ├── common_error_widget.dart (错误视图组件)
61 | │ │ ├── common_image.dart (图片组件)
62 | │ │ ├── common_input.dart (输入框组件)
63 | │ │ ├── common_input_area.dart (多行输入框组件)
64 | │ │ ├── common_refresh_widget.dart (列表刷新组件)
65 | │ │ ├── common_rich_text.dart (列表刷新组件)
66 | │ │ ├── common_text.dart (文本组件)
67 | │ │ ├── dialog
68 | │ │ │ ├── base_dialog.dart (对话框基类)
69 | │ │ │ ├── common_dialog.dart (对话框)
70 | │ │ │ └── loading_dialog.dart (加载等待对话框)
71 | │ │ └── widget
72 | │ │ ├── amount_text_field_formatter.dart (金额输入框格式化)
73 | │ │ ├── bloc_load_widget.dart (页面加载组件)
74 | │ │ ├── circular_progress_widget.dart (加载组件)
75 | │ │ ├── data_change_widget.dart (简单Bloc组件)
76 | │ │ ├── extended_refresh_indicator.dart (配合ExtendedNestedScrollView刷新组件)
77 | │ │ ├── loading_dialog_widget.dart (全局加载等待组件)
78 | │ │ ├── remove_ripple_widget.dart (移除Android水波纹效果组件)
79 | │ │ ├── saturation_widget.dart (饱和度组件)
80 | │ │ └── un_focus_widget.dart (移除焦点组件)
81 | │ └── util
82 | │ ├── log_util.dart (日志打印工具类)
83 | │ ├── object_util.dart (对象工具类)
84 | │ ├── preference_util.dart (本地数据存储工具类)
85 | │ ├── time_util.dart (时间处理工具类)
86 | │ └── tip_util.dart (吐司工具类)
87 | ├── todo_app.dart (框架初始化)
88 | ├── todo_flutter.dart
89 | └── todo_lib.dart (框架数据包装)
90 | ```
--------------------------------------------------------------------------------
/assets/images/ic_empty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/assets/images/ic_empty.png
--------------------------------------------------------------------------------
/assets/images/ic_error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/assets/images/ic_error.png
--------------------------------------------------------------------------------
/assets/images/ic_image_error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/assets/images/ic_image_error.png
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | .dart_tool/
26 | .flutter-plugins
27 | .flutter-plugins-dependencies
28 | .packages
29 | .pub-cache/
30 | .pub/
31 | build/
32 |
33 | # 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/ephemeral
64 | **/ios/Flutter/app.flx
65 | **/ios/Flutter/app.zip
66 | **/ios/Flutter/flutter_assets/
67 | **/ios/Flutter/flutter_export_environment.sh
68 | **/ios/ServiceDefinitions.json
69 | **/ios/Runner/GeneratedPluginRegistrant.*
70 |
71 | # Exceptions to above rules.
72 | !**/ios/**/default.mode1v3
73 | !**/ios/**/default.mode2v3
74 | !**/ios/**/default.pbxuser
75 | !**/ios/**/default.perspectivev3
76 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | ### 一、效果图
2 |
3 |
4 |
5 |
6 | ### 二、图片资源路径与路由路径通过[这个插件](https://github.com/Xie-Yin/FlutterPlugin)自动生成
7 |
8 | ### 三、目录结构
9 |
10 | ```
11 | ./lib
12 | ├── common
13 | │ ├── api(网络请求)
14 | │ │ ├── api_convert.dart
15 | │ │ └── api_provider.dart
16 | │ └── route(页面路由)
17 | │ └── module_route.dart
18 | ├── domain(Bloc、网络请求相关)
19 | │ ├── bloc
20 | │ │ ├── bloc
21 | │ │ │ ├── test_bloc.dart
22 | │ │ │ ├── test_event.dart
23 | │ │ │ └── test_state.dart
24 | │ │ └── net
25 | │ │ ├── net_bloc.dart
26 | │ │ ├── net_event.dart
27 | │ │ └── net_state.dart
28 | │ └── request
29 | │ ├── entity
30 | │ │ ├── get_entity.dart
31 | │ │ └── list_data_entity.dart
32 | │ ├── list_request.dart
33 | │ └── net_request.dart
34 | ├── generated(自动生成代码存放目录)
35 | │ ├── assets
36 | │ │ ├── example_assets.dart
37 | │ │ └── example_icon.dart
38 | │ ├── json
39 | │ │ ├── base
40 | │ │ │ ├── json_convert_content.dart
41 | │ │ │ └── json_field.dart
42 | │ │ ├── get_entity.g.dart
43 | │ │ └── list_data_entity.g.dart
44 | │ └── route
45 | │ └── example_route.dart
46 | ├── main.dart(项目初始化)
47 | └── view(使用示例)
48 | ├── bloc_page.dart
49 | ├── button_page.dart
50 | ├── dialog_page.dart
51 | ├── image_page.dart
52 | ├── input_page.dart
53 | ├── net_page.dart
54 | ├── refresh_page.dart
55 | ├── sliver_page.dart
56 | ├── text_page.dart
57 | └── toast_page.dart
58 | ```
59 |
60 | ### 运行之Web端
61 | > 增加启动参数:--web-renderer html
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id "com.android.application"
3 | id "kotlin-android"
4 | id "dev.flutter.flutter-gradle-plugin"
5 | }
6 |
7 | def localProperties = new Properties()
8 | def localPropertiesFile = rootProject.file('local.properties')
9 | if (localPropertiesFile.exists()) {
10 | localPropertiesFile.withReader('UTF-8') { reader ->
11 | localProperties.load(reader)
12 | }
13 | }
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | android {
25 | namespace "com.azhon.todo_flutter"
26 | compileSdk 34
27 |
28 | compileOptions {
29 | sourceCompatibility JavaVersion.VERSION_1_8
30 | targetCompatibility JavaVersion.VERSION_1_8
31 | }
32 | kotlinOptions {
33 | jvmTarget = '1.8'
34 | }
35 | sourceSets {
36 | main.java.srcDirs += 'src/main/kotlin'
37 | }
38 |
39 | defaultConfig {
40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
41 | applicationId "com.azhon.todo_flutter"
42 | minSdk 21
43 | targetSdk 30
44 | versionCode flutterVersionCode.toInteger()
45 | versionName flutterVersionName
46 | }
47 |
48 | buildTypes {
49 | release {
50 | // TODO: Add your own signing config for the release build.
51 | // Signing with the debug keys for now, so `flutter run --release` works.
52 | signingConfig signingConfigs.debug
53 | }
54 | }
55 | }
56 |
57 | flutter {
58 | source '../..'
59 | }
60 |
61 | dependencies {
62 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
63 | }
64 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
12 |
16 |
20 |
25 |
29 |
30 |
31 |
32 |
33 |
34 |
36 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/com/azhon/todo_flutter/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.azhon.todo_flutter
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.7.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.3.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | project.evaluationDependsOn(':app')
25 | }
26 |
27 | tasks.register("clean", Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
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.3-all.zip
6 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | def flutterSdkPath = {
3 | def properties = new Properties()
4 | file("local.properties").withInputStream { properties.load(it) }
5 | def flutterSdkPath = properties.getProperty("flutter.sdk")
6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7 | return flutterSdkPath
8 | }
9 | settings.ext.flutterSdkPath = flutterSdkPath()
10 |
11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
12 |
13 | plugins {
14 | id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
15 | }
16 | }
17 |
18 | include ":app"
19 |
20 | apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle"
21 |
--------------------------------------------------------------------------------
/example/assets/iconfont/iconfont.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "3788531",
3 | "name": "todo_flutter",
4 | "font_family": "iconfont",
5 | "css_prefix_text": "icon-",
6 | "description": "",
7 | "glyphs": [
8 | {
9 | "icon_id": "33036883",
10 | "name": "menu",
11 | "font_class": "menu",
12 | "unicode": "e600",
13 | "unicode_decimal": 58880
14 | }
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/example/assets/iconfont/iconfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/example/assets/iconfont/iconfont.ttf
--------------------------------------------------------------------------------
/example/assets/images/ic_clear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/example/assets/images/ic_clear.png
--------------------------------------------------------------------------------
/example/assets/images/ic_eye.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/example/assets/images/ic_eye.png
--------------------------------------------------------------------------------
/example/assets/images/ic_police.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/example/assets/images/ic_police.png
--------------------------------------------------------------------------------
/example/assets/images/ic_search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/example/assets/images/ic_search.png
--------------------------------------------------------------------------------
/example/img/img1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/example/img/img1.png
--------------------------------------------------------------------------------
/example/img/img2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/example/img/img2.png
--------------------------------------------------------------------------------
/example/img/img3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/example/img/img3.png
--------------------------------------------------------------------------------
/example/img/img4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/example/img/img4.png
--------------------------------------------------------------------------------
/example/img/img5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/example/img/img5.png
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/ephemeral/
22 | Flutter/app.flx
23 | Flutter/app.zip
24 | Flutter/flutter_assets/
25 | Flutter/flutter_export_environment.sh
26 | ServiceDefinitions.json
27 | Runner/GeneratedPluginRegistrant.*
28 |
29 | # Exceptions to above rules.
30 | !default.mode1v3
31 | !default.mode2v3
32 | !default.pbxuser
33 | !default.perspectivev3
34 |
--------------------------------------------------------------------------------
/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 | 11.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '11.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | end
36 |
37 | post_install do |installer|
38 | installer.pods_project.targets.each do |target|
39 | flutter_additional_ios_build_settings(target)
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - flutter_app_update (0.0.1):
4 | - Flutter
5 | - fluttertoast (0.0.2):
6 | - Flutter
7 | - Toast
8 | - path_provider_foundation (0.0.1):
9 | - Flutter
10 | - FlutterMacOS
11 | - shared_preferences_foundation (0.0.1):
12 | - Flutter
13 | - FlutterMacOS
14 | - Toast (4.0.0)
15 |
16 | DEPENDENCIES:
17 | - Flutter (from `Flutter`)
18 | - flutter_app_update (from `.symlinks/plugins/flutter_app_update/ios`)
19 | - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
20 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
21 | - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
22 |
23 | SPEC REPOS:
24 | trunk:
25 | - Toast
26 |
27 | EXTERNAL SOURCES:
28 | Flutter:
29 | :path: Flutter
30 | flutter_app_update:
31 | :path: ".symlinks/plugins/flutter_app_update/ios"
32 | fluttertoast:
33 | :path: ".symlinks/plugins/fluttertoast/ios"
34 | path_provider_foundation:
35 | :path: ".symlinks/plugins/path_provider_foundation/ios"
36 | shared_preferences_foundation:
37 | :path: ".symlinks/plugins/shared_preferences_foundation/ios"
38 |
39 | SPEC CHECKSUMS:
40 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
41 | flutter_app_update: 65f61da626cb111d1b24674abc4b01728d7723bc
42 | fluttertoast: eb263d302cc92e04176c053d2385237e9f43fad0
43 | path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9
44 | shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472
45 | Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
46 |
47 | PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
48 |
49 | COCOAPODS: 1.11.2
50 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/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/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azhon/todo_flutter/7672c91fb7a0cfb38ec23ce32abaddc6fa980bfd/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | TodoFlutter
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 | CADisableMinimumFrameDurationOnPhone
45 |
46 | UIApplicationSupportsIndirectInputEvents
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/example/lib/common/api/api_convert.dart:
--------------------------------------------------------------------------------
1 | /// createTime: 2021/10/15 on 14:31
2 | /// desc:
3 | ///
4 | /// @author azhon
5 |
6 | import 'dart:io';
7 | import 'package:todo_flutter/todo_flutter.dart';
8 | import 'package:todo_flutter_example/generated/json/base/json_convert_content.dart';
9 |
10 | class ApiConvert extends BaseConvert {
11 | @override
12 | BaseEntity convert(Result result) {
13 | if (result.statusCode == HttpStatus.ok) {
14 | final data = result.data?['data'];
15 |
16 | ///分页数据
17 | if (data is Map && data.containsKey('datas')) {
18 | return BaseEntity(
19 | code: result.data?['errorCode'],
20 | message: result.data?['errorMsg'],
21 | curPage: data['curPage'],
22 | total: data['total'],
23 | totalPage: data['pageCount'],
24 | data: JsonConvert.fromJsonAsT(data['datas']),
25 | );
26 | } else {
27 | return BaseEntity(
28 | code: result.data?['errorCode'],
29 | message: result.data?['errorMsg'],
30 | data: JsonConvert.fromJsonAsT(data),
31 | );
32 | }
33 | } else {
34 | ///网络请求 code != HttpStatus.ok
35 | return BaseEntity(
36 | code: result.statusCode ?? BaseEntity.defaultCode,
37 | message: result.statusMessage,
38 | );
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/example/lib/common/api/api_provider.dart:
--------------------------------------------------------------------------------
1 | /// createTime: 2021/10/15 on 10:29
2 | /// desc: 单例对象,保证所有请求使用一份数据
3 | ///
4 | /// @author azhon
5 | import 'package:todo_flutter/todo_flutter.dart';
6 | import 'package:todo_flutter_example/common/api/api_convert.dart';
7 |
8 | class ApiProvider extends BaseNetProvider {
9 | factory ApiProvider() => _getInstance();
10 |
11 | static ApiProvider get instance => _getInstance();
12 | static ApiProvider? _instance;
13 |
14 | static ApiProvider _getInstance() {
15 | _instance ??= ApiProvider._internal();
16 | return _instance!;
17 | }
18 |
19 | DioEngine dioEngine = DioEngine('http://www.wanandroid.com/');
20 | ApiConvert apiConvert = ApiConvert();
21 |
22 | ApiProvider._internal() {
23 | // dioEngine.setProxy('192.168.110.7', 8888);
24 | dioEngine.addInterceptor(TestInterceptor());
25 | }
26 |
27 | @override
28 | BaseNetEngine get engine => dioEngine;
29 |
30 | @override
31 | BaseConvert get convert => apiConvert;
32 | }
33 |
34 | class TestInterceptor extends InterceptorsWrapper {
35 | @override
36 | void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
37 | options.headers['test-header'] = 'flutter';
38 | handler.next(options);
39 | }
40 | }
41 |
42 | abstract class ApiRequest extends BaseRequest {
43 | ApiRequest(Map? params) : super(params);
44 |
45 | @override
46 | String get pageKey => 'page';
47 |
48 | @override
49 | String get pageSizeKey => 'page_size';
50 |
51 | @override
52 | BaseNetProvider get netProvider => ApiProvider.instance;
53 | }
54 |
--------------------------------------------------------------------------------
/example/lib/common/route/module_route.dart:
--------------------------------------------------------------------------------
1 | /// createTime: 2021/9/17 on 18:12
2 | /// desc:
3 | ///
4 | /// @author azhon
5 | import 'package:todo_flutter/todo_flutter.dart';
6 | import 'package:todo_flutter_example/generated/route/example_route.dart';
7 | import 'package:todo_flutter_example/view/app_update_page.dart';
8 | import 'package:todo_flutter_example/view/bloc_page.dart';
9 | import 'package:todo_flutter_example/view/button_page.dart';
10 | import 'package:todo_flutter_example/view/dialog_page.dart';
11 | import 'package:todo_flutter_example/view/image_page.dart';
12 | import 'package:todo_flutter_example/view/input_page.dart';
13 | import 'package:todo_flutter_example/view/net_page.dart';
14 | import 'package:todo_flutter_example/view/refresh_page.dart';
15 | import 'package:todo_flutter_example/view/sliver_page.dart';
16 | import 'package:todo_flutter_example/view/text_page.dart';
17 | import 'package:todo_flutter_example/view/toast_page.dart';
18 |
19 | class ModuleRoute {
20 | ///添加模块路由
21 | static void initRoute() {
22 | RouterUtil.instance.addRoute(ExampleRoute.textPage,
23 | (Map map) {
24 | return const TextPage();
25 | });
26 | RouterUtil.instance.addRoute(ExampleRoute.buttonPage,
27 | (Map map) {
28 | return const ButtonPage();
29 | });
30 | RouterUtil.instance.addRoute(ExampleRoute.imagePage,
31 | (Map map) {
32 | return const ImagePage();
33 | });
34 | RouterUtil.instance.addRoute(ExampleRoute.toastPage,
35 | (Map map) {
36 | return const ToastPage();
37 | });
38 | RouterUtil.instance.addRoute(ExampleRoute.inputPage,
39 | (Map map) {
40 | return const InputPage();
41 | });
42 | RouterUtil.instance.addRoute(ExampleRoute.dialogPage,
43 | (Map map) {
44 | return const DialogPage();
45 | });
46 | RouterUtil.instance.addRoute(ExampleRoute.blocPage,
47 | (Map map) {
48 | return const BlocPage();
49 | });
50 | RouterUtil.instance.addRoute(ExampleRoute.netPage,
51 | (Map map) {
52 | return const NetPage();
53 | });
54 | RouterUtil.instance.addRoute(ExampleRoute.refreshPage,
55 | (Map map) {
56 | return const RefreshPage();
57 | });
58 | RouterUtil.instance.addRoute(ExampleRoute.appUpdatePage,
59 | (Map map) {
60 | return const AppUpdatePage();
61 | });
62 | RouterUtil.instance.addRoute(ExampleRoute.sliverPage,
63 | (Map map) {
64 | return const SliverPage();
65 | });
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/example/lib/domain/bloc/bloc/test_bloc.dart:
--------------------------------------------------------------------------------
1 | /// createTime: 2021/9/29 on 17:10
2 | /// desc:
3 | ///
4 | /// @author azhon
5 |
6 | import 'dart:math';
7 |
8 | import 'package:todo_flutter/todo_flutter.dart';
9 | import 'package:todo_flutter_example/domain/bloc/bloc/test_event.dart';
10 | import 'package:todo_flutter_example/domain/bloc/bloc/test_state.dart';
11 |
12 | class TestBloc extends BaseBloc {
13 | DataChangeBloc dataChangeBloc = DataChangeBloc(0);
14 |
15 | TestBloc() : super(TestInitialState(null));
16 |
17 | void init() {
18 | add(InitEvent());
19 | }
20 |
21 | void changeData() {
22 | final int random = Random().nextInt(9999);
23 | dataChangeBloc.changeData(random);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/example/lib/domain/bloc/bloc/test_event.dart:
--------------------------------------------------------------------------------
1 | /// createTime: 2021/9/29 on 17:11
2 | /// desc:
3 | ///
4 | /// @author azhon
5 |
6 | import 'dart:math';
7 |
8 | import 'package:todo_flutter/todo_flutter.dart';
9 | import 'package:todo_flutter_example/domain/bloc/bloc/test_bloc.dart';
10 | import 'package:todo_flutter_example/domain/bloc/bloc/test_state.dart';
11 |
12 | abstract class TestEvent extends BaseEvent {}
13 |
14 | class InitEvent extends TestEvent {
15 | @override
16 | Future on(TestBloc bloc, TestState currentState) async {
17 | showLoading();
18 | final result = Random().nextInt(9999).toString();
19 | await Future.delayed(const Duration(milliseconds: 1500));
20 | dismissLoading();
21 | return TestInitialState(result);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/lib/domain/bloc/bloc/test_state.dart:
--------------------------------------------------------------------------------
1 | /// createTime: 2021/9/29 on 17:13
2 | /// desc:
3 | ///
4 | /// @author azhon
5 |
6 | abstract class TestState {
7 | final String? data;
8 |
9 | TestState(this.data);
10 | }
11 |
12 | class TestInitialState extends TestState {
13 | TestInitialState(String? data) : super(data);
14 | }
15 |
--------------------------------------------------------------------------------
/example/lib/domain/bloc/net/net_bloc.dart:
--------------------------------------------------------------------------------
1 | /// createTime: 2021/10/15 on 11:54
2 | /// desc:
3 | ///
4 | /// @author azhon
5 |
6 | import 'package:todo_flutter/todo_flutter.dart';
7 | import 'package:todo_flutter_example/domain/bloc/net/net_event.dart';
8 | import 'package:todo_flutter_example/domain/bloc/net/net_state.dart';
9 |
10 | class NetBloc extends BaseBloc {
11 | NetBloc() : super(NetInitialState(null));
12 |
13 | void get() {
14 | add(GetEvent());
15 | }
16 |
17 | void post() {
18 | add(PostEvent());
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/example/lib/domain/bloc/net/net_event.dart:
--------------------------------------------------------------------------------
1 | /// createTime: 2021/10/15 on 11:55
2 | /// desc:
3 | ///
4 | /// @author azhon
5 |
6 | import 'package:todo_flutter/todo_flutter.dart';
7 | import 'package:todo_flutter_example/domain/bloc/net/net_bloc.dart';
8 | import 'package:todo_flutter_example/domain/bloc/net/net_state.dart';
9 | import 'package:todo_flutter_example/domain/request/net_request.dart';
10 |
11 | abstract class NetEvent extends BaseEvent {}
12 |
13 | class GetEvent extends NetEvent {
14 | @override
15 | Future on(NetBloc bloc, NetState currentState) async {
16 | showLoading();
17 | final bean = await NetGetRequest().request();
18 | await Future.delayed(const Duration(seconds: 1));
19 | dismissLoading();
20 | bloc.loadDone();
21 | return NetInitialState(bean.data);
22 | }
23 | }
24 |
25 | class PostEvent extends NetEvent {
26 | @override
27 | Future on(NetBloc bloc, NetState currentState) async {
28 | bloc.loading();
29 | final bean = await NetPostRequest().request();
30 | await Future.delayed(const Duration(seconds: 1));
31 | bloc.loadError(NetworkException(bean));
32 | return NetInitialState(null);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/example/lib/domain/bloc/net/net_state.dart:
--------------------------------------------------------------------------------
1 | /// createTime: 2021/10/15 on 11:55
2 | /// desc:
3 | ///
4 | /// @author azhon
5 |
6 | import 'package:todo_flutter_example/domain/request/entity/get_entity.dart';
7 |
8 | abstract class NetState {
9 | final List? data;
10 |
11 | NetState(this.data);
12 | }
13 |
14 | class NetInitialState extends NetState {
15 | NetInitialState(List? data) : super(data);
16 | }
17 |
--------------------------------------------------------------------------------
/example/lib/domain/request/entity/get_entity.dart:
--------------------------------------------------------------------------------
1 | import 'package:todo_flutter_example/generated/json/base/json_field.dart';
2 | import 'package:todo_flutter_example/generated/json/get_entity.g.dart';
3 | import 'dart:convert';
4 |
5 | @JsonSerializable()
6 | class GetEntity {
7 | String? desc;
8 | int? id;
9 | String? imagePath;
10 | int? isVisible;
11 | int? order;
12 | String? title;
13 | int? type;
14 | String? url;
15 |
16 | GetEntity();
17 |
18 | factory GetEntity.fromJson(Map json) =>
19 | $GetEntityFromJson(json);
20 |
21 | Map toJson() => $GetEntityToJson(this);
22 |
23 | @override
24 | String toString() {
25 | return jsonEncode(this);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/example/lib/domain/request/entity/list_data_entity.dart:
--------------------------------------------------------------------------------
1 | import 'package:todo_flutter_example/generated/json/base/json_field.dart';
2 | import 'package:todo_flutter_example/generated/json/list_data_entity.g.dart';
3 | import 'dart:convert';
4 |
5 | @JsonSerializable()
6 | class ListDataEntity {
7 |
8 | bool? adminAdd;
9 | String? apkLink;
10 | int? audit;
11 | String? author;
12 | bool? canEdit;
13 | int? chapterId;
14 | String? chapterName;
15 | bool? collect;
16 | int? courseId;
17 | String? desc;
18 | String? descMd;
19 | String? envelopePic;
20 | bool? fresh;
21 | String? host;
22 | int? id;
23 | bool? isAdminAdd;
24 | String? link;
25 | String? niceDate;
26 | String? niceShareDate;
27 | String? origin;
28 | String? prefix;
29 | String? projectLink;
30 | int? publishTime;
31 | int? realSuperChapterId;
32 | int? selfVisible;
33 | int? shareDate;
34 | String? shareUser;
35 | int? superChapterId;
36 | String? superChapterName;
37 | List? tags;
38 | String? title;
39 | int? type;
40 | int? userId;
41 | int? visible;
42 | int? zan;
43 |
44 | ListDataEntity();
45 |
46 | factory ListDataEntity.fromJson(Map json) => $ListDataEntityFromJson(json);
47 |
48 | Map toJson() => $ListDataEntityToJson(this);
49 |
50 | @override
51 | String toString() {
52 | return jsonEncode(this);
53 | }
54 | }
--------------------------------------------------------------------------------
/example/lib/domain/request/list_request.dart:
--------------------------------------------------------------------------------
1 | /// createTime: 2022/07/27 on 10:14
2 | /// desc:
3 | ///
4 | /// @author azhon
5 |
6 | import 'package:todo_flutter/todo_flutter.dart';
7 | import 'package:todo_flutter_example/common/api/api_provider.dart';
8 | import 'package:todo_flutter_example/domain/request/entity/list_data_entity.dart';
9 |
10 | class ListRequest extends ApiRequest> {
11 | ListRequest() : super(null);
12 |
13 | @override
14 | RequestMethod get method => RequestMethod.get;
15 |
16 | @override
17 | String get url => 'article/list/$page/json';
18 | }
19 |
--------------------------------------------------------------------------------
/example/lib/domain/request/net_request.dart:
--------------------------------------------------------------------------------
1 | /// createTime: 2021/10/15 on 13:40
2 | /// desc:
3 | ///
4 | /// @author azhon
5 |
6 | import 'package:todo_flutter/todo_flutter.dart';
7 | import 'package:todo_flutter_example/common/api/api_provider.dart';
8 | import 'package:todo_flutter_example/domain/request/entity/get_entity.dart';
9 |
10 | class NetGetRequest extends ApiRequest> {
11 | NetGetRequest() : super({'id': '323', 'name': 'azhon'});
12 |
13 | @override
14 | RequestMethod get method => RequestMethod.get;
15 |
16 | @override
17 | String get url => 'banner/json';
18 | }
19 |
20 | class NetPostRequest extends ApiRequest {
21 | NetPostRequest() : super({'id': '323', 'name': 'azhon'});
22 |
23 | @override
24 | RequestMethod get method => RequestMethod.post;
25 |
26 | @override
27 | String get url => 'lg/uncollect_originId/2333/json';
28 | }
29 |
--------------------------------------------------------------------------------
/example/lib/generated/assets/example_assets.dart:
--------------------------------------------------------------------------------
1 | ///This file is automatically generated by the [FlutterResource], your modifications will be lost.
2 | class ExampleAssets {
3 | static const icEye = 'assets/images/ic_eye.png';
4 | static const icClear = 'assets/images/ic_clear.png';
5 | static const icPolice = 'assets/images/ic_police.png';
6 | static const icSearch = 'assets/images/ic_search.png';
7 | }
8 |
--------------------------------------------------------------------------------
/example/lib/generated/assets/example_icon.dart:
--------------------------------------------------------------------------------
1 | ///This file is automatically generated by the [FlutterResource], your modifications will be lost.
2 | import 'package:flutter/widgets.dart';
3 |
4 | class ExampleIcon {
5 | static const IconData menu = IconData(0xe600, fontFamily: 'todoIcon');
6 | }
7 |
--------------------------------------------------------------------------------
/example/lib/generated/json/base/json_convert_content.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: non_constant_identifier_names
2 | // ignore_for_file: camel_case_types
3 | // ignore_for_file: prefer_single_quotes
4 |
5 | // This file is automatically generated. DO NOT EDIT, all your changes would be lost.
6 | import 'package:flutter/material.dart' show debugPrint;
7 | import 'package:todo_flutter_example/domain/request/entity/get_entity.dart';
8 | import 'package:todo_flutter_example/domain/request/entity/list_data_entity.dart';
9 |
10 | JsonConvert jsonConvert = JsonConvert();
11 | typedef JsonConvertFunction = T Function(Map json);
12 |
13 | class JsonConvert {
14 | static final Map _convertFuncMap = {
15 | (GetEntity).toString(): GetEntity.fromJson,
16 | (ListDataEntity).toString(): ListDataEntity.fromJson,
17 | };
18 |
19 | T? convert(dynamic value) {
20 | if (value == null) {
21 | return null;
22 | }
23 | return asT(value);
24 | }
25 |
26 | List? convertList(List? value) {
27 | if (value == null) {
28 | return null;
29 | }
30 | try {
31 | return value.map((dynamic e) => asT(e)).toList();
32 | } catch (e, stackTrace) {
33 | debugPrint('asT<$T> $e $stackTrace');
34 | return [];
35 | }
36 | }
37 |
38 | List? convertListNotNull(dynamic value) {
39 | if (value == null) {
40 | return null;
41 | }
42 | try {
43 | return (value as List).map((dynamic e) => asT(e)!).toList();
44 | } catch (e, stackTrace) {
45 | debugPrint('asT<$T> $e $stackTrace');
46 | return [];
47 | }
48 | }
49 |
50 | T? asT(dynamic value) {
51 | if (value is T) {
52 | return value;
53 | }
54 | final String type = T.toString();
55 | try {
56 | final String valueS = value.toString();
57 | if (type == "String") {
58 | return valueS as T;
59 | } else if (type == "int") {
60 | final int? intValue = int.tryParse(valueS);
61 | if (intValue == null) {
62 | return double.tryParse(valueS)?.toInt() as T?;
63 | } else {
64 | return intValue as T;
65 | }
66 | } else if (type == "double") {
67 | return double.parse(valueS) as T;
68 | } else if (type == "DateTime") {
69 | return DateTime.parse(valueS) as T;
70 | } else if (type == "bool") {
71 | if (valueS == '0' || valueS == '1') {
72 | return (valueS == '1') as T;
73 | }
74 | return (valueS == 'true') as T;
75 | } else if (type == "Map" || type.startsWith("Map<")) {
76 | return value as T;
77 | } else {
78 | if (_convertFuncMap.containsKey(type)) {
79 | return _convertFuncMap[type]!(value) as T;
80 | } else {
81 | throw UnimplementedError('$type unimplemented');
82 | }
83 | }
84 | } catch (e, stackTrace) {
85 | debugPrint('asT<$T> $e $stackTrace');
86 | return null;
87 | }
88 | }
89 |
90 | //list is returned by type
91 | static M? _getListChildType(List