dio
一個強大的 HTTP 網路請求套件,支援攔截器、中止與取消請求、自訂適配器、轉換器等。
Flutter 超完整的開源專案,功能豐富,適合學習和日常使用。GSYGithubApp 系列的優勢:我們目前已擁有 Flutter、Weex、ReactNative、Kotlin View、Kotlin Jetpack Compose,Compose MultiPlatform,Harmony ArkUI 七個版本,功能齊全,項目框架內技術涵蓋面廣,完成度高,持續維護,搭配文章,適合全面學習,對比參考。
一個強大的 HTTP 網路請求套件,支援攔截器、中止與取消請求、自訂適配器、轉換器等。
用於表達開發人員意圖的註解,這些意圖無法透過靜態分析來推斷來源碼。
一個反應式快取與資料繫結框架。Riverpod 讓處理非同步程式碼變得輕鬆自在。
一個為 riverpod_generator 暴露註解的套件
Riverpod 的程式碼產生器。這不僅簡化語法,還增強功能,例如支援狀態熱重新載入。
一個包裝 InheritedWidget 的工具,讓它們更容易使用且更具可重複使用性。
v2.2.0功能豐富的預建動畫,可輕鬆整合至任何 Flutter 應用程式中。
基於蘋果風格圖標的Cupertino元件預設圖示資源
推薦用於 Flutter 應用程式、套件和外掛的程式碼檢查規則,以促進良好的程式設計習慣。
一個用於 Flutter 的 SVG 渲染和小部件庫,可讓您繪製和顯示可縮放向量圖形 1.1 檔案。
一個用於從 fonts.google.com 使用字體的 Flutter 套件。支援 HTTP 取得、快取和資源封裝。
Flutter 插件,用於取得主機平台檔案系統中常見使用的目錄位置,例如暫存與應用程式資料目錄。
{"sdk":"flutter"}any^1.0.410.0.013.3.05.2.12.4.32.2.12.3.03.1.25.11.02.1.64.14.16.2.0-beta.30.14.113.4.06.3.00.10.00.28.05.2.26.1.5+111.3.14.12.010.2.17.3.11.0.6^7.3.00.15.513.2.06.3.26.2.15.1.02.5.58.12.65.2.02.1.12.1.13.3.23.0.0{"sdk":"flutter"}0.15.0anyanyanyanyany3.4.24.0.65.1.205.1.204.0.88.13.0^2.4.146.14.15.0.0^4.7.0{"sdk":"flutter"}以下為英文專案原文快照,最新內容請造訪 GitHub。
https://raw.githubusercontent.com/CarGuo/gsy_github_app_flutter/HEAD/logo.png
Github Actions GitHub stars GitHub forks GitHub issues GitHub license star
| 公众号 | 掘金 | 知乎 | CSDN | 简书 |
|---|---|---|---|---|
| GSYTech | 点我 | 点我 | 点我 | 点我 |
因为是偏学习展示项目,所以项目里会有各式各样的模式、库、UI等,请不要介意
0、 全局状态管理目前有多种模式,包括 Provider、Redux、Riverpod 等
1、 TrendPage : 目前采用纯 riverpod 状态管理,演示
2、 Provider:目前在 RepositoryDetailPage 出使用
3、 Redux:目前展示了全局登陆和用户信息等上面使用。
4、 riverpod:目前用于管理全局灰度,多语言。
5、 Repos 等请求展示了 graphQL
6、 Redux:目前展示了全局登陆和用户信息等上面使用。
7、 Signals:目前用于 NotifyPage、RepositoryDetailFileListPage 页面内状态管理
列表显示有多个,其中:
1、gsy_pull_load_widget.dart.dart
common_list_page.dart 等使用,搭配 gsy_list_state.dart 使用2、gsy_pull_new_load_widget.dart.dart
dynamic_page.dart 等使用,搭配 gsy_bloc_list_state.dart 使用有 iOS 和 Android 两种风格下拉风格支持3、gsy_nested_pull_load_widget.dart
trend_page.dart 等使用,配置sliver 效果
1、配置好Flutter开发环境(目前Flutter SDK 版本 3.47.2,仓库已在 .fvmrc 里锁定该版本,推荐使用 FVM 一键切换:fvm install 3.47.2 && fvm use 3.47.2),可参阅 【搭建环境】。
2、clone代码,执行Packages get安装第三方包。(因为某些不可抗力原因,国内可能需要设置代理: 代理环境变量)
3、重点:你需要自己在lib/common/config/目录下 创建一个
ignoreConfig.dart文件,然后输入你申请的Github client_id 和 client_secret。
class NetConfig {
static const CLIENT_ID = "xxxx";
static const CLIENT_SECRET = "xxxxxxxxxxx";
}
注册 Github APP 传送门,当然,前提是你现有一个github账号(~ ̄▽ ̄)~ 。
gsygithubapp://authed1、本地 Flutter SDK 版本 3.47.2(
.fvmrc已锁定,可用fvm use切换); 2、是否执行过flutter pub get;3、 网络等问题参考: 如果出现登陆失败或者请求失败
openapk
| 类型 | 二维码 |
|---|---|
| Apk二维码 | https://raw.githubusercontent.com/CarGuo/gsy_github_app_flutter/HEAD/download.png |
| iOS暂无下载 |
https://raw.githubusercontent.com/CarGuo/gsy_github_app_flutter/HEAD/framework2.png
如果包同步失败,一般都是因为没设置包代理,可以参考:环境变量问题
https://raw.githubusercontent.com/CarGuo/gsy_github_app_flutter/HEAD/ios.gif
https://raw.githubusercontent.com/CarGuo/gsy_github_app_flutter/HEAD/theme.gif
http://img.cdn.guoshuyu.cn/showapp1.jpg http://img.cdn.guoshuyu.cn/showapp2.jpg http://img.cdn.guoshuyu.cn/showapp3.jpg当前 Flutter SDK 版本 3.47.2
用户交互 → UI层(Widget/Page) → 状态层(Redux/Provider/Riverpod) → 服务层(Repositories)
→ 网络层(Net) → GitHub API → 数据模型(Model) → 本地存储(DB) → UI更新
┌─────────────────────────────────────────────────────────────────┐
│ GSY GitHub App │
├─────────────┬───────────────┬────────────────┬─────────────────┤
│ UI Layer │ State Layer │ Service Layer │ Data Layer │
├─────────────┼───────────────┼────────────────┼─────────────────┤
│ │ │ │ │
│ ┌─────────┐│ ┌─────────┐ │ ┌─────────┐ │ ┌─────────┐ │
│ │ Pages ││ │ Redux │ │ │Repositories│ │ │ Models │ │
│ └─────────┘│ └─────────┘ │ └─────────┘ │ └─────────┘ │
│ │ │ │ │
│ ┌─────────┐│ ┌─────────┐ │ ┌─────────┐ │ ┌─────────┐ │
│ │ Widgets ││ │ Provider│ │ │Network API│ │ │Database │ │
│ └─────────┘│ └─────────┘ │ └─────────┘ │ └─────────┘ │
│ │ │ │ │
│ ┌─────────┐│ ┌─────────┐ │ │ │
│ │Common UI││ │Riverpod │ │ │ │
│ └─────────┘│ └─────────┘ │ │ │
│ │ │ │ │
│ │ ┌─────────┐ │ │ │
│ │ │ Signals │ │ │ │
│ │ └─────────┘ │ │ │
│ │ │ │ │
└─────────────┴───────────────┴────────────────┴─────────────────┘
lib/
├── main.dart # 应用入口点
├── main_prod.dart # 生产环境入口点
├── app.dart # 应用配置与路由
├── common/ # 公共功能模块
│ ├── config/ # 应用配置
│ ├── event/ # 事件总线
│ ├── local/ # 本地化
│ ├── localization/ # 多语言支持
│ ├── net/ # 网络请求
│ ├── repositories/ # 数据仓库
│ ├── router/ # 路由配置
│ ├── style/ # 样式配置
│ └── utils/ # 工具类
├── db/ # 数据库相关
│ ├── provider/ # 数据库提供者
│ ├── sql_manager.dart # SQL管理器
│ └── sql_provider.dart # SQL提供者
├── env/ # 环境配置
├── model/ # 数据模型
├── page/ # 页面
│ ├── debug/ # 调试页面
│ ├── dynamic/ # 动态页面
│ ├── home/ # 主页
│ ├── issue/ # Issue相关页面
│ ├── login/ # 登录页面
│ ├── push/ # 推送相关页面
│ ├── release/ # 发布相关页面
│ ├── repos/ # 仓库相关页面
│ ├── search/ # 搜索页面
│ ├── trend/ # 趋势页面
│ └── user/ # 用户相关页面
├── provider/ # Provider状态管理
├── redux/ # Redux状态管理
│ ├── middleware/ # Redux中间件
│ ├── gsy_state.dart # Redux状态定义
│ ├── login_redux.dart # 登录状态管理
│ └── user_redux.dart # 用户状态管理
├── test/ # 测试相关
└── widget/ # 自定义组件
├── anima/ # 动画组件
├── markdown/ # Markdown渲染组件
├── menu/ # 菜单组件
├── particle/ # 粒子效果组件
├── pull/ # 下拉刷新组件
└── state/ # 状态相关组件
riverpod 页面内状态管理:
┌───────────────────────────────────────────────────────────────────────────┐
│ Page Architecture Overview │
└───────────────────────────────────────────────────────────────────────────┘
│
▼
┌───────────────────────────────────────────────────────────────────────────┐
│ Global State │
│ ┌───────────────────┐ ┌────────────────────┐ ┌────────────────────┐ │
│ │ appThemeProvider │ │ appLocalProvider │ │ appGrepProvider │ │
│ │ (Theme Data) │ │ (Localization) │ │ (Grayscale Mode) │ │
│ └───────────────────┘ └────────────────────┘ └────────────────────┘ │
└───────────────────────────────────────────────────────────────────────────┘
│
┌────────────────┴────────────────┐
▼ ▼
┌─────────────────────────────────┐ ┌─────────────────────────────────────┐
│ TrendPage (Riverpod) │ │ NotifyPage (Signals) │
├─────────────────────────────────┤ ├─────────────────────────────────────┤
│ │ │ │
│┌─────────────────────────────┐ │ │┌───────────────────────────────────┐│
││ Riverpod Providers │ │ ││ Signals State ││
││┌───────────────────────────┐│ │ ││┌─────────────────────────────────┐││
│││ trendFirstProvider ││ │ │││ notifySignal (List) │││
│││ trendSecondProvider ││ │ │││ notifyIndexSignal (int) │││
││└───────────────────────────┘│ │ │││ signalPage (int) │││
│└─────────────────────────────┘ │ ││└─────────────────────────────────┘││
│ │ │└───────────────────────────────────┘│
│┌─────────────────────────────┐ │ │┌───────────────────────────────────┐│
││ Local State (StatefulWidget)│ │ ││ SignalsMixin Processing ││
││ - UI Controls │ │ ││ - createEffect() for reactions ││
││ - Filter Parameters │ │ ││ - Manages data loading ││
│└─────────────────────────────┘ │ ││ - Updates UI based on signals ││
│ │ │└───────────────────────────────────┘│
└─────────────────────────────────┘ └─────────────────────────────────────┘
│ │
└────────────────┬────────────────┘
▼
┌───────────────────────────────────────────────────────────────────────────┐
│ Data Layer │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ ReposRepository / UserRepository │ │
│ │ ┌────────────────────────┐ ┌─────────────────────────────────┐ │ │
│ │ │ Network Request │───┬──▶│ Database Providers │ │ │
│ │ │ - API calls │ │ │ - Data caching │ │ │
│ │ └────────────────────────┘ │ └─────────────────────────────────┘ │ │
│ │ │ │ │
│ │ │ ┌─────────────────────────────────┐ │ │
│ │ └──▶│ Data Models │ │ │
│ │ │ - Structure definitions │ │ │
│ │ └─────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
└───────────────────────────────────────────────────────────────────────────┘
│
▼
┌───────────────────────────────────────────────────────────────────────────┐
│ UI Components │
│ ┌────────────────────┐ ┌────────────────────┐ ┌────────────────────┐ │
│ │ View Models │ │ List Items │ │ Interactive UI │ │
│ │ - Data Formatting │ │ - Item Rendering │ │ - User Actions │ │
│ └────────────────────┘ └────────────────────┘ └────────────────────┘ │
└───────────────────────────────────────────────────────────────────────────┘
provider 页面内状态管理:
+-----------------------------------------------------+
| App User Interface |
+-----------------------------------------------------+
|
v
+-----------------------------------------------------+
| RepositoryDetailPage (StatefulWidget) |
| with SingleTickerProviderStateMixin |
+-----------------------------------------------------+
|
v
+-----------------------------------------------------+
| MultiProvider |
+-----------------------------------------------------+
| |
v v
+------------------+ +-----------------------+
| ReposNetWork |<----------| ReposDetailProvider |
| Provider | | |
+---------+--------+ +-----------------------+
| |
| |
v v
+-----------------------------------------------------+
| Repository Data Services |
| (ReposRepository, IssueRepository) |
+-----------------------------------------------------+
|
v
+-----------------------------------------------------+
| Four Tab Pages (Consumers) |
+-----------------------------------------------------+
| | | |
v v v v
+----------+ +----------+ +----------+ +----------+
| Info | | Readme | | Issues | | Files |
| Page | | Page | | Page | | Page |
+----------+ +----------+ +----------+ +----------+
| | | |
| | | |
v v v v
+-----------------------------------------------------+
| GlobalKeys for Tab Access |
| (infoListKey, readmeKey, issueListKey, fileListKey) |
+-----------------------------------------------------+
https://raw.githubusercontent.com/CarGuo/gsy_github_app_flutter/HEAD/p1.png https://raw.githubusercontent.com/CarGuo/gsy_github_app_flutter/HEAD/p2.png https://raw.githubusercontent.com/CarGuo/gsy_github_app_flutter/HEAD/p3.png https://raw.githubusercontent.com/CarGuo/gsy_github_app_flutter/HEAD/p4.png
更多可见:https://codewiki.google/github.com/carguo/gsy_github_app_flutter
Star History Chart
http://img.cdn.guoshuyu.cn/thanks.jpg
http://img.cdn.guoshuyu.cn/wechat_qq.png
CarGuo/gsy_github_app_flutter is licensed under the
Apache License 2.0
A permissive license whose main conditions require preservation of copyright and license notices.
Contributors provide an express grant of patent rights.
Licensed works, modifications, and larger works may be distributed under different terms and without source code.