├── android ├── gradle.properties ├── app │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── drawable │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── 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 │ │ │ │ └── layout │ │ │ │ │ └── webview.xml │ │ │ ├── java │ │ │ │ └── cn │ │ │ │ │ └── hg │ │ │ │ │ └── gxxq │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ ├── MyPlugin.java │ │ │ │ │ └── MyWebView.java │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── settings.gradle └── build.gradle ├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── AppDelegate.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── 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-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── main.m │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Runner.xcworkspace │ └── contents.xcworkspacedata └── Runner.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ ├── xcshareddata │ └── xcschemes │ │ └── Runner.xcscheme │ └── project.pbxproj ├── assets └── images │ ├── back.png │ ├── ic_me.png │ ├── ic_groups.png │ ├── ic_jinghua.png │ ├── ic_me_activated.png │ ├── ic_placeholder.png │ ├── ic_groups_activated.png │ ├── ic_topic_like_members.png │ ├── ic_filter_all_topic_normal.png │ ├── ic_filter_file_topic_normal.png │ ├── ic_filter_image_topic_normal.png │ ├── ic_filter_question_topic_normal.png │ ├── ic_filter_groupowner_topic_normal.png │ └── element.dart ├── lib ├── model │ ├── element.dart │ ├── topic_type.dart │ ├── group.dart │ ├── topic_image.dart │ ├── comment.dart │ └── topic.dart ├── page │ ├── page2.dart │ ├── page1.dart │ ├── topics_page.dart │ └── topic_detail.dart ├── view │ ├── photo_preview.dart │ ├── webview.dart │ ├── list_item_sticky.dart │ ├── list_item_group.dart │ ├── topic_images.dart │ ├── list_item_comment.dart │ └── list_item_topic.dart ├── util │ ├── date_util.dart │ ├── element_parser.dart │ └── view_util.dart └── main.dart ├── .metadata ├── README.md ├── test └── widget_test.dart ├── .gitignore ├── pubspec.yaml └── pubspec.lock /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | 3 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /assets/images/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/assets/images/back.png -------------------------------------------------------------------------------- /assets/images/ic_me.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/assets/images/ic_me.png -------------------------------------------------------------------------------- /assets/images/ic_groups.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/assets/images/ic_groups.png -------------------------------------------------------------------------------- /assets/images/ic_jinghua.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/assets/images/ic_jinghua.png -------------------------------------------------------------------------------- /assets/images/ic_me_activated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/assets/images/ic_me_activated.png -------------------------------------------------------------------------------- /assets/images/ic_placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/assets/images/ic_placeholder.png -------------------------------------------------------------------------------- /assets/images/ic_groups_activated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/assets/images/ic_groups_activated.png -------------------------------------------------------------------------------- /assets/images/ic_topic_like_members.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/assets/images/ic_topic_like_members.png -------------------------------------------------------------------------------- /assets/images/ic_filter_all_topic_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/assets/images/ic_filter_all_topic_normal.png -------------------------------------------------------------------------------- /assets/images/ic_filter_file_topic_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/assets/images/ic_filter_file_topic_normal.png -------------------------------------------------------------------------------- /assets/images/ic_filter_image_topic_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/assets/images/ic_filter_image_topic_normal.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/android/app/src/main/res/drawable/ic_launcher.png -------------------------------------------------------------------------------- /assets/images/ic_filter_question_topic_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/assets/images/ic_filter_question_topic_normal.png -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /assets/images/ic_filter_groupowner_topic_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/assets/images/ic_filter_groupowner_topic_normal.png -------------------------------------------------------------------------------- /lib/model/element.dart: -------------------------------------------------------------------------------- 1 | class Element { 2 | String type; 3 | String title; 4 | String href; 5 | String hid; 6 | 7 | 8 | Element(this.type); 9 | } -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /assets/images/element.dart: -------------------------------------------------------------------------------- 1 | class Element { 2 | String type; 3 | String title; 4 | String href; 5 | String hid; 6 | 7 | 8 | Element(this.type); 9 | } -------------------------------------------------------------------------------- /lib/model/topic_type.dart: -------------------------------------------------------------------------------- 1 | class TopicType { 2 | String scope; 3 | String image; 4 | String text; 5 | 6 | TopicType(this.scope, this.image, this.text); 7 | 8 | } -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/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/YellowDoing/gxxq/HEAD/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/YellowDoing/gxxq/HEAD/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/YellowDoing/gxxq/HEAD/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/YellowDoing/gxxq/HEAD/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/YellowDoing/gxxq/HEAD/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/YellowDoing/gxxq/HEAD/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/YellowDoing/gxxq/HEAD/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/YellowDoing/gxxq/HEAD/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/YellowDoing/gxxq/HEAD/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/YellowDoing/gxxq/HEAD/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/YellowDoing/gxxq/HEAD/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/YellowDoing/gxxq/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YellowDoing/gxxq/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.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: 20e59316b8b8474554b38493b8ca888794b0234a 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /lib/model/group.dart: -------------------------------------------------------------------------------- 1 | class Group { 2 | int id; 3 | String groupId; 4 | String image; 5 | String name; 6 | String auth; 7 | String color; 8 | String avatarUrl; 9 | 10 | 11 | Group.fromJson(Map json) { 12 | id = json['id']; 13 | groupId = json['groupId']; 14 | image = json['image']; 15 | name = json['name']; 16 | auth = json['auth']; 17 | color = json['color']; 18 | avatarUrl = json['avatarUrl']; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib/page/page2.dart: -------------------------------------------------------------------------------- 1 | import 'dart:core'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | import 'package:flutter/cupertino.dart'; 6 | 7 | class Page2 extends StatefulWidget { 8 | @override 9 | State createState() => _Page2State(); 10 | } 11 | 12 | class _Page2State extends State { 13 | @override 14 | Widget build(BuildContext context) { 15 | return Scaffold( 16 | body: Container( 17 | 18 | 19 | ), 20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 共享星球 2 | 3 | 仿《知识星球》APP,基于Flutter开发,丝滑流畅,仅供学习使用,数据为写死的模拟数据,请勿商用或盗版,谢谢。 4 | 5 | 安装包地址 https://fir.im/rvkc?release_id=5d3ec3e3f9454878877074fa 6 | 7 | ![image](https://note.youdao.com/yws/api/personal/file/30804715DE4143BE8E36660B92EB0DB9?method=download&shareKey=e11564b83722bdbfea4c0054ab623761) 8 | ![image](https://note.youdao.com/yws/api/personal/file/E881299C7EEB443C856CA5275DE84A89?method=download&shareKey=f8092d1435f567a21c75cc91205e6182) 9 | 10 | > 项目运行后若底部范围超出,需修改Tab控件源码112行,10改为2即可 11 | 12 | 13 | 14 | 15 | 《IT独立开发者》帮助程序员拓展产品、运营、设计等思维能力,开发独立产品,致力成为自由职业者,实现财富自由。 16 | 17 | ![image](https://note.youdao.com/yws/api/personal/file/3002024D05CB4DE093FE3D5B1C5F768E?method=download&shareKey=df4c885cbea566bf95c0a9cf515984d5) 18 | 19 | 微信扫码关注公众号《IT独立开发者》 20 | -------------------------------------------------------------------------------- /android/app/src/main/res/layout/webview.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/view/photo_preview.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../model/topic_image.dart'; 3 | import 'package:photo_view/photo_view.dart'; 4 | 5 | class PhotoPreview extends StatelessWidget { 6 | final List _list; 7 | final int currentIndex; 8 | 9 | PhotoPreview(this._list, this.currentIndex); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Scaffold( 14 | backgroundColor: Colors.black87, 15 | body: PageView.builder( 16 | itemBuilder: (context, index) { 17 | return GestureDetector( 18 | child: PhotoView( 19 | onTapUp: (context, details, controllerValue) { 20 | Navigator.pop(context); 21 | }, 22 | imageProvider: NetworkImage(_list[index].large.url), 23 | ), 24 | ); 25 | }, 26 | itemCount: _list.length, 27 | controller: PageController(initialPage: currentIndex), 28 | ), 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/view/webview.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/services.dart'; 5 | import '../util/view_util.dart'; 6 | 7 | 8 | class WebViewPage extends StatelessWidget { 9 | final String url; 10 | final String title; 11 | 12 | WebViewPage(this.url, this.title); 13 | 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Scaffold( 18 | appBar: ViewUtil.getAppBar(title, context), 19 | body: _Webview(), 20 | ); 21 | } 22 | 23 | _Webview() { 24 | if (Platform.isIOS) { 25 | // return WebView( 26 | // javascriptMode: JavascriptMode.unrestricted, 27 | // initialUrl: url); 28 | } else { 29 | return AndroidView( 30 | viewType: 'webview', 31 | onPlatformViewCreated: (i) { 32 | MethodChannel _channel = MethodChannel('huanggan/webview'); 33 | _channel.invokeMethod('loadUrl', {'url': url}); 34 | }, 35 | ); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /android/app/src/main/java/cn/hg/gxxq/MainActivity.java: -------------------------------------------------------------------------------- 1 | package cn.hg.gxxq; 2 | 3 | import android.Manifest; 4 | import android.app.ProgressDialog; 5 | import android.content.BroadcastReceiver; 6 | import android.content.Context; 7 | import android.content.Intent; 8 | import android.content.IntentFilter; 9 | import android.content.pm.PackageManager; 10 | import android.os.Build; 11 | import android.os.Bundle; 12 | import android.os.Environment; 13 | import android.util.Log; 14 | import android.widget.Toast; 15 | 16 | 17 | import java.io.File; 18 | 19 | import io.flutter.app.FlutterActivity; 20 | import io.flutter.plugins.GeneratedPluginRegistrant; 21 | 22 | 23 | public class MainActivity extends FlutterActivity { 24 | 25 | 26 | @Override 27 | protected void onCreate(Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | MyPlugin.registerWith(registrarFor("huanggan/myplugin"), this); 30 | GeneratedPluginRegistrant.registerWith(this); 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /lib/util/date_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:intl/intl.dart'; 2 | 3 | class DateUtil { 4 | static String timeStr(String createTime) { 5 | final past = 6 | DateTime.parse(createTime.substring(0, createTime.indexOf('.'))); 7 | final now = DateTime.now(); 8 | 9 | var msFormat = new DateFormat('HH:mm'); 10 | var ymdFormat = new DateFormat('yyyy/MM/dd'); 11 | 12 | final timeDiff = now.difference(past); 13 | if (timeDiff.inDays == 0) { 14 | //今天 15 | if (timeDiff.inHours < 1) { 16 | if (timeDiff.inMinutes < 1) { 17 | return '刚刚'; 18 | } else { 19 | return '${timeDiff.inMinutes}分钟前'; 20 | } 21 | } else { 22 | return '${timeDiff.inHours}小时前'; 23 | } 24 | } else if (timeDiff.inDays == 1) { 25 | //昨天 26 | return '昨天 ${msFormat.format(past)}'; 27 | } else if (timeDiff.inDays == 2) { 28 | //前天 29 | return '前天 ${msFormat.format(past)}'; 30 | } else { 31 | return ymdFormat.format(past) + ' ' + msFormat.format(past); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /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:gxxq/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 | -------------------------------------------------------------------------------- /lib/view/list_item_sticky.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter/gestures.dart'; 4 | import 'package:gxxq/util/element_parser.dart'; 5 | import '../model/topic.dart'; 6 | import '../page/topic_detail.dart'; 7 | import '../view/list_item_topic.dart'; 8 | 9 | //置顶 10 | class StickyListItem extends StatelessWidget { 11 | 12 | final Topic _topic; 13 | 14 | StickyListItem(this._topic); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return InkWell( 19 | onTap: () { 20 | Navigator.push(context, CupertinoPageRoute(builder: (context) { 21 | return TopicDetailPage(_topic); 22 | })); 23 | }, 24 | child: Column( 25 | children: [ 26 | Row( 27 | children: [ 28 | Padding( 29 | padding: EdgeInsets.all(14), 30 | child: Text( 31 | '置顶', style: TextStyle(fontSize: 10, color: Colors.grey),), 32 | ), 33 | Expanded( 34 | flex: 1, 35 | child: Text(ElementParser.hasE(_topic.talk.text) ? ElementParser.genEText(_topic.talk.text,context).textSpans[0].text 36 | :_topic.talk.text, maxLines: 1, 37 | overflow: TextOverflow.ellipsis,), 38 | ) 39 | ], 40 | ), 41 | _line() 42 | ], 43 | ), 44 | ); 45 | } 46 | 47 | _line() { 48 | return Container( 49 | width: double.infinity, 50 | height: 0.5, 51 | color: Colors.black12, 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/model/topic_image.dart: -------------------------------------------------------------------------------- 1 | class TopicImage { 2 | int imageId; 3 | String type; 4 | Thumbnail thumbnail; 5 | Large large; 6 | Original original; 7 | 8 | TopicImage( 9 | {this.imageId, this.type, this.thumbnail, this.large, this.original}); 10 | 11 | TopicImage.fromJson(Map json) { 12 | imageId = json['image_id']; 13 | type = json['type']; 14 | thumbnail = json['thumbnail'] != null 15 | ? new Thumbnail.fromJson(json['thumbnail']) 16 | : null; 17 | large = json['large'] != null ? new Large.fromJson(json['large']) : null; 18 | original = json['original'] != null 19 | ? new Original.fromJson(json['original']) 20 | : null; 21 | } 22 | 23 | } 24 | 25 | class Thumbnail { 26 | String url; 27 | int width; 28 | int height; 29 | 30 | Thumbnail({this.url, this.width, this.height}); 31 | 32 | Thumbnail.fromJson(Map json) { 33 | url = json['url']; 34 | width = json['width']; 35 | height = json['height']; 36 | } 37 | } 38 | 39 | class Large { 40 | String url; 41 | int width; 42 | int height; 43 | 44 | Large({this.url, this.width, this.height}); 45 | 46 | Large.fromJson(Map json) { 47 | url = json['url']; 48 | width = json['width']; 49 | height = json['height']; 50 | } 51 | } 52 | 53 | class Original { 54 | String url; 55 | int width; 56 | int height; 57 | int size; 58 | 59 | Original({this.url, this.width, this.height, this.size}); 60 | 61 | Original.fromJson(Map json) { 62 | url = json['url']; 63 | width = json['width']; 64 | height = json['height']; 65 | size = json['size']; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | gxxq 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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | /build/ 31 | 32 | # Android related 33 | **/android/**/gradle-wrapper.jar 34 | **/android/.gradle 35 | **/android/captures/ 36 | **/android/gradlew 37 | **/android/gradlew.bat 38 | **/android/local.properties 39 | **/android/**/GeneratedPluginRegistrant.java 40 | 41 | # iOS/XCode related 42 | **/ios/**/*.mode1v3 43 | **/ios/**/*.mode2v3 44 | **/ios/**/*.moved-aside 45 | **/ios/**/*.pbxuser 46 | **/ios/**/*.perspectivev3 47 | **/ios/**/*sync/ 48 | **/ios/**/.sconsign.dblite 49 | **/ios/**/.tags* 50 | **/ios/**/.vagrant/ 51 | **/ios/**/DerivedData/ 52 | **/ios/**/Icon? 53 | **/ios/**/Pods/ 54 | **/ios/**/.symlinks/ 55 | **/ios/**/profile 56 | **/ios/**/xcuserdata 57 | **/ios/.generated/ 58 | **/ios/Flutter/App.framework 59 | **/ios/Flutter/Flutter.framework 60 | **/ios/Flutter/Generated.xcconfig 61 | **/ios/Flutter/app.flx 62 | **/ios/Flutter/app.zip 63 | **/ios/Flutter/flutter_assets/ 64 | **/ios/ServiceDefinitions.json 65 | **/ios/Runner/GeneratedPluginRegistrant.* 66 | 67 | # Exceptions to above rules. 68 | !**/ios/**/default.mode1v3 69 | !**/ios/**/default.mode2v3 70 | !**/ios/**/default.pbxuser 71 | !**/ios/**/default.perspectivev3 72 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 73 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /android/app/src/main/java/cn/hg/gxxq/MyPlugin.java: -------------------------------------------------------------------------------- 1 | package cn.hg.gxxq; 2 | 3 | import android.app.DownloadManager; 4 | import android.content.Context; 5 | import android.net.Uri; 6 | import android.os.Environment; 7 | 8 | import io.flutter.plugin.common.MethodCall; 9 | import io.flutter.plugin.common.MethodChannel; 10 | import io.flutter.plugin.common.PluginRegistry; 11 | import io.flutter.plugin.common.StandardMessageCodec; 12 | import io.flutter.plugin.platform.PlatformView; 13 | import io.flutter.plugin.platform.PlatformViewFactory; 14 | 15 | import static android.content.Context.DOWNLOAD_SERVICE; 16 | 17 | 18 | class MyPlugin implements MethodChannel.MethodCallHandler { 19 | 20 | public static final String CHANNEL_NAME = "huanggan/myplugin"; 21 | private Context mContext; 22 | private MainActivity mMainActivity; 23 | 24 | /** 25 | * Plugin registration. 26 | */ 27 | public static void registerWith(PluginRegistry.Registrar registrar, MainActivity a) { 28 | final MethodChannel channel = new MethodChannel(registrar.messenger(), CHANNEL_NAME); 29 | channel.setMethodCallHandler(new MyPlugin(registrar.context(), a)); 30 | registrar.platformViewRegistry().registerViewFactory("webview", new PlatformViewFactory(StandardMessageCodec.INSTANCE) { 31 | @Override 32 | public PlatformView create(Context context, int i, Object o) { 33 | return new MyWebView(context, registrar.messenger()); 34 | } 35 | }); 36 | } 37 | 38 | 39 | public MyPlugin(Context context,MainActivity activity) { 40 | mContext = context; 41 | mMainActivity = activity; 42 | } 43 | 44 | @Override 45 | public void onMethodCall(MethodCall call, MethodChannel.Result result) { 46 | switch (call.method) { 47 | 48 | } 49 | } 50 | 51 | 52 | } -------------------------------------------------------------------------------- /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 28 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 "cn.hg.gxxq" 37 | minSdkVersion 16 38 | targetSdkVersion 28 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 | -------------------------------------------------------------------------------- /lib/view/list_item_group.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../model/group.dart'; 3 | 4 | class GroupListItem extends StatelessWidget { 5 | 6 | final Group _group; 7 | final GestureTapCallback _onTap; 8 | 9 | GroupListItem(this._group, this._onTap,{Key key}):super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | var tgb = _group.color.split(','); 14 | return GestureDetector( 15 | onTap: _onTap, 16 | child: Container( 17 | color: Colors.white, 18 | child: Column( 19 | children: [ 20 | // Expanded( 21 | // child: Image.network( 22 | // _group.image, 23 | // fit: BoxFit.fill, 24 | // ), 25 | // flex: 5, 26 | // ), 27 | // Expanded( 28 | // child: Container( 29 | // width: double.infinity, 30 | // color: Color.fromARGB(255, int.parse(tgb[0]), 31 | // int.parse(tgb[1]), int.parse(tgb[2])), 32 | // child: Column( 33 | // mainAxisAlignment: MainAxisAlignment.center, 34 | // children: [ 35 | // Text( 36 | // _group.name, 37 | // style: TextStyle( 38 | // fontSize: 15, 39 | // color: _group.color == '255,255,255' 40 | // ? Colors.black87 41 | // : Colors.white), 42 | // ), 43 | // Container( 44 | // height: 0.5, 45 | // width: 18, 46 | // margin: EdgeInsets.only(top: 4, bottom: 4), 47 | // color: _group.color == '255,255,255' 48 | // ? Colors.black87 49 | // : Colors.white, 50 | // ), 51 | // Text( 52 | // _group.auth, 53 | // style: TextStyle( 54 | // fontSize: 11, 55 | // color: _group.color == '255,255,255' 56 | // ? Colors.black87 57 | // : Colors.white), 58 | // ), 59 | // ], 60 | // ), 61 | // ), 62 | // flex: 2, 63 | // ), 64 | ], 65 | ), 66 | ), 67 | ); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/util/element_parser.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/gestures.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:gxxq/view/webview.dart'; 6 | import '../constant.dart'; 7 | import '../model/element.dart' as E; 8 | import 'package:html/dom.dart' as DOM; 9 | import 'package:flutter/cupertino.dart'; 10 | 11 | class ElementParser { 12 | static bool hasE(String text) { 13 | if(text == null) 14 | return false; 15 | return text.contains('') && 17 | text.contains('type') && 18 | text.contains('title'); 19 | } 20 | 21 | static E.Element parseE(String text) { 22 | var e = DOM.Element 23 | .html(text) 24 | .attributes; 25 | final element = E.Element(e['type']); 26 | if (e['hid'] != null) element.hid = e['hid']; 27 | if (e['href'] != null) element.href = Uri.decodeFull(e['href']); 28 | if (e['title'] != null) element.title = Uri.decodeFull(e['title']); 29 | 30 | return element; 31 | } 32 | 33 | static String getE(String text) { 34 | return text.substring(text.indexOf('') + 2); 35 | } 36 | 37 | static ParseResult genEText(String text, BuildContext context) { 38 | final textSpans = List(); 39 | final styleBlack = TextStyle(color: Colors.black87); 40 | final styleBlue = TextStyle(color: BLUE_DARK); 41 | String textResult = text; 42 | 43 | do { 44 | //取出一段e 45 | String elementStr = ElementParser.getE(textResult); 46 | var element = ElementParser.parseE(elementStr); 47 | var texts = textResult.split(elementStr); 48 | textSpans.add(TextSpan(text: texts[0], style: styleBlack)); 49 | 50 | var tap = TapGestureRecognizer(); 51 | tap.onTap = () { 52 | if (element.type == 'web') { 53 | if (Platform.isAndroid) 54 | Navigator.push(context, CupertinoPageRoute(builder: (context) { 55 | return WebViewPage(element.href, element.title); 56 | })); 57 | } 58 | }; 59 | textSpans.add(TextSpan( 60 | text: (element.type == 'web' ? "链接:" : "") + element.title, 61 | style: styleBlue, 62 | recognizer: tap, 63 | )); 64 | textResult = texts[1]; 65 | } while (ElementParser.hasE(textResult)); 66 | 67 | return ParseResult(textSpans, textResult); 68 | } 69 | } 70 | 71 | 72 | 73 | class ParseResult { 74 | List textSpans; 75 | String textResult; 76 | 77 | ParseResult(this.textSpans, this.textResult); 78 | } 79 | -------------------------------------------------------------------------------- /android/app/src/main/java/cn/hg/gxxq/MyWebView.java: -------------------------------------------------------------------------------- 1 | package cn.hg.gxxq; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.webkit.WebChromeClient; 8 | import android.webkit.WebSettings; 9 | import android.webkit.WebView; 10 | import android.webkit.WebViewClient; 11 | import android.widget.ProgressBar; 12 | 13 | import io.flutter.plugin.common.BinaryMessenger; 14 | import io.flutter.plugin.common.MethodCall; 15 | import io.flutter.plugin.common.MethodChannel; 16 | import io.flutter.plugin.platform.PlatformView; 17 | 18 | public class MyWebView implements PlatformView, MethodChannel.MethodCallHandler { 19 | 20 | private WebView mWebView; 21 | private final MethodChannel methodChannel; 22 | private View mView; 23 | 24 | public MyWebView(Context context, BinaryMessenger messenger) { 25 | initWevView(context); 26 | methodChannel = new MethodChannel(messenger, "huanggan/webview"); 27 | methodChannel.setMethodCallHandler(this); 28 | } 29 | 30 | private void initWevView(Context context) { 31 | mView = LayoutInflater.from(context).inflate(R.layout.webview, null); 32 | mWebView = mView.findViewById(R.id.web_view); 33 | ProgressBar progressBar = mView.findViewById(R.id.progress_bar); 34 | WebSettings webSettings = mWebView.getSettings(); 35 | webSettings.setJavaScriptEnabled(true); 36 | mWebView.setWebChromeClient(new WebChromeClient() { 37 | @Override 38 | public void onProgressChanged(WebView view, int newProgress) { 39 | super.onProgressChanged(view, newProgress); 40 | progressBar.setProgress(newProgress); 41 | } 42 | }); 43 | mWebView.setWebViewClient(new WebViewClient() { 44 | @Override 45 | public void onPageStarted(WebView view, String url, Bitmap favicon) { 46 | super.onPageStarted(view, url, favicon); 47 | progressBar.setVisibility(View.VISIBLE); 48 | } 49 | 50 | @Override 51 | public void onPageFinished(WebView view, String url) { 52 | super.onPageFinished(view, url); 53 | progressBar.setVisibility(View.GONE); 54 | } 55 | }); 56 | } 57 | 58 | @Override 59 | public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) { 60 | if ("loadUrl".equals(methodCall.method)) { 61 | mWebView.clearHistory(); 62 | mWebView.loadUrl(methodCall.argument("url")); 63 | } 64 | } 65 | 66 | @Override 67 | public View getView() { 68 | return mView; 69 | } 70 | 71 | @Override 72 | public void dispose() { 73 | 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: gxxq 2 | description: A new Flutter project. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 1.0.0+1 15 | 16 | environment: 17 | sdk: ">=2.1.0 <3.0.0" 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | 23 | # The following adds the Cupertino Icons font to your application. 24 | # Use with the CupertinoIcons class for iOS style icons. 25 | cupertino_icons: ^0.1.2 26 | intl: ^0.15.8 27 | photo_view: ^0.4.2 28 | html: ^0.14.0+2 29 | fluttertoast: ^3.0.4 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://dart.dev/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 | assets: 47 | - assets/images/ 48 | 49 | # To add assets to your application, add an assets section, like this: 50 | # assets: 51 | # - images/a_dot_burr.jpeg 52 | # - images/a_dot_ham.jpeg 53 | 54 | # An image asset can refer to one or more resolution-specific "variants", see 55 | # https://flutter.dev/assets-and-images/#resolution-aware. 56 | 57 | # For details regarding adding assets from package dependencies, see 58 | # https://flutter.dev/assets-and-images/#from-packages 59 | 60 | # To add custom fonts to your application, add a fonts section here, 61 | # in this "flutter" section. Each entry in this list should have a 62 | # "family" key with the font family name, and a "fonts" key with a 63 | # list giving the asset and other descriptors for the font. For 64 | # example: 65 | # fonts: 66 | # - family: Schyler 67 | # fonts: 68 | # - asset: fonts/Schyler-Regular.ttf 69 | # - asset: fonts/Schyler-Italic.ttf 70 | # style: italic 71 | # - family: Trajan Pro 72 | # fonts: 73 | # - asset: fonts/TrajanPro.ttf 74 | # - asset: fonts/TrajanPro_Bold.ttf 75 | # weight: 700 76 | # 77 | # For details regarding fonts from package dependencies, 78 | # see https://flutter.dev/custom-fonts/#from-packages 79 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import 'constant.dart'; 4 | import 'page/page1.dart'; 5 | import 'page/page2.dart'; 6 | 7 | void main() => runApp(MyApp()); 8 | 9 | class MyApp extends StatelessWidget { 10 | @override 11 | Widget build(BuildContext context) { 12 | _changeStatuBar(); 13 | return MaterialApp( 14 | title: '共享星球', 15 | theme: ThemeData( 16 | primaryColor: GREEN, 17 | accentColor: GREEN, 18 | scaffoldBackgroundColor: Color.fromARGB(255, 245, 246, 248)), 19 | home: MyHomePage(), 20 | ); 21 | } 22 | 23 | //改变状态栏字体颜色 24 | _changeStatuBar() { 25 | SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light.copyWith( 26 | statusBarColor: Colors.transparent, 27 | statusBarBrightness: Brightness.light)); 28 | } 29 | } 30 | 31 | class MyHomePage extends StatefulWidget { 32 | @override 33 | _MyHomePageState createState() => _MyHomePageState(); 34 | } 35 | 36 | class _MyHomePageState extends State 37 | with SingleTickerProviderStateMixin { 38 | 39 | TabController controller; //底部导航控制器 40 | int _currentIndex = 0; //选中位置 41 | 42 | 43 | @override 44 | void initState() { 45 | super.initState(); 46 | controller = TabController(length: 2, vsync: this); 47 | controller.addListener(() => _onTabChanged()); 48 | } 49 | 50 | @override 51 | Widget build(BuildContext context) { 52 | return Scaffold( 53 | body: IndexedStack( 54 | index: _currentIndex, 55 | children: [ 56 | Page1(), 57 | Page2(), 58 | ], 59 | ), 60 | bottomNavigationBar: _buildBottomNavigationBar(), 61 | ); 62 | } 63 | 64 | SafeArea _buildBottomNavigationBar() { 65 | return SafeArea( 66 | child: Container( 67 | height: 52, 68 | decoration: BoxDecoration(color: Colors.white, boxShadow: [ 69 | BoxShadow(color: const Color(0xFFd0d0d0), blurRadius: 1.0) 70 | ]), 71 | child: TabBar( 72 | labelColor: GREEN, 73 | controller: controller, 74 | tabs: [ 75 | _buildTab( 76 | '星球', 77 | _currentIndex == 0 78 | ? 'assets/images/ic_groups_activated.png' 79 | : 'assets/images/ic_groups.png'), 80 | _buildTab( 81 | '我的', 82 | _currentIndex == 1 83 | ? 'assets/images/ic_me_activated.png' 84 | : 'assets/images/ic_me.png') 85 | ], 86 | indicator: const BoxDecoration(), 87 | unselectedLabelColor: Color(0xFF888888), 88 | ), 89 | ), 90 | ); 91 | } 92 | 93 | Tab _buildTab(String tabName, String tabRes) { 94 | return Tab( 95 | child: Text( 96 | tabName, 97 | style: TextStyle(fontSize: 12), 98 | ), 99 | icon: Image.asset(tabRes, width: 28, height: 28)); 100 | } 101 | 102 | /* 103 | 底部导航点击事件 104 | */ 105 | _onTabChanged() { 106 | if (controller.indexIsChanging) { 107 | if (this.mounted) { 108 | this.setState(() { 109 | _currentIndex = controller.index; 110 | }); 111 | } 112 | } 113 | } 114 | 115 | 116 | } 117 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /lib/util/view_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../constant.dart'; 4 | 5 | class ViewUtil { 6 | static Widget getAppBar(String title, BuildContext context, 7 | {bool leading = true, double elevation = 0.5, color = Colors.white}) { 8 | return PreferredSize( 9 | preferredSize: Size.fromHeight(50), 10 | child: AppBar( 11 | leading: leading ? IconButton( 12 | icon: Image.asset( 13 | 'assets/images/backgreen.png', width: 22, height: 22,), 14 | onPressed: () => Navigator.pop(context), 15 | ) : null, 16 | //iconTheme: IconThemeData(color: GREEN), 17 | //brightness: Brightness.light, 18 | centerTitle: true, 19 | title: Text( 20 | title, 21 | overflow: TextOverflow.ellipsis, 22 | style: TextStyle( 23 | fontSize: 18, 24 | color: GREEN, 25 | ), 26 | ), 27 | elevation: elevation, 28 | backgroundColor: color, 29 | ), 30 | 31 | ) 32 | ; 33 | } 34 | 35 | static dismiss(BuildContext context) { 36 | Navigator.pop(context); 37 | } 38 | 39 | static loading(BuildContext context) { 40 | showDialog( 41 | context: context, 42 | barrierDismissible: false, 43 | builder: (context) { 44 | return Center( 45 | child: Container( 46 | padding: EdgeInsets.only(top: 25), 47 | color: Colors.white, 48 | width: 115, 49 | height: 115, 50 | child: Column( 51 | children: [ 52 | CircularProgressIndicator(), 53 | Padding( 54 | padding: EdgeInsets.only(top: 18), 55 | child: GestureDetector( 56 | child: Text( 57 | '加载中...', 58 | style: TextStyle( 59 | fontSize: 14, 60 | decoration: TextDecoration.none, 61 | color: Colors.black, 62 | fontWeight: FontWeight.normal), 63 | ), 64 | onTap: () => Navigator.pop(context), 65 | ), 66 | ) 67 | ], 68 | ), 69 | ), 70 | ); 71 | }); 72 | } 73 | 74 | static Widget renderTextFiled(Icon icon, 75 | String hintText, 76 | ValueChanged onChanged, 77 | Color borderColor, 78 | GestureTapCallback onTap, 79 | {obscureText = false, 80 | autoFocus = false, keyboardType = TextInputType.text}) { 81 | return Container( 82 | margin: EdgeInsets.only(top: 16), 83 | padding: EdgeInsets.only( 84 | left: 20, 85 | right: 20, 86 | ), 87 | decoration: BoxDecoration( 88 | border: Border.all(color: borderColor, width: 1), 89 | color: Colors.white, 90 | borderRadius: BorderRadius.all(Radius.circular(50)), 91 | ), 92 | width: 290, 93 | child: TextField( 94 | keyboardType: keyboardType, 95 | onTap: onTap, 96 | autofocus: autoFocus, 97 | onChanged: onChanged, 98 | maxLines: 1, 99 | decoration: InputDecoration( 100 | icon: icon, 101 | hintText: hintText, 102 | hintStyle: TextStyle(fontSize: 14), 103 | labelStyle: TextStyle(fontSize: 14), 104 | border: InputBorder.none), 105 | obscureText: obscureText, 106 | ), 107 | ); 108 | } 109 | 110 | 111 | static FadeInImage fadeImage(String url, {BoxFit fit}) { 112 | return FadeInImage.assetNetwork( 113 | placeholder: 'assets/images/ic_placeholder.png', 114 | image: url, 115 | fit: fit, 116 | ); 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /lib/view/topic_images.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:gxxq/view/photo_preview.dart'; 4 | import '../model/topic_image.dart'; 5 | 6 | class TopicImages { 7 | static double screenWidth; 8 | 9 | //单图 10 | static Widget singleImage(List topicImages, 11 | BuildContext context) { 12 | double width; 13 | //宽高比 14 | double ratio = 15 | topicImages[0].thumbnail.height / topicImages[0].thumbnail.width; 16 | if (ratio >= 2) { 17 | //竖直长方形 18 | width = 75; 19 | } else if (ratio <= 0.75) { 20 | //横长方形 21 | width = double.infinity; 22 | } else { 23 | //正方形 24 | width = 150; 25 | } 26 | 27 | return GestureDetector( 28 | onTap: () { 29 | Navigator.push(context, MaterialPageRoute(builder: (context) { 30 | return PhotoPreview(topicImages, 0); 31 | })); 32 | }, 33 | child: Image.network( 34 | topicImages[0].thumbnail.url, 35 | height: 150, 36 | width: width, 37 | fit: BoxFit.cover, 38 | ), 39 | ); 40 | } 41 | 42 | //双图 43 | static Widget doubleImage(List images, BuildContext context) { 44 | int verNum = 0; //是否显示竖图 45 | images.forEach((ti) { 46 | double ratio = ti.thumbnail.height / ti.thumbnail.width; 47 | if (ratio >= 2) verNum++; 48 | }); 49 | 50 | return Wrap( 51 | spacing: 4, 52 | children: _renderImages(images, (index) { 53 | Navigator.push(context, MaterialPageRoute(builder: (context) { 54 | return PhotoPreview(images, index); 55 | })); 56 | }, 57 | width: verNum == 2 ? 75 : 100, height: verNum == 2 ? 75 : 100), 58 | ); 59 | } 60 | 61 | //四图 62 | static Widget fourImages(List images, BuildContext context) { 63 | final secondWrap = List(); 64 | var i3 = images[2]; 65 | var i4 = images[3]; 66 | images.remove(i3); 67 | images.remove(i4); 68 | secondWrap.add(i3); 69 | secondWrap.add(i4); 70 | return Wrap( 71 | spacing: 4, 72 | direction: Axis.vertical, 73 | children: [ 74 | Wrap( 75 | spacing: 4, 76 | children: _renderImages(images, (index) { 77 | Navigator.push(context, MaterialPageRoute(builder: (context) { 78 | var i = images; 79 | i.addAll(secondWrap); 80 | return PhotoPreview(i, index); 81 | })); 82 | }, width: 75, height: 75), 83 | ), 84 | Wrap( 85 | spacing: 4, 86 | children: _renderImages(secondWrap, (index) { 87 | Navigator.push(context, MaterialPageRoute(builder: (context) { 88 | var i = images; 89 | i.addAll(secondWrap); 90 | return PhotoPreview(i, index + 2); 91 | })); 92 | }, width: 75, height: 75), 93 | ), 94 | ], 95 | ); 96 | } 97 | 98 | //多图 3 5 6 7 8 9 99 | static Widget multiImages(List images, BuildContext context) { 100 | return Wrap( 101 | spacing: 4, 102 | children: _renderImages(images, (index) { 103 | Navigator.push(context, MaterialPageRoute(builder: (context) { 104 | return PhotoPreview(images, index); 105 | })); 106 | }, width: 75, height: 75), 107 | ); 108 | } 109 | 110 | static _renderImages(List images, void Function(int index) taped, 111 | {double width, double height}) { 112 | return images.map((topicImage) { 113 | return GestureDetector( 114 | onTap: () { 115 | taped(images.indexOf(topicImage)); 116 | }, 117 | child: Image.network( 118 | topicImage.thumbnail.url, 119 | width: width, 120 | height: height, 121 | fit: BoxFit.cover, 122 | ), 123 | ); 124 | }).toList(); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /lib/page/page1.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter/painting.dart'; 4 | import 'package:gxxq/page/topics_page.dart'; 5 | import '../util/view_util.dart'; 6 | import '../model/group.dart'; 7 | import '../view/list_item_group.dart'; 8 | import '../constant.dart'; 9 | 10 | class Page1 extends StatefulWidget { 11 | @override 12 | State createState() => _Page1State(); 13 | } 14 | 15 | class _Page1State extends State { 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | 20 | List children = [ 21 | ]; 22 | 23 | GROUPS.forEach((map) { 24 | Group group = Group.fromJson(map); 25 | var tgb = group.color.split(','); 26 | children.add( _buildGridItem(group, tgb)); 27 | }); 28 | 29 | return Scaffold( 30 | appBar: ViewUtil.getAppBar('共享星球', context, 31 | leading: false, elevation: 0, color: Colors.transparent), 32 | body: Column( 33 | children: [ 34 | _renderNotificationText(), 35 | Expanded( 36 | flex: 1, 37 | child: GridView.count( 38 | crossAxisCount: 2, 39 | padding: EdgeInsets.all(27), 40 | mainAxisSpacing: 27.0, 41 | crossAxisSpacing: 27.0, 42 | children: children, 43 | childAspectRatio: 0.72, 44 | ), 45 | ) 46 | ], 47 | )); 48 | } 49 | 50 | GestureDetector _buildGridItem(Group group, List tgb) { 51 | return GestureDetector( 52 | onTap: (){ 53 | if(group.id != 1){ 54 | Navigator.push(context, CupertinoPageRoute(builder: (context) { 55 | return TopicsPage(group); 56 | })); 57 | } 58 | }, 59 | child: Container( 60 | color: Colors.white, 61 | child: Column( 62 | children: [ 63 | Expanded( 64 | child: Image.network( 65 | group.image, 66 | fit: BoxFit.fill, 67 | ), 68 | flex: 5, 69 | ), 70 | Expanded( 71 | child: Container( 72 | width: double.infinity, 73 | color: Color.fromARGB(255, int.parse(tgb[0]), 74 | int.parse(tgb[1]), int.parse(tgb[2])), 75 | child: Column( 76 | mainAxisAlignment: MainAxisAlignment.center, 77 | children: [ 78 | Text( 79 | group.name, 80 | style: TextStyle( 81 | fontSize: 15, 82 | color: group.color == '255,255,255' 83 | ? Colors.black87 84 | : Colors.white), 85 | ), 86 | Container( 87 | height: 0.5, 88 | width: 18, 89 | margin: EdgeInsets.only(top: 4, bottom: 4), 90 | color: group.color == '255,255,255' 91 | ? Colors.black87 92 | : Colors.white, 93 | ), 94 | Text( 95 | group.auth, 96 | style: TextStyle( 97 | fontSize: 11, 98 | color: group.color == '255,255,255' 99 | ? Colors.black87 100 | : Colors.white), 101 | ), 102 | ], 103 | ), 104 | ), 105 | flex: 2, 106 | ), 107 | ], 108 | ), 109 | ), 110 | ); 111 | } 112 | 113 | //通知 114 | Container _renderNotificationText() { 115 | return Container( 116 | height: 38, 117 | width: double.infinity, 118 | color: Color.fromARGB(255, 254, 242, 233), 119 | child: Center( 120 | child: Text( 121 | "禁止商用盗版否则后果自负", 122 | style: 123 | TextStyle(color: Color.fromARGB(255, 254, 113, 37), fontSize: 15), 124 | ), 125 | ), 126 | ); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /lib/model/comment.dart: -------------------------------------------------------------------------------- 1 | class Comment { 2 | int commentId; 3 | String createTime; 4 | Owner owner; 5 | String text; 6 | int likesCount; 7 | int rewardsCount; 8 | int repliesCount; 9 | List repliedComments; 10 | 11 | Comment({this.commentId, 12 | this.createTime, 13 | this.owner, 14 | this.text, 15 | this.likesCount, 16 | this.rewardsCount, 17 | this.repliesCount, 18 | this.repliedComments}); 19 | 20 | Comment.fromJson(Map json) { 21 | commentId = json['comment_id']; 22 | createTime = json['create_time']; 23 | owner = json['owner'] != null ? new Owner.fromJson(json['owner']) : null; 24 | text = json['text']; 25 | likesCount = json['likes_count']; 26 | rewardsCount = json['rewards_count']; 27 | repliesCount = json['replies_count']; 28 | if (json['replied_comments'] != null) { 29 | repliedComments = new List(); 30 | json['replied_comments'].forEach((v) { 31 | repliedComments.add(new RepliedComments.fromJson(v)); 32 | }); 33 | } 34 | } 35 | 36 | Map toJson() { 37 | final Map data = new Map(); 38 | data['comment_id'] = this.commentId; 39 | data['create_time'] = this.createTime; 40 | if (this.owner != null) { 41 | data['owner'] = this.owner.toJson(); 42 | } 43 | data['text'] = this.text; 44 | data['likes_count'] = this.likesCount; 45 | data['rewards_count'] = this.rewardsCount; 46 | data['replies_count'] = this.repliesCount; 47 | if (this.repliedComments != null) { 48 | data['replied_comments'] = 49 | this.repliedComments.map((v) => v.toJson()).toList(); 50 | } 51 | return data; 52 | } 53 | } 54 | 55 | class Owner { 56 | int userId; 57 | String name; 58 | String avatarUrl; 59 | 60 | Owner({this.userId, this.name, this.avatarUrl}); 61 | 62 | Owner.fromJson(Map json) { 63 | userId = json['user_id']; 64 | name = json['name']; 65 | avatarUrl = json['avatar_url']; 66 | } 67 | 68 | Map toJson() { 69 | final Map data = new Map(); 70 | data['user_id'] = this.userId; 71 | data['name'] = this.name; 72 | data['avatar_url'] = this.avatarUrl; 73 | return data; 74 | } 75 | } 76 | 77 | class RepliedComments { 78 | int commentId; 79 | String createTime; 80 | Owner owner; 81 | String text; 82 | int likesCount; 83 | int rewardsCount; 84 | Repliee repliee; 85 | 86 | RepliedComments({this.commentId, 87 | this.createTime, 88 | this.owner, 89 | this.text, 90 | this.likesCount, 91 | this.rewardsCount, 92 | this.repliee}); 93 | 94 | RepliedComments.fromJson(Map json) { 95 | commentId = json['comment_id']; 96 | createTime = json['create_time']; 97 | owner = json['owner'] != null ? new Owner.fromJson(json['owner']) : null; 98 | text = json['text']; 99 | likesCount = json['likes_count']; 100 | rewardsCount = json['rewards_count']; 101 | repliee = 102 | json['repliee'] != null ? new Repliee.fromJson(json['repliee']) : null; 103 | } 104 | 105 | Map toJson() { 106 | final Map data = new Map(); 107 | data['comment_id'] = this.commentId; 108 | data['create_time'] = this.createTime; 109 | if (this.owner != null) { 110 | data['owner'] = this.owner.toJson(); 111 | } 112 | data['text'] = this.text; 113 | data['likes_count'] = this.likesCount; 114 | data['rewards_count'] = this.rewardsCount; 115 | if (this.repliee != null) { 116 | data['repliee'] = this.repliee.toJson(); 117 | } 118 | return data; 119 | } 120 | } 121 | 122 | class Repliee { 123 | int userId; 124 | String name; 125 | String avatarUrl; 126 | 127 | Repliee({this.userId, this.name, this.avatarUrl}); 128 | 129 | Repliee.fromJson(Map json) { 130 | userId = json['user_id']; 131 | name = json['name']; 132 | avatarUrl = json['avatar_url']; 133 | } 134 | 135 | Map toJson() { 136 | final Map data = new Map(); 137 | data['user_id'] = this.userId; 138 | data['name'] = this.name; 139 | data['avatar_url'] = this.avatarUrl; 140 | return data; 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /lib/view/list_item_comment.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:gxxq/model/comment.dart'; 3 | import 'package:gxxq/util/date_util.dart'; 4 | import 'package:gxxq/util/element_parser.dart'; 5 | import '../constant.dart'; 6 | import '../model/topic.dart'; 7 | 8 | class CommentListItem extends StatelessWidget { 9 | final Comment _comment; 10 | 11 | CommentListItem(this._comment); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Column( 16 | crossAxisAlignment: CrossAxisAlignment.start, 17 | children: [ 18 | _avatarNameTime(), 19 | _renderContentText(context), 20 | _renderChildComments(context), 21 | _line(), 22 | ], 23 | ); 24 | } 25 | 26 | /* 渲染文本 */ 27 | Widget _renderContentText(BuildContext context) { 28 | if (_comment.text != null) { 29 | Widget child; 30 | if (ElementParser.hasE(_comment.text)) { 31 | final styleBlack = TextStyle(color: Colors.black); 32 | final textSpans = []; 33 | 34 | ParseResult parseResult = 35 | ElementParser.genEText(_comment.text, context); 36 | 37 | textSpans.addAll(parseResult.textSpans); 38 | textSpans 39 | .add(TextSpan(text: parseResult.textResult, style: styleBlack)); 40 | 41 | child = RichText( 42 | text: TextSpan( 43 | style: TextStyle(fontSize: 15), 44 | children: textSpans, 45 | ), 46 | ); 47 | } else { 48 | child = Text( 49 | _comment.text, 50 | style: TextStyle(fontSize: 15), 51 | ); 52 | } 53 | 54 | return Padding( 55 | padding: EdgeInsets.only(left: 54, top: 6, right: 16), 56 | child: child, 57 | ); 58 | } else 59 | return Container(); 60 | } 61 | 62 | //头像 63 | Widget _avatarNameTime() { 64 | return Padding( 65 | padding: EdgeInsets.only(left: 16, top: 14), 66 | child: Row( 67 | children: [ 68 | ClipOval( 69 | child: Image.network( 70 | _comment.owner.avatarUrl, 71 | width: 30, 72 | height: 30, 73 | ), 74 | ), //头像 75 | 76 | Padding( 77 | padding: EdgeInsets.only(left: 8), 78 | child: Column( 79 | crossAxisAlignment: CrossAxisAlignment.start, 80 | children: [ 81 | Text( 82 | _comment.owner.name, 83 | style: TextStyle(color: BLUE_DARK), 84 | ), //名字 85 | 86 | Padding( 87 | padding: EdgeInsets.only(top: 1.5), 88 | child: Text( 89 | DateUtil.timeStr(_comment.createTime), 90 | style: TextStyle(color: Colors.black38, fontSize: 10), 91 | ), 92 | ), //时间 93 | ], 94 | ), 95 | ), 96 | ], 97 | ), 98 | ); 99 | } 100 | 101 | _line() { 102 | return Container( 103 | margin: EdgeInsets.only(top: 14), 104 | width: double.infinity, 105 | height: 0.5, 106 | color: Colors.black12, 107 | ); 108 | } 109 | 110 | /* 子评论 */ 111 | _renderChildComments(BuildContext context) { 112 | if (_comment.repliesCount != null) { 113 | const style = TextStyle(color: BLUE_DARK, fontSize: 15); 114 | const styleBlack = TextStyle(color: Colors.black87); 115 | 116 | final comments = []; 117 | _comment.repliedComments.forEach((showComments) { 118 | final textSpans = []; 119 | 120 | bool hasRepliee = showComments.repliee != null; 121 | //如果回复的是评论 122 | if (hasRepliee) { 123 | textSpans.add(TextSpan(text: '回复', style: styleBlack)); 124 | textSpans.add(TextSpan(text: '${showComments.repliee.name}: ')); 125 | } 126 | 127 | String comment; 128 | 129 | if (ElementParser.hasE(showComments.text)) { 130 | ParseResult parseResult = 131 | ElementParser.genEText(showComments.text, context); 132 | textSpans.addAll(parseResult.textSpans); 133 | comment = parseResult.textResult; 134 | } else 135 | comment = showComments.text; 136 | 137 | textSpans.add(TextSpan(text: comment, style: styleBlack)); 138 | 139 | comments.add(Padding( 140 | padding: EdgeInsets.only(top: 3), 141 | child: RichText( 142 | text: TextSpan( 143 | text: '${showComments.owner.name}' + (hasRepliee ? '' : ': '), 144 | children: textSpans, 145 | style: style), 146 | ), 147 | )); 148 | }); 149 | 150 | return Padding( 151 | padding: EdgeInsets.only(left: 54, top: 6, right: 16), 152 | child: Column( 153 | crossAxisAlignment: CrossAxisAlignment.start, 154 | children: comments, 155 | ), 156 | ); 157 | } else 158 | return Container(); 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | after_layout: 5 | dependency: transitive 6 | description: 7 | name: after_layout 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "1.0.7+2" 11 | async: 12 | dependency: transitive 13 | description: 14 | name: async 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "2.2.0" 18 | boolean_selector: 19 | dependency: transitive 20 | description: 21 | name: boolean_selector 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.0.4" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "1.1.2" 32 | collection: 33 | dependency: transitive 34 | description: 35 | name: collection 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "1.14.11" 39 | csslib: 40 | dependency: transitive 41 | description: 42 | name: csslib 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "0.16.1" 46 | cupertino_icons: 47 | dependency: "direct main" 48 | description: 49 | name: cupertino_icons 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "0.1.2" 53 | flutter: 54 | dependency: "direct main" 55 | description: flutter 56 | source: sdk 57 | version: "0.0.0" 58 | flutter_test: 59 | dependency: "direct dev" 60 | description: flutter 61 | source: sdk 62 | version: "0.0.0" 63 | fluttertoast: 64 | dependency: "direct main" 65 | description: 66 | name: fluttertoast 67 | url: "https://pub.flutter-io.cn" 68 | source: hosted 69 | version: "3.1.0" 70 | html: 71 | dependency: "direct main" 72 | description: 73 | name: html 74 | url: "https://pub.flutter-io.cn" 75 | source: hosted 76 | version: "0.14.0+2" 77 | intl: 78 | dependency: "direct main" 79 | description: 80 | name: intl 81 | url: "https://pub.flutter-io.cn" 82 | source: hosted 83 | version: "0.15.8" 84 | matcher: 85 | dependency: transitive 86 | description: 87 | name: matcher 88 | url: "https://pub.flutter-io.cn" 89 | source: hosted 90 | version: "0.12.5" 91 | meta: 92 | dependency: transitive 93 | description: 94 | name: meta 95 | url: "https://pub.flutter-io.cn" 96 | source: hosted 97 | version: "1.1.6" 98 | path: 99 | dependency: transitive 100 | description: 101 | name: path 102 | url: "https://pub.flutter-io.cn" 103 | source: hosted 104 | version: "1.6.2" 105 | pedantic: 106 | dependency: transitive 107 | description: 108 | name: pedantic 109 | url: "https://pub.flutter-io.cn" 110 | source: hosted 111 | version: "1.7.0" 112 | photo_view: 113 | dependency: "direct main" 114 | description: 115 | name: photo_view 116 | url: "https://pub.flutter-io.cn" 117 | source: hosted 118 | version: "0.4.2" 119 | quiver: 120 | dependency: transitive 121 | description: 122 | name: quiver 123 | url: "https://pub.flutter-io.cn" 124 | source: hosted 125 | version: "2.0.3" 126 | sky_engine: 127 | dependency: transitive 128 | description: flutter 129 | source: sdk 130 | version: "0.0.99" 131 | source_span: 132 | dependency: transitive 133 | description: 134 | name: source_span 135 | url: "https://pub.flutter-io.cn" 136 | source: hosted 137 | version: "1.5.5" 138 | stack_trace: 139 | dependency: transitive 140 | description: 141 | name: stack_trace 142 | url: "https://pub.flutter-io.cn" 143 | source: hosted 144 | version: "1.9.3" 145 | stream_channel: 146 | dependency: transitive 147 | description: 148 | name: stream_channel 149 | url: "https://pub.flutter-io.cn" 150 | source: hosted 151 | version: "2.0.0" 152 | string_scanner: 153 | dependency: transitive 154 | description: 155 | name: string_scanner 156 | url: "https://pub.flutter-io.cn" 157 | source: hosted 158 | version: "1.0.4" 159 | term_glyph: 160 | dependency: transitive 161 | description: 162 | name: term_glyph 163 | url: "https://pub.flutter-io.cn" 164 | source: hosted 165 | version: "1.1.0" 166 | test_api: 167 | dependency: transitive 168 | description: 169 | name: test_api 170 | url: "https://pub.flutter-io.cn" 171 | source: hosted 172 | version: "0.2.5" 173 | typed_data: 174 | dependency: transitive 175 | description: 176 | name: typed_data 177 | url: "https://pub.flutter-io.cn" 178 | source: hosted 179 | version: "1.1.6" 180 | vector_math: 181 | dependency: transitive 182 | description: 183 | name: vector_math 184 | url: "https://pub.flutter-io.cn" 185 | source: hosted 186 | version: "2.0.8" 187 | sdks: 188 | dart: ">=2.2.2 <3.0.0" 189 | flutter: ">=1.5.9-pre.94 <2.0.0" 190 | -------------------------------------------------------------------------------- /lib/page/topics_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluttertoast/fluttertoast.dart'; 3 | import 'package:gxxq/constant.dart'; 4 | import 'package:gxxq/model/topic.dart'; 5 | import 'package:gxxq/model/topic_type.dart'; 6 | import 'package:gxxq/view/list_item_sticky.dart'; 7 | import 'package:gxxq/view/list_item_topic.dart'; 8 | import '../model/group.dart'; 9 | import '../util/view_util.dart'; 10 | 11 | class TopicsPage extends StatefulWidget { 12 | final Group _group; 13 | int data; 14 | 15 | TopicsPage(this._group); 16 | 17 | @override 18 | State createState() => _TopicsPageState(_group, data); 19 | } 20 | 21 | class _TopicsPageState extends State { 22 | final Group _group; 23 | var _topics = new List(); 24 | final int data; 25 | 26 | _TopicsPageState(this._group, this.data); 27 | 28 | ScrollController _controller; 29 | 30 | @override 31 | void initState() { 32 | super.initState(); 33 | _getData(); 34 | _getSticky(); 35 | _controller = ScrollController(); 36 | _controller.addListener(() { 37 | if (_controller.position.pixels == _controller.position.maxScrollExtent) { 38 | //上拉加载更多 39 | } 40 | }); 41 | } 42 | 43 | //获取置顶 44 | void _getSticky() { 45 | var topics = STICKY[_group.id]["resp_data"]['topics']; 46 | setState(() { 47 | for (int i = topics.length - 1; i > -1; i--) { 48 | var topic = Topic.fromJson(topics[i]); 49 | _topics.insert(0, topic); 50 | } 51 | }); 52 | } 53 | 54 | @override 55 | Widget build(BuildContext context) { 56 | return new Scaffold( 57 | body: CustomScrollView( 58 | controller: _controller, 59 | slivers: [ 60 | _renderSliverBar(), 61 | SliverList( 62 | delegate: new SliverChildBuilderDelegate( 63 | (BuildContext context, int index) { 64 | if (index < _topics.length) { 65 | var topic = _topics[index]; 66 | if (topic.sticky == true) 67 | return StickyListItem(topic); 68 | else 69 | return TopicListItem(topic); 70 | } else { 71 | return Offstage( 72 | offstage: _topics.length == 0, 73 | child: Padding( 74 | padding: EdgeInsets.only(top: 12, bottom: 12), 75 | child: Text( 76 | '没有更多了', 77 | textAlign: TextAlign.center, 78 | style: TextStyle(fontSize: 15, color: Colors.black54), 79 | ), 80 | ), 81 | ); 82 | } 83 | }, childCount: _topics.length + 1), 84 | ), 85 | ], 86 | ), 87 | ); 88 | } 89 | 90 | _getData() { 91 | setState(() { 92 | TOPICS[_group.id]["resp_data"]['topics'].forEach((v) { 93 | var topic = Topic.fromJson(v); 94 | _topics.add(topic); 95 | }); 96 | }); 97 | } 98 | 99 | SliverAppBar _renderSliverBar() { 100 | final menus = [ 101 | TopicType('digests', 'assets/images/ic_jinghua.png', '精华主题'), 102 | TopicType('by_owner', 103 | 'assets/images/ic_filter_groupowner_topic_normal.png', '只看题主'), 104 | TopicType('with_images', 'assets/images/ic_filter_image_topic_normal.png', 105 | '图片主题'), 106 | TopicType('with_files', 'assets/images/ic_filter_file_topic_normal.png', 107 | '文件主题'), 108 | TopicType('questions', 109 | 'assets/images/ic_filter_question_topic_normal.png', '问答主题'), 110 | TopicType('all', 'assets/images/ic_filter_all_topic_normal.png', '所有主题') 111 | ]; 112 | 113 | var items = List>(); 114 | menus.forEach((topicType) => items.add(PopupMenuItem( 115 | value: topicType, 116 | child: Wrap( 117 | spacing: topicType.scope == 'digests' ? 8 : 12, 118 | crossAxisAlignment: WrapCrossAlignment.center, 119 | children: [ 120 | topicType.scope == 'digests' 121 | ? Image.asset(topicType.image, width: 31, height: 28) 122 | : Padding( 123 | padding: EdgeInsets.only(left: 4), 124 | child: 125 | Image.asset(topicType.image, width: 23, height: 23), 126 | ), 127 | Text(topicType.text), 128 | PopupMenuDivider(), 129 | ])))); 130 | 131 | return SliverAppBar( 132 | leading: IconButton( 133 | icon: Image.asset( 134 | 'assets/images/back.png', 135 | width: 21, 136 | height: 21, 137 | ), 138 | onPressed: () => Navigator.pop(context), 139 | ), 140 | 141 | actions: [ 142 | InkWell( 143 | highlightColor: Colors.black12, 144 | splashColor: Colors.black12, 145 | onTap: () { 146 | showMenu( 147 | context: context, 148 | items: items, 149 | position: RelativeRect.fromLTRB(1, 30, 0, 0)) 150 | .then((topicType) { 151 | Fluttertoast.showToast(msg: '暂不支持'); 152 | }); 153 | }, 154 | child: Padding( 155 | padding: EdgeInsets.only(left: 15, right: 15), 156 | child: Icon(Icons.format_line_spacing), 157 | ), 158 | ), 159 | ], 160 | 161 | //标题是否居中 162 | elevation: 1, 163 | //阴影的高度 164 | forceElevated: false, 165 | //拉满时是否显示阴影 166 | iconTheme: IconThemeData( 167 | color: Colors.white, 168 | ), 169 | //所有的icon的样式,不仅仅是左侧的,右侧的也会改变 170 | 171 | expandedHeight: 200.0, 172 | //默认高度是状态栏和导航栏的高度,如果有滚动视差的话,要大于前两者的高度 173 | // floating: true, //滑动到最上面,再滑动是否隐藏导航栏的文字和标题等的具体内容,为true是隐藏,为false是不隐藏 174 | pinned: true, 175 | //是否固定导航栏 176 | // snap:false, //只跟floating相对应,如果为true,floating必须为true,也就是向下滑动一点儿,整个大背景就会动画显示全部,网上滑动整个导航栏的内容就会消失 177 | flexibleSpace: new FlexibleSpaceBar( 178 | centerTitle: true, 179 | title: Text( 180 | _group.name, 181 | style: TextStyle( 182 | color: Colors.white, 183 | fontSize: 18, 184 | ), 185 | ), 186 | background: Stack( 187 | children: [ 188 | Image.network( 189 | _group.image, 190 | fit: BoxFit.cover, 191 | width: double.infinity, 192 | ), 193 | Center( 194 | child: Container( 195 | padding: EdgeInsets.all(2), 196 | width: 74.0, 197 | height: 74.0, 198 | decoration: BoxDecoration( 199 | color: Colors.white, 200 | borderRadius: BorderRadius.circular(90), 201 | ), 202 | child: ClipOval( 203 | child: ViewUtil.fadeImage(_group.avatarUrl), 204 | ), 205 | ), 206 | ) 207 | ], 208 | ), 209 | collapseMode: CollapseMode.parallax, 210 | ), 211 | ); 212 | } 213 | } 214 | -------------------------------------------------------------------------------- /lib/model/topic.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | import '../model/topic_image.dart'; 4 | 5 | class Topic { 6 | int topicId; 7 | IGroup group; 8 | String type; 9 | Talk talk; 10 | List latestLikes; 11 | List showComments; 12 | int likesCount; 13 | int rewardsCount; 14 | int commentsCount; 15 | int readingCount; 16 | bool digested; 17 | bool sticky; 18 | String createTime; 19 | UserSpecific userSpecific; 20 | Question question; 21 | Answer answer; 22 | 23 | Topic({this.topicId, 24 | this.group, 25 | this.type, 26 | this.talk, 27 | this.latestLikes, 28 | this.showComments, 29 | this.likesCount, 30 | this.rewardsCount, 31 | this.commentsCount, 32 | this.readingCount, 33 | this.digested, 34 | this.sticky, 35 | this.createTime, 36 | this.question, 37 | this.answer, 38 | this.userSpecific}); 39 | 40 | Topic.fromJson(Map json) { 41 | if (json['topic_id'] != null) 42 | topicId = json['topic_id']; 43 | group = json['group'] != null ? new IGroup.fromJson(json['group']) : null; 44 | type = json['type']; 45 | talk = json['talk'] != null ? new Talk.fromJson(json['talk']) : null; 46 | if (json['latest_likes'] != null) { 47 | latestLikes = new List(); 48 | json['latest_likes'].forEach((v) { 49 | latestLikes.add(new LatestLikes.fromJson(v)); 50 | }); 51 | } 52 | if (json['show_comments'] != null) { 53 | showComments = new List(); 54 | json['show_comments'].forEach((v) { 55 | showComments.add(new ShowComments.fromJson(v)); 56 | }); 57 | } 58 | likesCount = json['likes_count']; 59 | rewardsCount = json['rewards_count']; 60 | commentsCount = json['comments_count']; 61 | readingCount = json['reading_count']; 62 | digested = json['digested']; 63 | sticky = json['sticky']; 64 | createTime = json['create_time']; 65 | userSpecific = json['user_specific'] != null 66 | ? new UserSpecific.fromJson(json['user_specific']) 67 | : null; 68 | 69 | answer = 70 | json['answer'] != null ? new Answer.fromJson(json['answer']) : null; 71 | 72 | question = json['question'] != null 73 | ? new Question.fromJson(json['question']) 74 | : null; 75 | } 76 | 77 | Map toJson() { 78 | final Map data = new Map(); 79 | data['topic_id'] = this.topicId; 80 | if (this.group != null) { 81 | data['group'] = this.group.toJson(); 82 | } 83 | data['type'] = this.type; 84 | if (this.talk != null) { 85 | data['talk'] = this.talk.toJson(); 86 | } 87 | if (this.latestLikes != null) { 88 | data['latest_likes'] = this.latestLikes.map((v) => v.toJson()).toList(); 89 | } 90 | if (this.showComments != null) { 91 | data['show_comments'] = this.showComments.map((v) => v.toJson()).toList(); 92 | } 93 | data['likes_count'] = this.likesCount; 94 | data['rewards_count'] = this.rewardsCount; 95 | data['comments_count'] = this.commentsCount; 96 | data['reading_count'] = this.readingCount; 97 | data['digested'] = this.digested; 98 | data['sticky'] = this.sticky; 99 | data['create_time'] = this.createTime; 100 | if (this.userSpecific != null) { 101 | data['user_specific'] = this.userSpecific.toJson(); 102 | } 103 | return data; 104 | } 105 | } 106 | 107 | class IGroup { 108 | int groupId; 109 | String name; 110 | 111 | IGroup({this.groupId, this.name}); 112 | 113 | IGroup.fromJson(Map json) { 114 | groupId = json['group_id']; 115 | name = json['name']; 116 | } 117 | 118 | Map toJson() { 119 | final Map data = new Map(); 120 | data['group_id'] = this.groupId; 121 | data['name'] = this.name; 122 | return data; 123 | } 124 | } 125 | 126 | class Talk { 127 | Owner owner; 128 | String text; 129 | List images; 130 | List files; 131 | 132 | Talk({this.owner, this.text}); 133 | 134 | Talk.fromJson(Map json) { 135 | owner = json['owner'] != null ? new Owner.fromJson(json['owner']) : null; 136 | text = json['text']; 137 | if (json['images'] != null) { 138 | images = new List(); 139 | json['images'].forEach((v) { 140 | images.add(new TopicImage.fromJson(v)); 141 | }); 142 | } 143 | if (json['files'] != null) { 144 | files = new List(); 145 | json['files'].forEach((v) { 146 | files.add(new File.fromJson(v)); 147 | }); 148 | } 149 | } 150 | 151 | Map toJson() { 152 | final Map data = new Map(); 153 | if (this.owner != null) { 154 | data['owner'] = this.owner.toJson(); 155 | } 156 | data['text'] = this.text; 157 | return data; 158 | } 159 | } 160 | 161 | class File { 162 | int fileId; 163 | String name; 164 | String hash; 165 | int size; 166 | int downloadCount; 167 | String createTime; 168 | int duration; 169 | 170 | File({this.fileId, 171 | this.name, 172 | this.hash, 173 | this.size, 174 | this.downloadCount, 175 | this.createTime, 176 | this.duration}); 177 | 178 | File.fromJson(Map json) { 179 | fileId = json['file_id']; 180 | name = json['name']; 181 | hash = json['hash']; 182 | size = json['size']; 183 | downloadCount = json['download_count']; 184 | createTime = json['create_time']; 185 | duration = json['duration']; 186 | } 187 | } 188 | 189 | class Owner { 190 | int userId; 191 | String name; 192 | String avatarUrl; 193 | 194 | Owner({this.userId, this.name, this.avatarUrl}); 195 | 196 | Owner.fromJson(Map json) { 197 | userId = json['user_id']; 198 | name = json['name']; 199 | avatarUrl = json['avatar_url']; 200 | } 201 | 202 | Map toJson() { 203 | final Map data = new Map(); 204 | data['user_id'] = this.userId; 205 | data['name'] = this.name; 206 | data['avatar_url'] = this.avatarUrl; 207 | return data; 208 | } 209 | } 210 | 211 | class LatestLikes { 212 | String createTime; 213 | Owner owner; 214 | 215 | LatestLikes({this.createTime, this.owner}); 216 | 217 | LatestLikes.fromJson(Map json) { 218 | createTime = json['create_time']; 219 | owner = json['owner'] != null ? new Owner.fromJson(json['owner']) : null; 220 | } 221 | 222 | Map toJson() { 223 | final Map data = new Map(); 224 | data['create_time'] = this.createTime; 225 | if (this.owner != null) { 226 | data['owner'] = this.owner.toJson(); 227 | } 228 | return data; 229 | } 230 | } 231 | 232 | class ShowComments { 233 | int commentId; 234 | String createTime; 235 | Owner owner; 236 | String text; 237 | int likesCount; 238 | int rewardsCount; 239 | Owner repliee; 240 | 241 | ShowComments({this.commentId, 242 | this.createTime, 243 | this.owner, 244 | this.text, 245 | this.likesCount, 246 | this.rewardsCount, 247 | this.repliee}); 248 | 249 | ShowComments.fromJson(Map json) { 250 | commentId = json['comment_id']; 251 | createTime = json['create_time']; 252 | owner = json['owner'] != null ? new Owner.fromJson(json['owner']) : null; 253 | text = json['text']; 254 | likesCount = json['likes_count']; 255 | rewardsCount = json['rewards_count']; 256 | repliee = 257 | json['repliee'] != null ? new Owner.fromJson(json['repliee']) : null; 258 | } 259 | 260 | Map toJson() { 261 | final Map data = new Map(); 262 | data['comment_id'] = this.commentId; 263 | data['create_time'] = this.createTime; 264 | if (this.owner != null) { 265 | data['owner'] = this.owner.toJson(); 266 | } 267 | data['text'] = this.text; 268 | data['likes_count'] = this.likesCount; 269 | data['rewards_count'] = this.rewardsCount; 270 | if (this.repliee != null) { 271 | data['repliee'] = this.repliee.toJson(); 272 | } 273 | 274 | return data; 275 | } 276 | } 277 | 278 | class UserSpecific { 279 | bool liked; 280 | bool subscribed; 281 | 282 | UserSpecific({this.liked, this.subscribed}); 283 | 284 | UserSpecific.fromJson(Map json) { 285 | liked = json['liked']; 286 | subscribed = json['subscribed']; 287 | } 288 | 289 | Map toJson() { 290 | final Map data = new Map(); 291 | data['liked'] = this.liked; 292 | data['subscribed'] = this.subscribed; 293 | return data; 294 | } 295 | } 296 | 297 | class Answer { 298 | Owner owner; 299 | String text; 300 | 301 | Answer({this.owner, this.text}); 302 | 303 | Answer.fromJson(Map json) { 304 | owner = json['owner'] != null ? new Owner.fromJson(json['owner']) : null; 305 | 306 | text = json['text']; 307 | } 308 | } 309 | 310 | class Question { 311 | Owner questionee; 312 | Owner owner; 313 | String text; 314 | bool expired; 315 | bool anonymous; 316 | 317 | Question( 318 | {this.questionee, this.text, this.expired, this.anonymous, this.owner}); 319 | 320 | Question.fromJson(Map json) { 321 | questionee = json['questionee'] != null 322 | ? new Owner.fromJson(json['questionee']) 323 | : null; 324 | owner = json['owner'] != null ? new Owner.fromJson(json['owner']) : null; 325 | 326 | text = json['text']; 327 | expired = json['expired']; 328 | anonymous = json['anonymous']; 329 | } 330 | } 331 | -------------------------------------------------------------------------------- /lib/page/topic_detail.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:gxxq/model/comment.dart'; 5 | import 'package:gxxq/util/date_util.dart'; 6 | import 'package:gxxq/util/element_parser.dart'; 7 | import 'package:gxxq/view/list_item_comment.dart'; 8 | import 'package:gxxq/view/topic_images.dart'; 9 | 10 | 11 | import '../constant.dart'; 12 | import '../model/topic.dart'; 13 | 14 | import '../util/view_util.dart'; 15 | 16 | class TopicDetailPage extends StatefulWidget { 17 | final Topic _topic; 18 | 19 | TopicDetailPage(this._topic); 20 | 21 | @override 22 | State createState() => _TopicDetailState(_topic); 23 | } 24 | 25 | class _TopicDetailState extends State { 26 | final Topic _topic; 27 | List _comments = List(); 28 | ScrollController _controller; 29 | 30 | _TopicDetailState(this._topic) { 31 | _controller = ScrollController(); 32 | _controller.addListener(() { 33 | if (_controller.position.pixels == _controller.position.maxScrollExtent && 34 | _comments.length % 30 == 0) { 35 | _getComments(isLoadMore: _comments.length > 0); 36 | } 37 | }); 38 | } 39 | 40 | @override 41 | void initState() { 42 | super.initState(); 43 | _getComments(); 44 | } 45 | 46 | @override 47 | Widget build(BuildContext context) { 48 | return Scaffold( 49 | appBar: ViewUtil.getAppBar('详情', context), 50 | body: SingleChildScrollView( 51 | controller: _controller, 52 | child: Column( 53 | crossAxisAlignment: CrossAxisAlignment.start, 54 | children: [ 55 | Padding( 56 | child: _avatarNameTime(), 57 | padding: EdgeInsets.all(16), 58 | ), 59 | _renderQuestion(), 60 | _renderContentText(context), 61 | _renderFiles(), 62 | _renderImages(context), 63 | _renderLikePeople(), 64 | _line(), 65 | // Column( 66 | // children: _comments.map((c) => CommentListItem(c)).toList(), 67 | // ), 68 | Container( 69 | width: double.infinity, 70 | child: Offstage( 71 | offstage: _comments.length == 0, 72 | child: Padding( 73 | padding: EdgeInsets.only(top: 12, bottom: 12), 74 | child: Text( 75 | _comments.length % 30 == 0 ? '加载中...' : '没有更多了', 76 | textAlign: TextAlign.center, 77 | style: TextStyle(color: Colors.black54), 78 | ), 79 | ), 80 | ), 81 | ) 82 | ], 83 | ), 84 | ), 85 | ); 86 | } 87 | 88 | _line() { 89 | return Container( 90 | margin: EdgeInsets.only(top: 16), 91 | width: double.infinity, 92 | height: 0.5, 93 | color: Colors.black12, 94 | ); 95 | } 96 | 97 | //头像 98 | Widget _avatarNameTime() { 99 | var type = _topic.type; 100 | if (type == 'talk' || type == 'q&a') { 101 | return Row( 102 | children: [ 103 | ClipOval( 104 | child: Image.network( 105 | type == 'talk' 106 | ? _topic.talk.owner.avatarUrl 107 | : _topic.answer.owner.avatarUrl, 108 | width: 33, 109 | height: 33, 110 | ), 111 | ), //头像 112 | 113 | Padding( 114 | padding: EdgeInsets.only(left: 8), 115 | child: Column( 116 | crossAxisAlignment: CrossAxisAlignment.start, 117 | children: [ 118 | Text( 119 | type == 'talk' 120 | ? _topic.talk.owner.name 121 | : _topic.answer.owner.name, 122 | style: TextStyle(color: BLUE_DARK, fontSize: 12), 123 | ), //名字 124 | 125 | Padding( 126 | padding: EdgeInsets.only(top: 1.5), 127 | child: Text( 128 | DateUtil.timeStr(_topic.createTime), 129 | style: TextStyle(color: Colors.black38, fontSize: 9), 130 | ), 131 | ), 132 | //时间 133 | ], 134 | ), 135 | ), 136 | ], 137 | ); 138 | } else { 139 | return Container(); 140 | } 141 | } 142 | 143 | /* 渲染文本 */ 144 | Widget _renderContentText(BuildContext context) { 145 | var type = _topic.type; 146 | if ((type == 'talk' && _topic.talk.text != null) || 147 | (type == 'q&a' && _topic.answer.text != null)) { 148 | Widget child; 149 | if (ElementParser.hasE( 150 | type == 'talk' ? _topic.talk.text : _topic.answer.text)) { 151 | final styleBlack = TextStyle(color: Colors.black); 152 | final textSpans = []; 153 | 154 | ParseResult parseResult = ElementParser.genEText( 155 | type == 'talk' ? _topic.talk.text : _topic.answer.text, context); 156 | 157 | textSpans.addAll(parseResult.textSpans); 158 | textSpans 159 | .add(TextSpan(text: parseResult.textResult, style: styleBlack)); 160 | 161 | child = RichText( 162 | text: TextSpan( 163 | style: TextStyle(fontSize: 15), 164 | children: textSpans, 165 | ), 166 | ); 167 | } else { 168 | child = Text( 169 | type == 'talk' ? _topic.talk.text : _topic.answer.text, 170 | style: TextStyle(fontSize: 15), 171 | ); 172 | } 173 | 174 | return Padding( 175 | padding: EdgeInsets.only(left: 20, right: 16), 176 | child: child, 177 | ); 178 | } else 179 | return Container(); 180 | } 181 | 182 | //渲染问题 183 | Widget _renderQuestion() { 184 | if (_topic.type == 'q&a') { 185 | String name = 186 | _topic.question.anonymous ? '匿名用户' : _topic.question.owner.name; 187 | 188 | var textSpans = List(); 189 | textSpans.add( 190 | TextSpan(text: ' 回复: ', style: TextStyle(color: Colors.black87))); 191 | 192 | if (ElementParser.hasE(_topic.question.text)) { 193 | final styleBlack = TextStyle(color: Colors.black); 194 | 195 | ParseResult parseResult = 196 | ElementParser.genEText(_topic.question.text, context); 197 | 198 | textSpans.addAll(parseResult.textSpans); 199 | textSpans 200 | .add(TextSpan(text: parseResult.textResult, style: styleBlack)); 201 | } else { 202 | textSpans.add(TextSpan( 203 | text: _topic.question.text, 204 | style: TextStyle(color: Colors.black87))); 205 | } 206 | 207 | return Container( 208 | padding: EdgeInsets.only(left: 7), 209 | margin: EdgeInsets.only(left: 20, right: 16, bottom: 5), 210 | decoration: BoxDecoration( 211 | border: Border( 212 | left: BorderSide( 213 | color: Color.fromARGB(255, 208, 208, 208), width: 3)), 214 | ), 215 | child: RichText( 216 | maxLines: 10, 217 | overflow: TextOverflow.ellipsis, 218 | text: TextSpan( 219 | text: name, 220 | style: TextStyle( 221 | color: name == '匿名用户' ? Colors.grey : BLUE_DARK, 222 | fontSize: 15, 223 | ), 224 | children: textSpans, 225 | ), 226 | ), 227 | ); 228 | } else 229 | return Container(); 230 | } 231 | 232 | //图片 233 | _renderImages(BuildContext context) { 234 | if (_topic.type == 'talk' && _topic.talk.images != null) { 235 | var renderWidget; 236 | var images = _topic.talk.images; 237 | 238 | if (images.length == 1) { 239 | //单图 240 | renderWidget = TopicImages.singleImage(images, context); 241 | } else if (images.length == 2) { 242 | //双图 243 | renderWidget = TopicImages.doubleImage(images, context); 244 | } else if (images.length == 4) { 245 | //四图 246 | renderWidget = TopicImages.fourImages(images, context); 247 | } else { 248 | //多图 249 | renderWidget = TopicImages.multiImages(images, context); 250 | } 251 | 252 | return Padding( 253 | padding: EdgeInsets.only(left: 18, top: 12), 254 | child: renderWidget, 255 | ); 256 | } else 257 | return Container(); 258 | } 259 | 260 | //点赞 261 | Widget _renderLikePeople() { 262 | if (_topic.likesCount > 0) { 263 | var likeTexts = []; 264 | likeTexts.add( 265 | Image.asset( 266 | 'assets/images/ic_topic_like_members.png', 267 | width: 15, 268 | height: 15, 269 | ), 270 | ); 271 | _topic.latestLikes.forEach((latestLike) { 272 | likeTexts.add(Text( 273 | '${latestLike.owner.name},', 274 | style: TextStyle(color: BLUE_DARK), 275 | )); 276 | }); 277 | return Padding( 278 | padding: EdgeInsets.only(left: 20, right: 16, top: 16), 279 | child: Wrap( 280 | crossAxisAlignment: WrapCrossAlignment.center, 281 | spacing: 6, 282 | children: likeTexts, 283 | ), 284 | ); 285 | } else 286 | return Container(); 287 | } 288 | 289 | //获取评论 290 | _getComments({isLoadMore = false}) { 291 | 292 | setState(() {_comments = _topic.showComments; 293 | 294 | }); 295 | } 296 | 297 | _renderFiles() { 298 | if (_topic.type == 'talk' && 299 | _topic.talk.files != null && 300 | _topic.talk.files.length > 0) { 301 | var widgets = []; 302 | _topic.talk.files.forEach((file) { 303 | widgets.add(GestureDetector( 304 | onTap: () { 305 | openfile(file); 306 | }, 307 | child: Container( 308 | margin: EdgeInsets.only(top: 2), 309 | color: Colors.grey[200], 310 | padding: EdgeInsets.only(top: 4, bottom: 4), 311 | child: Row( 312 | children: [ 313 | Icon(Icons.attach_file, color: GREEN), 314 | Expanded( 315 | flex: 1, 316 | child: Text( 317 | '附件: ' + file.name, 318 | overflow: TextOverflow.visible, 319 | maxLines: 1, 320 | )) 321 | ], 322 | ), 323 | ), 324 | )); 325 | }); 326 | 327 | return Padding( 328 | padding: EdgeInsets.only(left: 38, top: 9), 329 | child: Column( 330 | children: widgets, 331 | ), 332 | ); 333 | } else 334 | return Container(); 335 | } 336 | 337 | Future openfile(File file) async { 338 | // var sp = await SharedPreferences.getInstance(); 339 | // var headers = Map(); 340 | // headers[User_Agent] = sp.getString(User_Agent); 341 | // var data = await NetUtils.get('$ZSXQ_FILES/${file.fileId}/download_url', 342 | // headers: headers); 343 | // DownloadUrl downloadUrl = DownloadUrl.fromJson(data); 344 | // if (Platform.isIOS) 345 | // _launchURL(downloadUrl.downloadUrl); 346 | // else 347 | // MyPlugin.open(downloadUrl.downloadUrl, file.name); 348 | } 349 | 350 | } 351 | -------------------------------------------------------------------------------- /lib/view/list_item_topic.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'dart:io' as prefix0; 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:gxxq/util/element_parser.dart'; 6 | 7 | import '../constant.dart'; 8 | import '../model/topic.dart'; 9 | import '../page/topic_detail.dart'; 10 | import '../view/topic_images.dart'; 11 | import '../util/date_util.dart'; 12 | 13 | class TopicListItem extends StatelessWidget { 14 | final Topic _topic; 15 | 16 | TopicListItem(this._topic); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return InkWell( 21 | onTap: () { 22 | Navigator.push(context, CupertinoPageRoute(builder: (context) { 23 | return TopicDetailPage(_topic); 24 | })); 25 | }, 26 | child: Column( 27 | children: [ 28 | Padding( 29 | padding: EdgeInsets.all(16), 30 | child: Column( 31 | crossAxisAlignment: CrossAxisAlignment.start, 32 | children: [ 33 | _avatarNameTime(), 34 | _renderQuestion(context), 35 | _renderContentText(context), //内容文本 36 | _renderFiles(), 37 | _renderImages(context), 38 | _renderLikePeople(), 39 | _renderComments(context), 40 | ], 41 | ), 42 | ), 43 | _line(), //分割线 44 | ], 45 | )); 46 | } 47 | 48 | _renderFiles() { 49 | if (_topic.type == 'talk' && 50 | _topic.talk.files != null && 51 | _topic.talk.files.length > 0) { 52 | var widgets = []; 53 | _topic.talk.files.forEach((file) { 54 | widgets.add(GestureDetector( 55 | onTap: () { 56 | openfile(file); 57 | }, 58 | child: Container( 59 | margin: EdgeInsets.only(top: 2), 60 | color: Colors.grey[200], 61 | padding: EdgeInsets.only(top: 4, bottom: 4), 62 | child: Row( 63 | children: [ 64 | Icon(Icons.attach_file, color: GREEN), 65 | Expanded( 66 | flex: 1, 67 | child: Text( 68 | '附件: ' + file.name, 69 | overflow: TextOverflow.visible, 70 | maxLines: 1, 71 | )) 72 | ], 73 | ), 74 | ), 75 | )); 76 | }); 77 | 78 | return Padding( 79 | padding: EdgeInsets.only(left: 38, top: 9), 80 | child: Column( 81 | children: widgets, 82 | ), 83 | ); 84 | } else 85 | return Container(); 86 | } 87 | 88 | Future openfile(File file) async { 89 | 90 | } 91 | 92 | //图片 93 | _renderImages(BuildContext context) { 94 | if (_topic.type == 'talk' && _topic.talk.images != null) { 95 | var renderWidget; 96 | var images = _topic.talk.images; 97 | 98 | if (images.length == 1) { 99 | //单图 100 | renderWidget = TopicImages.singleImage(images, context); 101 | } else if (images.length == 2) { 102 | //双图 103 | renderWidget = TopicImages.doubleImage(images, context); 104 | } else if (images.length == 4) { 105 | //四图 106 | renderWidget = TopicImages.fourImages(images, context); 107 | } else { 108 | //多图 109 | renderWidget = TopicImages.multiImages(images, context); 110 | } 111 | 112 | return Padding( 113 | padding: EdgeInsets.only(left: 38, top: 9), 114 | child: renderWidget, 115 | ); 116 | } else 117 | return Container(); 118 | } 119 | 120 | /* 评论 */ 121 | _renderComments(BuildContext context) { 122 | if (_topic.commentsCount > 0) { 123 | const style = TextStyle(color: BLUE_DARK, fontSize: 15); 124 | const styleBlack = TextStyle(color: Colors.black87); 125 | 126 | final comments = []; 127 | _topic.showComments.forEach((showComments) { 128 | final textSpans = []; 129 | 130 | bool hasRepliee = showComments.repliee != null; 131 | //如果回复的是评论 132 | if (hasRepliee) { 133 | textSpans.add(TextSpan(text: '回复', style: styleBlack)); 134 | textSpans.add(TextSpan(text: '${showComments.repliee.name}: ')); 135 | } 136 | 137 | String comment; 138 | 139 | if (ElementParser.hasE(showComments.text)) { 140 | ParseResult parseResult = 141 | ElementParser.genEText(showComments.text, context); 142 | textSpans.addAll(parseResult.textSpans); 143 | comment = parseResult.textResult; 144 | } else 145 | comment = showComments.text; 146 | 147 | textSpans.add(TextSpan(text: comment, style: styleBlack)); 148 | 149 | comments.add(Padding( 150 | padding: EdgeInsets.only(top: 3), 151 | child: RichText( 152 | text: TextSpan( 153 | text: '${showComments.owner.name}' + (hasRepliee ? '' : ': '), 154 | children: textSpans, 155 | style: style), 156 | ), 157 | )); 158 | }); 159 | 160 | if (_topic.commentsCount > 8) { 161 | //查看更多 162 | comments.add( 163 | Padding( 164 | padding: EdgeInsets.only(top: 2), 165 | child: InkWell( 166 | onTap: () { 167 | Navigator.push(context, CupertinoPageRoute(builder: (context) { 168 | return TopicDetailPage(_topic); 169 | })); 170 | }, 171 | child: Text( 172 | '查看更多>', 173 | style: style, 174 | ), 175 | ), 176 | ), 177 | ); 178 | } 179 | 180 | return Padding( 181 | padding: EdgeInsets.only(left: 38, top: 6), 182 | child: Column( 183 | crossAxisAlignment: CrossAxisAlignment.start, 184 | children: comments, 185 | ), 186 | ); 187 | } else 188 | return Container(); 189 | } 190 | 191 | //点赞 192 | Widget _renderLikePeople() { 193 | if (_topic.likesCount > 0) { 194 | var likeTexts = []; 195 | likeTexts.add( 196 | Image.asset( 197 | 'assets/images/ic_topic_like_members.png', 198 | width: 15, 199 | height: 15, 200 | ), 201 | ); 202 | _topic.latestLikes.forEach((latestLike) { 203 | likeTexts.add(Text( 204 | '${latestLike.owner.name},', 205 | style: TextStyle(color: BLUE_DARK), 206 | )); 207 | }); 208 | return Padding( 209 | padding: EdgeInsets.only(left: 38, top: 9), 210 | child: Wrap( 211 | crossAxisAlignment: WrapCrossAlignment.center, 212 | spacing: 6, 213 | children: likeTexts, 214 | ), 215 | ); 216 | } else 217 | return Container(); 218 | } 219 | 220 | _line() { 221 | return Container( 222 | width: double.infinity, 223 | height: 0.5, 224 | color: Colors.black12, 225 | ); 226 | } 227 | 228 | //渲染问题 229 | Widget _renderQuestion(BuildContext context) { 230 | if (_topic.type == 'q&a') { 231 | String name = 232 | _topic.question.anonymous ? '匿名用户' : _topic.question.owner.name; 233 | 234 | var textSpans = List(); 235 | textSpans.add( 236 | TextSpan(text: ' 回复: ', style: TextStyle(color: Colors.black87))); 237 | 238 | if (ElementParser.hasE(_topic.question.text)) { 239 | final styleBlack = TextStyle(color: Colors.black); 240 | 241 | ParseResult parseResult = 242 | ElementParser.genEText(_topic.question.text, context); 243 | 244 | textSpans.addAll(parseResult.textSpans); 245 | textSpans 246 | .add(TextSpan(text: parseResult.textResult, style: styleBlack)); 247 | } else { 248 | textSpans.add(TextSpan( 249 | text: _topic.question.text, 250 | style: TextStyle(color: Colors.black87))); 251 | } 252 | 253 | return Container( 254 | padding: EdgeInsets.only(left: 7), 255 | margin: EdgeInsets.only(left: 38, top: 8), 256 | decoration: BoxDecoration( 257 | border: Border( 258 | left: BorderSide( 259 | color: Color.fromARGB(255, 208, 208, 208), width: 3)), 260 | ), 261 | child: RichText( 262 | maxLines: 10, 263 | overflow: TextOverflow.ellipsis, 264 | text: TextSpan( 265 | text: name, 266 | style: TextStyle( 267 | color: name == '匿名用户' ? Colors.grey : BLUE_DARK, 268 | fontSize: 15, 269 | ), 270 | children: textSpans, 271 | ), 272 | ), 273 | ); 274 | } else 275 | return Container(); 276 | } 277 | 278 | /* 渲染文本 */ 279 | Widget _renderContentText(BuildContext context) { 280 | var type = _topic.type; 281 | if ((type == 'talk' && _topic.talk.text != null) || 282 | (type == 'q&a' && _topic.answer.text != null)) { 283 | Widget child; 284 | if (ElementParser.hasE( 285 | type == 'talk' ? _topic.talk.text : _topic.answer.text)) { 286 | final styleBlack = TextStyle(color: Colors.black); 287 | final textSpans = []; 288 | 289 | ParseResult parseResult = ElementParser.genEText( 290 | type == 'talk' ? _topic.talk.text : _topic.answer.text, context); 291 | 292 | textSpans.addAll(parseResult.textSpans); 293 | textSpans 294 | .add(TextSpan(text: parseResult.textResult, style: styleBlack)); 295 | 296 | child = RichText( 297 | maxLines: 15, 298 | overflow: TextOverflow.ellipsis, 299 | text: TextSpan( 300 | style: TextStyle(fontSize: 15), 301 | children: textSpans, 302 | ), 303 | ); 304 | } else { 305 | child = Text( 306 | type == 'talk' ? _topic.talk.text : _topic.answer.text, 307 | maxLines: 15, 308 | overflow: TextOverflow.ellipsis, 309 | style: TextStyle(fontSize: 15), 310 | ); 311 | } 312 | 313 | return Padding( 314 | padding: EdgeInsets.only(left: 38, top: 8), 315 | child: child, 316 | ); 317 | } else 318 | return Container(); 319 | } 320 | 321 | //头像 322 | Widget _avatarNameTime() { 323 | var type = _topic.type; 324 | if (type == 'talk' || type == 'q&a') { 325 | return Row( 326 | children: [ 327 | ClipOval( 328 | child: Image.network( 329 | type == 'talk' 330 | ? _topic.talk.owner.avatarUrl 331 | : _topic.answer.owner.avatarUrl, 332 | width: 30, 333 | height: 30, 334 | ), 335 | ), //头像 336 | 337 | Padding( 338 | padding: EdgeInsets.only(left: 8), 339 | child: Column( 340 | crossAxisAlignment: CrossAxisAlignment.start, 341 | children: [ 342 | Text( 343 | type == 'talk' 344 | ? _topic.talk.owner.name 345 | : _topic.answer.owner.name, 346 | style: TextStyle(color: BLUE_DARK, fontSize: 12), 347 | ), //名字 348 | 349 | Padding( 350 | padding: EdgeInsets.only(top: 1.5), 351 | child: Text( 352 | DateUtil.timeStr(_topic.createTime), 353 | style: TextStyle(color: Colors.black38, fontSize: 9), 354 | ), 355 | ), 356 | //时间 357 | ], 358 | ), 359 | ), 360 | ], 361 | ); 362 | } else { 363 | return Container(); 364 | } 365 | } 366 | 367 | 368 | } 369 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 15 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 16 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 17 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 18 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 19 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 20 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 21 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXCopyFilesBuildPhase section */ 25 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 26 | isa = PBXCopyFilesBuildPhase; 27 | buildActionMask = 2147483647; 28 | dstPath = ""; 29 | dstSubfolderSpec = 10; 30 | files = ( 31 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 32 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 33 | ); 34 | name = "Embed Frameworks"; 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXCopyFilesBuildPhase section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 41 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 42 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 43 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 44 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 45 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 46 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 47 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 48 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 49 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 50 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 53 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 54 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 55 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 64 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | 9740EEB11CF90186004384FC /* Flutter */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 3B80C3931E831B6300D905FE /* App.framework */, 75 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 76 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 77 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 78 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 79 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 80 | ); 81 | name = Flutter; 82 | sourceTree = ""; 83 | }; 84 | 97C146E51CF9000F007C117D = { 85 | isa = PBXGroup; 86 | children = ( 87 | 9740EEB11CF90186004384FC /* Flutter */, 88 | 97C146F01CF9000F007C117D /* Runner */, 89 | 97C146EF1CF9000F007C117D /* Products */, 90 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | 97C146EF1CF9000F007C117D /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 97C146EE1CF9000F007C117D /* Runner.app */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | 97C146F01CF9000F007C117D /* Runner */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 106 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 107 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 108 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 109 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 110 | 97C147021CF9000F007C117D /* Info.plist */, 111 | 97C146F11CF9000F007C117D /* Supporting Files */, 112 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 113 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 114 | ); 115 | path = Runner; 116 | sourceTree = ""; 117 | }; 118 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 97C146F21CF9000F007C117D /* main.m */, 122 | ); 123 | name = "Supporting Files"; 124 | sourceTree = ""; 125 | }; 126 | /* End PBXGroup section */ 127 | 128 | /* Begin PBXNativeTarget section */ 129 | 97C146ED1CF9000F007C117D /* Runner */ = { 130 | isa = PBXNativeTarget; 131 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 132 | buildPhases = ( 133 | 9740EEB61CF901F6004384FC /* Run Script */, 134 | 97C146EA1CF9000F007C117D /* Sources */, 135 | 97C146EB1CF9000F007C117D /* Frameworks */, 136 | 97C146EC1CF9000F007C117D /* Resources */, 137 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 138 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 139 | ); 140 | buildRules = ( 141 | ); 142 | dependencies = ( 143 | ); 144 | name = Runner; 145 | productName = Runner; 146 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 147 | productType = "com.apple.product-type.application"; 148 | }; 149 | /* End PBXNativeTarget section */ 150 | 151 | /* Begin PBXProject section */ 152 | 97C146E61CF9000F007C117D /* Project object */ = { 153 | isa = PBXProject; 154 | attributes = { 155 | LastUpgradeCheck = 1020; 156 | ORGANIZATIONNAME = "The Chromium Authors"; 157 | TargetAttributes = { 158 | 97C146ED1CF9000F007C117D = { 159 | CreatedOnToolsVersion = 7.3.1; 160 | }; 161 | }; 162 | }; 163 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 164 | compatibilityVersion = "Xcode 3.2"; 165 | developmentRegion = en; 166 | hasScannedForEncodings = 0; 167 | knownRegions = ( 168 | en, 169 | Base, 170 | ); 171 | mainGroup = 97C146E51CF9000F007C117D; 172 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 173 | projectDirPath = ""; 174 | projectRoot = ""; 175 | targets = ( 176 | 97C146ED1CF9000F007C117D /* Runner */, 177 | ); 178 | }; 179 | /* End PBXProject section */ 180 | 181 | /* Begin PBXResourcesBuildPhase section */ 182 | 97C146EC1CF9000F007C117D /* Resources */ = { 183 | isa = PBXResourcesBuildPhase; 184 | buildActionMask = 2147483647; 185 | files = ( 186 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 187 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 188 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 189 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 190 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | }; 194 | /* End PBXResourcesBuildPhase section */ 195 | 196 | /* Begin PBXShellScriptBuildPhase section */ 197 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 198 | isa = PBXShellScriptBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | ); 202 | inputPaths = ( 203 | ); 204 | name = "Thin Binary"; 205 | outputPaths = ( 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | shellPath = /bin/sh; 209 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 210 | }; 211 | 9740EEB61CF901F6004384FC /* Run Script */ = { 212 | isa = PBXShellScriptBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | ); 216 | inputPaths = ( 217 | ); 218 | name = "Run Script"; 219 | outputPaths = ( 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | shellPath = /bin/sh; 223 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 224 | }; 225 | /* End PBXShellScriptBuildPhase section */ 226 | 227 | /* Begin PBXSourcesBuildPhase section */ 228 | 97C146EA1CF9000F007C117D /* Sources */ = { 229 | isa = PBXSourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 233 | 97C146F31CF9000F007C117D /* main.m in Sources */, 234 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | }; 238 | /* End PBXSourcesBuildPhase section */ 239 | 240 | /* Begin PBXVariantGroup section */ 241 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 242 | isa = PBXVariantGroup; 243 | children = ( 244 | 97C146FB1CF9000F007C117D /* Base */, 245 | ); 246 | name = Main.storyboard; 247 | sourceTree = ""; 248 | }; 249 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 250 | isa = PBXVariantGroup; 251 | children = ( 252 | 97C147001CF9000F007C117D /* Base */, 253 | ); 254 | name = LaunchScreen.storyboard; 255 | sourceTree = ""; 256 | }; 257 | /* End PBXVariantGroup section */ 258 | 259 | /* Begin XCBuildConfiguration section */ 260 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 261 | isa = XCBuildConfiguration; 262 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 263 | buildSettings = { 264 | ALWAYS_SEARCH_USER_PATHS = NO; 265 | CLANG_ANALYZER_NONNULL = YES; 266 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 267 | CLANG_CXX_LIBRARY = "libc++"; 268 | CLANG_ENABLE_MODULES = YES; 269 | CLANG_ENABLE_OBJC_ARC = YES; 270 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 271 | CLANG_WARN_BOOL_CONVERSION = YES; 272 | CLANG_WARN_COMMA = YES; 273 | CLANG_WARN_CONSTANT_CONVERSION = YES; 274 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 275 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 276 | CLANG_WARN_EMPTY_BODY = YES; 277 | CLANG_WARN_ENUM_CONVERSION = YES; 278 | CLANG_WARN_INFINITE_RECURSION = YES; 279 | CLANG_WARN_INT_CONVERSION = YES; 280 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 281 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 282 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 283 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 284 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 285 | CLANG_WARN_STRICT_PROTOTYPES = YES; 286 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 287 | CLANG_WARN_UNREACHABLE_CODE = YES; 288 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 289 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 290 | COPY_PHASE_STRIP = NO; 291 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 292 | ENABLE_NS_ASSERTIONS = NO; 293 | ENABLE_STRICT_OBJC_MSGSEND = YES; 294 | GCC_C_LANGUAGE_STANDARD = gnu99; 295 | GCC_NO_COMMON_BLOCKS = YES; 296 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 297 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 298 | GCC_WARN_UNDECLARED_SELECTOR = YES; 299 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 300 | GCC_WARN_UNUSED_FUNCTION = YES; 301 | GCC_WARN_UNUSED_VARIABLE = YES; 302 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 303 | MTL_ENABLE_DEBUG_INFO = NO; 304 | SDKROOT = iphoneos; 305 | TARGETED_DEVICE_FAMILY = "1,2"; 306 | VALIDATE_PRODUCT = YES; 307 | }; 308 | name = Profile; 309 | }; 310 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 311 | isa = XCBuildConfiguration; 312 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 313 | buildSettings = { 314 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 315 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 316 | DEVELOPMENT_TEAM = S8QB4VV633; 317 | ENABLE_BITCODE = NO; 318 | FRAMEWORK_SEARCH_PATHS = ( 319 | "$(inherited)", 320 | "$(PROJECT_DIR)/Flutter", 321 | ); 322 | INFOPLIST_FILE = Runner/Info.plist; 323 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 324 | LIBRARY_SEARCH_PATHS = ( 325 | "$(inherited)", 326 | "$(PROJECT_DIR)/Flutter", 327 | ); 328 | PRODUCT_BUNDLE_IDENTIFIER = cn.hg.gxxq; 329 | PRODUCT_NAME = "$(TARGET_NAME)"; 330 | VERSIONING_SYSTEM = "apple-generic"; 331 | }; 332 | name = Profile; 333 | }; 334 | 97C147031CF9000F007C117D /* Debug */ = { 335 | isa = XCBuildConfiguration; 336 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 337 | buildSettings = { 338 | ALWAYS_SEARCH_USER_PATHS = NO; 339 | CLANG_ANALYZER_NONNULL = YES; 340 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 341 | CLANG_CXX_LIBRARY = "libc++"; 342 | CLANG_ENABLE_MODULES = YES; 343 | CLANG_ENABLE_OBJC_ARC = YES; 344 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 345 | CLANG_WARN_BOOL_CONVERSION = YES; 346 | CLANG_WARN_COMMA = YES; 347 | CLANG_WARN_CONSTANT_CONVERSION = YES; 348 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 349 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 350 | CLANG_WARN_EMPTY_BODY = YES; 351 | CLANG_WARN_ENUM_CONVERSION = YES; 352 | CLANG_WARN_INFINITE_RECURSION = YES; 353 | CLANG_WARN_INT_CONVERSION = YES; 354 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 355 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = 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_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 405 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 406 | CLANG_WARN_EMPTY_BODY = YES; 407 | CLANG_WARN_ENUM_CONVERSION = YES; 408 | CLANG_WARN_INFINITE_RECURSION = YES; 409 | CLANG_WARN_INT_CONVERSION = YES; 410 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 412 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 413 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 414 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 415 | CLANG_WARN_STRICT_PROTOTYPES = YES; 416 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 417 | CLANG_WARN_UNREACHABLE_CODE = YES; 418 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 419 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 420 | COPY_PHASE_STRIP = NO; 421 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 422 | ENABLE_NS_ASSERTIONS = NO; 423 | ENABLE_STRICT_OBJC_MSGSEND = YES; 424 | GCC_C_LANGUAGE_STANDARD = gnu99; 425 | GCC_NO_COMMON_BLOCKS = YES; 426 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 427 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 428 | GCC_WARN_UNDECLARED_SELECTOR = YES; 429 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 430 | GCC_WARN_UNUSED_FUNCTION = YES; 431 | GCC_WARN_UNUSED_VARIABLE = YES; 432 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 433 | MTL_ENABLE_DEBUG_INFO = NO; 434 | SDKROOT = iphoneos; 435 | TARGETED_DEVICE_FAMILY = "1,2"; 436 | VALIDATE_PRODUCT = YES; 437 | }; 438 | name = Release; 439 | }; 440 | 97C147061CF9000F007C117D /* Debug */ = { 441 | isa = XCBuildConfiguration; 442 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 443 | buildSettings = { 444 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 445 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 446 | ENABLE_BITCODE = NO; 447 | FRAMEWORK_SEARCH_PATHS = ( 448 | "$(inherited)", 449 | "$(PROJECT_DIR)/Flutter", 450 | ); 451 | INFOPLIST_FILE = Runner/Info.plist; 452 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 453 | LIBRARY_SEARCH_PATHS = ( 454 | "$(inherited)", 455 | "$(PROJECT_DIR)/Flutter", 456 | ); 457 | PRODUCT_BUNDLE_IDENTIFIER = cn.hg.gxxq; 458 | PRODUCT_NAME = "$(TARGET_NAME)"; 459 | VERSIONING_SYSTEM = "apple-generic"; 460 | }; 461 | name = Debug; 462 | }; 463 | 97C147071CF9000F007C117D /* Release */ = { 464 | isa = XCBuildConfiguration; 465 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 466 | buildSettings = { 467 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 468 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 469 | ENABLE_BITCODE = NO; 470 | FRAMEWORK_SEARCH_PATHS = ( 471 | "$(inherited)", 472 | "$(PROJECT_DIR)/Flutter", 473 | ); 474 | INFOPLIST_FILE = Runner/Info.plist; 475 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 476 | LIBRARY_SEARCH_PATHS = ( 477 | "$(inherited)", 478 | "$(PROJECT_DIR)/Flutter", 479 | ); 480 | PRODUCT_BUNDLE_IDENTIFIER = cn.hg.gxxq; 481 | PRODUCT_NAME = "$(TARGET_NAME)"; 482 | VERSIONING_SYSTEM = "apple-generic"; 483 | }; 484 | name = Release; 485 | }; 486 | /* End XCBuildConfiguration section */ 487 | 488 | /* Begin XCConfigurationList section */ 489 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 490 | isa = XCConfigurationList; 491 | buildConfigurations = ( 492 | 97C147031CF9000F007C117D /* Debug */, 493 | 97C147041CF9000F007C117D /* Release */, 494 | 249021D3217E4FDB00AE95B9 /* Profile */, 495 | ); 496 | defaultConfigurationIsVisible = 0; 497 | defaultConfigurationName = Release; 498 | }; 499 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 500 | isa = XCConfigurationList; 501 | buildConfigurations = ( 502 | 97C147061CF9000F007C117D /* Debug */, 503 | 97C147071CF9000F007C117D /* Release */, 504 | 249021D4217E4FDB00AE95B9 /* Profile */, 505 | ); 506 | defaultConfigurationIsVisible = 0; 507 | defaultConfigurationName = Release; 508 | }; 509 | /* End XCConfigurationList section */ 510 | }; 511 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 512 | } 513 | --------------------------------------------------------------------------------