├── .gitignore ├── .metadata ├── LICENSE ├── README.md ├── android ├── app │ ├── build.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── karelgt │ │ │ └── dwarfdoc │ │ │ └── MainActivity.java │ │ └── 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 ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── capture ├── img_favorite.png ├── img_hot.png ├── img_node.png └── img_topic.png ├── ios ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ └── contents.xcworkspacedata └── Runner │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── 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 │ └── main.m ├── lib ├── application.dart ├── bean │ ├── member_wrap.dart │ ├── node_wrap.dart │ ├── reply_wrap.dart │ └── topic_wrap.dart ├── database │ ├── db_event.dart │ ├── db_helper.dart │ └── favorite_dao.dart ├── http │ ├── http_module.dart │ ├── ip_config.dart │ ├── member_api.dart │ ├── member_resp.dart │ ├── node_api.dart │ ├── node_resp.dart │ ├── reply_resp.dart │ ├── topic_api.dart │ └── topic_resp.dart ├── main.dart ├── manager │ └── route_manager.dart ├── page │ ├── favorite_contract.dart │ ├── favorite_page.dart │ ├── favorite_presenter.dart │ ├── home_page.dart │ ├── member_contract.dart │ ├── member_page.dart │ ├── member_presenter.dart │ ├── node_contract.dart │ ├── node_page.dart │ ├── node_presenter.dart │ ├── popular_contract.dart │ ├── popular_page.dart │ ├── popular_presenter.dart │ ├── topic_contract.dart │ ├── topic_list_contract.dart │ ├── topic_list_page.dart │ ├── topic_list_presenter.dart │ ├── topic_page.dart │ └── topic_presenter.dart └── util │ ├── logger.dart │ └── string_utils.dart ├── pubspec.yaml └── test └── widget_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # Visual Studio Code related 20 | .vscode/ 21 | 22 | # Flutter/Dart/Pub related 23 | **/doc/api/ 24 | .dart_tool/ 25 | .flutter-plugins 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | # Android related 32 | **/android/**/gradle-wrapper.jar 33 | **/android/.gradle 34 | **/android/captures/ 35 | **/android/gradlew 36 | **/android/gradlew.bat 37 | **/android/local.properties 38 | **/android/**/GeneratedPluginRegistrant.java 39 | 40 | # iOS/XCode related 41 | **/ios/**/*.mode1v3 42 | **/ios/**/*.mode2v3 43 | **/ios/**/*.moved-aside 44 | **/ios/**/*.pbxuser 45 | **/ios/**/*.perspectivev3 46 | **/ios/**/*sync/ 47 | **/ios/**/.sconsign.dblite 48 | **/ios/**/.tags* 49 | **/ios/**/.vagrant/ 50 | **/ios/**/DerivedData/ 51 | **/ios/**/Icon? 52 | **/ios/**/Pods/ 53 | **/ios/**/.symlinks/ 54 | **/ios/**/profile 55 | **/ios/**/xcuserdata 56 | **/ios/.generated/ 57 | **/ios/Flutter/App.framework 58 | **/ios/Flutter/Flutter.framework 59 | **/ios/Flutter/Generated.xcconfig 60 | **/ios/Flutter/app.flx 61 | **/ios/Flutter/app.zip 62 | **/ios/Flutter/flutter_assets/ 63 | **/ios/ServiceDefinitions.json 64 | **/ios/Runner/GeneratedPluginRegistrant.* 65 | 66 | # Exceptions to above rules. 67 | !**/ios/**/default.mode1v3 68 | !**/ios/**/default.mode2v3 69 | !**/ios/**/default.pbxuser 70 | !**/ios/**/default.perspectivev3 71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 72 | -------------------------------------------------------------------------------- /.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: 5391447fae6209bb21a89e6a5a6583cac1af9b4b 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dwarf_doc 2 | 3 | 用Flutter写的简单V2EX客户端,实现了基本的帖子浏览的功能,新增本地的收藏功能。 4 | 5 | 整体为简单的MVP结构。 6 | 7 | **1.0.1** 8 | 9 | 添加首页的下拉刷新逻辑。 10 | 11 | 12 | 13 | 用到的开源库: 14 | 15 | * dio Http请求 16 | * fluro 路由 17 | * flutter_html 简单HTML页面的渲染 18 | * rxdart Rx 19 | * intl 格式化日期 20 | * url_launcher 打开URL 21 | * sqflite SQLite数据库 22 | * event_bus 事件收发 23 | 24 | 25 | 26 | ## Capture 27 | ![Hot](capture/img_hot.png) 28 | 29 | ![Nodes](capture/img_node.png) 30 | 31 | 32 | 33 | ![Favorite](capture/img_favorite.png) 34 | 35 | ![Topic](capture/img_topic.png) 36 | 37 | 38 | 39 | ## API 40 | 41 | API接口来自[这里](https://github.com/djyde/V2EX-API) 42 | 43 | 列表相关的分页参数好像都是无效的,要是有知道的同学告诉我一下哈 44 | 45 | 46 | 47 | 48 | ## Getting Started 49 | 50 | This project is a starting point for a Flutter application. 51 | 52 | A few resources to get you started if this is your first Flutter project: 53 | 54 | - [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab) 55 | - [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook) 56 | 57 | For help getting started with Flutter, view our 58 | [online documentation](https://flutter.io/docs), which offers tutorials, 59 | samples, guidance on mobile development, and a full API reference. 60 | -------------------------------------------------------------------------------- /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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 27 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.karelgt.dwarfdoc" 37 | minSdkVersion 16 38 | targetSdkVersion 27 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | testImplementation 'junit:junit:4.12' 59 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 61 | } 62 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 15 | 19 | 26 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/karelgt/dwarfdoc/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.karelgt.dwarfdoc; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.2.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /capture/img_favorite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/capture/img_favorite.png -------------------------------------------------------------------------------- /capture/img_hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/capture/img_hot.png -------------------------------------------------------------------------------- /capture/img_node.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/capture/img_node.png -------------------------------------------------------------------------------- /capture/img_topic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/capture/img_topic.png -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def parse_KV_file(file, separator='=') 14 | file_abs_path = File.expand_path(file) 15 | if !File.exists? file_abs_path 16 | return []; 17 | end 18 | pods_ary = [] 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) { |line| 21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 22 | plugin = line.split(pattern=separator) 23 | if plugin.length == 2 24 | podname = plugin[0].strip() 25 | path = plugin[1].strip() 26 | podpath = File.expand_path("#{path}", file_abs_path) 27 | pods_ary.push({:name => podname, :path => podpath}); 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | } 32 | return pods_ary 33 | end 34 | 35 | target 'Runner' do 36 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 37 | # referring to absolute paths on developers' machines. 38 | system('rm -rf .symlinks') 39 | system('mkdir -p .symlinks/plugins') 40 | 41 | # Flutter Pods 42 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') 43 | if generated_xcode_build_settings.empty? 44 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." 45 | end 46 | generated_xcode_build_settings.map { |p| 47 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR' 48 | symlink = File.join('.symlinks', 'flutter') 49 | File.symlink(File.dirname(p[:path]), symlink) 50 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) 51 | end 52 | } 53 | 54 | # Plugin Pods 55 | plugin_pods = parse_KV_file('../.flutter-plugins') 56 | plugin_pods.map { |p| 57 | symlink = File.join('.symlinks', 'plugins', p[:name]) 58 | File.symlink(p[:path], symlink) 59 | pod p[:name], :path => File.join(symlink, 'ios') 60 | } 61 | end 62 | 63 | post_install do |installer| 64 | installer.pods_project.targets.each do |target| 65 | target.build_configurations.each do |config| 66 | config.build_settings['ENABLE_BITCODE'] = 'NO' 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /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 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 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 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 19 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 20 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 21 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 22 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXCopyFilesBuildPhase section */ 26 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 27 | isa = PBXCopyFilesBuildPhase; 28 | buildActionMask = 2147483647; 29 | dstPath = ""; 30 | dstSubfolderSpec = 10; 31 | files = ( 32 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 33 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 34 | ); 35 | name = "Embed Frameworks"; 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXCopyFilesBuildPhase section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 42 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 43 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; 44 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 45 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 46 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 47 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 48 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 49 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 50 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 51 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 52 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 54 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 55 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 56 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 57 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 66 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | /* End PBXFrameworksBuildPhase section */ 71 | 72 | /* Begin PBXGroup section */ 73 | 9740EEB11CF90186004384FC /* Flutter */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, 77 | 3B80C3931E831B6300D905FE /* App.framework */, 78 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 79 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 80 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 81 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 82 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 83 | ); 84 | name = Flutter; 85 | sourceTree = ""; 86 | }; 87 | 97C146E51CF9000F007C117D = { 88 | isa = PBXGroup; 89 | children = ( 90 | 9740EEB11CF90186004384FC /* Flutter */, 91 | 97C146F01CF9000F007C117D /* Runner */, 92 | 97C146EF1CF9000F007C117D /* Products */, 93 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, 94 | ); 95 | sourceTree = ""; 96 | }; 97 | 97C146EF1CF9000F007C117D /* Products */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 97C146EE1CF9000F007C117D /* Runner.app */, 101 | ); 102 | name = Products; 103 | sourceTree = ""; 104 | }; 105 | 97C146F01CF9000F007C117D /* Runner */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 109 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 110 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 111 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 112 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 113 | 97C147021CF9000F007C117D /* Info.plist */, 114 | 97C146F11CF9000F007C117D /* Supporting Files */, 115 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 116 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 117 | ); 118 | path = Runner; 119 | sourceTree = ""; 120 | }; 121 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 97C146F21CF9000F007C117D /* main.m */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | /* End PBXGroup section */ 130 | 131 | /* Begin PBXNativeTarget section */ 132 | 97C146ED1CF9000F007C117D /* Runner */ = { 133 | isa = PBXNativeTarget; 134 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 135 | buildPhases = ( 136 | 9740EEB61CF901F6004384FC /* Run Script */, 137 | 97C146EA1CF9000F007C117D /* Sources */, 138 | 97C146EB1CF9000F007C117D /* Frameworks */, 139 | 97C146EC1CF9000F007C117D /* Resources */, 140 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 141 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 142 | ); 143 | buildRules = ( 144 | ); 145 | dependencies = ( 146 | ); 147 | name = Runner; 148 | productName = Runner; 149 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 150 | productType = "com.apple.product-type.application"; 151 | }; 152 | /* End PBXNativeTarget section */ 153 | 154 | /* Begin PBXProject section */ 155 | 97C146E61CF9000F007C117D /* Project object */ = { 156 | isa = PBXProject; 157 | attributes = { 158 | LastUpgradeCheck = 0910; 159 | ORGANIZATIONNAME = "The Chromium Authors"; 160 | TargetAttributes = { 161 | 97C146ED1CF9000F007C117D = { 162 | CreatedOnToolsVersion = 7.3.1; 163 | }; 164 | }; 165 | }; 166 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 167 | compatibilityVersion = "Xcode 3.2"; 168 | developmentRegion = English; 169 | hasScannedForEncodings = 0; 170 | knownRegions = ( 171 | en, 172 | Base, 173 | ); 174 | mainGroup = 97C146E51CF9000F007C117D; 175 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 176 | projectDirPath = ""; 177 | projectRoot = ""; 178 | targets = ( 179 | 97C146ED1CF9000F007C117D /* Runner */, 180 | ); 181 | }; 182 | /* End PBXProject section */ 183 | 184 | /* Begin PBXResourcesBuildPhase section */ 185 | 97C146EC1CF9000F007C117D /* Resources */ = { 186 | isa = PBXResourcesBuildPhase; 187 | buildActionMask = 2147483647; 188 | files = ( 189 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 190 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 191 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 192 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 193 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, 194 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | }; 198 | /* End PBXResourcesBuildPhase section */ 199 | 200 | /* Begin PBXShellScriptBuildPhase section */ 201 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 202 | isa = PBXShellScriptBuildPhase; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | ); 206 | inputPaths = ( 207 | ); 208 | name = "Thin Binary"; 209 | outputPaths = ( 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | shellPath = /bin/sh; 213 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 214 | }; 215 | 9740EEB61CF901F6004384FC /* Run Script */ = { 216 | isa = PBXShellScriptBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | ); 220 | inputPaths = ( 221 | ); 222 | name = "Run Script"; 223 | outputPaths = ( 224 | ); 225 | runOnlyForDeploymentPostprocessing = 0; 226 | shellPath = /bin/sh; 227 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 228 | }; 229 | /* End PBXShellScriptBuildPhase section */ 230 | 231 | /* Begin PBXSourcesBuildPhase section */ 232 | 97C146EA1CF9000F007C117D /* Sources */ = { 233 | isa = PBXSourcesBuildPhase; 234 | buildActionMask = 2147483647; 235 | files = ( 236 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 237 | 97C146F31CF9000F007C117D /* main.m in Sources */, 238 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | /* End PBXSourcesBuildPhase section */ 243 | 244 | /* Begin PBXVariantGroup section */ 245 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 246 | isa = PBXVariantGroup; 247 | children = ( 248 | 97C146FB1CF9000F007C117D /* Base */, 249 | ); 250 | name = Main.storyboard; 251 | sourceTree = ""; 252 | }; 253 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 254 | isa = PBXVariantGroup; 255 | children = ( 256 | 97C147001CF9000F007C117D /* Base */, 257 | ); 258 | name = LaunchScreen.storyboard; 259 | sourceTree = ""; 260 | }; 261 | /* End PBXVariantGroup section */ 262 | 263 | /* Begin XCBuildConfiguration section */ 264 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 265 | isa = XCBuildConfiguration; 266 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 267 | buildSettings = { 268 | ALWAYS_SEARCH_USER_PATHS = NO; 269 | CLANG_ANALYZER_NONNULL = YES; 270 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 271 | CLANG_CXX_LIBRARY = "libc++"; 272 | CLANG_ENABLE_MODULES = YES; 273 | CLANG_ENABLE_OBJC_ARC = YES; 274 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 275 | CLANG_WARN_BOOL_CONVERSION = YES; 276 | CLANG_WARN_COMMA = YES; 277 | CLANG_WARN_CONSTANT_CONVERSION = YES; 278 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 279 | CLANG_WARN_EMPTY_BODY = YES; 280 | CLANG_WARN_ENUM_CONVERSION = YES; 281 | CLANG_WARN_INFINITE_RECURSION = YES; 282 | CLANG_WARN_INT_CONVERSION = YES; 283 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 284 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 285 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 286 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 287 | CLANG_WARN_STRICT_PROTOTYPES = YES; 288 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 289 | CLANG_WARN_UNREACHABLE_CODE = YES; 290 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 291 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 292 | COPY_PHASE_STRIP = NO; 293 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 294 | ENABLE_NS_ASSERTIONS = NO; 295 | ENABLE_STRICT_OBJC_MSGSEND = YES; 296 | GCC_C_LANGUAGE_STANDARD = gnu99; 297 | GCC_NO_COMMON_BLOCKS = YES; 298 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 299 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 300 | GCC_WARN_UNDECLARED_SELECTOR = YES; 301 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 302 | GCC_WARN_UNUSED_FUNCTION = YES; 303 | GCC_WARN_UNUSED_VARIABLE = YES; 304 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 305 | MTL_ENABLE_DEBUG_INFO = NO; 306 | SDKROOT = iphoneos; 307 | TARGETED_DEVICE_FAMILY = "1,2"; 308 | VALIDATE_PRODUCT = YES; 309 | }; 310 | name = Profile; 311 | }; 312 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 313 | isa = XCBuildConfiguration; 314 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 315 | buildSettings = { 316 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 317 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 318 | DEVELOPMENT_TEAM = S8QB4VV633; 319 | ENABLE_BITCODE = NO; 320 | FRAMEWORK_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "$(PROJECT_DIR)/Flutter", 323 | ); 324 | INFOPLIST_FILE = Runner/Info.plist; 325 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 326 | LIBRARY_SEARCH_PATHS = ( 327 | "$(inherited)", 328 | "$(PROJECT_DIR)/Flutter", 329 | ); 330 | PRODUCT_BUNDLE_IDENTIFIER = com.karelgt.dwarfDoc; 331 | PRODUCT_NAME = "$(TARGET_NAME)"; 332 | VERSIONING_SYSTEM = "apple-generic"; 333 | }; 334 | name = Profile; 335 | }; 336 | 97C147031CF9000F007C117D /* Debug */ = { 337 | isa = XCBuildConfiguration; 338 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 339 | buildSettings = { 340 | ALWAYS_SEARCH_USER_PATHS = NO; 341 | CLANG_ANALYZER_NONNULL = YES; 342 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 343 | CLANG_CXX_LIBRARY = "libc++"; 344 | CLANG_ENABLE_MODULES = YES; 345 | CLANG_ENABLE_OBJC_ARC = YES; 346 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 347 | CLANG_WARN_BOOL_CONVERSION = YES; 348 | CLANG_WARN_COMMA = YES; 349 | CLANG_WARN_CONSTANT_CONVERSION = YES; 350 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 351 | CLANG_WARN_EMPTY_BODY = YES; 352 | CLANG_WARN_ENUM_CONVERSION = YES; 353 | CLANG_WARN_INFINITE_RECURSION = YES; 354 | CLANG_WARN_INT_CONVERSION = YES; 355 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 356 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 357 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 358 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 359 | CLANG_WARN_STRICT_PROTOTYPES = YES; 360 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 361 | CLANG_WARN_UNREACHABLE_CODE = YES; 362 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 363 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 364 | COPY_PHASE_STRIP = NO; 365 | DEBUG_INFORMATION_FORMAT = dwarf; 366 | ENABLE_STRICT_OBJC_MSGSEND = YES; 367 | ENABLE_TESTABILITY = YES; 368 | GCC_C_LANGUAGE_STANDARD = gnu99; 369 | GCC_DYNAMIC_NO_PIC = NO; 370 | GCC_NO_COMMON_BLOCKS = YES; 371 | GCC_OPTIMIZATION_LEVEL = 0; 372 | GCC_PREPROCESSOR_DEFINITIONS = ( 373 | "DEBUG=1", 374 | "$(inherited)", 375 | ); 376 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 377 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 378 | GCC_WARN_UNDECLARED_SELECTOR = YES; 379 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 380 | GCC_WARN_UNUSED_FUNCTION = YES; 381 | GCC_WARN_UNUSED_VARIABLE = YES; 382 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 383 | MTL_ENABLE_DEBUG_INFO = YES; 384 | ONLY_ACTIVE_ARCH = YES; 385 | SDKROOT = iphoneos; 386 | TARGETED_DEVICE_FAMILY = "1,2"; 387 | }; 388 | name = Debug; 389 | }; 390 | 97C147041CF9000F007C117D /* Release */ = { 391 | isa = XCBuildConfiguration; 392 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 393 | buildSettings = { 394 | ALWAYS_SEARCH_USER_PATHS = NO; 395 | CLANG_ANALYZER_NONNULL = YES; 396 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 397 | CLANG_CXX_LIBRARY = "libc++"; 398 | CLANG_ENABLE_MODULES = YES; 399 | CLANG_ENABLE_OBJC_ARC = YES; 400 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 401 | CLANG_WARN_BOOL_CONVERSION = YES; 402 | CLANG_WARN_COMMA = YES; 403 | CLANG_WARN_CONSTANT_CONVERSION = YES; 404 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 405 | CLANG_WARN_EMPTY_BODY = YES; 406 | CLANG_WARN_ENUM_CONVERSION = YES; 407 | CLANG_WARN_INFINITE_RECURSION = YES; 408 | CLANG_WARN_INT_CONVERSION = YES; 409 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = 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 | TARGETED_DEVICE_FAMILY = "1,2"; 434 | VALIDATE_PRODUCT = YES; 435 | }; 436 | name = Release; 437 | }; 438 | 97C147061CF9000F007C117D /* Debug */ = { 439 | isa = XCBuildConfiguration; 440 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 441 | buildSettings = { 442 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 443 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 444 | ENABLE_BITCODE = NO; 445 | FRAMEWORK_SEARCH_PATHS = ( 446 | "$(inherited)", 447 | "$(PROJECT_DIR)/Flutter", 448 | ); 449 | INFOPLIST_FILE = Runner/Info.plist; 450 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 451 | LIBRARY_SEARCH_PATHS = ( 452 | "$(inherited)", 453 | "$(PROJECT_DIR)/Flutter", 454 | ); 455 | PRODUCT_BUNDLE_IDENTIFIER = com.karelgt.dwarfDoc; 456 | PRODUCT_NAME = "$(TARGET_NAME)"; 457 | VERSIONING_SYSTEM = "apple-generic"; 458 | }; 459 | name = Debug; 460 | }; 461 | 97C147071CF9000F007C117D /* Release */ = { 462 | isa = XCBuildConfiguration; 463 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 464 | buildSettings = { 465 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 466 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 467 | ENABLE_BITCODE = NO; 468 | FRAMEWORK_SEARCH_PATHS = ( 469 | "$(inherited)", 470 | "$(PROJECT_DIR)/Flutter", 471 | ); 472 | INFOPLIST_FILE = Runner/Info.plist; 473 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 474 | LIBRARY_SEARCH_PATHS = ( 475 | "$(inherited)", 476 | "$(PROJECT_DIR)/Flutter", 477 | ); 478 | PRODUCT_BUNDLE_IDENTIFIER = com.karelgt.dwarfDoc; 479 | PRODUCT_NAME = "$(TARGET_NAME)"; 480 | VERSIONING_SYSTEM = "apple-generic"; 481 | }; 482 | name = Release; 483 | }; 484 | /* End XCBuildConfiguration section */ 485 | 486 | /* Begin XCConfigurationList section */ 487 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 488 | isa = XCConfigurationList; 489 | buildConfigurations = ( 490 | 97C147031CF9000F007C117D /* Debug */, 491 | 97C147041CF9000F007C117D /* Release */, 492 | 249021D3217E4FDB00AE95B9 /* Profile */, 493 | ); 494 | defaultConfigurationIsVisible = 0; 495 | defaultConfigurationName = Release; 496 | }; 497 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 498 | isa = XCConfigurationList; 499 | buildConfigurations = ( 500 | 97C147061CF9000F007C117D /* Debug */, 501 | 97C147071CF9000F007C117D /* Release */, 502 | 249021D4217E4FDB00AE95B9 /* Profile */, 503 | ); 504 | defaultConfigurationIsVisible = 0; 505 | defaultConfigurationName = Release; 506 | }; 507 | /* End XCConfigurationList section */ 508 | }; 509 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 510 | } 511 | -------------------------------------------------------------------------------- /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 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/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/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KarelGT/DwarfDoc/6c0dc57bc0ba9c29ee7e41ed086e1a4f55a71a34/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 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | dwarf_doc 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/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/application.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:dwarf_doc/database/db_helper.dart'; 3 | import 'package:dwarf_doc/http/http_module.dart'; 4 | import 'package:dwarf_doc/http/ip_config.dart'; 5 | import 'package:dwarf_doc/manager/route_manager.dart'; 6 | import 'package:event_bus/event_bus.dart'; 7 | import 'package:fluro/fluro.dart'; 8 | import 'package:meta/meta.dart'; 9 | import 'package:sqflite/sqflite.dart'; 10 | 11 | class Application { 12 | static Application _instance; 13 | bool isDebug; 14 | HttpModule httpModule; 15 | Router router; 16 | EventBus eventBus; 17 | DBHelper _dbHelper; 18 | 19 | static Application getInstance() { 20 | if (_instance == null) { 21 | _instance = Application(); 22 | } 23 | return _instance; 24 | } 25 | 26 | @protected 27 | Application(); 28 | 29 | Future init() async { 30 | _initHttpModule(); 31 | _initRouter(); 32 | _initEventBus(); 33 | _initDatabase(); 34 | } 35 | 36 | void _initHttpModule() { 37 | var options = BaseOptions( 38 | baseUrl: IPConfig.getInstance().getApiIp(), 39 | connectTimeout: 5000, 40 | receiveTimeout: 3000, 41 | ); 42 | httpModule = HttpModule(Dio(options)); 43 | } 44 | 45 | void _initRouter() { 46 | router = RouteManager.getInstance().router; 47 | } 48 | 49 | void _initEventBus() { 50 | eventBus = EventBus(); 51 | } 52 | 53 | void _initDatabase() async { 54 | _dbHelper = DBHelper(); 55 | await _dbHelper.init(); 56 | } 57 | 58 | Future getDatabase() async { 59 | return _dbHelper.getDatabase(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/bean/member_wrap.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/http/member_resp.dart'; 2 | import 'package:dwarf_doc/util/string_utils.dart'; 3 | import 'package:intl/intl.dart'; 4 | 5 | class MemberWrap { 6 | int id; 7 | String avatar; 8 | String name; 9 | String createTime; 10 | String website; 11 | String twitter; 12 | String psn; 13 | String github; 14 | String bio; 15 | 16 | MemberResp resp; 17 | 18 | MemberWrap(this.resp) { 19 | if (resp.avatarNormal != null) { 20 | avatar = 'http:' + resp.avatarNormal; 21 | } 22 | name = StringUtils.safeString(resp.username); 23 | id = resp.id; 24 | createTime = DateFormat('yyyy-MM-dd HH:mm:ss') 25 | .format(DateTime.fromMillisecondsSinceEpoch(resp.created * 1000)); 26 | website = StringUtils.safeString(resp.website); 27 | psn = StringUtils.safeString(resp.psn); 28 | twitter = StringUtils.safeString(resp.twitter); 29 | github = StringUtils.safeString(resp.github); 30 | bio = StringUtils.safeString(resp.bio); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/bean/node_wrap.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/http/node_resp.dart'; 2 | import 'package:dwarf_doc/util/logger.dart'; 3 | import 'package:dwarf_doc/util/string_utils.dart'; 4 | 5 | class NodeWrap { 6 | static final String TAG = 'NodeWrap'; 7 | String title; 8 | String header; 9 | String footer; 10 | int id; 11 | int topics; 12 | NodeResp resp; 13 | 14 | NodeWrap(NodeResp resp) { 15 | title = StringUtils.safeString(resp.title); 16 | header = StringUtils.safeString(resp.header); 17 | footer = StringUtils.safeString(resp.footer); 18 | Logger.d(TAG, "title: " + title); 19 | Logger.d(TAG, "header: " + header); 20 | Logger.d(TAG, "footer: " + footer); 21 | 22 | id = resp.id; 23 | topics = resp.topics; 24 | this.resp = resp; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/bean/reply_wrap.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/bean/member_wrap.dart'; 2 | import 'package:dwarf_doc/http/reply_resp.dart'; 3 | import 'package:dwarf_doc/util/string_utils.dart'; 4 | import 'package:intl/intl.dart'; 5 | 6 | class ReplyWrap { 7 | String content; 8 | String contentHtml; 9 | String createdTime; 10 | MemberWrap member; 11 | ReplyResp resp; 12 | 13 | ReplyWrap(this.resp) { 14 | content = StringUtils.safeString(resp.content); 15 | contentHtml = StringUtils.safeString(resp.contentRendered); 16 | createdTime = DateFormat('yyyy-MM-dd HH:mm:ss').format(DateTime.fromMillisecondsSinceEpoch(resp.created * 1000)); 17 | if (resp.member != null) { 18 | member = MemberWrap(resp.member); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/bean/topic_wrap.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/bean/member_wrap.dart'; 2 | import 'package:dwarf_doc/http/topic_resp.dart'; 3 | import 'package:dwarf_doc/util/string_utils.dart'; 4 | import 'package:intl/intl.dart'; 5 | 6 | class TopicWrap { 7 | int id; 8 | String title; 9 | MemberWrap member; 10 | String content; 11 | String contentHtml; 12 | String createdTime; 13 | int replies; 14 | TopicResp resp; 15 | 16 | TopicWrap(this.resp) { 17 | id = resp.id; 18 | title = StringUtils.safeString(resp.title); 19 | content = StringUtils.safeString(resp.content); 20 | contentHtml = '${StringUtils.safeString(resp.contentRendered)}'; 21 | createdTime = DateFormat('yyyy-MM-dd HH:mm:ss').format(DateTime.fromMillisecondsSinceEpoch(resp.created * 1000)); 22 | replies = resp.replies; 23 | if (resp.member != null) { 24 | member = MemberWrap(resp.member); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/database/db_event.dart: -------------------------------------------------------------------------------- 1 | class FavoriteEvent { 2 | FavoriteEvent(); 3 | } 4 | -------------------------------------------------------------------------------- /lib/database/db_helper.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:dwarf_doc/database/favorite_dao.dart'; 3 | import 'package:path/path.dart'; 4 | import 'package:sqflite/sqflite.dart'; 5 | 6 | class DBHelper { 7 | static const String _dbFileName = 'v2ex.db'; 8 | static const int _dbVersion = 1; 9 | String _databasesPath; 10 | Database database; 11 | 12 | Future init() async => _initDatabase(); 13 | 14 | Future _initDatabase() async { 15 | var databasesPath = await getDatabasesPath(); 16 | _databasesPath = join(databasesPath, _dbFileName); 17 | } 18 | 19 | Future getDatabase() async { 20 | if (database == null || !database.isOpen) { 21 | database = await openDatabase(_databasesPath, version: _dbVersion, 22 | onCreate: (database, version) async { 23 | await database.execute(FavoriteDao.CREATE_SQL); 24 | }); 25 | } 26 | return database; 27 | } 28 | 29 | Future closeDatabase() async { 30 | if (database != null && database.isOpen) { 31 | database.close(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/database/favorite_dao.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:dwarf_doc/application.dart'; 4 | import 'package:dwarf_doc/database/db_event.dart'; 5 | import 'package:dwarf_doc/http/topic_resp.dart'; 6 | import 'package:event_bus/event_bus.dart'; 7 | import 'package:sqflite/sqflite.dart'; 8 | 9 | class FavoriteDao { 10 | static const String _TABLE_NAME = "Favorite"; 11 | static const String _ID = 'id'; 12 | static const String _TOPIC_ID = 'topicId'; 13 | static const String _TOPIC_RESP = 'topicResp'; 14 | 15 | static const String CREATE_SQL = 16 | 'CREATE TABLE IF NOT EXISTS $_TABLE_NAME ($_ID INTEGER PRIMARY KEY, $_TOPIC_ID INTEGER, $_TOPIC_RESP TEXT)'; 17 | 18 | //添加或者更新Topic 19 | Future saveOrUpdateTopicResp(TopicResp topicResp) async { 20 | int id = 0; 21 | var database = await Application.getInstance().getDatabase(); 22 | var ret = await _queryTopicResps(database, topicId: topicResp.id); 23 | if (ret == null || ret.isEmpty) { 24 | id = await database.rawInsert( 25 | 'INSERT INTO $_TABLE_NAME($_TOPIC_ID, $_TOPIC_RESP) VALUES (?, ?)', 26 | [topicResp.id, jsonEncode(topicResp)]); 27 | } else { 28 | id = ret.first.id; 29 | await database.rawUpdate( 30 | 'UPDATE $_TABLE_NAME SET $_TOPIC_RESP = ? WHERE $_TOPIC_ID = ?', 31 | [jsonEncode(topicResp), topicResp.id]); 32 | } 33 | await database.close(); 34 | Application.getInstance().eventBus.fire(FavoriteEvent()); 35 | return id; 36 | } 37 | 38 | Future deleteTopicResp(int topicId) async { 39 | int id = 0; 40 | var database = await Application.getInstance().getDatabase(); 41 | id = await database 42 | .delete(_TABLE_NAME, where: '$_TOPIC_ID = ?', whereArgs: [topicId]); 43 | await database.close(); 44 | Application.getInstance().eventBus.fire(FavoriteEvent()); 45 | return id; 46 | } 47 | 48 | //通过数据库id查询Topic 49 | Future> queryTopicRespsById(int id) async { 50 | var database = await Application.getInstance().getDatabase(); 51 | var ret = await _queryTopicResps(database, id: id); 52 | await database.close(); 53 | return ret; 54 | } 55 | 56 | //通过topicId查询Topic 57 | Future> queryTopicRespsByTopicId(int topicId) async { 58 | var database = await Application.getInstance().getDatabase(); 59 | var ret = await _queryTopicResps(database, topicId: topicId); 60 | await database.close(); 61 | return ret; 62 | } 63 | 64 | //查询所有Topic 65 | Future> queryTopicResps() async { 66 | var database = await Application.getInstance().getDatabase(); 67 | var ret = await _queryTopicResps(database); 68 | await database.close(); 69 | return ret; 70 | } 71 | 72 | Future> _queryTopicResps(Database database, 73 | {int id, int topicId}) async { 74 | List ret = List(); 75 | String where; 76 | List whereArgs; 77 | if (id != null) { 78 | where = '$_ID = ?'; 79 | whereArgs = [id]; 80 | } else if (topicId != null) { 81 | where = '$_TOPIC_ID = ?'; 82 | whereArgs = [topicId]; 83 | } 84 | var list = await database.query(_TABLE_NAME, 85 | columns: [_ID, _TOPIC_ID, _TOPIC_RESP], 86 | where: where, 87 | whereArgs: whereArgs); 88 | ret = list 89 | .map((value) => TopicResp.fromJson(jsonDecode(value[_TOPIC_RESP]))) 90 | .toList(); 91 | return ret; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /lib/http/http_module.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:dwarf_doc/util/logger.dart'; 3 | import 'package:meta/meta.dart'; 4 | 5 | class HttpModule { 6 | static String TAG = 'HttpModule'; 7 | Dio _dio; 8 | 9 | HttpModule(Dio dio) { 10 | _dio = dio; 11 | _dio.interceptors.add(InterceptorsWrapper( 12 | onRequest: (RequestOptions options) { 13 | Logger.d(HttpModule.TAG, 'request:\t${options.path}\nmethod:\t${options.method}\nqueryParams:\t${options.queryParameters.toString()}\ndata:\t${options.data.toString()}'); 14 | return options; 15 | }, 16 | onResponse: (Response response) { 17 | Logger.d(HttpModule.TAG, 'response:\t${response.request.path}\nmethod:\t${response.request.method}\ndata:\t${response.data.toString()}'); 18 | return response; 19 | }, 20 | )); 21 | } 22 | 23 | Future get(String path, {Map params}) async { 24 | var response = await _dio.get(path, queryParameters: params); 25 | return response.data; 26 | } 27 | 28 | Future post(String path, {Map params}) async { 29 | var response = await _dio.post(path, data: params); 30 | return response.data; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/http/ip_config.dart: -------------------------------------------------------------------------------- 1 | import 'package:meta/meta.dart'; 2 | 3 | class IPConfig { 4 | static IPConfig _instance; 5 | String _api; 6 | 7 | static IPConfig getInstance() { 8 | if(_instance == null) { 9 | _instance = IPConfig(); 10 | } 11 | return _instance; 12 | } 13 | 14 | @protected 15 | IPConfig() { 16 | _api = 'https://www.v2ex.com'; 17 | } 18 | 19 | String getApiIp() { 20 | return _api; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/http/member_api.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/http/http_module.dart'; 2 | import 'package:dwarf_doc/http/member_resp.dart'; 3 | 4 | class MemberApi { 5 | HttpModule _httpModule; 6 | 7 | MemberApi(this._httpModule); 8 | 9 | Future queryUserByName(String username) async { 10 | Map respone = await _httpModule.get('/api/members/show.json', 11 | params: {'username': username}); 12 | MemberResp resp = MemberResp.fromJson(respone); 13 | return resp; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lib/http/member_resp.dart: -------------------------------------------------------------------------------- 1 | class MemberResp { 2 | int id; 3 | String username; 4 | String website; 5 | String github; 6 | String psn; 7 | String avatarNormal; 8 | String avatarLarge; 9 | String avatarMini; 10 | String bio; 11 | String url; 12 | String tagline; 13 | String twitter; 14 | int created; 15 | String location; 16 | String btc; 17 | 18 | MemberResp( 19 | {this.id, 20 | this.username, 21 | this.website, 22 | this.github, 23 | this.psn, 24 | this.avatarNormal, 25 | this.avatarLarge, 26 | this.avatarMini, 27 | this.bio, 28 | this.url, 29 | this.tagline, 30 | this.twitter, 31 | this.created, 32 | this.location, 33 | this.btc}); 34 | 35 | factory MemberResp.fromJson(Map json) { 36 | return MemberResp( 37 | id: json['id'], 38 | username: json['username'], 39 | website: json['website'], 40 | github: json['github'], 41 | psn: json['psn'], 42 | bio: json['bio'], 43 | url: json['url'], 44 | tagline: json['tagline'], 45 | twitter: json['twitter'], 46 | created: json['created'], 47 | avatarMini: json['avatar_mini'], 48 | avatarNormal: json['avatar_normal'], 49 | avatarLarge: json['avatar_large'], 50 | location: json['location'], 51 | btc: json['btc']); 52 | } 53 | 54 | Map toJson() => { 55 | 'id': id, 56 | 'username': username, 57 | 'website': website, 58 | 'github': github, 59 | 'psn': psn, 60 | 'bio': bio, 61 | 'url': url, 62 | 'tagline': tagline, 63 | 'twitter': twitter, 64 | 'created': created, 65 | 'avatar_mini': avatarMini, 66 | 'avatar_normal': avatarNormal, 67 | 'avatar_large': avatarLarge, 68 | 'location': location, 69 | 'btc': btc, 70 | }; 71 | } 72 | -------------------------------------------------------------------------------- /lib/http/node_api.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/http/http_module.dart'; 2 | import 'package:dwarf_doc/http/node_resp.dart'; 3 | 4 | class NodeApi { 5 | static final String TAG = 'NodeApi'; 6 | HttpModule httpModule; 7 | 8 | NodeApi(this.httpModule); 9 | 10 | Future> queryAllNodes() async { 11 | List response = await httpModule.get("/api/nodes/all.json"); 12 | List resps = response.map((value) => NodeResp.fromJson(value)).toList(); 13 | return resps; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lib/http/node_resp.dart: -------------------------------------------------------------------------------- 1 | class NodeResp { 2 | int id; 3 | String name; 4 | String url; 5 | String title; 6 | String titleAlternative; 7 | int topics; 8 | String footer; 9 | String header; 10 | String avatarLarge; 11 | String avatarNormal; 12 | String avatarMini; 13 | int stars; 14 | bool root; 15 | String parentNodeName; 16 | 17 | NodeResp( 18 | {this.id, 19 | this.name, 20 | this.url, 21 | this.title, 22 | this.titleAlternative, 23 | this.topics, 24 | this.footer, 25 | this.header, 26 | this.avatarLarge, 27 | this.avatarNormal, 28 | this.avatarMini, 29 | this.stars, 30 | this.root, 31 | this.parentNodeName}); 32 | 33 | factory NodeResp.fromJson(Map json) { 34 | return new NodeResp( 35 | id: json['id'], 36 | name: json['name'], 37 | url: json['url'], 38 | title: json['title'], 39 | titleAlternative: json['title_alternative'], 40 | avatarLarge: json['avatar_large'], 41 | avatarMini: json['avatar_mini'], 42 | avatarNormal: json['avatar_normal'], 43 | topics: json['topics'], 44 | footer: json['footer'], 45 | header: json['header'], 46 | stars: json['stars'], 47 | root: json['root'], 48 | parentNodeName: json['parent_node_name']); 49 | } 50 | 51 | Map toJson() => { 52 | 'id': id, 53 | 'name': name, 54 | 'url': url, 55 | 'title': title, 56 | 'title_alternative': titleAlternative, 57 | 'avatar_large': avatarLarge, 58 | 'avatar_normal': avatarNormal, 59 | 'avatar_mini': avatarMini, 60 | 'topics': topics, 61 | 'footer': footer, 62 | 'header': header, 63 | 'stars': stars, 64 | 'root': root, 65 | 'parent_node_name': parentNodeName, 66 | }; 67 | } 68 | -------------------------------------------------------------------------------- /lib/http/reply_resp.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/http/member_resp.dart'; 2 | 3 | class ReplyResp { 4 | int id; 5 | int thanks; 6 | String content; 7 | String contentRendered; 8 | int created; 9 | int lastModified; 10 | MemberResp member; 11 | 12 | ReplyResp( 13 | {this.id, 14 | this.thanks, 15 | this.content, 16 | this.contentRendered, 17 | this.created, 18 | this.lastModified, 19 | this.member}); 20 | 21 | factory ReplyResp.fromJson(Map json) { 22 | return ReplyResp( 23 | id: json['id'], 24 | thanks: json['thanks'], 25 | content: json['content'], 26 | contentRendered: json['content_rendered'], 27 | created: json['created'], 28 | lastModified: json['last_modified'], 29 | member: MemberResp.fromJson(json['member']), 30 | ); 31 | } 32 | 33 | Map toJson() => { 34 | 'id': id, 35 | 'thanks': thanks, 36 | 'content': content, 37 | 'content_rendered': contentRendered, 38 | 'created': created, 39 | 'last_modified': lastModified, 40 | 'member': member.toJson() 41 | }; 42 | } 43 | -------------------------------------------------------------------------------- /lib/http/topic_api.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/http/http_module.dart'; 2 | import 'package:dwarf_doc/http/reply_resp.dart'; 3 | import 'package:dwarf_doc/http/topic_resp.dart'; 4 | 5 | class TopicApi { 6 | static final String TAG = 'TopicApi'; 7 | HttpModule _httpModule; 8 | 9 | TopicApi(this._httpModule); 10 | 11 | Future> queryHotTopics() async { 12 | List response = await _httpModule.get('/api/topics/hot.json'); 13 | List resps = 14 | response.map((value) => TopicResp.fromJson(value)).toList(); 15 | return resps; 16 | } 17 | 18 | Future> queryLatestTopics() async { 19 | List response = await _httpModule.get('/api/topics/latest.json'); 20 | List resps = 21 | response.map((value) => TopicResp.fromJson(value)).toList(); 22 | return resps; 23 | } 24 | 25 | Future> queryTopicsByNodeId(int nodeId) async { 26 | List response = await _httpModule.get('/api/topics/show.json', 27 | params: {'node_id': '$nodeId'}); 28 | List resps = 29 | response.map((value) => TopicResp.fromJson(value)).toList(); 30 | return resps; 31 | } 32 | 33 | Future queryTopicById(int topicId) async { 34 | List response = await _httpModule.get('/api/topics/show.json', 35 | params: {'id': '$topicId'}); 36 | List resps = 37 | response.map((value) => TopicResp.fromJson(value)).toList(); 38 | return resps.isEmpty ? null : resps.first; 39 | } 40 | 41 | Future> queryRepliesByTopicId(int topicId) async { 42 | List response = await _httpModule.get('/api/replies/show.json', 43 | params: {'topic_id': '$topicId'}); 44 | List resps = 45 | response.map((value) => ReplyResp.fromJson(value)).toList(); 46 | return resps; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/http/topic_resp.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/http/member_resp.dart'; 2 | import 'package:dwarf_doc/http/node_resp.dart'; 3 | 4 | class TopicResp { 5 | NodeResp node; 6 | MemberResp member; 7 | String lastReplyBy; 8 | int lastTouched; 9 | String title; 10 | String url; 11 | String content; 12 | String contentRendered; 13 | int created; 14 | int lastModified; 15 | int replies; 16 | int id; 17 | 18 | TopicResp( 19 | {this.node, 20 | this.member, 21 | this.lastReplyBy, 22 | this.lastTouched, 23 | this.title, 24 | this.url, 25 | this.content, 26 | this.contentRendered, 27 | this.created, 28 | this.lastModified, 29 | this.replies, 30 | this.id}); 31 | 32 | factory TopicResp.fromJson(Map json) { 33 | return TopicResp( 34 | node: NodeResp.fromJson(json['node']), 35 | member: MemberResp.fromJson(json['member']), 36 | lastModified: json['last_modified'], 37 | lastReplyBy: json['last_reply_by'], 38 | lastTouched: json['last_touched'], 39 | title: json['title'], 40 | url: json['url'], 41 | content: json['content'], 42 | contentRendered: json['content_rendered'], 43 | created: json['created'], 44 | replies: json['replies'], 45 | id: json['id'], 46 | ); 47 | } 48 | 49 | Map toJson() => { 50 | 'node': node.toJson(), 51 | 'member': member.toJson(), 52 | 'last_modified': lastModified, 53 | 'last_reply_by': lastReplyBy, 54 | 'last_touched': lastTouched, 55 | 'title': title, 56 | 'url': url, 57 | 'content': content, 58 | 'content_rendered': contentRendered, 59 | 'created': created, 60 | 'replies': replies, 61 | 'id': id, 62 | }; 63 | } 64 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/application.dart'; 2 | import 'package:dwarf_doc/page/home_page.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/rendering.dart'; 5 | 6 | void main() async { 7 | await Application.getInstance().init(); 8 | Application.getInstance().isDebug = true; 9 | debugPaintSizeEnabled = false; 10 | runApp(MyApp()); 11 | } 12 | 13 | class MyApp extends StatelessWidget { 14 | // This widget is the root of your application. 15 | @override 16 | Widget build(BuildContext context) { 17 | return MaterialApp( 18 | title: 'Dwarf Doc', 19 | theme: ThemeData( 20 | // This is the theme of your application. 21 | // 22 | // Try running your application with "flutter run". You'll see the 23 | // application has a blue toolbar. Then, without quitting the app, try 24 | // changing the primarySwatch below to Colors.green and then invoke 25 | // "hot reload" (press "r" in the console where you ran "flutter run", 26 | // or simply save your changes to "hot reload" in a Flutter IDE). 27 | // Notice that the counter didn't reset back to zero; the application 28 | // is not restarted. 29 | primarySwatch: Colors.grey, 30 | primaryColor: Colors.grey[400], 31 | highlightColor: Colors.black, 32 | scaffoldBackgroundColor: Colors.white, 33 | bottomAppBarColor: Colors.white, 34 | ), 35 | home: HomePage(), 36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/manager/route_manager.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:dwarf_doc/bean/node_wrap.dart'; 4 | import 'package:dwarf_doc/bean/topic_wrap.dart'; 5 | import 'package:dwarf_doc/http/node_resp.dart'; 6 | import 'package:dwarf_doc/http/topic_resp.dart'; 7 | import 'package:dwarf_doc/page/member_page.dart'; 8 | import 'package:dwarf_doc/page/topic_list_page.dart'; 9 | import 'package:dwarf_doc/page/topic_page.dart'; 10 | import 'package:dwarf_doc/util/logger.dart'; 11 | import 'package:fluro/fluro.dart'; 12 | import 'package:flutter/widgets.dart'; 13 | import 'package:meta/meta.dart'; 14 | 15 | class RouteManager { 16 | static const String _TAG = "RouteManager"; 17 | static RouteManager _instance; 18 | Router router; 19 | 20 | static RouteManager getInstance() { 21 | if (_instance == null) { 22 | _instance = RouteManager(); 23 | } 24 | return _instance; 25 | } 26 | 27 | @protected 28 | RouteManager() { 29 | router = Router(); 30 | configureRoutes(router); 31 | } 32 | 33 | void configureRoutes(Router router) { 34 | router.notFoundHandler = new Handler( 35 | handlerFunc: (BuildContext context, Map> params) { 36 | Logger.d(_TAG, params.toString()); 37 | }); 38 | router.define(RouteHub.topicListPath, 39 | handler: RouteHandler.topicListHandler); 40 | router.define(RouteHub.topicPath, handler: RouteHandler.topicHandler); 41 | router.define(RouteHub.memberPath, handler: RouteHandler.memberHandler); 42 | } 43 | } 44 | 45 | class RouteHandler { 46 | static Handler topicListHandler = Handler( 47 | handlerFunc: (BuildContext context, Map> params) { 48 | var nodeWrap; 49 | var nodeJson = params[RouteHub.nodeParam]?.first; 50 | if (nodeJson != null && nodeJson.isNotEmpty) { 51 | nodeWrap = NodeWrap(NodeResp.fromJson(json.decode(nodeJson))); 52 | } 53 | return TopicListPage(nodeWrap); 54 | }); 55 | 56 | static Handler topicHandler = Handler( 57 | handlerFunc: (BuildContext context, Map> params) { 58 | var topicJson = params[RouteHub.topicParam]?.first; 59 | var topicId = params[RouteHub.topicIdParam]?.first; 60 | if (topicJson != null && topicJson.isNotEmpty) { 61 | var topicWrap = TopicWrap(TopicResp.fromJson(json.decode(topicJson))); 62 | return TopicPage(topicWrap.id, topicWrap); 63 | } else if(topicId != null && topicId.isNotEmpty){ 64 | return TopicPage(int.parse(topicId), null); 65 | } else { 66 | return TopicPage(-1, null); 67 | } 68 | }); 69 | 70 | static Handler memberHandler = Handler( 71 | handlerFunc: (BuildContext context, Map> params) { 72 | var username = params[RouteHub.usernameParam]?.first; 73 | return MemberPage(username); 74 | }); 75 | } 76 | 77 | class RouteHub { 78 | static String topicListPath = '/topicList'; 79 | static String nodeParam = 'node'; 80 | 81 | static String topicPath = '/topic'; 82 | static String topicParam = 'topic'; 83 | static String topicIdParam = 'id'; 84 | 85 | static String memberPath = '/member'; 86 | static String usernameParam = 'username'; 87 | } 88 | -------------------------------------------------------------------------------- /lib/page/favorite_contract.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/bean/topic_wrap.dart'; 2 | import 'package:flutter/src/widgets/framework.dart'; 3 | 4 | class View { 5 | displayTopics(List topics){} 6 | } 7 | 8 | class Presenter { 9 | void start() {} 10 | 11 | void openMember(BuildContext context, String username) {} 12 | 13 | void openTopic(BuildContext context, int topicId){} 14 | 15 | void detach() {} 16 | } 17 | -------------------------------------------------------------------------------- /lib/page/favorite_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/bean/topic_wrap.dart'; 2 | import 'package:dwarf_doc/page/favorite_contract.dart' as FavoriteContract; 3 | import 'package:dwarf_doc/page/favorite_presenter.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/widgets.dart'; 6 | 7 | class FavoritePage extends StatefulWidget { 8 | @override 9 | State createState() { 10 | return FavoriteState(); 11 | } 12 | } 13 | 14 | class FavoriteState extends State 15 | with AutomaticKeepAliveClientMixin 16 | implements FavoriteContract.View { 17 | List _topics; 18 | FavoriteContract.Presenter _presenter; 19 | 20 | FavoriteState() { 21 | _topics = List(); 22 | _presenter = FavoritePresenter(this); 23 | } 24 | 25 | @override 26 | void initState() { 27 | super.initState(); 28 | _presenter.start(); 29 | } 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | return Container( 34 | child: GridView.builder( 35 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( 36 | crossAxisCount: 2, 37 | ), 38 | itemBuilder: (context, index) => _createTopicItemView(_topics[index]), 39 | itemCount: _topics.length, 40 | ), 41 | ); 42 | } 43 | 44 | Widget _createTopicItemView(TopicWrap topicWrap) { 45 | return GestureDetector( 46 | onTap: () => _presenter.openTopic(context, topicWrap.id), 47 | child: Card( 48 | color: Colors.white, 49 | elevation: 2, 50 | child: Padding( 51 | padding: EdgeInsets.all(10), 52 | child: Column( 53 | crossAxisAlignment: CrossAxisAlignment.center, 54 | mainAxisAlignment: MainAxisAlignment.center, 55 | children: [ 56 | Expanded( 57 | child: Text( 58 | topicWrap.title, 59 | style: TextStyle( 60 | fontSize: 18, color: Theme.of(context).highlightColor), 61 | ), 62 | ), 63 | Row( 64 | children: [ 65 | Image.network( 66 | topicWrap.member.avatar, 67 | fit: BoxFit.contain, 68 | width: 32, 69 | height: 32, 70 | ), 71 | Padding( 72 | padding: EdgeInsets.only(left: 10), 73 | child: Column( 74 | crossAxisAlignment: CrossAxisAlignment.start, 75 | children: [ 76 | GestureDetector( 77 | onTap: () => _presenter.openMember( 78 | context, topicWrap.member.name), 79 | child: Text( 80 | topicWrap.member.name, 81 | style: TextStyle( 82 | color: Theme.of(context).primaryColor, 83 | fontSize: 12, 84 | fontWeight: FontWeight.bold), 85 | ), 86 | ), 87 | Text( 88 | topicWrap.createdTime, 89 | style: TextStyle( 90 | color: Theme.of(context).primaryColor, 91 | fontSize: 12), 92 | ), 93 | ], 94 | ), 95 | ), 96 | ], 97 | ), 98 | ], 99 | ), 100 | ), 101 | ), 102 | ); 103 | } 104 | 105 | @override 106 | displayTopics(List topics) { 107 | setState(() { 108 | _topics.clear(); 109 | if (topics != null) { 110 | _topics.addAll(topics); 111 | } 112 | }); 113 | } 114 | 115 | @override 116 | void dispose() { 117 | _presenter.detach(); 118 | super.dispose(); 119 | } 120 | 121 | @override 122 | bool get wantKeepAlive => true; 123 | } 124 | -------------------------------------------------------------------------------- /lib/page/favorite_presenter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:dwarf_doc/application.dart'; 4 | import 'package:dwarf_doc/bean/topic_wrap.dart'; 5 | import 'package:dwarf_doc/database/db_event.dart'; 6 | import 'package:dwarf_doc/database/favorite_dao.dart'; 7 | import 'package:dwarf_doc/manager/route_manager.dart'; 8 | import 'package:dwarf_doc/page/favorite_contract.dart' as FavoriteContract; 9 | import 'package:event_bus/event_bus.dart'; 10 | import 'package:fluro/fluro.dart'; 11 | import 'package:flutter/widgets.dart'; 12 | 13 | class FavoritePresenter implements FavoriteContract.Presenter { 14 | FavoriteContract.View _view; 15 | FavoriteDao _favoriteDao; 16 | EventBus _eventBus; 17 | StreamSubscription _subQuery; 18 | 19 | FavoritePresenter(this._view) { 20 | _favoriteDao = FavoriteDao(); 21 | } 22 | 23 | @override 24 | void start() { 25 | _updateFavorite(); 26 | _subQuery = Application.getInstance().eventBus.on().listen((event) { 27 | _updateFavorite(); 28 | }); 29 | } 30 | 31 | void _updateFavorite() { 32 | _favoriteDao.queryTopicResps().then((value) { 33 | var topics = value.map((resp) => TopicWrap(resp)).toList(); 34 | _view.displayTopics(topics); 35 | }); 36 | } 37 | 38 | @override 39 | void openMember(BuildContext context, String username) { 40 | Application.getInstance().router.navigateTo( 41 | context, '${RouteHub.memberPath}?${RouteHub.usernameParam}=$username', 42 | transition: TransitionType.inFromRight); 43 | } 44 | 45 | @override 46 | void openTopic(BuildContext context, int topicId) { 47 | Application.getInstance().router.navigateTo( 48 | context, '${RouteHub.topicPath}?${RouteHub.topicIdParam}=$topicId', 49 | transition: TransitionType.inFromRight); 50 | } 51 | 52 | @override 53 | void detach() { 54 | if (_subQuery != null) { 55 | _subQuery.cancel(); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/page/home_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/page/favorite_page.dart'; 2 | import 'package:dwarf_doc/page/node_page.dart'; 3 | import 'package:dwarf_doc/page/popular_page.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/widgets.dart'; 6 | 7 | class HomePage extends StatefulWidget { 8 | @override 9 | State createState() { 10 | return _HomeState(); 11 | } 12 | } 13 | 14 | class _HomeState extends State { 15 | List _pages; 16 | List _tabs; 17 | 18 | _HomeState() { 19 | _pages = List(); 20 | _tabs = List(); 21 | _createPages(_pages, _tabs); 22 | } 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return new DefaultTabController( 27 | length: _pages.length, 28 | child: Scaffold( 29 | appBar: new AppBar( 30 | backgroundColor: Colors.white, 31 | title: Text("V2EX"), 32 | ), 33 | body: TabBarView(children: _pages), 34 | bottomNavigationBar: Material( 35 | child: SafeArea( 36 | child: Container( 37 | height: 65, 38 | decoration: BoxDecoration( 39 | color: Colors.white, 40 | boxShadow: [ 41 | BoxShadow( 42 | color: Colors.black26, 43 | blurRadius: 3, 44 | spreadRadius: 2, 45 | offset: Offset(-1, -1)) 46 | ], 47 | ), 48 | child: TabBar( 49 | indicatorColor: Theme.of(context).highlightColor, 50 | indicatorWeight: 3, 51 | labelColor: Theme.of(context).highlightColor, 52 | unselectedLabelColor: Theme.of(context).primaryColor, 53 | tabs: _tabs, 54 | ), 55 | ), 56 | ), 57 | ), 58 | ), 59 | ); 60 | } 61 | 62 | void _createPages(List pages, List tabs) { 63 | pages.add(PopularPage()); 64 | tabs.add(Tab( 65 | text: "热门", 66 | icon: Icon(Icons.whatshot), 67 | )); 68 | pages.add(NodePage()); 69 | tabs.add(Tab( 70 | text: "节点", 71 | icon: Icon(Icons.widgets), 72 | )); 73 | pages.add(FavoritePage()); 74 | tabs.add(Tab( 75 | text: "收藏", 76 | icon: Icon(Icons.favorite), 77 | )); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/page/member_contract.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/bean/member_wrap.dart'; 2 | 3 | class View { 4 | void displayUser(MemberWrap memberWrap) {} 5 | } 6 | 7 | class Presenter { 8 | void start() {} 9 | 10 | void detach(){} 11 | } 12 | -------------------------------------------------------------------------------- /lib/page/member_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/bean/member_wrap.dart'; 2 | import 'package:dwarf_doc/page/member_contract.dart' as MemberContract; 3 | import 'package:dwarf_doc/page/member_presenter.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/widgets.dart'; 6 | 7 | class MemberPage extends StatefulWidget { 8 | final String _username; 9 | 10 | MemberPage(this._username); 11 | 12 | @override 13 | State createState() { 14 | return MemberState(_username); 15 | } 16 | } 17 | 18 | class MemberState extends State implements MemberContract.View { 19 | String _username; 20 | MemberWrap _member; 21 | MemberContract.Presenter _presenter; 22 | 23 | MemberState(this._username) { 24 | _presenter = MemberPresenter(this, _username); 25 | } 26 | 27 | @override 28 | void initState() { 29 | super.initState(); 30 | _presenter.start(); 31 | } 32 | 33 | @override 34 | Widget build(BuildContext context) { 35 | return Scaffold( 36 | appBar: AppBar( 37 | backgroundColor: Colors.white, 38 | title: Text(_username), 39 | ), 40 | body: Container( 41 | padding: EdgeInsets.all(10), 42 | child: _createUserContent(_member), 43 | ), 44 | ); 45 | } 46 | 47 | Widget _createUserContent(MemberWrap memberWrap) { 48 | if (memberWrap == null) { 49 | return Container(); 50 | } else { 51 | return Column( 52 | children: [ 53 | Card( 54 | child: Padding( 55 | padding: EdgeInsets.all(10), 56 | child: Column( 57 | crossAxisAlignment: CrossAxisAlignment.start, 58 | children: [ 59 | Row( 60 | crossAxisAlignment: CrossAxisAlignment.center, 61 | children: [ 62 | Image.network( 63 | memberWrap.avatar, 64 | width: 64, 65 | height: 64, 66 | fit: BoxFit.contain, 67 | ), 68 | Flexible( 69 | child: Container( 70 | margin: EdgeInsets.only(left: 10, right: 10), 71 | child: Column( 72 | crossAxisAlignment: CrossAxisAlignment.start, 73 | children: [ 74 | Text( 75 | memberWrap.name, 76 | style: TextStyle( 77 | color: Theme.of(context).highlightColor, 78 | fontSize: 22), 79 | ), 80 | Padding(padding: EdgeInsets.only(top: 5)), 81 | Text( 82 | 'V2EX第${memberWrap.id}号会员\n加入于${memberWrap.createTime}', 83 | style: TextStyle( 84 | color: Theme.of(context).primaryColor, 85 | fontSize: 16), 86 | ) 87 | ], 88 | ), 89 | ), 90 | ) 91 | ], 92 | ), 93 | Offstage( 94 | offstage: memberWrap.bio == null || memberWrap.bio.isEmpty, 95 | child: Column( 96 | crossAxisAlignment: CrossAxisAlignment.start, 97 | children: [ 98 | Padding( 99 | padding: EdgeInsets.only(top: 10), 100 | ), 101 | Text( 102 | memberWrap.bio, 103 | style: TextStyle( 104 | color: Theme.of(context).primaryColor, 105 | fontSize: 18), 106 | ) 107 | ], 108 | ), 109 | ) 110 | ], 111 | ), 112 | ), 113 | ), 114 | Padding( 115 | padding: EdgeInsets.only(top: 10), 116 | ), 117 | _createUserItem('Website', memberWrap.website), 118 | _createUserItem('Github', memberWrap.github), 119 | _createUserItem('Twitter', memberWrap.twitter), 120 | _createUserItem('PSN', memberWrap.psn), 121 | ], 122 | ); 123 | } 124 | } 125 | 126 | Widget _createUserItem(String title, String content) { 127 | return Offstage( 128 | offstage: content == null || content.isEmpty, 129 | child: Padding( 130 | padding: EdgeInsets.only(bottom: 10), 131 | child: Card( 132 | child: Padding( 133 | padding: EdgeInsets.all(10), 134 | child: Row( 135 | children: [ 136 | Expanded( 137 | flex: 1, 138 | child: Text( 139 | title, 140 | style: TextStyle( 141 | color: Theme.of(context).highlightColor, fontSize: 18), 142 | ), 143 | ), 144 | Expanded( 145 | flex: 2, 146 | child: Text(content, 147 | style: TextStyle( 148 | color: Theme.of(context).primaryColor, fontSize: 18)), 149 | ) 150 | ], 151 | ), 152 | ), 153 | ), 154 | ), 155 | ); 156 | } 157 | 158 | @override 159 | void displayUser(MemberWrap memberWrap) { 160 | setState(() { 161 | _member = memberWrap; 162 | }); 163 | } 164 | 165 | @override 166 | void dispose() { 167 | super.dispose(); 168 | _presenter.detach(); 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /lib/page/member_presenter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:dwarf_doc/application.dart'; 4 | import 'package:dwarf_doc/bean/member_wrap.dart'; 5 | import 'package:dwarf_doc/http/member_api.dart'; 6 | import 'package:dwarf_doc/page/member_contract.dart' as MemberContract; 7 | 8 | class MemberPresenter implements MemberContract.Presenter { 9 | MemberContract.View _view; 10 | String _username; 11 | MemberApi _memberApi; 12 | StreamSubscription _memberSubscription; 13 | 14 | MemberPresenter(this._view, this._username) { 15 | _memberApi = MemberApi(Application.getInstance().httpModule); 16 | } 17 | 18 | @override 19 | void start() { 20 | _memberSubscription = _fetchMember(_username) 21 | .asStream() 22 | .listen((memberWrap) => _view.displayUser(memberWrap)); 23 | } 24 | 25 | Future _fetchMember(String username) async { 26 | return _memberApi 27 | .queryUserByName(_username) 28 | .then((value) => MemberWrap(value)); 29 | } 30 | 31 | @override 32 | void detach() { 33 | if (_memberSubscription != null) { 34 | _memberSubscription.cancel(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/page/node_contract.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/bean/node_wrap.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | 4 | class View { 5 | void displayNodes(List nodeWraps) {} 6 | } 7 | 8 | class Presenter { 9 | void start() {} 10 | 11 | Future fetchNodes() async {} 12 | 13 | void openTopicList(BuildContext context, NodeWrap nodeWrap) {} 14 | } 15 | -------------------------------------------------------------------------------- /lib/page/node_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/bean/node_wrap.dart'; 2 | import 'package:dwarf_doc/page/node_contract.dart' as NodeContract; 3 | import 'package:dwarf_doc/page/node_presenter.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/widgets.dart'; 6 | 7 | class NodePage extends StatefulWidget { 8 | @override 9 | State createState() { 10 | return _NodeState(); 11 | } 12 | } 13 | 14 | class _NodeState extends State 15 | with AutomaticKeepAliveClientMixin 16 | implements NodeContract.View { 17 | NodeContract.Presenter _presenter; 18 | List _nodeWraps; 19 | 20 | _NodeState() { 21 | _presenter = new NodePresenter(this); 22 | _nodeWraps = new List(); 23 | } 24 | 25 | @override 26 | void initState() { 27 | super.initState(); 28 | _presenter.start(); 29 | } 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | return Container( 34 | color: Colors.white, 35 | child: RefreshIndicator( 36 | child: GridView.builder( 37 | gridDelegate: 38 | SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), 39 | itemBuilder: (context, index) { 40 | return _createNodeItemView(_nodeWraps[index]); 41 | }, 42 | itemCount: _nodeWraps.length, 43 | ), 44 | onRefresh: ()=>_presenter.fetchNodes()), 45 | ); 46 | } 47 | 48 | Widget _createNodeItemView(NodeWrap nodeWrap) { 49 | return GestureDetector( 50 | onTap: () => _presenter.openTopicList(context, nodeWrap), 51 | child: Container( 52 | decoration: BoxDecoration( 53 | border: 54 | Border.all(color: Theme.of(context).primaryColor, width: 0.5)), 55 | child: Center( 56 | child: Column( 57 | mainAxisAlignment: MainAxisAlignment.center, 58 | children: [ 59 | Text( 60 | nodeWrap.title, 61 | maxLines: 2, 62 | textAlign: TextAlign.center, 63 | style: TextStyle( 64 | color: Theme.of(context).highlightColor, 65 | fontSize: 18, 66 | ), 67 | ), 68 | Container( 69 | margin: EdgeInsets.only(top: 10), 70 | decoration: BoxDecoration( 71 | color: Theme.of(context).primaryColor, 72 | borderRadius: BorderRadius.circular(10)), 73 | padding: EdgeInsets.fromLTRB(8, 0, 8, 0), 74 | child: Text( 75 | nodeWrap.topics.toString(), 76 | style: TextStyle( 77 | color: Colors.white, 78 | fontSize: 16, 79 | fontWeight: FontWeight.bold), 80 | ), 81 | ), 82 | ], 83 | ), 84 | ), 85 | ), 86 | ); 87 | } 88 | 89 | @override 90 | bool get wantKeepAlive => true; 91 | 92 | @override 93 | void displayNodes(List nodeWraps) { 94 | setState(() { 95 | _nodeWraps.clear(); 96 | if (nodeWraps != null) { 97 | _nodeWraps.addAll(nodeWraps); 98 | } 99 | }); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /lib/page/node_presenter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:async/async.dart'; 4 | import 'package:dwarf_doc/application.dart'; 5 | import 'package:dwarf_doc/bean/node_wrap.dart'; 6 | import 'package:dwarf_doc/http/node_api.dart'; 7 | import 'package:dwarf_doc/manager/route_manager.dart'; 8 | import 'package:dwarf_doc/page/node_contract.dart' as NodeContract; 9 | import 'package:fluro/fluro.dart'; 10 | import 'package:flutter/widgets.dart'; 11 | 12 | class NodePresenter implements NodeContract.Presenter { 13 | static const String _TAG = "NodePresenter"; 14 | NodeApi _nodeApi; 15 | NodeContract.View _view; 16 | CancelableOperation> _cancelableOperation; 17 | 18 | NodePresenter(NodeContract.View view) { 19 | _view = view; 20 | _nodeApi = NodeApi(Application.getInstance().httpModule); 21 | } 22 | 23 | @override 24 | void start() { 25 | _fetchNodes().then((List nodeWraps) { 26 | _view.displayNodes(nodeWraps); 27 | }); 28 | } 29 | 30 | @override 31 | Future fetchNodes() async { 32 | await _fetchNodes().then((List nodeWraps) { 33 | _view.displayNodes(nodeWraps); 34 | }); 35 | } 36 | 37 | Future> _fetchNodes() async { 38 | if (_cancelableOperation != null) { 39 | _cancelableOperation.cancel(); 40 | _cancelableOperation = null; 41 | } 42 | _cancelableOperation = CancelableOperation.fromFuture( 43 | _nodeApi.queryAllNodes().then((nodeResps) { 44 | List nodeWraps = List(); 45 | nodeResps.forEach((item) { 46 | nodeWraps.add(NodeWrap(item)); 47 | }); 48 | nodeWraps.sort((a, b) => b.topics - a.topics); 49 | return nodeWraps; 50 | })); 51 | return _cancelableOperation.value; 52 | } 53 | 54 | @override 55 | void openTopicList(BuildContext context, NodeWrap nodeWrap) { 56 | String nodeParam = jsonEncode(nodeWrap.resp); 57 | nodeParam = Uri.encodeComponent(nodeParam); 58 | Application.getInstance().router.navigateTo( 59 | context, '${RouteHub.topicListPath}?${RouteHub.nodeParam}=$nodeParam', 60 | transition: TransitionType.inFromRight); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lib/page/popular_contract.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/bean/topic_wrap.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | 4 | class View { 5 | void displayPopular(List topicWraps) {} 6 | } 7 | 8 | class Presenter { 9 | void start() {} 10 | 11 | Future fetchTopics() async {} 12 | 13 | void openTopic(BuildContext context, TopicWrap topicWrap) {} 14 | 15 | void dispose() {} 16 | } 17 | -------------------------------------------------------------------------------- /lib/page/popular_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/bean/topic_wrap.dart'; 2 | import 'package:dwarf_doc/page/popular_contract.dart' as PopularContract; 3 | import 'package:dwarf_doc/page/popular_presenter.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/widgets.dart'; 6 | 7 | class PopularPage extends StatefulWidget { 8 | @override 9 | State createState() { 10 | return _PopularState(); 11 | } 12 | } 13 | 14 | class _PopularState extends State 15 | with AutomaticKeepAliveClientMixin 16 | implements PopularContract.View { 17 | List _topics; 18 | PopularContract.Presenter _presenter; 19 | 20 | _PopularState() { 21 | _topics = List(); 22 | _presenter = PopularPresenter(this); 23 | } 24 | 25 | @override 26 | void initState() { 27 | super.initState(); 28 | _presenter.start(); 29 | } 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | return Container( 34 | color: Colors.white, 35 | child: RefreshIndicator( 36 | child: ListView.separated( 37 | itemBuilder: (BuildContext context, int index) { 38 | return _createTopicItem(_topics[index]); 39 | }, 40 | separatorBuilder: (BuildContext context, int index) { 41 | return Divider(color: Theme.of(context).primaryColor); 42 | }, 43 | itemCount: _topics.length), 44 | onRefresh: () async { 45 | await _presenter.fetchTopics(); 46 | }), 47 | ); 48 | } 49 | 50 | Widget _createTopicItem(TopicWrap topicWrap) { 51 | return ListTile( 52 | leading: Image.network( 53 | topicWrap.member.avatar, 54 | height: 48, 55 | width: 48, 56 | fit: BoxFit.contain, 57 | ), 58 | title: Text( 59 | topicWrap.title, 60 | maxLines: 1, 61 | overflow: TextOverflow.ellipsis, 62 | style: TextStyle(fontSize: 18, color: Theme.of(context).highlightColor), 63 | ), 64 | subtitle: Row( 65 | children: [ 66 | Text( 67 | topicWrap.member.name, 68 | style: TextStyle( 69 | fontSize: 12, 70 | color: Theme.of(context).primaryColor, 71 | fontWeight: FontWeight.bold), 72 | ), 73 | Text( 74 | ' ${topicWrap.createdTime}', 75 | style: TextStyle( 76 | fontSize: 12, 77 | color: Theme.of(context).primaryColor, 78 | ), 79 | ), 80 | ], 81 | ), 82 | trailing: Container( 83 | decoration: BoxDecoration( 84 | color: Theme.of(context).primaryColor, 85 | borderRadius: BorderRadius.circular(10)), 86 | padding: EdgeInsets.fromLTRB(8, 0, 8, 0), 87 | child: Text( 88 | topicWrap.replies.toString(), 89 | style: TextStyle( 90 | color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold), 91 | ), 92 | ), 93 | onTap: () => _presenter.openTopic(context, topicWrap), 94 | ); 95 | } 96 | 97 | @override 98 | bool get wantKeepAlive => true; 99 | 100 | @override 101 | void displayPopular(List topicWraps) { 102 | setState(() { 103 | _topics.clear(); 104 | if (topicWraps != null) { 105 | _topics.addAll(topicWraps); 106 | } 107 | }); 108 | } 109 | 110 | @override 111 | void dispose() { 112 | _presenter.dispose(); 113 | super.dispose(); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /lib/page/popular_presenter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | 4 | import 'package:async/async.dart'; 5 | import 'package:dwarf_doc/application.dart'; 6 | import 'package:dwarf_doc/bean/topic_wrap.dart'; 7 | import 'package:dwarf_doc/http/topic_api.dart'; 8 | import 'package:dwarf_doc/http/topic_resp.dart'; 9 | import 'package:dwarf_doc/manager/route_manager.dart'; 10 | import 'package:dwarf_doc/page/popular_contract.dart' as PopularContract; 11 | import 'package:fluro/fluro.dart'; 12 | import 'package:flutter/src/widgets/framework.dart'; 13 | 14 | class PopularPresenter implements PopularContract.Presenter { 15 | PopularContract.View _view; 16 | TopicApi _topicApi; 17 | CancelableOperation> _cancelableOperation; 18 | 19 | PopularPresenter(this._view) { 20 | _topicApi = TopicApi(Application.getInstance().httpModule); 21 | } 22 | 23 | @override 24 | void start() { 25 | _fetchTopics().then((value) => _view.displayPopular(value)); 26 | } 27 | 28 | @override 29 | void dispose() { 30 | if (_cancelableOperation != null) { 31 | _cancelableOperation.cancel(); 32 | _cancelableOperation = null; 33 | } 34 | } 35 | 36 | @override 37 | void openTopic(BuildContext context, TopicWrap topicWrap) { 38 | String topicParam = jsonEncode(topicWrap.resp); 39 | topicParam = Uri.encodeComponent(topicParam); 40 | Application.getInstance().router.navigateTo( 41 | context, '${RouteHub.topicPath}?${RouteHub.topicParam}=$topicParam', 42 | transition: TransitionType.inFromRight); 43 | } 44 | 45 | @override 46 | Future fetchTopics() async { 47 | await _fetchTopics().then((value) => _view.displayPopular(value)); 48 | } 49 | 50 | Future> _fetchTopics() async { 51 | if (_cancelableOperation != null) { 52 | _cancelableOperation.cancel(); 53 | _cancelableOperation = null; 54 | } 55 | var future = 56 | Future.wait([_topicApi.queryHotTopics(), _topicApi.queryLatestTopics()]) 57 | .then((value) { 58 | var list = List(); 59 | for (int i = 0; i < value.length; i++) { 60 | list.addAll(value[i]); 61 | } 62 | return list; 63 | }).then((value) { 64 | return value.map((resp) => TopicWrap(resp)).toList(); 65 | }); 66 | _cancelableOperation = CancelableOperation.fromFuture(future); 67 | return _cancelableOperation.value; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/page/topic_contract.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/bean/reply_wrap.dart'; 2 | import 'package:dwarf_doc/bean/topic_wrap.dart'; 3 | import 'package:flutter/widgets.dart'; 4 | 5 | class View { 6 | void displayTopic(TopicWrap topic) {} 7 | 8 | void displayReplies(List replies) {} 9 | 10 | displayFavorite(bool isFavorite) {} 11 | } 12 | 13 | class Presenter { 14 | void start() {} 15 | 16 | void openUrl(String url) {} 17 | 18 | void openMember(BuildContext context, String username) {} 19 | 20 | void detach() {} 21 | 22 | void doFavorite(bool isFavorite, TopicWrap topic) {} 23 | } 24 | -------------------------------------------------------------------------------- /lib/page/topic_list_contract.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/bean/topic_wrap.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | 4 | class View { 5 | void displayTopics(List topics) {} 6 | } 7 | 8 | class Presenter { 9 | void start() {} 10 | 11 | void openTopic(BuildContext context, TopicWrap topicWrap) {} 12 | } 13 | -------------------------------------------------------------------------------- /lib/page/topic_list_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/bean/node_wrap.dart'; 2 | import 'package:dwarf_doc/bean/topic_wrap.dart'; 3 | import 'package:dwarf_doc/page/topic_list_contract.dart' as TopicListContract; 4 | import 'package:dwarf_doc/page/topic_list_presenter.dart'; 5 | import 'package:flutter/material.dart'; 6 | 7 | class TopicListPage extends StatefulWidget { 8 | final NodeWrap _nodeWrap; 9 | 10 | TopicListPage(this._nodeWrap); 11 | 12 | @override 13 | State createState() { 14 | return _TopicState(_nodeWrap); 15 | } 16 | } 17 | 18 | class _TopicState extends State 19 | implements TopicListContract.View { 20 | TopicListContract.Presenter _presenter; 21 | List _topics; 22 | NodeWrap _nodeWrap; 23 | 24 | _TopicState(this._nodeWrap) { 25 | _presenter = TopicListPresenter(this, _nodeWrap); 26 | _topics = List(); 27 | } 28 | 29 | @override 30 | void initState() { 31 | super.initState(); 32 | _presenter.start(); 33 | } 34 | 35 | @override 36 | Widget build(BuildContext context) { 37 | return Scaffold( 38 | appBar: AppBar( 39 | backgroundColor: Colors.white, 40 | title: Text(_nodeWrap.title), 41 | ), 42 | body: Container( 43 | color: Colors.white, 44 | child: ListView.separated( 45 | itemBuilder: (BuildContext context, int index) { 46 | return _createTopicItem(_topics[index]); 47 | }, 48 | separatorBuilder: (BuildContext context, int index) { 49 | return Divider(color: Theme.of(context).primaryColor); 50 | }, 51 | itemCount: _topics.length), 52 | ), 53 | ); 54 | } 55 | 56 | Widget _createTopicItem(TopicWrap topicWrap) { 57 | return ListTile( 58 | leading: Image.network( 59 | topicWrap.member.avatar, 60 | height: 48, 61 | width: 48, 62 | fit: BoxFit.contain, 63 | ), 64 | title: Text( 65 | topicWrap.title, 66 | maxLines: 1, 67 | overflow: TextOverflow.ellipsis, 68 | style: TextStyle(fontSize: 18, color: Theme.of(context).highlightColor), 69 | ), 70 | subtitle: Row( 71 | children: [ 72 | Text( 73 | topicWrap.member.name, 74 | style: TextStyle( 75 | fontSize: 12, 76 | color: Theme.of(context).primaryColor, 77 | fontWeight: FontWeight.bold), 78 | ), 79 | Text( 80 | ' ${topicWrap.createdTime}', 81 | style: TextStyle( 82 | fontSize: 12, 83 | color: Theme.of(context).primaryColor, 84 | ), 85 | ), 86 | ], 87 | ), 88 | trailing: Container( 89 | decoration: BoxDecoration( 90 | color: Theme.of(context).primaryColor, 91 | borderRadius: BorderRadius.circular(10)), 92 | padding: EdgeInsets.fromLTRB(8, 0, 8, 0), 93 | child: Text( 94 | topicWrap.replies.toString(), 95 | style: TextStyle( 96 | color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold), 97 | ), 98 | ), 99 | onTap: () => _presenter.openTopic(context, topicWrap), 100 | ); 101 | } 102 | 103 | @override 104 | void displayTopics(List topics) { 105 | setState(() { 106 | _topics.clear(); 107 | if (topics != null) { 108 | _topics.addAll(topics); 109 | } 110 | }); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /lib/page/topic_list_presenter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:dwarf_doc/application.dart'; 4 | import 'package:dwarf_doc/bean/node_wrap.dart'; 5 | import 'package:dwarf_doc/bean/topic_wrap.dart'; 6 | import 'package:dwarf_doc/http/topic_api.dart'; 7 | import 'package:dwarf_doc/http/topic_resp.dart'; 8 | import 'package:dwarf_doc/manager/route_manager.dart'; 9 | import 'package:dwarf_doc/page/topic_list_contract.dart' as TopListContract; 10 | import 'package:fluro/fluro.dart'; 11 | import 'package:flutter/widgets.dart'; 12 | 13 | class TopicListPresenter implements TopListContract.Presenter { 14 | TopListContract.View _view; 15 | TopicApi _topicApi; 16 | NodeWrap _nodeWrap; 17 | 18 | TopicListPresenter(TopListContract.View view, NodeWrap nodeWrap) { 19 | _view = view; 20 | _nodeWrap = nodeWrap; 21 | _topicApi = new TopicApi(Application.getInstance().httpModule); 22 | } 23 | 24 | @override 25 | void start() { 26 | _fetchTopicList().then((topics) { 27 | _view.displayTopics(topics); 28 | }); 29 | } 30 | 31 | Future> _fetchTopicList() async { 32 | List topResps = 33 | await _topicApi.queryTopicsByNodeId(_nodeWrap.id); 34 | List topicWraps = List(); 35 | topResps.forEach((item) { 36 | topicWraps.add(TopicWrap(item)); 37 | }); 38 | return topicWraps; 39 | } 40 | 41 | @override 42 | void openTopic(BuildContext context, TopicWrap topicWrap) { 43 | String topicParam = jsonEncode(topicWrap.resp); 44 | topicParam = Uri.encodeComponent(topicParam); 45 | Application.getInstance().router.navigateTo( 46 | context, '${RouteHub.topicPath}?${RouteHub.topicParam}=$topicParam', 47 | transition: TransitionType.inFromRight); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/page/topic_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/bean/reply_wrap.dart'; 2 | import 'package:dwarf_doc/bean/topic_wrap.dart'; 3 | import 'package:dwarf_doc/page/topic_contract.dart' as TopicContract; 4 | import 'package:dwarf_doc/page/topic_presenter.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter/widgets.dart'; 7 | import 'package:flutter_html/flutter_html.dart'; 8 | 9 | class TopicPage extends StatefulWidget { 10 | final int _topicId; 11 | final TopicWrap _topic; 12 | 13 | TopicPage(this._topicId, this._topic); 14 | 15 | @override 16 | State createState() { 17 | return TopicState(_topicId, _topic); 18 | } 19 | } 20 | 21 | class TopicState extends State implements TopicContract.View { 22 | TopicWrap _topic; 23 | int _topicId; 24 | bool _isFavorite; 25 | List _replies; 26 | TopicContract.Presenter _presenter; 27 | 28 | TopicState(this._topicId, this._topic) { 29 | _replies = new List(); 30 | _isFavorite = false; 31 | _presenter = new TopicPresenter(this, _topicId, _topic); 32 | } 33 | 34 | @override 35 | void initState() { 36 | super.initState(); 37 | _presenter.start(); 38 | } 39 | 40 | @override 41 | Widget build(BuildContext context) { 42 | return Scaffold( 43 | appBar: AppBar( 44 | backgroundColor: Colors.white, 45 | title: Text(_topic?.title ?? ''), 46 | ), 47 | body: Container( 48 | child: _createBody(_topic, _replies), 49 | ), 50 | ); 51 | } 52 | 53 | Widget _createBody(TopicWrap _topicWrap, List _replyWraps) { 54 | return ListView.builder( 55 | itemBuilder: (BuildContext context, index) { 56 | if (index == 0 && _topicWrap != null) { 57 | return _createTopicItem(_topicWrap); 58 | } else { 59 | return _createReplyItem( 60 | _replyWraps[index - (_topicWrap != null ? 1 : 0)]); 61 | } 62 | }, 63 | itemCount: _replyWraps.length + (_topicWrap != null ? 1 : 0), 64 | ); 65 | } 66 | 67 | Widget _createTopicItem(TopicWrap topicWrap) { 68 | return Container( 69 | padding: EdgeInsets.all(10), 70 | child: Column( 71 | crossAxisAlignment: CrossAxisAlignment.start, 72 | children: [ 73 | Container( 74 | child: Row( 75 | children: [ 76 | GestureDetector( 77 | onTap: () => 78 | _presenter.openMember(context, _topic.member.name), 79 | child: Image.network( 80 | topicWrap.member.avatar, 81 | width: 48, 82 | height: 48, 83 | fit: BoxFit.contain, 84 | ), 85 | ), 86 | Flexible( 87 | child: Container( 88 | padding: EdgeInsets.all(10), 89 | child: Column( 90 | crossAxisAlignment: CrossAxisAlignment.start, 91 | children: [ 92 | Text(topicWrap.title, 93 | softWrap: true, 94 | style: TextStyle( 95 | color: Theme.of(context).highlightColor, 96 | fontSize: 18)), 97 | Row( 98 | children: [ 99 | GestureDetector( 100 | onTap: () => _presenter.openMember( 101 | context, _topic.member.name), 102 | child: Text( 103 | topicWrap.member.name, 104 | style: TextStyle( 105 | color: Theme.of(context).primaryColor, 106 | fontSize: 12, 107 | fontWeight: FontWeight.bold), 108 | ), 109 | ), 110 | Text( 111 | ' ${topicWrap.createdTime}', 112 | style: TextStyle( 113 | color: Theme.of(context).primaryColor, 114 | fontSize: 12), 115 | ) 116 | ], 117 | ), 118 | ], 119 | ), 120 | ), 121 | ), 122 | GestureDetector( 123 | onTap: () => _presenter.doFavorite(!_isFavorite, topicWrap), 124 | child: Icon( 125 | _isFavorite ? Icons.favorite : Icons.favorite_border, 126 | color: _isFavorite 127 | ? Colors.pinkAccent[200] 128 | : Theme.of(context).primaryColor, 129 | ), 130 | ), 131 | ], 132 | ), 133 | ), 134 | Divider( 135 | color: Theme.of(context).primaryColor, 136 | height: 1, 137 | ), 138 | Container( 139 | padding: EdgeInsets.only(top: 10, bottom: 10), 140 | child: Html( 141 | defaultTextStyle: TextStyle( 142 | color: Theme.of(context).highlightColor, fontSize: 16), 143 | data: _topic.contentHtml, 144 | onLinkTap: (url) { 145 | _presenter.openUrl(url); 146 | }, 147 | ), 148 | ), 149 | Divider( 150 | color: Theme.of(context).primaryColor, 151 | height: 1, 152 | ), 153 | Container( 154 | child: Row( 155 | mainAxisAlignment: MainAxisAlignment.end, 156 | children: [ 157 | Text('${_topic.replies} 回复', 158 | style: TextStyle( 159 | color: Theme.of(context).primaryColor, fontSize: 12)), 160 | ], 161 | ), 162 | margin: EdgeInsets.only(top: 10), 163 | ) 164 | ], 165 | ), 166 | ); 167 | } 168 | 169 | Widget _createReplyItem(ReplyWrap replyWrap) { 170 | return Container( 171 | padding: EdgeInsets.all(10), 172 | child: Column( 173 | children: [ 174 | Row( 175 | crossAxisAlignment: CrossAxisAlignment.start, 176 | children: [ 177 | GestureDetector( 178 | onTap: () => 179 | _presenter.openMember(context, replyWrap.member.name), 180 | child: Image.network( 181 | replyWrap.member.avatar, 182 | width: 24, 183 | height: 24, 184 | ), 185 | ), 186 | Flexible( 187 | child: Container( 188 | padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), 189 | child: Column( 190 | mainAxisAlignment: MainAxisAlignment.start, 191 | children: [ 192 | Row( 193 | children: [ 194 | GestureDetector( 195 | onTap: () => _presenter.openMember( 196 | context, replyWrap.member.name), 197 | child: Text( 198 | replyWrap.member.name, 199 | style: TextStyle( 200 | color: Theme.of(context).primaryColor, 201 | fontSize: 12, 202 | fontWeight: FontWeight.bold), 203 | ), 204 | ), 205 | Text(' ${replyWrap.createdTime}', 206 | style: TextStyle( 207 | color: Theme.of(context).primaryColor, 208 | fontSize: 12)), 209 | ], 210 | ), 211 | Html( 212 | defaultTextStyle: TextStyle( 213 | color: Theme.of(context).highlightColor, 214 | fontSize: 16), 215 | data: replyWrap.contentHtml, 216 | onLinkTap: (url) { 217 | _presenter.openUrl(url); 218 | }, 219 | ) 220 | ], 221 | ), 222 | ), 223 | ) 224 | ], 225 | ), 226 | Divider( 227 | color: Theme.of(context).primaryColor, 228 | height: 1, 229 | ), 230 | ], 231 | ), 232 | ); 233 | } 234 | 235 | @override 236 | void displayTopic(TopicWrap topic) { 237 | setState(() { 238 | _topic = topic; 239 | }); 240 | } 241 | 242 | @override 243 | void displayReplies(List replies) { 244 | setState(() { 245 | _replies.clear(); 246 | if (replies != null) { 247 | _replies.addAll(replies); 248 | } 249 | }); 250 | } 251 | 252 | @override 253 | displayFavorite(bool isFavorite) { 254 | setState(() { 255 | _isFavorite = isFavorite; 256 | }); 257 | } 258 | 259 | @override 260 | void dispose() { 261 | super.dispose(); 262 | _presenter.detach(); 263 | } 264 | } 265 | -------------------------------------------------------------------------------- /lib/page/topic_presenter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:dwarf_doc/application.dart'; 4 | import 'package:dwarf_doc/bean/reply_wrap.dart'; 5 | import 'package:dwarf_doc/bean/topic_wrap.dart'; 6 | import 'package:dwarf_doc/database/favorite_dao.dart'; 7 | import 'package:dwarf_doc/http/reply_resp.dart'; 8 | import 'package:dwarf_doc/http/topic_api.dart'; 9 | import 'package:dwarf_doc/manager/route_manager.dart'; 10 | import 'package:dwarf_doc/page/topic_contract.dart' as TopicContract; 11 | import 'package:dwarf_doc/util/logger.dart'; 12 | import 'package:fluro/fluro.dart'; 13 | import 'package:flutter/widgets.dart'; 14 | import 'package:rxdart/rxdart.dart'; 15 | import 'package:url_launcher/url_launcher.dart'; 16 | 17 | class TopicPresenter implements TopicContract.Presenter { 18 | static const _TAG = 'TopicPresenter'; 19 | TopicApi _topicApi; 20 | TopicContract.View _view; 21 | TopicWrap _topicWrap; 22 | int _topicId; 23 | StreamSubscription _replySubscription; 24 | FavoriteDao _favoriteDao; 25 | 26 | TopicPresenter(this._view, this._topicId, _topicWrap) { 27 | _topicApi = TopicApi(Application.getInstance().httpModule); 28 | _favoriteDao = FavoriteDao(); 29 | } 30 | 31 | @override 32 | void start() { 33 | if (_topicWrap != null) { 34 | notifyDisplayTopic(_topicWrap); 35 | _replySubscription = _fetchReplies(_topicId) 36 | .asStream() 37 | .listen((replyWraps) => notifyDisplayReplies(replyWraps)); 38 | } else { 39 | _replySubscription = Observable.zip2( 40 | _fetchTopic(_topicId).asStream(), 41 | _fetchReplies(_topicId).asStream(), 42 | (topicWrap, replyWraps) => TopicContent(topicWrap, replyWraps)) 43 | .listen((topicContent) { 44 | _topicWrap = topicContent.topicWrap; 45 | notifyDisplayTopic(_topicWrap); 46 | notifyDisplayReplies(topicContent.replayWraps); 47 | }); 48 | } 49 | _favoriteDao.queryTopicRespsByTopicId(_topicId).then((topics) { 50 | _view.displayFavorite(topics != null && topics.isNotEmpty); 51 | }); 52 | } 53 | 54 | Future _fetchTopic(int topicId) async { 55 | TopicWrap topicWrap; 56 | var resp = await _topicApi.queryTopicById(topicId); 57 | if (resp != null) { 58 | topicWrap = TopicWrap(resp); 59 | } 60 | return topicWrap; 61 | } 62 | 63 | Future> _fetchReplies(int topicId) async { 64 | List replyResps = await _topicApi.queryRepliesByTopicId(topicId); 65 | List replyWraps = List(); 66 | replyResps.forEach((value) { 67 | replyWraps.add(ReplyWrap(value)); 68 | }); 69 | return replyWraps; 70 | } 71 | 72 | void notifyDisplayTopic(TopicWrap topicWrap) { 73 | _view.displayTopic(topicWrap); 74 | } 75 | 76 | void notifyDisplayReplies(List replyWraps) { 77 | _view.displayReplies(replyWraps); 78 | } 79 | 80 | @override 81 | void openUrl(String url) async { 82 | if (await canLaunch(url)) { 83 | await launch(url); 84 | } else { 85 | Logger.d(_TAG, 'Could not launch $url'); 86 | } 87 | } 88 | 89 | @override 90 | void openMember(BuildContext context, String username) { 91 | Application.getInstance().router.navigateTo( 92 | context, '${RouteHub.memberPath}?${RouteHub.usernameParam}=$username', 93 | transition: TransitionType.inFromRight); 94 | } 95 | 96 | @override 97 | void detach() { 98 | if (_replySubscription != null) { 99 | _replySubscription.cancel(); 100 | } 101 | } 102 | 103 | @override 104 | void doFavorite(bool isFavorite, TopicWrap topic) { 105 | Observable.just(isFavorite).flatMap((it) { 106 | if (it) { 107 | return _favoriteDao.saveOrUpdateTopicResp(topic.resp).asStream(); 108 | } else { 109 | return _favoriteDao.deleteTopicResp(topic.id).asStream(); 110 | } 111 | }).listen((value) => _view.displayFavorite(isFavorite)); 112 | } 113 | } 114 | 115 | class TopicContent { 116 | TopicWrap topicWrap; 117 | List replayWraps; 118 | 119 | TopicContent(this.topicWrap, this.replayWraps); 120 | } 121 | -------------------------------------------------------------------------------- /lib/util/logger.dart: -------------------------------------------------------------------------------- 1 | import 'package:dwarf_doc/application.dart'; 2 | 3 | class Logger { 4 | static void d(String tag, String log) { 5 | if (Application.getInstance().isDebug) { 6 | print('$tag: $log'); 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/util/string_utils.dart: -------------------------------------------------------------------------------- 1 | class StringUtils { 2 | static String safeString(String str) { 3 | return str ?? ''; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dwarf_doc 2 | description: A V2EX 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 | # Read more about versioning at semver.org. 10 | version: 1.0.1+0 11 | 12 | environment: 13 | sdk: ">=2.0.0-dev.68.0 <3.0.0" 14 | 15 | dependencies: 16 | flutter: 17 | sdk: flutter 18 | 19 | # The following adds the Cupertino Icons font to your application. 20 | # Use with the CupertinoIcons class for iOS style icons. 21 | cupertino_icons: ^0.1.2 22 | dio: ^2.0.5 #Http 23 | fluro: ^1.4.0 #Route 24 | flutter_html: ^0.9.4 #Html内容渲染 25 | rxdart: ^0.20.0 26 | intl: ^0.15.7 #格式化日期 27 | url_launcher: ^5.0.1 #打开Url 28 | sqflite: ^1.1.0 29 | event_bus: ^1.0.3 30 | 31 | dev_dependencies: 32 | flutter_test: 33 | sdk: flutter 34 | 35 | 36 | # For information on the generic Dart part of this file, see the 37 | # following page: https://www.dartlang.org/tools/pub/pubspec 38 | 39 | # The following section is specific to Flutter. 40 | flutter: 41 | 42 | # The following line ensures that the Material Icons font is 43 | # included with your application, so that you can use the icons in 44 | # the material Icons class. 45 | uses-material-design: true 46 | 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.io/assets-and-images/#resolution-aware. 54 | 55 | # For details regarding adding assets from package dependencies, see 56 | # https://flutter.io/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.io/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_test/flutter_test.dart'; 10 | 11 | import 'package:dwarf_doc/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | --------------------------------------------------------------------------------