├── .gitignore ├── .metadata ├── README.md ├── android ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── lht │ │ │ │ └── flutter_android_fun │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── 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 │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── images ├── icon_index.png └── icon_second.png ├── ios ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ └── contents.xcworkspacedata └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── lib ├── app.dart ├── conf │ └── ColorConf.dart ├── domain │ └── entity │ │ └── BannerInfoBean.dart ├── global_state │ ├── global_action.dart │ ├── global_reducer.dart │ ├── global_state.dart │ └── global_store.dart ├── main.dart ├── net │ ├── DioUtils.dart │ └── EnvConf.dart └── page │ ├── login │ ├── login_action.dart │ ├── login_effect.dart │ ├── login_page.dart │ ├── login_reducer.dart │ ├── login_state.dart │ └── login_view.dart │ └── main │ ├── index │ ├── banner_component │ │ ├── banner_action.dart │ │ ├── banner_component.dart │ │ ├── banner_effect.dart │ │ ├── banner_reducer.dart │ │ ├── banner_state.dart │ │ └── banner_view.dart │ ├── index_action.dart │ ├── index_adapter │ │ ├── action.dart │ │ ├── adapter.dart │ │ └── reducer.dart │ ├── index_component.dart │ ├── index_effect.dart │ ├── index_reducer.dart │ ├── index_state.dart │ └── index_view.dart │ ├── main_action.dart │ ├── main_effect.dart │ ├── main_page.dart │ ├── main_reducer.dart │ ├── main_state.dart │ ├── main_view.dart │ └── second │ ├── action.dart │ ├── component.dart │ ├── effect.dart │ ├── reducer.dart │ ├── state.dart │ └── view.dart ├── pubspec.lock ├── pubspec.yaml ├── test └── widget_test.dart └── web └── index.html /.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 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | /build/ 31 | 32 | # Android related 33 | **/android/**/gradle-wrapper.jar 34 | **/android/.gradle 35 | **/android/captures/ 36 | **/android/gradlew 37 | **/android/gradlew.bat 38 | **/android/local.properties 39 | **/android/**/GeneratedPluginRegistrant.java 40 | 41 | # iOS/XCode related 42 | **/ios/**/*.mode1v3 43 | **/ios/**/*.mode2v3 44 | **/ios/**/*.moved-aside 45 | **/ios/**/*.pbxuser 46 | **/ios/**/*.perspectivev3 47 | **/ios/**/*sync/ 48 | **/ios/**/.sconsign.dblite 49 | **/ios/**/.tags* 50 | **/ios/**/.vagrant/ 51 | **/ios/**/DerivedData/ 52 | **/ios/**/Icon? 53 | **/ios/**/Pods/ 54 | **/ios/**/.symlinks/ 55 | **/ios/**/profile 56 | **/ios/**/xcuserdata 57 | **/ios/.generated/ 58 | **/ios/Flutter/App.framework 59 | **/ios/Flutter/Flutter.framework 60 | **/ios/Flutter/Generated.xcconfig 61 | **/ios/Flutter/app.flx 62 | **/ios/Flutter/app.zip 63 | **/ios/Flutter/flutter_assets/ 64 | **/ios/Flutter/flutter_export_environment.sh 65 | **/ios/ServiceDefinitions.json 66 | **/ios/Runner/GeneratedPluginRegistrant.* 67 | 68 | # Exceptions to above rules. 69 | !**/ios/**/default.mode1v3 70 | !**/ios/**/default.mode2v3 71 | !**/ios/**/default.pbxuser 72 | !**/ios/**/default.perspectivev3 73 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 74 | -------------------------------------------------------------------------------- /.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: 68587a0916366e9512a78df22c44163d041dd5f3 8 | channel: unknown 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [toc] 2 | # FishRedux完成一个玩安卓客户端 3 | 4 | ## 前言 5 | 不知不觉从18年接触Flutter断断续续到现在,说是一直在玩,其实接触得也都很浅~ 6 | 实际说起来,貌似自己一点都不懂... 7 | 虽然自己断断续续也写了一些app: 8 | [玩安卓](https://github.com/LinHuanTanLy/FlutterWanAndroid) 9 | [钢铁直男版](https://github.com/LinHuanTanLy/TuneAndroid) 10 | 也在公司app上集成了一个单页面的flutter首页 11 | [捂脸] 但是说实话我自己都不想去玩,好垃圾~ 12 | 13 | 所以才会想在年底比较闲的时候,做出一个至少我愿意装在我手机上的app,至少是...对我有用的app,所以才有了这个项目。 14 | 15 | 希望自己可以一直有恒心完善下去: 16 | 17 | **已完成** 18 | - [x] 首页文章列表 19 | - [x] banner 20 | - [x] 微信公众号列表 21 | - [x] 热门项目 22 | - [x] 搜索 23 | - [x] 我的收藏(网站,文章) 24 | - [x] 添加&删除&编辑收藏 25 | - [x] 体系 26 | - [x] 导航 27 | - [x] 积分(收益详情&排名列表) 28 | - [x] 分享 29 | - [x] 主题换肤 30 | 31 | **未完成** 32 | 33 | - [ ] todo模块,希望可以完成一个todo提示, 34 | - [ ] 吃枣药丸,加入一些比较好玩的东西,看博客腻了可以看点好玩的 35 | - [ ] 放松放松,同上 36 | - [ ] 实用工具,(至少我要加入一个千卡转千焦,千焦转大卡的计算工具) 37 | - [ ] webViewPlugs和flutter自带webView的切换(实际上试过,plugs是整个覆盖在flutter页面上,实际上体验一般,很多控件不能自己定义;自带的webview性能一般) 38 | - [ ] 切换字体 39 | - [ ] and so on 40 | 41 | 42 | ## 基本架子 43 | Flutter开发的一个爽点是:无脑堆代码(大雾),而最大的痛点也是这个,很多时候你会发现自己哼哧哼哧一通代码写下来: 44 | ```dart 45 | class _TestPageState extends State { 46 | @override 47 | Widget build(BuildContext context) { 48 | return Scaffold( 49 | appBar: AppBar( 50 | leading: null, 51 | title: null, 52 | actions: [], 53 | ), 54 | body: Column(children: [],), 55 | bottomNavigationBar: Row(children: [],), 56 | ); 57 | } 58 | } 59 | ``` 60 | **哇!!** **一气呵成!** **浑身通透!** 61 | 再仔细一看: 62 | ```dart 63 | ), 64 | ), 65 | ), 66 | ), 67 | ), 68 | ), 69 | ), 70 | ), 71 | ) 72 | ], 73 | ), 74 | ); 75 | } 76 | } 77 | ``` 78 | ![卧槽!!!!!!!!!!!!](https://upload-images.jianshu.io/upload_images/1924616-ac1bfd4562c24736.jpeg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 79 | 80 | 而且这只是v的代码,更别说还有mc的代码,一个稍微复杂点的页面,轻而易举就上了几百行代码,更别说没有提供页面预览功能(新版as已经提供了),这给日后的界面修改和业务修改都增加了难度,这其实就是很多人被劝退的直接原因了。 81 | 有没有解决办法呢? 其实是有的,页面拆分就是一个不错的办法,把一个页面进行业务级的拆分,多个cell组成一个页面,单个cell可以独立,其实就是组件化的思想,但是!还是麻烦!!! 82 | 而且我也不满足于原生的方法,因为群里大佬已经在疯狂安利FishRedux了,而我想着说,反正是个2019的句号,索性我也画得疯狂一点,就用fisnRedex了。 83 | 84 | ###提前总结 85 | 86 | **代码量爆炸! 但是爽!!!! 爽得可以边写代码边喝酒边唱歌!** 87 | **有坑!!!! 坑巨多!! 文档贼少!!!** 88 | **大部份坑都是可以解决的,而且很爽** 89 | 90 | 如果不是很了解*fishRedux*的可以去看下 91 | [fishRedux地址](https://github.com/alibaba/fish-redux) 92 | [用FishRedux完成一个登录页面](https://www.jianshu.com/p/a624b3029080) 93 | ### 页面预览 94 | ![Screenshot_2020-01-07-23-39-11-008_com.lht.flutter_android_fun.png](https://upload-images.jianshu.io/upload_images/1924616-649568385c517d6b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 95 | 96 | ![Screenshot_2020-01-07-23-39-18-750_com.lht.flutter_android_fun.png](https://upload-images.jianshu.io/upload_images/1924616-ade0e081faedbc68.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 97 | 98 | ![Screenshot_2020-01-07-23-39-21-059_com.lht.flutter_android_fun.png](https://upload-images.jianshu.io/upload_images/1924616-08cbc671155b4066.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 99 | 100 | ![Screenshot_2020-01-07-23-39-23-285_com.lht.flutter_android_fun.png](https://upload-images.jianshu.io/upload_images/1924616-8ca3fca3d1fd7c1e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 101 | 102 | ![Screenshot_2020-01-07-23-39-30-113_com.lht.flutter_android_fun.png](https://upload-images.jianshu.io/upload_images/1924616-9e3184958155104a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 103 | 104 | ![Screenshot_2020-01-07-23-39-36-264_com.lht.flutter_android_fun.png](https://upload-images.jianshu.io/upload_images/1924616-83d23a89bf6c0689.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 105 | 106 | ### 路由定义: 107 | ```dart 108 | /// 创建应用的根 Widget 109 | /// 1. 创建一个简单的路由,并注册页面 110 | /// 2. 对所需的页面进行和 AppStore 的连接 111 | /// 3. 对所需的页面进行 AOP 的增强 112 | 113 | class AppRoute { 114 | static AbstractRoutes _global; 115 | 116 | static AbstractRoutes get global { 117 | if (_global == null) { 118 | _global = PageRoutes( 119 | pages: >{ 120 | /// 闪屏页 121 | 'splash': SplashPage(), 122 | 123 | /// 首页 124 | 'home': MainPage(), 125 | 126 | /// 登录页面 127 | 'login': LoginPage(), 128 | 129 | /// 注册页面 130 | 'register': RegisterPage(), 131 | 132 | /// 首页的第二个tab 133 | 'second': SecondPage(), 134 | 135 | /// 首页的第一个tab 136 | 'index': IndexPage(), 137 | 138 | ///项目目录 139 | 'project_list': ProjectListPage(), 140 | 141 | /// 项目子目录 142 | 'project_child_list': ProjectChildPage(), 143 | 144 | /// webView页面 145 | 'webView': WebLoadPage(), 146 | 147 | /// 微信公众号列表页面 148 | 'wechat_author': AuthorPage(), 149 | 150 | /// 微信公众号文章列表页面 151 | 'wechat_author_article': AuthorArticlePage(), 152 | 153 | /// 用户积分 154 | 'user_point': UserPointPage(), 155 | 156 | /// 用户排名 157 | 'user_rank': UserRankPage(), 158 | 159 | /// 网址收藏 160 | 'web_collection': WebCollectionPage(), 161 | 162 | ///文章收藏 163 | 'article_collection': ArticleCollectionPage(), 164 | 165 | /// 体系列表 166 | 'system': SystemPage(), 167 | 168 | /// 体系列表下属文章 169 | 'system_child': SystemChildPage(), 170 | 171 | /// 导航体系 172 | 'navi': NaviPage(), 173 | 174 | /// 侧滑页面 175 | 'draw': DrawPage(), 176 | 177 | /// 主题颜色修改 178 | 'theme_change': ThemeChangePage(), 179 | 180 | /// 搜索页面 181 | 'search': SearchPage(), 182 | }, 183 | visitor: (String path, Page page) { 184 | /// 只有特定的范围的 Page 才需要建立和 AppStore 的连接关系 185 | /// 满足 Page ,T 是 GlobalBaseState 的子类 186 | if (page.isTypeof()) { 187 | /// 建立 AppStore 驱动 PageStore 的单向数据连接 188 | /// 1. 参数1 AppStore 189 | /// 2. 参数2 当 AppStore.state 变化时, PageStore.state 该如何变化 190 | page.connectExtraStore(GlobalStore.store, 191 | (Object pageState, GlobalState appState) { 192 | final GlobalBaseState p = pageState; 193 | // if (p.themeColor != appState.themeColor && 194 | // p.ifLogin != appState.ifLogin) { 195 | if (pageState is Cloneable) { 196 | print('修改--进行复制'); 197 | final Object copy = pageState.clone(); 198 | final GlobalBaseState newState = copy; 199 | newState.themeColor = appState.themeColor; 200 | newState.ifLogin = appState.ifLogin; 201 | newState.screenH = appState.screenH; 202 | newState.screenW = appState.screenW; 203 | newState.userPoint = appState.userPoint; 204 | return newState; 205 | // } 206 | } 207 | return pageState; 208 | }); 209 | } 210 | 211 | /// AOP 212 | /// 页面可以有一些私有的 AOP 的增强, 但往往会有一些 AOP 是整个应用下,所有页面都会有的。 213 | /// 这些公共的通用 AOP ,通过遍历路由页面的形式统一加入。 214 | page.enhancer.append( 215 | /// View AOP 216 | viewMiddleware: >[ 217 | safetyView(), 218 | ], 219 | 220 | /// Adapter AOP 221 | adapterMiddleware: >[ 222 | safetyAdapter() 223 | ], 224 | 225 | /// Effect AOP 226 | effectMiddleware: >[ 227 | _pageAnalyticsMiddleware(), 228 | ], 229 | 230 | /// Store AOP 231 | middleware: >[ 232 | logMiddleware(tag: page.runtimeType.toString()), 233 | ], 234 | ); 235 | }, 236 | ); 237 | } 238 | return _global; 239 | } 240 | } 241 | 242 | Widget createApp() { 243 | final AbstractRoutes routes = AppRoute.global; 244 | 245 | return MaterialApp( 246 | title: '玩安卓', 247 | debugShowCheckedModeBanner: false, 248 | theme: ThemeData( 249 | indicatorColor: ColorConf.ColorFFFFFF, 250 | primarySwatch: ColorConf.themeColor, 251 | ), 252 | home: routes.buildPage('splash', null), 253 | onGenerateRoute: (RouteSettings settings) { 254 | return MaterialPageRoute(builder: (BuildContext context) { 255 | return routes.buildPage(settings.name, settings.arguments); 256 | }); 257 | }, 258 | ); 259 | } 260 | 261 | /// 简单的 Effect AOP 262 | /// 只针对页面的生命周期进行打印 263 | EffectMiddleware _pageAnalyticsMiddleware({String tag = 'redux'}) { 264 | return (AbstractLogic logic, Store store) { 265 | return (Effect effect) { 266 | return (Action action, Context ctx) { 267 | if (logic is Page && action.type is Lifecycle) { 268 | print('${logic.runtimeType} ${action.type.toString()} '); 269 | } 270 | return effect?.call(action, ctx); 271 | }; 272 | }; 273 | }; 274 | } 275 | 276 | ``` 277 | ## 首页 278 | 根据FishRedux的思想,我们把首页架构定义为: 279 | 一个大的page(MainPage),里面用pageView装载了两个大的page(SecondPage&IndexPage), 280 | 281 | ### view 282 | ```dart 283 | Widget buildView(MainState state, Dispatch dispatch, ViewService viewService) { 284 | /// 渲染appBar 285 | AppBar _renderAppBar() { 286 | return AppBar( 287 | backgroundColor: state.themeColor, 288 | centerTitle: true, 289 | titleSpacing: 60, 290 | title: TabBar( 291 | tabs: state.menuList 292 | .map((e) => Tab( 293 | text: e, 294 | )) 295 | .toList(), 296 | labelColor: Colors.white, 297 | controller: state.tabControllerForMenu, 298 | labelPadding: const EdgeInsets.all(0), 299 | labelStyle: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), 300 | unselectedLabelStyle: TextStyle(fontSize: 14), 301 | indicatorPadding: const EdgeInsets.all(0), 302 | indicatorSize: TabBarIndicatorSize.label, 303 | ), 304 | leading: Builder(builder: (ctx) { 305 | return IconButton( 306 | onPressed: () { 307 | dispatch(MainActionCreator.onOpenDraw(ctx)); 308 | }, 309 | icon: Image.asset( 310 | 'images/icon_more.png', 311 | color: Colors.white, 312 | height: 24, 313 | ), 314 | ); 315 | }), 316 | actions: [ 317 | IconButton( 318 | onPressed: () { 319 | dispatch(MainActionCreator.onToSearch()); 320 | }, 321 | icon: Icon(Icons.search), 322 | ) 323 | ], 324 | ); 325 | } 326 | 327 | return Scaffold( 328 | primary: true, 329 | appBar: _renderAppBar(), 330 | body: TabBarView( 331 | controller: state.tabControllerForMenu, 332 | children: [ 333 | KeepAliveWidget(AppRoute.global.buildPage('second', null)), 334 | KeepAliveWidget(AppRoute.global.buildPage('index', null)), 335 | ], 336 | ), 337 | drawer: AppRoute.global.buildPage('draw', null), 338 | ); 339 | } 340 | ``` 341 | 342 | ### and so on 343 | 好像也没有其他什么需要注意的了,只有一个难点是**TabController**,以及page页面需要如何**保活**: 344 | #### 定义自己的TabController 345 | 这个可以参考下之前的文章:[在fishRedux中使用TabController](https://github.com/LinHuanTanLy/FishReduxFunAndroid/blob/dev_new_ui/lib/page/main/main_page.dart) 346 | 347 | #### 页面保活 348 | 在普通的stf页面中,我们需要页面保持,只需要实现**AutomaticKeepAliveClientMixin **: 349 | ```dart 350 | class _TestPageState extends State with AutomaticKeepAliveClientMixin { 351 | @override 352 | Widget build(BuildContext context) { 353 | /// 实现super方法 354 | super.build(context); 355 | return Container(); 356 | } 357 | 358 | /// 返回true 359 | @override 360 | bool get wantKeepAlive => true; 361 | } 362 | ``` 363 | 而在*fishRedux*中就比较麻烦,我们需要把这个page用keepWidget包裹起来: 364 | ```dart 365 | import 'package:flutter/material.dart'; 366 | /// 保持状态的包裹类 367 | class KeepAliveWidget extends StatefulWidget { 368 | final Widget child; 369 | 370 | const KeepAliveWidget(this.child); 371 | 372 | @override 373 | State createState() => _KeepAliveState(); 374 | } 375 | 376 | class _KeepAliveState extends State 377 | with AutomaticKeepAliveClientMixin { 378 | @override 379 | bool get wantKeepAlive => true; 380 | 381 | @override 382 | Widget build(BuildContext context) { 383 | super.build(context); 384 | return widget.child; 385 | } 386 | } 387 | 388 | Widget keepAliveWrapper(Widget child) => KeepAliveWidget(child) 389 | ``` 390 | ### Adapter写法 391 | 我们看下首页的布局,很明显由几个cell组成: 392 | * banner 393 | * 公众号分类gridView 394 | * 置顶推荐 395 | * 项目推荐 396 | * 首页分章分页 397 | 398 | 如果在Android里面,那很明显就是一个RecyclerView+itemType组成; 399 | 如果是在Flutter原生里面,那很明显就是一个ListView+ItemBuilder里面按item划分 400 | 而我们在FishRedux里面,我们把页面做了一个拆分,页面是由一个SingleScrollView组成,而无论bannerComponent,classifyComponent,projectComponent,都是它的一个cell,而重头戏是articleComponent,它带有了父组件带来的loadMore和Refresh(其实整个页面都可以由一个ListView组成,当时不是很熟就用了上面的方法),我们来看看布局层级: 401 | ![code](https://upload-images.jianshu.io/upload_images/1924616-039bacc9ee6952c0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 402 | 403 | 其中的Index_view为: 404 | ```dart 405 | child: CustomScrollView( 406 | slivers: [ 407 | SliverToBoxAdapter( 408 | child: viewService.buildComponent('banner'), 409 | ), 410 | SliverToBoxAdapter( 411 | child: viewService.buildComponent('classify'), 412 | ), 413 | SliverToBoxAdapter( 414 | child: viewService.buildComponent('hotArticle'), 415 | ), 416 | ], 417 | ), 418 | ``` 419 | 420 | #### adapter 421 | 首页我们需要关注的是首页文章的*Adapter*,它隶属于**DynamicFlowAdapter**,其他的还有 422 | * [StaticFlowAdapter ](https://github.com/alibaba/fish-redux/blob/master/doc/concept/static-flow-adapter-cn.md) 423 | * [CustomAdapter](https://github.com/alibaba/fish-redux/blob/master/doc/concept/custom-adapter-cn.md) 424 | * [DynamicFlowAdapter](https://github.com/alibaba/fish-redux/blob/master/doc/concept/dynamic-flow-adapter-cn.md) 425 | 我们看下首页的代码: 426 | ```dart 427 | class ArticleAdapter extends DynamicFlowAdapter { 428 | ArticleAdapter() 429 | : super( 430 | pool: >{ 431 | "article_cell": ArticleCellComponent(), 432 | "comm_article_cell": CommArticleCellComponent(), 433 | "hot_project_cell": ProjectComponent(), 434 | }, 435 | connector: _ArticleAdapterConnector(), 436 | reducer: buildReducer(), 437 | ); 438 | } 439 | 440 | class _ArticleAdapterConnector extends ConnOp> { 441 | @override 442 | List get(HotArticleState state) { 443 | List _tempList = []; 444 | _tempList.addAll(state.hotArticleDataSource 445 | .map((e) => ItemBean( 446 | "article_cell", ArticleCellState()..hotArticleCellBean = e)) 447 | .toList()); 448 | _tempList.add(ItemBean( 449 | "hot_project_cell", 450 | ProjectState() 451 | ..projectListDataSource = state.projectDataSource 452 | ..screenW = state.size?.width 453 | ..screenH = state.size?.height)); 454 | _tempList.addAll(state.commArticleDataSource 455 | .map((e) => 456 | ItemBean("comm_article_cell", CommArticleCellState()..cellBean = e)) 457 | .toList()); 458 | return _tempList; 459 | } 460 | 461 | @override 462 | void set(HotArticleState state, List items) {} 463 | 464 | @override 465 | subReducer(reducer) { 466 | return super.subReducer(reducer); 467 | } 468 | } 469 | ``` 470 | 我们稍微分析下: 471 | 1. 我们在*pool*中定义了component的路由 472 | 2. 我们在_ArticleAdapterConnector的**get**方法中返回了一个ItemBean的List,其type为我们提前定义好的component,而data为各个component的state(各个component的state应该为page的子集) 473 | 3. over 474 | 475 | ## 个人页面&登录页面 476 | 本来还想写写其他页面的代码的,但是其实都是个人主页页面的代码的拓展,说难点其实没有,唯一的尴尬点就是代码量爆炸,还有一点是一开始用fishRedux会忘记使用方法,比如: 477 | 1. action怎么写? 478 | 2. 在effect还是reducer里面写逻辑?? 479 | 3. 我的分页要怎么写比较好? 480 | 4. 卧槽,我的tabController咋写 481 | 5. ... 482 | 这里把我的葵花宝典奉上,我把下面这段文字写成了一个txt,放在桌面,忘记了就打开看看: 483 | ```dart 484 | action 485 | 用来定义在这个页面中发生的动作,例如:登录,清理输入框,更换验证码框等。 486 | 同时可以通过payload参数传值,传递一些不能通过state传递的值。 487 | 488 | effect 489 | 这个dart文件在fish_redux中是定义来处理副作用操作的,比如显示弹窗,网络请求,数据库查询等操作。 490 | 491 | page 492 | 这个dart文件在用来在路由注册,同时完成注册effect,reducer,component,adapter的功能。 493 | 494 | reducer 495 | 这个dart文件是用来更新View,即直接操作View状态。 496 | 497 | state 498 | state用来定义页面中的数据,用来保存页面状态和数据。 499 | 500 | view 501 | view很明显,就是flutter里面当中展示给用户看到的页面。 502 | ``` 503 | 504 | ## 结语 505 | 这个app还很粗糙,欢迎提issue,我会持续改进的。 506 | ![密码是123456](https://upload-images.jianshu.io/upload_images/1924616-08531bf20767f5fe.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 507 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.lht.flutter_android_fun" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 66 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 67 | } 68 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/lht/flutter_android_fun/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.lht.flutter_android_fun 2 | 3 | import android.os.Bundle 4 | 5 | import io.flutter.app.FlutterActivity 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | GeneratedPluginRegistrant.registerWith(this) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.2.71' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.2.1' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | 3 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /images/icon_index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/images/icon_index.png -------------------------------------------------------------------------------- /images/icon_second.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/images/icon_second.png -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 18 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 19 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 20 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXCopyFilesBuildPhase section */ 24 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 25 | isa = PBXCopyFilesBuildPhase; 26 | buildActionMask = 2147483647; 27 | dstPath = ""; 28 | dstSubfolderSpec = 10; 29 | files = ( 30 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 31 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 32 | ); 33 | name = "Embed Frameworks"; 34 | runOnlyForDeploymentPostprocessing = 0; 35 | }; 36 | /* End PBXCopyFilesBuildPhase section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 40 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 41 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 42 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 43 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 44 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 45 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 46 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 47 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 48 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 49 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 51 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 52 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 53 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 62 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | /* End PBXFrameworksBuildPhase section */ 67 | 68 | /* Begin PBXGroup section */ 69 | 9740EEB11CF90186004384FC /* Flutter */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 3B80C3931E831B6300D905FE /* App.framework */, 73 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 74 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 75 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 76 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 77 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 78 | ); 79 | name = Flutter; 80 | sourceTree = ""; 81 | }; 82 | 97C146E51CF9000F007C117D = { 83 | isa = PBXGroup; 84 | children = ( 85 | 9740EEB11CF90186004384FC /* Flutter */, 86 | 97C146F01CF9000F007C117D /* Runner */, 87 | 97C146EF1CF9000F007C117D /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | 97C146EF1CF9000F007C117D /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 97C146EE1CF9000F007C117D /* Runner.app */, 95 | ); 96 | name = Products; 97 | sourceTree = ""; 98 | }; 99 | 97C146F01CF9000F007C117D /* Runner */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 103 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 104 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 105 | 97C147021CF9000F007C117D /* Info.plist */, 106 | 97C146F11CF9000F007C117D /* Supporting Files */, 107 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 108 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 109 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 110 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 111 | ); 112 | path = Runner; 113 | sourceTree = ""; 114 | }; 115 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | ); 119 | name = "Supporting Files"; 120 | sourceTree = ""; 121 | }; 122 | /* End PBXGroup section */ 123 | 124 | /* Begin PBXNativeTarget section */ 125 | 97C146ED1CF9000F007C117D /* Runner */ = { 126 | isa = PBXNativeTarget; 127 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 128 | buildPhases = ( 129 | 9740EEB61CF901F6004384FC /* Run Script */, 130 | 97C146EA1CF9000F007C117D /* Sources */, 131 | 97C146EB1CF9000F007C117D /* Frameworks */, 132 | 97C146EC1CF9000F007C117D /* Resources */, 133 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 134 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 135 | ); 136 | buildRules = ( 137 | ); 138 | dependencies = ( 139 | ); 140 | name = Runner; 141 | productName = Runner; 142 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 143 | productType = "com.apple.product-type.application"; 144 | }; 145 | /* End PBXNativeTarget section */ 146 | 147 | /* Begin PBXProject section */ 148 | 97C146E61CF9000F007C117D /* Project object */ = { 149 | isa = PBXProject; 150 | attributes = { 151 | LastUpgradeCheck = 1020; 152 | ORGANIZATIONNAME = "The Chromium Authors"; 153 | TargetAttributes = { 154 | 97C146ED1CF9000F007C117D = { 155 | CreatedOnToolsVersion = 7.3.1; 156 | LastSwiftMigration = 0910; 157 | }; 158 | }; 159 | }; 160 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 161 | compatibilityVersion = "Xcode 3.2"; 162 | developmentRegion = en; 163 | hasScannedForEncodings = 0; 164 | knownRegions = ( 165 | en, 166 | Base, 167 | ); 168 | mainGroup = 97C146E51CF9000F007C117D; 169 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 170 | projectDirPath = ""; 171 | projectRoot = ""; 172 | targets = ( 173 | 97C146ED1CF9000F007C117D /* Runner */, 174 | ); 175 | }; 176 | /* End PBXProject section */ 177 | 178 | /* Begin PBXResourcesBuildPhase section */ 179 | 97C146EC1CF9000F007C117D /* Resources */ = { 180 | isa = PBXResourcesBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 184 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 185 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 186 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 187 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 188 | ); 189 | runOnlyForDeploymentPostprocessing = 0; 190 | }; 191 | /* End PBXResourcesBuildPhase section */ 192 | 193 | /* Begin PBXShellScriptBuildPhase section */ 194 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 195 | isa = PBXShellScriptBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | ); 199 | inputPaths = ( 200 | ); 201 | name = "Thin Binary"; 202 | outputPaths = ( 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | shellPath = /bin/sh; 206 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 207 | }; 208 | 9740EEB61CF901F6004384FC /* Run Script */ = { 209 | isa = PBXShellScriptBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | ); 213 | inputPaths = ( 214 | ); 215 | name = "Run Script"; 216 | outputPaths = ( 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | shellPath = /bin/sh; 220 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 221 | }; 222 | /* End PBXShellScriptBuildPhase section */ 223 | 224 | /* Begin PBXSourcesBuildPhase section */ 225 | 97C146EA1CF9000F007C117D /* Sources */ = { 226 | isa = PBXSourcesBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 230 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | /* End PBXSourcesBuildPhase section */ 235 | 236 | /* Begin PBXVariantGroup section */ 237 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 238 | isa = PBXVariantGroup; 239 | children = ( 240 | 97C146FB1CF9000F007C117D /* Base */, 241 | ); 242 | name = Main.storyboard; 243 | sourceTree = ""; 244 | }; 245 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 246 | isa = PBXVariantGroup; 247 | children = ( 248 | 97C147001CF9000F007C117D /* Base */, 249 | ); 250 | name = LaunchScreen.storyboard; 251 | sourceTree = ""; 252 | }; 253 | /* End PBXVariantGroup section */ 254 | 255 | /* Begin XCBuildConfiguration section */ 256 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 257 | isa = XCBuildConfiguration; 258 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 259 | buildSettings = { 260 | ALWAYS_SEARCH_USER_PATHS = NO; 261 | CLANG_ANALYZER_NONNULL = YES; 262 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 263 | CLANG_CXX_LIBRARY = "libc++"; 264 | CLANG_ENABLE_MODULES = YES; 265 | CLANG_ENABLE_OBJC_ARC = YES; 266 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 267 | CLANG_WARN_BOOL_CONVERSION = YES; 268 | CLANG_WARN_COMMA = YES; 269 | CLANG_WARN_CONSTANT_CONVERSION = YES; 270 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 271 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 272 | CLANG_WARN_EMPTY_BODY = YES; 273 | CLANG_WARN_ENUM_CONVERSION = YES; 274 | CLANG_WARN_INFINITE_RECURSION = YES; 275 | CLANG_WARN_INT_CONVERSION = YES; 276 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 277 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 278 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 279 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 280 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 281 | CLANG_WARN_STRICT_PROTOTYPES = YES; 282 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 283 | CLANG_WARN_UNREACHABLE_CODE = YES; 284 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 285 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 286 | COPY_PHASE_STRIP = NO; 287 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 288 | ENABLE_NS_ASSERTIONS = NO; 289 | ENABLE_STRICT_OBJC_MSGSEND = YES; 290 | GCC_C_LANGUAGE_STANDARD = gnu99; 291 | GCC_NO_COMMON_BLOCKS = YES; 292 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 293 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 294 | GCC_WARN_UNDECLARED_SELECTOR = YES; 295 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 296 | GCC_WARN_UNUSED_FUNCTION = YES; 297 | GCC_WARN_UNUSED_VARIABLE = YES; 298 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 299 | MTL_ENABLE_DEBUG_INFO = NO; 300 | SDKROOT = iphoneos; 301 | TARGETED_DEVICE_FAMILY = "1,2"; 302 | VALIDATE_PRODUCT = YES; 303 | }; 304 | name = Profile; 305 | }; 306 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 307 | isa = XCBuildConfiguration; 308 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 309 | buildSettings = { 310 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 311 | CLANG_ENABLE_MODULES = YES; 312 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 313 | ENABLE_BITCODE = NO; 314 | FRAMEWORK_SEARCH_PATHS = ( 315 | "$(inherited)", 316 | "$(PROJECT_DIR)/Flutter", 317 | ); 318 | INFOPLIST_FILE = Runner/Info.plist; 319 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 320 | LIBRARY_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "$(PROJECT_DIR)/Flutter", 323 | ); 324 | PRODUCT_BUNDLE_IDENTIFIER = com.lht.flutterAndroidFun; 325 | PRODUCT_NAME = "$(TARGET_NAME)"; 326 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 327 | SWIFT_VERSION = 4.0; 328 | VERSIONING_SYSTEM = "apple-generic"; 329 | }; 330 | name = Profile; 331 | }; 332 | 97C147031CF9000F007C117D /* Debug */ = { 333 | isa = XCBuildConfiguration; 334 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 335 | buildSettings = { 336 | ALWAYS_SEARCH_USER_PATHS = NO; 337 | CLANG_ANALYZER_NONNULL = YES; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 343 | CLANG_WARN_BOOL_CONVERSION = YES; 344 | CLANG_WARN_COMMA = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 347 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 348 | CLANG_WARN_EMPTY_BODY = YES; 349 | CLANG_WARN_ENUM_CONVERSION = YES; 350 | CLANG_WARN_INFINITE_RECURSION = YES; 351 | CLANG_WARN_INT_CONVERSION = YES; 352 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 353 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 354 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 355 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 356 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 357 | CLANG_WARN_STRICT_PROTOTYPES = YES; 358 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 359 | CLANG_WARN_UNREACHABLE_CODE = YES; 360 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 361 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 362 | COPY_PHASE_STRIP = NO; 363 | DEBUG_INFORMATION_FORMAT = dwarf; 364 | ENABLE_STRICT_OBJC_MSGSEND = YES; 365 | ENABLE_TESTABILITY = YES; 366 | GCC_C_LANGUAGE_STANDARD = gnu99; 367 | GCC_DYNAMIC_NO_PIC = NO; 368 | GCC_NO_COMMON_BLOCKS = YES; 369 | GCC_OPTIMIZATION_LEVEL = 0; 370 | GCC_PREPROCESSOR_DEFINITIONS = ( 371 | "DEBUG=1", 372 | "$(inherited)", 373 | ); 374 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 375 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 376 | GCC_WARN_UNDECLARED_SELECTOR = YES; 377 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 378 | GCC_WARN_UNUSED_FUNCTION = YES; 379 | GCC_WARN_UNUSED_VARIABLE = YES; 380 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 381 | MTL_ENABLE_DEBUG_INFO = YES; 382 | ONLY_ACTIVE_ARCH = YES; 383 | SDKROOT = iphoneos; 384 | TARGETED_DEVICE_FAMILY = "1,2"; 385 | }; 386 | name = Debug; 387 | }; 388 | 97C147041CF9000F007C117D /* Release */ = { 389 | isa = XCBuildConfiguration; 390 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 391 | buildSettings = { 392 | ALWAYS_SEARCH_USER_PATHS = NO; 393 | CLANG_ANALYZER_NONNULL = YES; 394 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 395 | CLANG_CXX_LIBRARY = "libc++"; 396 | CLANG_ENABLE_MODULES = YES; 397 | CLANG_ENABLE_OBJC_ARC = YES; 398 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 399 | CLANG_WARN_BOOL_CONVERSION = YES; 400 | CLANG_WARN_COMMA = YES; 401 | CLANG_WARN_CONSTANT_CONVERSION = YES; 402 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 403 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 404 | CLANG_WARN_EMPTY_BODY = YES; 405 | CLANG_WARN_ENUM_CONVERSION = YES; 406 | CLANG_WARN_INFINITE_RECURSION = YES; 407 | CLANG_WARN_INT_CONVERSION = YES; 408 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 409 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 410 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 413 | CLANG_WARN_STRICT_PROTOTYPES = YES; 414 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 415 | CLANG_WARN_UNREACHABLE_CODE = YES; 416 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 417 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 418 | COPY_PHASE_STRIP = NO; 419 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 420 | ENABLE_NS_ASSERTIONS = NO; 421 | ENABLE_STRICT_OBJC_MSGSEND = YES; 422 | GCC_C_LANGUAGE_STANDARD = gnu99; 423 | GCC_NO_COMMON_BLOCKS = YES; 424 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 425 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 426 | GCC_WARN_UNDECLARED_SELECTOR = YES; 427 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 428 | GCC_WARN_UNUSED_FUNCTION = YES; 429 | GCC_WARN_UNUSED_VARIABLE = YES; 430 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 431 | MTL_ENABLE_DEBUG_INFO = NO; 432 | SDKROOT = iphoneos; 433 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 434 | TARGETED_DEVICE_FAMILY = "1,2"; 435 | VALIDATE_PRODUCT = YES; 436 | }; 437 | name = Release; 438 | }; 439 | 97C147061CF9000F007C117D /* Debug */ = { 440 | isa = XCBuildConfiguration; 441 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 442 | buildSettings = { 443 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 444 | CLANG_ENABLE_MODULES = YES; 445 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 446 | ENABLE_BITCODE = NO; 447 | FRAMEWORK_SEARCH_PATHS = ( 448 | "$(inherited)", 449 | "$(PROJECT_DIR)/Flutter", 450 | ); 451 | INFOPLIST_FILE = Runner/Info.plist; 452 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 453 | LIBRARY_SEARCH_PATHS = ( 454 | "$(inherited)", 455 | "$(PROJECT_DIR)/Flutter", 456 | ); 457 | PRODUCT_BUNDLE_IDENTIFIER = com.lht.flutterAndroidFun; 458 | PRODUCT_NAME = "$(TARGET_NAME)"; 459 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 460 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 461 | SWIFT_VERSION = 4.0; 462 | VERSIONING_SYSTEM = "apple-generic"; 463 | }; 464 | name = Debug; 465 | }; 466 | 97C147071CF9000F007C117D /* Release */ = { 467 | isa = XCBuildConfiguration; 468 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 469 | buildSettings = { 470 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 471 | CLANG_ENABLE_MODULES = YES; 472 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 473 | ENABLE_BITCODE = NO; 474 | FRAMEWORK_SEARCH_PATHS = ( 475 | "$(inherited)", 476 | "$(PROJECT_DIR)/Flutter", 477 | ); 478 | INFOPLIST_FILE = Runner/Info.plist; 479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 480 | LIBRARY_SEARCH_PATHS = ( 481 | "$(inherited)", 482 | "$(PROJECT_DIR)/Flutter", 483 | ); 484 | PRODUCT_BUNDLE_IDENTIFIER = com.lht.flutterAndroidFun; 485 | PRODUCT_NAME = "$(TARGET_NAME)"; 486 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 487 | SWIFT_VERSION = 4.0; 488 | VERSIONING_SYSTEM = "apple-generic"; 489 | }; 490 | name = Release; 491 | }; 492 | /* End XCBuildConfiguration section */ 493 | 494 | /* Begin XCConfigurationList section */ 495 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 496 | isa = XCConfigurationList; 497 | buildConfigurations = ( 498 | 97C147031CF9000F007C117D /* Debug */, 499 | 97C147041CF9000F007C117D /* Release */, 500 | 249021D3217E4FDB00AE95B9 /* Profile */, 501 | ); 502 | defaultConfigurationIsVisible = 0; 503 | defaultConfigurationName = Release; 504 | }; 505 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 506 | isa = XCConfigurationList; 507 | buildConfigurations = ( 508 | 97C147061CF9000F007C117D /* Debug */, 509 | 97C147071CF9000F007C117D /* Release */, 510 | 249021D4217E4FDB00AE95B9 /* Profile */, 511 | ); 512 | defaultConfigurationIsVisible = 0; 513 | defaultConfigurationName = Release; 514 | }; 515 | /* End XCConfigurationList section */ 516 | 517 | }; 518 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 519 | } 520 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/FishReduxFunAndroid/0faf47947f16449955605f7087d933301692d1d6/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_android_fun 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /lib/app.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'package:flutter/material.dart' hide Action; 3 | 4 | import 'global_state/global_state.dart'; 5 | import 'global_state/global_store.dart'; 6 | import 'page/login/login_page.dart'; 7 | import 'page/main/main_page.dart'; 8 | 9 | /// 创建应用的根 Widget 10 | /// 1. 创建一个简单的路由,并注册页面 11 | /// 2. 对所需的页面进行和 AppStore 的连接 12 | /// 3. 对所需的页面进行 AOP 的增强 13 | Widget createApp() { 14 | final AbstractRoutes routes = PageRoutes( 15 | pages: >{ 16 | /// 注册TodoList主页面 17 | "main": MainPage(), 18 | "login": LoginPage() 19 | 20 | /// 注册Todo编辑页面 21 | }, 22 | visitor: (String path, Page page) { 23 | print('the page is $page'); 24 | print('the page is $path'); 25 | /// 只有特定的范围的 Page 才需要建立和 AppStore 的连接关系 26 | /// 满足 Page ,T 是 GlobalBaseState 的子类 27 | if (page.isTypeof()) { 28 | /// 建立 AppStore 驱动 PageStore 的单向数据连接 29 | /// 1. 参数1 AppStore 30 | /// 2. 参数2 当 AppStore.state 变化时, PageStore.state 该如何变化 31 | page.connectExtraStore(GlobalStore.store, 32 | (Object pageState, GlobalState appState) { 33 | final GlobalBaseState p = pageState; 34 | if (p.themeColor != appState.themeColor || 35 | p.screenH != appState.screenH || 36 | p.screenW != appState.screenW) { 37 | if (pageState is Cloneable) { 38 | final Object copy = pageState.clone(); 39 | final GlobalBaseState newState = copy; 40 | newState.themeColor = appState.themeColor; 41 | newState.screenH = appState.screenH; 42 | newState.screenW = appState.screenW; 43 | return newState; 44 | } 45 | } 46 | return pageState; 47 | }); 48 | } 49 | 50 | /// AOP 51 | /// 页面可以有一些私有的 AOP 的增强, 但往往会有一些 AOP 是整个应用下,所有页面都会有的。 52 | /// 这些公共的通用 AOP ,通过遍历路由页面的形式统一加入。 53 | page.enhancer.append( 54 | /// View AOP 55 | viewMiddleware: >[ 56 | safetyView(), 57 | ], 58 | 59 | /// Adapter AOP 60 | adapterMiddleware: >[ 61 | safetyAdapter() 62 | ], 63 | 64 | /// Effect AOP 65 | effectMiddleware: >[ 66 | _pageAnalyticsMiddleware(), 67 | ], 68 | 69 | /// Store AOP 70 | middleware: >[ 71 | logMiddleware(tag: page.runtimeType.toString()), 72 | ], 73 | ); 74 | }, 75 | ); 76 | 77 | return MaterialApp( 78 | debugShowCheckedModeBanner: false, 79 | theme: ThemeData( 80 | primarySwatch: Colors.blue, 81 | ), 82 | home: routes.buildPage('main', null), 83 | onGenerateRoute: (RouteSettings settings) { 84 | return MaterialPageRoute(builder: (BuildContext context) { 85 | return routes.buildPage(settings.name, settings.arguments); 86 | }); 87 | }, 88 | ); 89 | } 90 | 91 | /// 简单的 Effect AOP 92 | /// 只针对页面的生命周期进行打印 93 | EffectMiddleware _pageAnalyticsMiddleware({String tag = 'redux'}) { 94 | return (AbstractLogic logic, Store store) { 95 | return (Effect effect) { 96 | return (Action action, Context ctx) { 97 | if (logic is Page && action.type is Lifecycle) { 98 | print('${logic.runtimeType} ${action.type.toString()} '); 99 | } 100 | return effect?.call(action, ctx); 101 | }; 102 | }; 103 | }; 104 | } 105 | -------------------------------------------------------------------------------- /lib/conf/ColorConf.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ColorConf { 4 | static const Color48586D = Color(0XFF48586D); 5 | static const Color8048586D = Color(0X8048586D); 6 | } 7 | -------------------------------------------------------------------------------- /lib/domain/entity/BannerInfoBean.dart: -------------------------------------------------------------------------------- 1 | class BannerInfoBean { 2 | List data; 3 | int errorCode; 4 | String errorMsg; 5 | 6 | BannerInfoBean({this.data, this.errorCode, this.errorMsg}); 7 | 8 | BannerInfoBean.fromJson(Map json) { 9 | if (json['data'] != null) { 10 | data = new List(); 11 | json['data'].forEach((v) { 12 | data.add(new Data.fromJson(v)); 13 | }); 14 | } 15 | errorCode = json['errorCode']; 16 | errorMsg = json['errorMsg']; 17 | } 18 | 19 | Map toJson() { 20 | final Map data = new Map(); 21 | if (this.data != null) { 22 | data['data'] = this.data.map((v) => v.toJson()).toList(); 23 | } 24 | data['errorCode'] = this.errorCode; 25 | data['errorMsg'] = this.errorMsg; 26 | return data; 27 | } 28 | } 29 | 30 | class Data { 31 | String desc; 32 | int id; 33 | String imagePath; 34 | int isVisible; 35 | int order; 36 | String title; 37 | int type; 38 | String url; 39 | 40 | Data( 41 | {this.desc, 42 | this.id, 43 | this.imagePath, 44 | this.isVisible, 45 | this.order, 46 | this.title, 47 | this.type, 48 | this.url}); 49 | 50 | Data.fromJson(Map json) { 51 | desc = json['desc']; 52 | id = json['id']; 53 | imagePath = json['imagePath']; 54 | isVisible = json['isVisible']; 55 | order = json['order']; 56 | title = json['title']; 57 | type = json['type']; 58 | url = json['url']; 59 | } 60 | 61 | Map toJson() { 62 | final Map data = new Map(); 63 | data['desc'] = this.desc; 64 | data['id'] = this.id; 65 | data['imagePath'] = this.imagePath; 66 | data['isVisible'] = this.isVisible; 67 | data['order'] = this.order; 68 | data['title'] = this.title; 69 | data['type'] = this.type; 70 | data['url'] = this.url; 71 | return data; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /lib/global_state/global_action.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | enum GlobalAction { changeThemeColor, updateGlobalW, updateGlobalH } 4 | 5 | class GlobalActionCreator { 6 | static Action onChangeThemeColor() { 7 | return const Action(GlobalAction.changeThemeColor); 8 | } 9 | 10 | static Action onUpdateGlobalH(double h) { 11 | return Action(GlobalAction.updateGlobalH, payload: h); 12 | } 13 | 14 | static Action onUpdateGlobalW(double w) { 15 | return Action(GlobalAction.updateGlobalW, payload: w); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/global_state/global_reducer.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'dart:ui'; 3 | import 'package:flutter/material.dart' hide Action; 4 | import 'global_action.dart'; 5 | import 'global_state.dart'; 6 | 7 | Reducer buildReducer() { 8 | return asReducer( 9 | >{ 10 | GlobalAction.changeThemeColor: _onchangeThemeColor, 11 | GlobalAction.updateGlobalH: _onUpdateGlobalH, 12 | GlobalAction.updateGlobalW: _onUpdateGlobalW, 13 | }, 14 | ); 15 | } 16 | 17 | List _colors = [ 18 | Colors.green, 19 | Colors.red, 20 | Colors.black, 21 | Colors.blue 22 | ]; 23 | 24 | GlobalState _onUpdateGlobalW(GlobalState state, Action action) { 25 | debugPrint('修改系统宽度'); 26 | final double w = action.payload; 27 | debugPrint('修改系统宽度---$w'); 28 | return state.clone()..screenW = w; 29 | } 30 | 31 | GlobalState _onUpdateGlobalH(GlobalState state, Action action) { 32 | debugPrint('修改系统高度'); 33 | final double h = action.payload; 34 | debugPrint('修改系统高度---$h'); 35 | return state.clone()..screenH = h; 36 | } 37 | 38 | GlobalState _onchangeThemeColor(GlobalState state, Action action) { 39 | debugPrint('修改系统配色'); 40 | final Color next = 41 | _colors[((_colors.indexOf(state.themeColor) + 1) % _colors.length)]; 42 | debugPrint('修改系统配色---$next'); 43 | return state.clone()..themeColor = next; 44 | } 45 | -------------------------------------------------------------------------------- /lib/global_state/global_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | abstract class GlobalBaseState { 5 | Color get themeColor; 6 | 7 | double get screenW; 8 | 9 | double get screenH; 10 | 11 | set themeColor(Color color); 12 | 13 | set screenW(double d); 14 | 15 | set screenH(double d); 16 | } 17 | 18 | class GlobalState implements GlobalBaseState, Cloneable { 19 | @override 20 | Color themeColor; 21 | @override 22 | double screenW; 23 | @override 24 | double screenH; 25 | 26 | @override 27 | GlobalState clone() { 28 | return GlobalState() 29 | ..themeColor = themeColor 30 | ..screenW = screenW 31 | ..screenH = screenH; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/global_state/global_store.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | import 'global_reducer.dart'; 4 | import 'global_state.dart'; 5 | 6 | class GlobalStore { 7 | static Store _globalStore; 8 | 9 | static Store get store => 10 | _globalStore ??= createStore(GlobalState(), buildReducer()); 11 | } 12 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'app.dart'; 4 | 5 | void main() => runApp(createApp()); 6 | -------------------------------------------------------------------------------- /lib/net/DioUtils.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:dio/dio.dart'; 4 | 5 | import 'EnvConf.dart'; 6 | 7 | class DioUtils { 8 | static DioUtils _dioUtils; 9 | Dio _dio = Dio(); 10 | 11 | String _methodGet = "get"; 12 | String _methodPost = "post"; 13 | 14 | static DioUtils getInstance() { 15 | if (_dioUtils == null) { 16 | _dioUtils = DioUtils(); 17 | } 18 | return _dioUtils; 19 | } 20 | 21 | DioUtils() { 22 | // 通用header 23 | _dio.options.headers = {}; 24 | _dio.options.baseUrl = EnvConf.url; 25 | _dio.options.connectTimeout = 15000; 26 | _dio.options.receiveTimeout = 15000; 27 | _dio.interceptors.add(LogInterceptor(responseBody: true)); //是否开启请求日志 28 | // dio.interceptors.add(CookieManager(CookieJar()));//缓存相关类,具体设置见https://github.com/flutterchina/cookie_jar 29 | } 30 | 31 | doGet(String url, Function success, 32 | {Map params, Function error}) { 33 | _requestHttp(url, params, success, 34 | errorCallback: error, method: _methodGet); 35 | } 36 | 37 | doPost(String url, Function success, 38 | {Map params, Function error}) { 39 | _requestHttp(url, params, success, 40 | errorCallback: error, method: _methodPost); 41 | } 42 | 43 | _requestHttp( 44 | String url, Map params, Function successCallback, 45 | {String method, Function errorCallback}) async { 46 | Response _response; 47 | try { 48 | if (params == null) { 49 | params = Map(); 50 | } 51 | if (method == _methodGet) { 52 | _response = await _dio.get(url, queryParameters: params); 53 | } else { 54 | FormData _forData = FormData(); 55 | if (params != null && params.isNotEmpty == true) { 56 | _forData = FormData.fromMap(params); 57 | } 58 | _response = await _dio.post(url, data: _forData); 59 | } 60 | } on DioError catch (e) { 61 | Response _errorResponse; 62 | if (e != null) { 63 | _errorResponse = e.response; 64 | } else { 65 | _errorResponse = Response(statusCode: 500); 66 | } 67 | print(_errorResponse); 68 | _errBack(errorCallback, e.message); 69 | return; 70 | } 71 | String dataStr = json.encode(_response.data); 72 | Map dataMap = json.decode(dataStr); 73 | if (dataMap == null || dataMap['errorCode'] != 0) { 74 | _errBack(errorCallback, dataMap["errorMsg"] ?? '网络不给力'); 75 | } else { 76 | successCallback(dataMap); 77 | } 78 | } 79 | 80 | _errBack(Function errCallback, String error) { 81 | if (errCallback != null) { 82 | errCallback(error); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /lib/net/EnvConf.dart: -------------------------------------------------------------------------------- 1 | class EnvConf { 2 | // uat 3 | static String url = "https://www.wanandroid.com/"; 4 | 5 | // release 6 | 7 | } 8 | -------------------------------------------------------------------------------- /lib/page/login/login_action.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | //TODO replace with your own action 4 | enum loginAction { action } 5 | 6 | class loginActionCreator { 7 | static Action onAction() { 8 | return const Action(loginAction.action); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /lib/page/login/login_effect.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'login_action.dart'; 3 | import 'login_state.dart'; 4 | 5 | Effect buildEffect() { 6 | return combineEffects(>{ 7 | loginAction.action: _onAction, 8 | }); 9 | } 10 | 11 | void _onAction(Action action, Context ctx) { 12 | } 13 | -------------------------------------------------------------------------------- /lib/page/login/login_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | import 'login_effect.dart'; 4 | import 'login_reducer.dart'; 5 | import 'login_state.dart'; 6 | import 'login_view.dart'; 7 | 8 | class LoginPage extends Page> { 9 | LoginPage() 10 | : super( 11 | initState: initState, 12 | effect: buildEffect(), 13 | reducer: buildReducer(), 14 | view: buildView, 15 | dependencies: Dependencies( 16 | adapter: null, 17 | slots: >{ 18 | }), 19 | middleware: >[ 20 | ],); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /lib/page/login/login_reducer.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | import 'login_action.dart'; 4 | import 'login_state.dart'; 5 | 6 | Reducer buildReducer() { 7 | return asReducer( 8 | >{ 9 | loginAction.action: _onAction, 10 | }, 11 | ); 12 | } 13 | 14 | loginState _onAction(loginState state, Action action) { 15 | final loginState newState = state.clone(); 16 | return newState; 17 | } 18 | -------------------------------------------------------------------------------- /lib/page/login/login_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | class loginState implements Cloneable { 4 | 5 | @override 6 | loginState clone() { 7 | return loginState(); 8 | } 9 | } 10 | 11 | loginState initState(Map args) { 12 | return loginState(); 13 | } 14 | -------------------------------------------------------------------------------- /lib/page/login/login_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import 'login_action.dart'; 5 | import 'login_state.dart'; 6 | 7 | Widget buildView(loginState state, Dispatch dispatch, ViewService viewService) { 8 | return Container(); 9 | } 10 | -------------------------------------------------------------------------------- /lib/page/main/index/banner_component/banner_action.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'package:flutter_android_fun/domain/entity/BannerInfoBean.dart'; 3 | 4 | enum BannerAction { action, initBannerDataSource } 5 | 6 | class BannerActionCreator { 7 | static Action onAction() { 8 | return const Action(BannerAction.action); 9 | } 10 | 11 | static Action onInitBannerDataSource(List data) { 12 | return Action(BannerAction.initBannerDataSource, payload: data); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /lib/page/main/index/banner_component/banner_component.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | import 'banner_effect.dart'; 4 | import 'banner_reducer.dart'; 5 | import 'banner_state.dart'; 6 | import 'banner_view.dart'; 7 | 8 | class BannerComponent extends Component { 9 | BannerComponent() 10 | : super( 11 | effect: buildEffect(), 12 | reducer: buildReducer(), 13 | view: buildView, 14 | dependencies: Dependencies( 15 | adapter: null, slots: >{}), 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /lib/page/main/index/banner_component/banner_effect.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'package:flutter_android_fun/domain/entity/BannerInfoBean.dart'; 3 | import 'package:flutter_android_fun/net/DioUtils.dart'; 4 | import 'banner_action.dart'; 5 | import 'banner_state.dart'; 6 | 7 | Effect buildEffect() { 8 | return combineEffects(>{ 9 | BannerAction.action: _onAction, 10 | 11 | }); 12 | } 13 | 14 | 15 | 16 | void _onAction(Action action, Context ctx) {} 17 | -------------------------------------------------------------------------------- /lib/page/main/index/banner_component/banner_reducer.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'package:flutter_android_fun/domain/entity/BannerInfoBean.dart'; 3 | 4 | import 'banner_action.dart'; 5 | import 'banner_state.dart'; 6 | 7 | Reducer buildReducer() { 8 | return asReducer( 9 | >{ 10 | BannerAction.action: _onAction, 11 | // BannerAction.initBannerDataSource: _onInitBannerData, 12 | }, 13 | ); 14 | } 15 | 16 | BannerState _onAction(BannerState state, Action action) { 17 | final BannerState newState = state.clone(); 18 | return newState; 19 | } 20 | 21 | //BannerState _onInitBannerData(BannerState state, Action action) { 22 | // List _tempForBannerData = action.payload; 23 | // print('buildReducer---_onInitBannerData=$_tempForBannerData'); 24 | // final BannerState newState = state.clone(); 25 | // return newState..dataForBanner = _tempForBannerData; 26 | //} 27 | -------------------------------------------------------------------------------- /lib/page/main/index/banner_component/banner_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'package:flutter_android_fun/domain/entity/BannerInfoBean.dart'; 3 | 4 | class BannerState implements Cloneable { 5 | List dataForBanner; 6 | @override 7 | BannerState clone() { 8 | return BannerState()..dataForBanner=dataForBanner; 9 | } 10 | 11 | @override 12 | String toString() { 13 | return 'BannerState{dataForBanner: $dataForBanner}'; 14 | } 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /lib/page/main/index/banner_component/banner_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_android_fun/global_state/global_state.dart'; 4 | import 'package:flutter_android_fun/global_state/global_store.dart'; 5 | import 'package:flutter_swiper/flutter_swiper.dart'; 6 | 7 | import 'banner_action.dart'; 8 | import 'banner_state.dart'; 9 | 10 | Widget buildView( 11 | BannerState state, Dispatch dispatch, ViewService viewService) { 12 | // return Container( 13 | // height: 200, 14 | // child: Swiper( 15 | // itemBuilder: (BuildContext context, int index) { 16 | // return new Image.network( 17 | // '${state.dataForBanner[index].imagePath}', 18 | // fit: BoxFit.fill, 19 | // ); 20 | // }, 21 | // itemCount: state.dataForBanner.length, 22 | // pagination: new SwiperPagination(), 23 | // control: new SwiperControl(), 24 | // ), 25 | // ); 26 | return Text(state.dataForBanner.toString()); 27 | } 28 | -------------------------------------------------------------------------------- /lib/page/main/index/index_action.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'package:flutter_android_fun/domain/entity/BannerInfoBean.dart'; 3 | 4 | //TODO replace with your own action 5 | enum IndexAction { action , initBannerDataSource,} 6 | 7 | class IndexActionCreator { 8 | static Action onAction() { 9 | return const Action(IndexAction.action); 10 | } 11 | static Action onInitBannerDataSource(List data) { 12 | return Action(IndexAction.initBannerDataSource, payload: data); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /lib/page/main/index/index_adapter/action.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | //TODO replace with your own action 4 | enum ListIndexAction { action } 5 | 6 | class ListIndexActionCreator { 7 | static Action onAction() { 8 | return const Action(ListIndexAction.action); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /lib/page/main/index/index_adapter/adapter.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'package:flutter_android_fun/page/main/index/banner_component/banner_component.dart'; 3 | import 'package:flutter_android_fun/page/main/index/banner_component/banner_state.dart'; 4 | 5 | import '../index_state.dart'; 6 | import 'reducer.dart'; 7 | 8 | class ListIndexAdapter extends DynamicFlowAdapter { 9 | ListIndexAdapter() 10 | : super( 11 | pool: >{"banner": BannerComponent()}, 12 | connector: _ListIndexConnector(), 13 | reducer: buildReducer(), 14 | ); 15 | } 16 | 17 | class _ListIndexConnector extends ConnOp> { 18 | @override 19 | List get(IndexState state) { 20 | print( 21 | 'when init the Adapter, the dataforBanner in IndexStats is${state.dataForBanner}'); 22 | return [ 23 | ItemBean('banner', BannerState()..dataForBanner = state.dataForBanner) 24 | ]; 25 | } 26 | 27 | @override 28 | void set(IndexState state, List items) {} 29 | 30 | @override 31 | subReducer(reducer) { 32 | return super.subReducer(reducer); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/page/main/index/index_adapter/reducer.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | import '../index_state.dart'; 4 | import 'action.dart'; 5 | 6 | Reducer buildReducer() { 7 | return asReducer( 8 | >{ 9 | ListIndexAction.action: _onAction, 10 | }, 11 | ); 12 | } 13 | 14 | IndexState _onAction(IndexState state, Action action) { 15 | final IndexState newState = state.clone(); 16 | return newState; 17 | } 18 | -------------------------------------------------------------------------------- /lib/page/main/index/index_component.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | import 'index_adapter/adapter.dart'; 4 | import 'index_effect.dart'; 5 | import 'index_reducer.dart'; 6 | import 'index_state.dart'; 7 | import 'index_view.dart'; 8 | 9 | class IndexComponent extends Component { 10 | IndexComponent() 11 | : super( 12 | effect: buildEffect(), 13 | reducer: buildReducer(), 14 | view: buildView, 15 | dependencies: Dependencies( 16 | adapter: NoneConn() + ListIndexAdapter(), 17 | slots: >{}), 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /lib/page/main/index/index_effect.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'package:flutter_android_fun/domain/entity/BannerInfoBean.dart'; 3 | import 'package:flutter_android_fun/net/DioUtils.dart'; 4 | import 'index_action.dart'; 5 | import 'index_state.dart'; 6 | 7 | Effect buildEffect() { 8 | return combineEffects(>{ 9 | IndexAction.action: _onAction, 10 | Lifecycle.initState: _onInitState, 11 | }); 12 | } 13 | 14 | void _onAction(Action action, Context ctx) {} 15 | 16 | void _onInitState(Action action, Context ctx) { 17 | DioUtils.getInstance().doGet('banner/json', (data) { 18 | BannerInfoBean _banner = BannerInfoBean.fromJson(data); 19 | List _dataForBanner = _banner?.data ?? []; 20 | ctx.dispatch(IndexActionCreator.onInitBannerDataSource(_dataForBanner)); 21 | }); 22 | } 23 | -------------------------------------------------------------------------------- /lib/page/main/index/index_reducer.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | import 'index_action.dart'; 4 | import 'index_state.dart'; 5 | 6 | Reducer buildReducer() { 7 | return asReducer( 8 | >{ 9 | IndexAction.action: _onAction, 10 | IndexAction.initBannerDataSource: _onInitBannerDataSource, 11 | }, 12 | ); 13 | } 14 | 15 | IndexState _onAction(IndexState state, Action action) { 16 | final IndexState newState = state.clone(); 17 | return newState; 18 | } 19 | 20 | IndexState _onInitBannerDataSource(IndexState state, Action action) { 21 | final IndexState newState = state.clone(); 22 | return newState..dataForBanner = action.payload; 23 | } 24 | -------------------------------------------------------------------------------- /lib/page/main/index/index_state.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:fish_redux/fish_redux.dart'; 4 | import 'package:flutter_android_fun/domain/entity/BannerInfoBean.dart'; 5 | import 'package:flutter_android_fun/global_state/global_state.dart'; 6 | 7 | class IndexState implements GlobalBaseState, Cloneable { 8 | 9 | List dataForBanner=[]; 10 | @override 11 | IndexState clone() { 12 | return IndexState()..dataForBanner=dataForBanner; 13 | } 14 | 15 | @override 16 | double screenH; 17 | 18 | @override 19 | double screenW; 20 | 21 | @override 22 | Color themeColor; 23 | } 24 | 25 | 26 | -------------------------------------------------------------------------------- /lib/page/main/index/index_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import 'index_action.dart'; 5 | import 'index_state.dart'; 6 | 7 | Widget buildView(IndexState state, Dispatch dispatch, ViewService viewService) { 8 | ListAdapter _adapter = viewService.buildAdapter(); 9 | return ListView.builder( 10 | itemBuilder: _adapter.itemBuilder, 11 | itemCount: _adapter.itemCount, 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /lib/page/main/main_action.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'package:flutter_android_fun/domain/entity/BannerInfoBean.dart'; 3 | 4 | enum MainAction { 5 | action, 6 | clickTab, 7 | updatePageContent, 8 | 9 | } 10 | 11 | class MainActionCreator { 12 | static Action onAction() { 13 | return const Action(MainAction.action); 14 | } 15 | 16 | static Action onClickTab(int newIndex) { 17 | return Action(MainAction.clickTab, payload: newIndex); 18 | } 19 | 20 | static Action onUpdatePageContent(int newIndex) { 21 | return Action(MainAction.updatePageContent, payload: newIndex); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /lib/page/main/main_effect.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'package:flutter/material.dart' hide Action; 3 | import 'package:flutter_android_fun/domain/entity/BannerInfoBean.dart'; 4 | import 'package:flutter_android_fun/global_state/global_action.dart'; 5 | import 'package:flutter_android_fun/global_state/global_state.dart'; 6 | import 'package:flutter_android_fun/global_state/global_store.dart'; 7 | import 'package:flutter_android_fun/net/DioUtils.dart'; 8 | import 'main_action.dart'; 9 | import 'main_state.dart'; 10 | 11 | Effect buildEffect() { 12 | return combineEffects(>{ 13 | MainAction.action: _onAction, 14 | MainAction.clickTab: _onClickTab, 15 | // Lifecycle.initState: _onInitState, 16 | }); 17 | } 18 | 19 | void _onBuild(Action action, Context ctx) { 20 | // Size size = MediaQuery.of(ctx.context).size; 21 | // double w = size?.width; 22 | // double h = size?.height; 23 | // GlobalStore.store.dispatch(GlobalActionCreator.onUpdateGlobalH(h)); 24 | // GlobalStore.store.dispatch(GlobalActionCreator.onUpdateGlobalW(w)); 25 | } 26 | 27 | 28 | void _onClickTab(Action action, Context ctx) { 29 | ctx.dispatch(MainActionCreator.onUpdatePageContent(action.payload)); 30 | } 31 | 32 | void _onAction(Action action, Context ctx) {} 33 | -------------------------------------------------------------------------------- /lib/page/main/main_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | import 'index/index_component.dart'; 4 | import 'main_effect.dart'; 5 | import 'main_reducer.dart'; 6 | import 'main_state.dart'; 7 | import 'main_view.dart'; 8 | import 'second/component.dart'; 9 | 10 | class MainPage extends Page> { 11 | MainPage() 12 | : super( 13 | initState: initState, 14 | effect: buildEffect(), 15 | reducer: buildReducer(), 16 | view: buildView, 17 | dependencies: Dependencies( 18 | adapter: null, 19 | slots: >{ 20 | "index": IndexConnector() + IndexComponent(), 21 | "second": SecondConnector() + SecondComponent(), 22 | }), 23 | middleware: >[], 24 | ); 25 | } 26 | -------------------------------------------------------------------------------- /lib/page/main/main_reducer.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | import 'main_action.dart'; 4 | import 'main_state.dart'; 5 | 6 | Reducer buildReducer() { 7 | return asReducer( 8 | >{ 9 | MainAction.action: _onAction, 10 | MainAction.updatePageContent: _onUpdatePageContent, 11 | }, 12 | ); 13 | } 14 | 15 | 16 | MainState _onUpdatePageContent(MainState state, Action action) { 17 | print('_onUpdatePageContent------------------'); 18 | final MainState newState = state.clone(); 19 | newState.currIndex = action.payload; 20 | return newState; 21 | } 22 | 23 | MainState _onAction(MainState state, Action action) { 24 | final MainState newState = state.clone(); 25 | return newState; 26 | } 27 | -------------------------------------------------------------------------------- /lib/page/main/main_state.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:fish_redux/fish_redux.dart'; 4 | import 'package:flutter_android_fun/global_state/global_state.dart'; 5 | 6 | import 'index/index_state.dart'; 7 | import 'second/state.dart'; 8 | 9 | class MainState implements GlobalBaseState, Cloneable { 10 | double iconSize = 22; 11 | int currIndex = 0; 12 | 13 | @override 14 | MainState clone() { 15 | return MainState() 16 | ..currIndex = currIndex 17 | ..iconSize = iconSize; 18 | } 19 | 20 | @override 21 | double screenH; 22 | 23 | @override 24 | double screenW; 25 | 26 | @override 27 | Color themeColor; 28 | } 29 | 30 | MainState initState(Map args) { 31 | return MainState(); 32 | } 33 | 34 | class IndexConnector extends ConnOp 35 | with ReselectMixin { 36 | @override 37 | void set(MainState state, IndexState subState) {} 38 | 39 | @override 40 | IndexState computed(MainState state) { 41 | return IndexState(); 42 | } 43 | 44 | @override 45 | List factors(MainState state) { 46 | return [state.currIndex]; 47 | } 48 | } 49 | 50 | class SecondConnector extends ConnOp 51 | with ReselectMixin { 52 | @override 53 | SecondState computed(MainState state) { 54 | return SecondState(); 55 | } 56 | 57 | @override 58 | List factors(MainState state) { 59 | return [state.currIndex]; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/page/main/main_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_android_fun/conf/ColorConf.dart'; 4 | 5 | import 'main_action.dart'; 6 | import 'main_state.dart'; 7 | 8 | Widget buildView(MainState state, Dispatch dispatch, ViewService viewService) { 9 | BottomNavigationBarItem _renderBottomMenuItem( 10 | String imgStr, String menuStr, int indexFlag) { 11 | return BottomNavigationBarItem( 12 | icon: Image.asset( 13 | imgStr, 14 | width: state.iconSize, 15 | color: indexFlag == state.currIndex 16 | ? ColorConf.Color48586D 17 | : ColorConf.Color8048586D, 18 | ), 19 | title: Text(menuStr)); 20 | } 21 | 22 | return Scaffold( 23 | // body: Column( 24 | // children: [ 25 | // viewService.buildComponent('index'), 26 | // viewService.buildComponent('second'), 27 | // ], 28 | // ), 29 | body: IndexedStack( 30 | index: state.currIndex, 31 | children: [ 32 | viewService.buildComponent('index'), 33 | viewService.buildComponent('second'), 34 | ], 35 | ), 36 | bottomNavigationBar: BottomNavigationBar( 37 | unselectedFontSize: 11, 38 | selectedFontSize: 12, 39 | currentIndex: state.currIndex, 40 | unselectedItemColor: ColorConf.Color8048586D, 41 | selectedItemColor: ColorConf.Color48586D, 42 | onTap: (index) { 43 | dispatch(MainActionCreator.onClickTab(index)); 44 | }, 45 | items: [ 46 | _renderBottomMenuItem('images/icon_index.png', '首页', 0), 47 | _renderBottomMenuItem('images/icon_second.png', '发现', 1), 48 | ]), 49 | ); 50 | } 51 | -------------------------------------------------------------------------------- /lib/page/main/second/action.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | //TODO replace with your own action 4 | enum SecondAction { action } 5 | 6 | class SecondActionCreator { 7 | static Action onAction() { 8 | return const Action(SecondAction.action); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /lib/page/main/second/component.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | import 'effect.dart'; 4 | import 'reducer.dart'; 5 | import 'state.dart'; 6 | import 'view.dart'; 7 | 8 | class SecondComponent extends Component { 9 | SecondComponent() 10 | : super( 11 | effect: buildEffect(), 12 | reducer: buildReducer(), 13 | view: buildView, 14 | dependencies: Dependencies( 15 | adapter: null, 16 | slots: >{ 17 | }),); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /lib/page/main/second/effect.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'action.dart'; 3 | import 'state.dart'; 4 | 5 | Effect buildEffect() { 6 | return combineEffects(>{ 7 | SecondAction.action: _onAction, 8 | }); 9 | } 10 | 11 | void _onAction(Action action, Context ctx) { 12 | } 13 | -------------------------------------------------------------------------------- /lib/page/main/second/reducer.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | import 'action.dart'; 4 | import 'state.dart'; 5 | 6 | Reducer buildReducer() { 7 | return asReducer( 8 | >{ 9 | SecondAction.action: _onAction, 10 | }, 11 | ); 12 | } 13 | 14 | SecondState _onAction(SecondState state, Action action) { 15 | final SecondState newState = state.clone(); 16 | return newState; 17 | } 18 | -------------------------------------------------------------------------------- /lib/page/main/second/state.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | 3 | class SecondState implements Cloneable { 4 | 5 | @override 6 | SecondState clone() { 7 | return SecondState(); 8 | } 9 | } 10 | 11 | SecondState initState(Map args) { 12 | return SecondState(); 13 | } 14 | -------------------------------------------------------------------------------- /lib/page/main/second/view.dart: -------------------------------------------------------------------------------- 1 | import 'package:fish_redux/fish_redux.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import 'action.dart'; 5 | import 'state.dart'; 6 | 7 | Widget buildView(SecondState state, Dispatch dispatch, ViewService viewService) { 8 | return Container(child: Text('second'),); 9 | } 10 | -------------------------------------------------------------------------------- /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 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "2.3.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "1.0.5" 18 | charcode: 19 | dependency: transitive 20 | description: 21 | name: charcode 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.1.2" 25 | collection: 26 | dependency: transitive 27 | description: 28 | name: collection 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "1.14.11" 32 | cupertino_icons: 33 | dependency: "direct main" 34 | description: 35 | name: cupertino_icons 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "0.1.2" 39 | dio: 40 | dependency: "direct main" 41 | description: 42 | name: dio 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "3.0.7" 46 | fish_redux: 47 | dependency: "direct main" 48 | description: 49 | name: fish_redux 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "0.3.1" 53 | flutter: 54 | dependency: "direct main" 55 | description: flutter 56 | source: sdk 57 | version: "0.0.0" 58 | flutter_page_indicator: 59 | dependency: transitive 60 | description: 61 | name: flutter_page_indicator 62 | url: "https://pub.flutter-io.cn" 63 | source: hosted 64 | version: "0.0.3" 65 | flutter_swiper: 66 | dependency: "direct main" 67 | description: 68 | name: flutter_swiper 69 | url: "https://pub.flutter-io.cn" 70 | source: hosted 71 | version: "1.1.6" 72 | flutter_test: 73 | dependency: "direct dev" 74 | description: flutter 75 | source: sdk 76 | version: "0.0.0" 77 | http_parser: 78 | dependency: transitive 79 | description: 80 | name: http_parser 81 | url: "https://pub.flutter-io.cn" 82 | source: hosted 83 | version: "3.1.3" 84 | matcher: 85 | dependency: transitive 86 | description: 87 | name: matcher 88 | url: "https://pub.flutter-io.cn" 89 | source: hosted 90 | version: "0.12.5" 91 | meta: 92 | dependency: transitive 93 | description: 94 | name: meta 95 | url: "https://pub.flutter-io.cn" 96 | source: hosted 97 | version: "1.1.7" 98 | path: 99 | dependency: transitive 100 | description: 101 | name: path 102 | url: "https://pub.flutter-io.cn" 103 | source: hosted 104 | version: "1.6.4" 105 | pedantic: 106 | dependency: transitive 107 | description: 108 | name: pedantic 109 | url: "https://pub.flutter-io.cn" 110 | source: hosted 111 | version: "1.8.0+1" 112 | quiver: 113 | dependency: transitive 114 | description: 115 | name: quiver 116 | url: "https://pub.flutter-io.cn" 117 | source: hosted 118 | version: "2.0.5" 119 | sky_engine: 120 | dependency: transitive 121 | description: flutter 122 | source: sdk 123 | version: "0.0.99" 124 | source_span: 125 | dependency: transitive 126 | description: 127 | name: source_span 128 | url: "https://pub.flutter-io.cn" 129 | source: hosted 130 | version: "1.5.5" 131 | stack_trace: 132 | dependency: transitive 133 | description: 134 | name: stack_trace 135 | url: "https://pub.flutter-io.cn" 136 | source: hosted 137 | version: "1.9.3" 138 | stream_channel: 139 | dependency: transitive 140 | description: 141 | name: stream_channel 142 | url: "https://pub.flutter-io.cn" 143 | source: hosted 144 | version: "2.0.0" 145 | string_scanner: 146 | dependency: transitive 147 | description: 148 | name: string_scanner 149 | url: "https://pub.flutter-io.cn" 150 | source: hosted 151 | version: "1.0.5" 152 | term_glyph: 153 | dependency: transitive 154 | description: 155 | name: term_glyph 156 | url: "https://pub.flutter-io.cn" 157 | source: hosted 158 | version: "1.1.0" 159 | test_api: 160 | dependency: transitive 161 | description: 162 | name: test_api 163 | url: "https://pub.flutter-io.cn" 164 | source: hosted 165 | version: "0.2.5" 166 | transformer_page_view: 167 | dependency: transitive 168 | description: 169 | name: transformer_page_view 170 | url: "https://pub.flutter-io.cn" 171 | source: hosted 172 | version: "0.1.6" 173 | typed_data: 174 | dependency: transitive 175 | description: 176 | name: typed_data 177 | url: "https://pub.flutter-io.cn" 178 | source: hosted 179 | version: "1.1.6" 180 | vector_math: 181 | dependency: transitive 182 | description: 183 | name: vector_math 184 | url: "https://pub.flutter-io.cn" 185 | source: hosted 186 | version: "2.0.8" 187 | sdks: 188 | dart: ">2.4.0 <3.0.0" 189 | flutter: ">=0.1.4 <3.0.0" 190 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_android_fun 2 | description: A new Flutter application. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 1.0.0+1 15 | 16 | environment: 17 | sdk: ">=2.1.0 <3.0.0" 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | fish_redux: ^0.3.1 23 | dio: ^3.0.0 24 | # The following adds the Cupertino Icons font to your application. 25 | # Use with the CupertinoIcons class for iOS style icons. 26 | cupertino_icons: ^0.1.2 27 | flutter_swiper: ^1.1.6 28 | dev_dependencies: 29 | flutter_test: 30 | sdk: flutter 31 | 32 | 33 | # For information on the generic Dart part of this file, see the 34 | # following page: https://dart.dev/tools/pub/pubspec 35 | 36 | # The following section is specific to Flutter. 37 | flutter: 38 | 39 | # The following line ensures that the Material Icons font is 40 | # included with your application, so that you can use the icons in 41 | # the material Icons class. 42 | uses-material-design: true 43 | 44 | assets: 45 | - images/icon_index.png 46 | - images/icon_second.png 47 | # To add assets to your application, add an assets section, like this: 48 | # assets: 49 | # - images/a_dot_burr.jpeg 50 | # - images/a_dot_ham.jpeg 51 | 52 | # An image asset can refer to one or more resolution-specific "variants", see 53 | # https://flutter.dev/assets-and-images/#resolution-aware. 54 | 55 | # For details regarding adding assets from package dependencies, see 56 | # https://flutter.dev/assets-and-images/#from-packages 57 | 58 | # To add custom fonts to your application, add a fonts section here, 59 | # in this "flutter" section. Each entry in this list should have a 60 | # "family" key with the font family name, and a "fonts" key with a 61 | # list giving the asset and other descriptors for the font. For 62 | # example: 63 | # fonts: 64 | # - family: Schyler 65 | # fonts: 66 | # - asset: fonts/Schyler-Regular.ttf 67 | # - asset: fonts/Schyler-Italic.ttf 68 | # style: italic 69 | # - family: Trajan Pro 70 | # fonts: 71 | # - asset: fonts/TrajanPro.ttf 72 | # - asset: fonts/TrajanPro_Bold.ttf 73 | # weight: 700 74 | # 75 | # For details regarding fonts from package dependencies, 76 | # see https://flutter.dev/custom-fonts/#from-packages 77 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility 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_android_fun/app.dart'; 10 | import 'package:flutter_test/flutter_test.dart'; 11 | 12 | import 'package:flutter_android_fun/main.dart'; 13 | 14 | void main() { 15 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 16 | // Build our app and trigger a frame. 17 | await tester.pumpWidget(createApp()); 18 | 19 | // Verify that our counter starts at 0. 20 | expect(find.text('0'), findsOneWidget); 21 | expect(find.text('1'), findsNothing); 22 | 23 | // Tap the '+' icon and trigger a frame. 24 | await tester.tap(find.byIcon(Icons.add)); 25 | await tester.pump(); 26 | 27 | // Verify that our counter has incremented. 28 | expect(find.text('0'), findsNothing); 29 | expect(find.text('1'), findsOneWidget); 30 | }); 31 | } 32 | -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | flutter_android_fun 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------------------------------------