From 73ecfe9ddcf259a26280427294ef2ca1d7d18ffd Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 7 Aug 2019 19:14:11 +0800 Subject: [PATCH 01/11] + --- ios/Runner.xcodeproj/project.pbxproj | 50 ++----------- lib/routers/router_handler.dart | 2 +- pubspec.lock | 108 +++++++++++++-------------- 3 files changed, 60 insertions(+), 100 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index cc98f703..4da84c53 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -32,16 +32,6 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - FA240D7922F2857D003025F3 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD0115F22F1B9DF0016E673 /* Flutter.framework */; }; - FA240D7A22F2857D003025F3 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = FAD0115F22F1B9DF0016E673 /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - FA240D7B22F28581003025F3 /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD0116122F1B9DF0016E673 /* App.framework */; }; - FA240D7C22F28581003025F3 /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = FAD0116122F1B9DF0016E673 /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - FAD0116422F1B9DF0016E673 /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = FAD0115E22F1B9DF0016E673 /* Debug.xcconfig */; }; - FAD0116522F1B9DF0016E673 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD0115F22F1B9DF0016E673 /* Flutter.framework */; }; - FAD0116622F1B9DF0016E673 /* Release.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = FAD0116022F1B9DF0016E673 /* Release.xcconfig */; }; - FAD0116722F1B9DF0016E673 /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD0116122F1B9DF0016E673 /* App.framework */; }; - FAD0116822F1B9DF0016E673 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = FAD0116222F1B9DF0016E673 /* AppFrameworkInfo.plist */; }; - FAD0116922F1B9DF0016E673 /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = FAD0116322F1B9DF0016E673 /* Generated.xcconfig */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -51,8 +41,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - FA240D7C22F28581003025F3 /* App.framework in Embed Frameworks */, - FA240D7A22F2857D003025F3 /* Flutter.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -92,12 +80,6 @@ 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; A4868A865F318D337B7500AF /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; B7B77D3AD1E975E5BE03D770 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - FAD0115E22F1B9DF0016E673 /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; - FAD0115F22F1B9DF0016E673 /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Flutter.framework; sourceTree = ""; }; - FAD0116022F1B9DF0016E673 /* Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; - FAD0116122F1B9DF0016E673 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = App.framework; sourceTree = ""; }; - FAD0116222F1B9DF0016E673 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = AppFrameworkInfo.plist; sourceTree = ""; }; - FAD0116322F1B9DF0016E673 /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Generated.xcconfig; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -106,10 +88,6 @@ buildActionMask = 2147483647; files = ( 17DB4C25EDB98B3648015B9E /* libPods-Runner.a in Frameworks */, - FAD0116722F1B9DF0016E673 /* App.framework in Frameworks */, - FAD0116522F1B9DF0016E673 /* Flutter.framework in Frameworks */, - FA240D7922F2857D003025F3 /* Flutter.framework in Frameworks */, - FA240D7B22F28581003025F3 /* App.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -149,7 +127,6 @@ 97C146E51CF9000F007C117D = { isa = PBXGroup; children = ( - FAD0115D22F1B9DF0016E673 /* Flutter */, 0828E485220692A700A59437 /* launch */, 084A20872202E4FD00428FF5 /* flutter go.png */, 97C146F01CF9000F007C117D /* Runner */, @@ -203,19 +180,6 @@ path = Pods; sourceTree = ""; }; - FAD0115D22F1B9DF0016E673 /* Flutter */ = { - isa = PBXGroup; - children = ( - FAD0115E22F1B9DF0016E673 /* Debug.xcconfig */, - FAD0115F22F1B9DF0016E673 /* Flutter.framework */, - FAD0116022F1B9DF0016E673 /* Release.xcconfig */, - FAD0116122F1B9DF0016E673 /* App.framework */, - FAD0116222F1B9DF0016E673 /* AppFrameworkInfo.plist */, - FAD0116322F1B9DF0016E673 /* Generated.xcconfig */, - ); - path = Flutter; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -286,7 +250,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - FAD0116622F1B9DF0016E673 /* Release.xcconfig in Resources */, 0828E4A0220692B500A59437 /* iPad Landscape.png in Resources */, 0828E4A1220692B500A59437 /* iPhone XR Portrait.png in Resources */, 0828E49F220692B500A59437 /* iPhone XS Max Landscape.png in Resources */, @@ -297,17 +260,14 @@ 0828E49E220692B500A59437 /* iPad Portrait@2x.png in Resources */, 0828E49D220692B500A59437 /* iPhone Portrait@2x.png in Resources */, 0828E499220692B500A59437 /* iPhone Portrait-Retina HD 4.7.png in Resources */, - FAD0116822F1B9DF0016E673 /* AppFrameworkInfo.plist in Resources */, 084A20882202E4FD00428FF5 /* flutter go.png in Resources */, 0828E497220692B500A59437 /* iPhone X_XS Landscape.png in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 0828E4A52206936100A59437 /* Images.xcassets in Resources */, - FAD0116922F1B9DF0016E673 /* Generated.xcconfig in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 0828E49B220692B500A59437 /* iPad Landscape@2x.png in Resources */, 0828E495220692B500A59437 /* iPhone Portrait-Retina 4.png in Resources */, 0828E498220692B500A59437 /* iPhone XS Max Portrait.png in Resources */, - FAD0116422F1B9DF0016E673 /* Debug.xcconfig in Resources */, 94722E5C22511D3600F63900 /* GoogleService-Info.plist in Resources */, 0828E496220692B500A59437 /* iPad Portrait.png in Resources */, 0828E49C220692B500A59437 /* iPhone Landscape-Retina HD 5.5.png in Resources */, @@ -329,11 +289,11 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"/Users/nealyang/development/flutter/packages/flutter_tools/bin/xcode_backend.sh\" thin\n"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; - buildActionMask = 12; + buildActionMask = 2147483647; files = ( ); inputPaths = ( @@ -343,7 +303,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; B34D03FFEA3831330E64E5C7 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; @@ -546,7 +506,7 @@ }; 97C147061CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FAD0115E22F1B9DF0016E673 /* Debug.xcconfig */; + baseConfigurationReference = A4868A865F318D337B7500AF /* Pods-Runner.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = Launch2; @@ -577,7 +537,7 @@ }; 97C147071CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FAD0116022F1B9DF0016E673 /* Release.xcconfig */; + baseConfigurationReference = B7B77D3AD1E975E5BE03D770 /* Pods-Runner.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = Launch2; diff --git a/lib/routers/router_handler.dart b/lib/routers/router_handler.dart index b0555b56..3d6e671e 100644 --- a/lib/routers/router_handler.dart +++ b/lib/routers/router_handler.dart @@ -11,7 +11,7 @@ import 'package:flutter_go/model/user_info.dart'; import 'package:flutter_go/views/collection_page/collection_page.dart'; import 'package:flutter_go/views/collection_page/collection_full_page.dart'; import 'package:flutter_go/views/standard_demo_page/index.dart'; -import 'package:flutter_go/views/issuse_message_page/issuse_message_page.dart' +import 'package:flutter_go/views/issuse_message_page/issuse_message_page.dart'; // app的首页 var homeHandler = new Handler( diff --git a/pubspec.lock b/pubspec.lock index 1b6d1d35..7cd78d61 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,105 +5,105 @@ packages: dependency: transitive description: name: args - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.5.2" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.0" bloc: dependency: "direct main" description: name: bloc - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.12.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.4" charcode: dependency: transitive description: name: charcode - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.2" city_pickers: dependency: "direct main" description: name: city_pickers - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.0.4" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.14.11" cookie_jar: dependency: "direct main" description: name: cookie_jar - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" csslib: dependency: transitive description: name: csslib - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.16.1" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.2" dio: dependency: "direct main" description: name: dio - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.13" event_bus: dependency: "direct main" description: name: event_bus - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" firebase_analytics: dependency: "direct main" description: name: firebase_analytics - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0+1" firebase_core: dependency: "direct main" description: name: firebase_core - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.4" fluro: dependency: "direct main" description: name: fluro - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.5.1" flutter: @@ -115,28 +115,28 @@ packages: dependency: "direct main" description: name: flutter_bloc - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.11.1" flutter_downloader: dependency: "direct main" description: name: flutter_downloader - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.9" flutter_jpush: dependency: "direct main" description: name: flutter_jpush - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.0.4" flutter_spinkit: dependency: "direct main" description: name: flutter_spinkit - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.0" flutter_test: @@ -148,154 +148,154 @@ packages: dependency: "direct main" description: name: flutter_webview_plugin - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.5" fluttertoast: dependency: "direct main" description: name: fluttertoast - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.0" html: dependency: "direct main" description: name: html - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.14.0+2" image_picker: dependency: "direct main" description: name: image_picker - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.5.4+3" intl: dependency: "direct main" description: name: intl - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.15.7" lpinyin: dependency: transitive description: name: lpinyin - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.7" markdown: dependency: "direct main" description: name: markdown - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.3" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.12.5" meta: dependency: "direct main" description: name: meta - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.6" notus: dependency: transitive description: name: notus - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.3" open_file: dependency: "direct main" description: name: open_file - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.3" package_info: dependency: "direct main" description: name: package_info - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.0+6" path: dependency: "direct main" description: name: path - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.6.2" path_provider: dependency: "direct main" description: name: path_provider - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" pedantic: dependency: transitive description: name: pedantic - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.7.0" permission_handler: dependency: "direct main" description: name: permission_handler - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "3.2.0" + version: "3.2.1+1" quill_delta: dependency: transitive description: name: quill_delta - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" quiver: dependency: transitive description: name: quiver - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.3" quiver_hashcode: dependency: transitive description: name: quiver_hashcode - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" rxdart: dependency: transitive description: name: rxdart - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.21.0" share: dependency: "direct main" description: name: share - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.6.2+1" shared_preferences: dependency: "direct main" description: name: shared_preferences - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.3" sky_engine: @@ -307,77 +307,77 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.5.5" sqflite: dependency: "direct main" description: name: sqflite - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.6+3" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.9.3" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" string_scanner: dependency: "direct main" description: name: string_scanner - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.4" synchronized: dependency: transitive description: name: synchronized - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0+1" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.5" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.6" url_launcher: dependency: "direct main" description: name: url_launcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted - version: "5.1.1" + version: "5.1.2" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.8" zefyr: From a3dcd6cce26c49eb666cdc87bc2c7abedf79dd31 Mon Sep 17 00:00:00 2001 From: "xiaojia.dxj" Date: Thu, 8 Aug 2019 15:57:25 +0800 Subject: [PATCH 02/11] fix --- ios/Flutter/Debug.xcconfig | 2 +- ios/Flutter/Release.xcconfig | 2 +- ios/Runner.xcodeproj/project.pbxproj | 142 ++++++++---------- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- .../issuse_message_page.dart | 2 +- 5 files changed, 70 insertions(+), 80 deletions(-) diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig index ae516c8c..0aaf7bbc 100644 --- a/ios/Flutter/Debug.xcconfig +++ b/ios/Flutter/Debug.xcconfig @@ -1,3 +1,3 @@ #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" -#include "../Pods/Target\ Support\ Files/Pods-Runner/Pods-Runner.debug.xcconfig" + diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig index 3e14f624..4747c695 100644 --- a/ios/Flutter/Release.xcconfig +++ b/ios/Flutter/Release.xcconfig @@ -1,3 +1,3 @@ #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" -#include "../Pods/Target\ Support\ Files/Pods-Runner/Pods-Runner.release.xcconfig" + diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index cc98f703..d388f84d 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -25,23 +25,18 @@ 0828E4A52206936100A59437 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0828E4A42206936100A59437 /* Images.xcassets */; }; 084A20882202E4FD00428FF5 /* flutter go.png in Resources */ = {isa = PBXBuildFile; fileRef = 084A20872202E4FD00428FF5 /* flutter go.png */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 17DB4C25EDB98B3648015B9E /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 813A089174EBE6F8695A172E /* libPods-Runner.a */; }; + 28E53B1918D78EE80D39B80B /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8CA6E84257C027654D3B0DE2 /* libPods-Runner.a */; }; 94722E5C22511D3600F63900 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 94722E5B22511D3600F63900 /* GoogleService-Info.plist */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - FA240D7922F2857D003025F3 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD0115F22F1B9DF0016E673 /* Flutter.framework */; }; FA240D7A22F2857D003025F3 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = FAD0115F22F1B9DF0016E673 /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - FA240D7B22F28581003025F3 /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD0116122F1B9DF0016E673 /* App.framework */; }; FA240D7C22F28581003025F3 /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = FAD0116122F1B9DF0016E673 /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - FAD0116422F1B9DF0016E673 /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = FAD0115E22F1B9DF0016E673 /* Debug.xcconfig */; }; FAD0116522F1B9DF0016E673 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD0115F22F1B9DF0016E673 /* Flutter.framework */; }; - FAD0116622F1B9DF0016E673 /* Release.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = FAD0116022F1B9DF0016E673 /* Release.xcconfig */; }; FAD0116722F1B9DF0016E673 /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD0116122F1B9DF0016E673 /* App.framework */; }; FAD0116822F1B9DF0016E673 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = FAD0116222F1B9DF0016E673 /* AppFrameworkInfo.plist */; }; - FAD0116922F1B9DF0016E673 /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = FAD0116322F1B9DF0016E673 /* Generated.xcconfig */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -82,7 +77,9 @@ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 813A089174EBE6F8695A172E /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 89FACEFBFBEF7EF9543ED2CB /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 8CA6E84257C027654D3B0DE2 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 8EF8BF8C94C017772D134BF5 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 94722E5B22511D3600F63900 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -90,8 +87,6 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - A4868A865F318D337B7500AF /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - B7B77D3AD1E975E5BE03D770 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; FAD0115E22F1B9DF0016E673 /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; FAD0115F22F1B9DF0016E673 /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Flutter.framework; sourceTree = ""; }; FAD0116022F1B9DF0016E673 /* Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; @@ -105,11 +100,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 17DB4C25EDB98B3648015B9E /* libPods-Runner.a in Frameworks */, FAD0116722F1B9DF0016E673 /* App.framework in Frameworks */, FAD0116522F1B9DF0016E673 /* Flutter.framework in Frameworks */, - FA240D7922F2857D003025F3 /* Flutter.framework in Frameworks */, - FA240D7B22F28581003025F3 /* App.framework in Frameworks */, + 28E53B1918D78EE80D39B80B /* libPods-Runner.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -138,10 +131,10 @@ path = launch; sourceTree = ""; }; - 8B83D3FCE2CD78ED2CD9BC84 /* Frameworks */ = { + 7A8DD22A849804A38B883F48 /* Frameworks */ = { isa = PBXGroup; children = ( - 813A089174EBE6F8695A172E /* libPods-Runner.a */, + 8CA6E84257C027654D3B0DE2 /* libPods-Runner.a */, ); name = Frameworks; sourceTree = ""; @@ -155,7 +148,7 @@ 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, F1785F83FDEE22F813679AE5 /* Pods */, - 8B83D3FCE2CD78ED2CD9BC84 /* Frameworks */, + 7A8DD22A849804A38B883F48 /* Frameworks */, ); sourceTree = ""; }; @@ -197,8 +190,8 @@ F1785F83FDEE22F813679AE5 /* Pods */ = { isa = PBXGroup; children = ( - A4868A865F318D337B7500AF /* Pods-Runner.debug.xcconfig */, - B7B77D3AD1E975E5BE03D770 /* Pods-Runner.release.xcconfig */, + 89FACEFBFBEF7EF9543ED2CB /* Pods-Runner.debug.xcconfig */, + 8EF8BF8C94C017772D134BF5 /* Pods-Runner.release.xcconfig */, ); path = Pods; sourceTree = ""; @@ -223,15 +216,15 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - FBE7DB4E8DD084FE99B9ED05 /* [CP] Check Pods Manifest.lock */, + 58F6EF4F43D025EF078E3114 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - B34D03FFEA3831330E64E5C7 /* [CP] Embed Pods Frameworks */, - E54A6BDEF16ACE4A6988913A /* [CP] Copy Pods Resources */, + 61B12781D52CE38332797DFE /* [CP] Embed Pods Frameworks */, + B9D270AE480D301A54E3C20C /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -248,7 +241,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1030; ORGANIZATIONNAME = "The Chromium Authors"; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -286,7 +279,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - FAD0116622F1B9DF0016E673 /* Release.xcconfig in Resources */, 0828E4A0220692B500A59437 /* iPad Landscape.png in Resources */, 0828E4A1220692B500A59437 /* iPhone XR Portrait.png in Resources */, 0828E49F220692B500A59437 /* iPhone XS Max Landscape.png in Resources */, @@ -302,12 +294,10 @@ 0828E497220692B500A59437 /* iPhone X_XS Landscape.png in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 0828E4A52206936100A59437 /* Images.xcassets in Resources */, - FAD0116922F1B9DF0016E673 /* Generated.xcconfig in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 0828E49B220692B500A59437 /* iPad Landscape@2x.png in Resources */, 0828E495220692B500A59437 /* iPhone Portrait-Retina 4.png in Resources */, 0828E498220692B500A59437 /* iPhone XS Max Portrait.png in Resources */, - FAD0116422F1B9DF0016E673 /* Debug.xcconfig in Resources */, 94722E5C22511D3600F63900 /* GoogleService-Info.plist in Resources */, 0828E496220692B500A59437 /* iPad Portrait.png in Resources */, 0828E49C220692B500A59437 /* iPhone Landscape-Retina HD 5.5.png in Resources */, @@ -329,59 +319,9 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"/Users/nealyang/development/flutter/packages/flutter_tools/bin/xcode_backend.sh\" thin\n"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; }; - 9740EEB61CF901F6004384FC /* Run Script */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 12; - files = ( - ); - inputPaths = ( - ); - name = "Run Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n"; - }; - B34D03FFEA3831330E64E5C7 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - E54A6BDEF16ACE4A6988913A /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/flutter_downloader/FlutterDownloaderDatabase.bundle", - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FlutterDownloaderDatabase.bundle", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - FBE7DB4E8DD084FE99B9ED05 /* [CP] Check Pods Manifest.lock */ = { + 58F6EF4F43D025EF078E3114 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -403,6 +343,56 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + 61B12781D52CE38332797DFE /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", + "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 12; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n"; + }; + B9D270AE480D301A54E3C20C /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/flutter_downloader/FlutterDownloaderDatabase.bundle", + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FlutterDownloaderDatabase.bundle", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index d71252f9..0ce4e52b 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ { } _submit() { - String mk = notusMarkdown.encode(_delta); if (_title.trim().isEmpty) { _show('标题不能为空'); } else { + String mk = (_delta==null)?'No description provided.':notusMarkdown.encode(_delta); DataUtils.feedback({'title': _title, "body": mk},context).then((result) { _show('提交成功'); Navigator.maybePop(context); From 548dc3d571d31ca075905eeea2fc42526762cf08 Mon Sep 17 00:00:00 2001 From: "xiaojia.dxj" Date: Thu, 8 Aug 2019 17:50:57 +0800 Subject: [PATCH 03/11] merge --- .github/issue_template.md | 0 docs/contribute.md | 52 +---- go-cli/pubspec.yaml | 1 + go-cli/src/build/build_page_list.dart | 65 ++++-- go-cli/src/cli_command_runder.dart | 2 + go-cli/src/command/build.dart | 32 +++ ios/Runner.xcodeproj/project.pbxproj | 72 +++--- .../xcshareddata/IDEWorkspaceChecks.plist | 8 - .../xcshareddata/WorkspaceSettings.xcsettings | 8 - lib/api/api.dart | 2 +- lib/components/full_screen_code_dialog.dart | 3 +- lib/components/loading.dart | 94 ++++++++ lib/components/widget_demo.dart | 101 +++++---- lib/main.dart | 10 +- lib/model/cat.dart | 214 +++++++++--------- lib/model/widget.dart | 49 +++- lib/page_demo_package/.demo.json | 2 +- lib/page_demo_package/index.dart | 4 +- .../.demo.json | 9 + .../index.dart | 15 ++ .../src/index.dart | 16 ++ lib/routers/routers.dart | 1 + lib/standard_pages/.pages.json | 12 +- lib/standard_pages/index.dart | 25 +- .../.page.json | 10 + .../index.dart | 52 +++++ .../index.md | 48 ++++ .../.page.json | 10 + .../index.dart | 52 +++++ .../index.md | 48 ++++ lib/utils/data_utils.dart | 2 +- lib/views/standard_demo_page/const.dart | 12 - lib/views/standard_demo_page/index.dart | 111 ++++++--- lib/views/widget_page/widget_page.dart | 1 - pubspec.lock | 104 ++++----- 35 files changed, 852 insertions(+), 395 deletions(-) delete mode 100644 .github/issue_template.md create mode 100644 go-cli/src/command/build.dart delete mode 100644 ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings create mode 100644 lib/components/loading.dart create mode 100644 lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/.demo.json create mode 100644 lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/index.dart create mode 100644 lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/src/index.dart create mode 100644 lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/.page.json create mode 100644 lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.dart create mode 100644 lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.md create mode 100644 lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/.page.json create mode 100644 lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.dart create mode 100644 lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.md delete mode 100644 lib/views/standard_demo_page/const.dart diff --git a/.github/issue_template.md b/.github/issue_template.md deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/contribute.md b/docs/contribute.md index 6ce5f0a5..78d14868 100644 --- a/docs/contribute.md +++ b/docs/contribute.md @@ -12,56 +12,14 @@ # Issue -PR的第一步就是提交issue,即提交你发现的BUG 或者 想加入的功能, 选择你issue在类型 +pr的第一步是先提交issue,即提交你发现的BUG 或者 想加入的功能, 选择你issue在类型 ![](https://img.alicdn.com/tfs/TB1r3LEbKL2gK0jSZFmXXc7iXXa-858-317.png) -您的 Pull Request 可能包含以下几种 +您的 Issue 可能包含以下几种 -- 当前项目逻辑代码的问题修复或者优化 -- widget 示例的完善 -- widget 文档的完善与更新 - - -# 文档与DEMO的完善 -一个widget的demo实例与文档说明, 由以下目录构成, 我们以**/lib/widgets/components/Tab/Tab**组件举例, 在此文件目录下构建您的demo运行即可看到效果 - -- index.dart -- demo.dart - - - -# 撰写 Pull Request - -为了更好的将 *flutter* 的各种使用方法分享给大家, 我们欢迎第三方提交个人Pull Request(简称为PR)到开源仓库中. 提交的PR需要满足以下规则: - -- PR 的提交名称, 请使用有意义可以理解的词汇, 否则我们请直接关闭它. - - 例如: 增加了XX功能, 优化..., 修复在 XX 状态下对 XX 的异常处理 -- PR 只能被提交合并到 *develop* 分支, 被提交到master的 PR, 我们将会直接关闭. -- PR 的描述区,需要描述本次改动的主要内容, 以及为什么要如此改动. -- 避免超大的 PR 提交 - - 当 PR 的改动 **change** 超过1000行(暂定为1000)时, 请尽量拆分后进行提交. -- 规范化的commit信息 - - commit规范参照[develop规范](https://github.com/alibbaba/flutter-go/blob/master/develop.md#commit-%E6%8F%90%E4%BA%A4%E8%A7%84%E8%8C%83) - - commit列表, 请在提交PR之前做好整理, 避免出现一个功能点的多条commit.[如何整理commit](https://help.github.com/en/articles/using-git-rebase-on-the-command-line) - -# 如何提交PR -* fork项目到自己仓库 -* git clone (您的仓库地址)到本地 -* 建立上游源 - * git remote add upStream git@github.com:alibaba/flutter-go.git - * 创建开发分支(非必须) - * git checkout -b develop -* 修改提交代码 - * git status - * git add . - * git commit -m 'feat: message' - * git push origin develop -* 同步代码 - * git fetch upstream - * git merge upstream/develop - * git push origin develop -* 提交PR - * 到自己github仓库对应fork的项目下new pull request +- bug report (修复逻辑相关bug) +- feature (增加新的功能) +- widget (关于widget示例展示) diff --git a/go-cli/pubspec.yaml b/go-cli/pubspec.yaml index f2725f4a..dfc961c2 100644 --- a/go-cli/pubspec.yaml +++ b/go-cli/pubspec.yaml @@ -17,6 +17,7 @@ dependencies: args: '^1.5.1' dart_inquirer: '^1.0.0' watcher: ^0.9.7+10 + mustache: ^1.1.1 dev_dependencies: diff --git a/go-cli/src/build/build_page_list.dart b/go-cli/src/build/build_page_list.dart index 212acffd..a8757444 100644 --- a/go-cli/src/build/build_page_list.dart +++ b/go-cli/src/build/build_page_list.dart @@ -1,11 +1,23 @@ import 'dart:io'; import 'dart:convert'; +import 'package:mustache/mustache.dart'; import 'package:path/path.dart' as p; import '../../utils/util.dart'; import '../config.dart'; import '../exception/demo.dart'; +String prettyJson(Map json) { + String res = "{"; + json.forEach((k, v) { + res += ( + "\t'$k': '$v'"); + }); + res +='}'; + return res; +} + + Future buildPageListJson() async { List childList = await readeDirChildren(TARGET_PAGE_DIC, false); List pagePathList = []; @@ -55,36 +67,45 @@ Future buildPageListJson() async { } String renderPagesDart(List> data) { - // 自定义前缀 避免出现数字非法字符等 - String pre = "StandardPage"; - String head = ''; - String foot = """ + print('data>>> $data'); + var source = ''' + + {{# pages }} +import '{{ name }}_{{ author }}_{{ id }}/index.dart' as StandardPage_{{ name }}_{{ id }}; + {{/ pages }} class StandardPages { Map standardPages; Map getPages() { return { -"""; - - for (int i = 0; i < data.length; i++) { - Map item = data[i]; - String demoImportName = '${item['name']}_${item['id']}'; - head += "import '${item['name']}_${item['author']}_${item['id']}/index.dart' as ${pre}_$demoImportName;\r\n"; - - foot += "\t\t\t'${item['id']}': ${pre}_${demoImportName}.getMd()"; - - if (i != data.length - 1) { - foot += ',\r\n'; - } - - } - foot += """\r + "0": "0" {{# pages }}, + "{{ id }}" : StandardPage_{{ name }}_{{ id }}.getMd() + {{/ pages }} }; } -} + List> getLocalList() { + return [ + {}{{# pages }}, + { "id": "{{ id }}", "name": "{{ name }}", "email": "{{ email }}", "author": "{{ author }}"} + {{/ pages }} + ]; + } - """; +} + + '''; + var template = new Template(source, name: 'template-filename.html'); + + + // 自定义前缀 避免出现数字非法字符等 + Map formatData = { + "pages": data + }; + + String output = template.renderString(formatData); + + +return output; - return head + foot; } Future checkPage(String path) async { List files = [ diff --git a/go-cli/src/cli_command_runder.dart b/go-cli/src/cli_command_runder.dart index b27b85f7..d9581573 100644 --- a/go-cli/src/cli_command_runder.dart +++ b/go-cli/src/cli_command_runder.dart @@ -6,6 +6,7 @@ import './version.dart'; import './command/create_demo.dart'; import './command/create_page.dart'; import './command/watch_md.dart'; +import './command/build.dart'; @@ -18,6 +19,7 @@ class _CommandRunner extends CommandRunner { addCommand(CreateDemoCommand()); addCommand(CreatePageCommand()); addCommand(WatchCommand()); + addCommand(Build()); } diff --git a/go-cli/src/command/build.dart b/go-cli/src/command/build.dart new file mode 100644 index 00000000..5502cc33 --- /dev/null +++ b/go-cli/src/command/build.dart @@ -0,0 +1,32 @@ +// +// Created with Android Studio. +// User: 三帆 +// Date: 30/07/2019 +// Time: 16:51 +// email: sanfan.hx@alibaba-inc.com +// target: build +// + + +import 'package:args/command_runner.dart'; +import '../build/build_demo_list.dart'; +import '../build/build_page_list.dart'; + + +import 'dart:async'; + + +class Build extends Command { + @override + final name = 'build'; + @override + final description = '生成索引等'; + + + @override + Future run() async { + buildPageListJson(); + buildDemoListJson(); + return 0; + } +} \ No newline at end of file diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index d388f84d..467ce320 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -25,7 +25,7 @@ 0828E4A52206936100A59437 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0828E4A42206936100A59437 /* Images.xcassets */; }; 084A20882202E4FD00428FF5 /* flutter go.png in Resources */ = {isa = PBXBuildFile; fileRef = 084A20872202E4FD00428FF5 /* flutter go.png */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 28E53B1918D78EE80D39B80B /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8CA6E84257C027654D3B0DE2 /* libPods-Runner.a */; }; + 61218C54852F80DBB5690C6B /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 57AAEC56B643BC3DE4EF4F8C /* libPods-Runner.a */; }; 94722E5C22511D3600F63900 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 94722E5B22511D3600F63900 /* GoogleService-Info.plist */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; @@ -75,11 +75,10 @@ 10D9E78922B7651B003C2C98 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 57AAEC56B643BC3DE4EF4F8C /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 73D4159B73B37E5BB51DC8A8 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 89FACEFBFBEF7EF9543ED2CB /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - 8CA6E84257C027654D3B0DE2 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 8EF8BF8C94C017772D134BF5 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 94722E5B22511D3600F63900 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -87,6 +86,7 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + C1B7099BCFD500AF7A1AE3BA /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; FAD0115E22F1B9DF0016E673 /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; FAD0115F22F1B9DF0016E673 /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Flutter.framework; sourceTree = ""; }; FAD0116022F1B9DF0016E673 /* Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; @@ -102,7 +102,7 @@ files = ( FAD0116722F1B9DF0016E673 /* App.framework in Frameworks */, FAD0116522F1B9DF0016E673 /* Flutter.framework in Frameworks */, - 28E53B1918D78EE80D39B80B /* libPods-Runner.a in Frameworks */, + 61218C54852F80DBB5690C6B /* libPods-Runner.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -131,10 +131,10 @@ path = launch; sourceTree = ""; }; - 7A8DD22A849804A38B883F48 /* Frameworks */ = { + 70363EC0C64C41727112751D /* Frameworks */ = { isa = PBXGroup; children = ( - 8CA6E84257C027654D3B0DE2 /* libPods-Runner.a */, + 57AAEC56B643BC3DE4EF4F8C /* libPods-Runner.a */, ); name = Frameworks; sourceTree = ""; @@ -148,7 +148,7 @@ 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, F1785F83FDEE22F813679AE5 /* Pods */, - 7A8DD22A849804A38B883F48 /* Frameworks */, + 70363EC0C64C41727112751D /* Frameworks */, ); sourceTree = ""; }; @@ -190,8 +190,8 @@ F1785F83FDEE22F813679AE5 /* Pods */ = { isa = PBXGroup; children = ( - 89FACEFBFBEF7EF9543ED2CB /* Pods-Runner.debug.xcconfig */, - 8EF8BF8C94C017772D134BF5 /* Pods-Runner.release.xcconfig */, + 73D4159B73B37E5BB51DC8A8 /* Pods-Runner.debug.xcconfig */, + C1B7099BCFD500AF7A1AE3BA /* Pods-Runner.release.xcconfig */, ); path = Pods; sourceTree = ""; @@ -216,15 +216,15 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 58F6EF4F43D025EF078E3114 /* [CP] Check Pods Manifest.lock */, + 34CFEC045D120AACCFB18EF6 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 61B12781D52CE38332797DFE /* [CP] Embed Pods Frameworks */, - B9D270AE480D301A54E3C20C /* [CP] Copy Pods Resources */, + 8B2E54AA10C5E285608EB386 /* [CP] Embed Pods Frameworks */, + 1213D882A132005FD721F0C6 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -307,21 +307,25 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + 1213D882A132005FD721F0C6 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/flutter_downloader/FlutterDownloaderDatabase.bundle", ); - name = "Thin Binary"; + name = "[CP] Copy Pods Resources"; outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FlutterDownloaderDatabase.bundle", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; }; - 58F6EF4F43D025EF078E3114 /* [CP] Check Pods Manifest.lock */ = { + 34CFEC045D120AACCFB18EF6 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -343,7 +347,21 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 61B12781D52CE38332797DFE /* [CP] Embed Pods Frameworks */ = { + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + }; + 8B2E54AA10C5E285608EB386 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -375,24 +393,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n"; }; - B9D270AE480D301A54E3C20C /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/flutter_downloader/FlutterDownloaderDatabase.bundle", - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FlutterDownloaderDatabase.bundle", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings deleted file mode 100644 index 949b6789..00000000 --- a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ /dev/null @@ -1,8 +0,0 @@ - - - - - BuildSystemType - Original - - diff --git a/lib/api/api.dart b/lib/api/api.dart index bfac51fc..748e3422 100644 --- a/lib/api/api.dart +++ b/lib/api/api.dart @@ -29,7 +29,7 @@ class Api{ static const String GET_THEMECOLOR = BASE_URL +'/getThemeColor';//获取主题颜色 - static const String GET_WIDGET_TREE = 'http://flutter-go.alibaba.net/' + 'getCateList';//获取widget列表树 + static const String GET_WIDGET_TREE = BASE_URL + 'getCateList';//获取widget列表树 static const String SEARCH_WIDGET = BASE_URL+'searchWidget';//搜索组件 } diff --git a/lib/components/full_screen_code_dialog.dart b/lib/components/full_screen_code_dialog.dart index 76147749..c8f05476 100644 --- a/lib/components/full_screen_code_dialog.dart +++ b/lib/components/full_screen_code_dialog.dart @@ -9,9 +9,10 @@ import 'package:flutter_go/utils/example_code_parser.dart'; import 'package:flutter_go/utils/syntax_highlighter.dart'; class FullScreenCodeDialog extends StatefulWidget { - const FullScreenCodeDialog({this.filePath}); + const FullScreenCodeDialog({this.filePath, this.remoteFilePath}); final String filePath; + final String remoteFilePath; _FullScreenCodeDialogState createState() => _FullScreenCodeDialogState(); } diff --git a/lib/components/loading.dart b/lib/components/loading.dart new file mode 100644 index 00000000..659b2ff8 --- /dev/null +++ b/lib/components/loading.dart @@ -0,0 +1,94 @@ +// +// Created with Android Studio. +// User: 三帆 +// Date: 07/08/2019 +// Time: 08:40 +// email: sanfan.hx@alibaba-inc.com +// tartget: 代码获取自: https://blog.csdn.net/O_time/article/details/86496537 +// +import 'dart:async'; +import 'package:flutter/material.dart'; + +// ignore: must_be_immutable +class NetLoadingDialog extends StatefulWidget { + String loadingText; + bool outsideDismiss; + bool loading; + Function dismissCallback; + Future requestCallBack; + + NetLoadingDialog( + {Key key, + this.loadingText = "loading...", + this.outsideDismiss = true, + this.dismissCallback, + this.loading, + this.requestCallBack}) + : super(key: key); + + @override + State createState() => _LoadingDialog(); +} + +class _LoadingDialog extends State { + _dismissDialog() { + if (widget.dismissCallback != null) { + widget.dismissCallback(); + } + Navigator.of(context).pop(); + } + + @override + void initState() { + super.initState(); + if (widget.requestCallBack != null) { + widget.requestCallBack.then((_) { + Navigator.pop(context); + }); + } + } + + @override + Widget build(BuildContext context) { + if (!widget.loading) { + return Container(); + } + return new GestureDetector( + onTap: widget.outsideDismiss ? _dismissDialog : null, + child: Material( + type: MaterialType.transparency, + child: new Center( + child: new SizedBox( + width: 120.0, + height: 120.0, + child: new Container( + decoration: ShapeDecoration( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all( + Radius.circular(8.0), + ), + ), + ), + child: new Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + new CircularProgressIndicator(), + new Padding( + padding: const EdgeInsets.only( + top: 20.0, + ), + child: new Text( + widget.loadingText, + style: new TextStyle(fontSize: 12.0), + ), + ), + ], + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/components/widget_demo.dart b/lib/components/widget_demo.dart index 5c75bb32..8783b18a 100644 --- a/lib/components/widget_demo.dart +++ b/lib/components/widget_demo.dart @@ -25,8 +25,8 @@ class WidgetDemo extends StatefulWidget { {Key key, @required this.title, @required this.contentList, - @required this.codeUrl, - @required this.docUrl, + this.codeUrl, + this.docUrl, this.bottomNaviBar}) : super(key: key); @@ -141,7 +141,38 @@ class _WidgetDemoState extends State { '${Routes.codeView}?filePath=${Uri.encodeComponent(widget.codeUrl)}'); } } - + List> buildPopupMenu() { + List> comps = []; + if (widget.docUrl != null) { + comps.add( + PopupMenuItem( + value: 'doc', + child: ListTile( + leading: Icon( + Icons.library_books, + size: 22.0, + ), + title: Text('查看文档'), + ), + ) + ); + } + if (widget.codeUrl != null) { + comps.add( + PopupMenuItem( + value: 'code', + child: ListTile( + leading: Icon( + Icons.code, + size: 22.0, + ), + title: Text('查看Demo'), + ), + ) + ); + } + return comps; + } @override Widget build(BuildContext context) { if (_hasCollected) { @@ -149,50 +180,34 @@ class _WidgetDemoState extends State { } else { _collectionIcons = Icons.favorite_border; } + List> menus = buildPopupMenu(); + List actions = [ + new IconButton( + tooltip: 'goBack home', + onPressed: () { + Navigator.popUntil(context, ModalRoute.withName('/')); + }, + icon: Icon(Icons.home), + ), + new IconButton( + tooltip: 'collection', + onPressed: _getCollection, + icon: Icon(_collectionIcons), + ), + ]; + if (menus.length > 0) { + actions.add( + PopupMenuButton( + onSelected: _selectValue, + itemBuilder: (BuildContext context) => menus, + ) + ); + } return Scaffold( key: _scaffoldKey, appBar: AppBar( title: Text(widget.title), - actions: [ - new IconButton( - tooltip: 'goBack home', - onPressed: () { - Navigator.popUntil(context, ModalRoute.withName('/')); - }, - icon: Icon(Icons.home), - ), - new IconButton( - tooltip: 'collection', - onPressed: _getCollection, - icon: Icon(_collectionIcons), - ), - PopupMenuButton( - onSelected: _selectValue, - itemBuilder: (BuildContext context) => >[ - const PopupMenuItem( - value: 'doc', - child: ListTile( - leading: Icon( - Icons.library_books, - size: 22.0, - ), - title: Text('查看文档'), - ), - ), - const PopupMenuDivider(), - const PopupMenuItem( - value: 'code', - child: ListTile( - leading: Icon( - Icons.code, - size: 22.0, - ), - title: Text('查看Demo'), - ), - ), - ], - ), - ], + actions: actions, ), body: Container( padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0), diff --git a/lib/main.dart b/lib/main.dart index 95c7f3f9..52082f22 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -17,7 +17,7 @@ import 'package:flutter_go/event/event_bus.dart'; import 'package:flutter_go/event/event_model.dart'; import 'package:event_bus/event_bus.dart'; import 'package:flutter_go/model/widget.dart'; - +import 'package:flutter_go/standard_pages/index.dart'; //import 'views/welcome_page/index.dart'; SpUtil sp; @@ -28,7 +28,6 @@ class MyApp extends StatefulWidget { final router = new Router(); Routes.configureRoutes(router); // 这里设置项目环境 - Application.env = ENV.PRODUCTION; Application.router = router; } @@ -189,10 +188,13 @@ void main() async { await provider.init(true); sp = await SpUtil.getInstance(); new SearchHistoryList(sp); + await DataUtils.getWidgetTreeList().then((List json) { - if (json == null) return; - Application.widgetTree = WidgetTree.buildWidgetTree(json); + List data = WidgetTree.insertDevPagesToList(json, StandardPages().getLocalList()); + Application.widgetTree = WidgetTree.buildWidgetTree(data); + print("Application.widgetTree>>>> ${Application.widgetTree}"); }); db = Provider.db; runApp(new MyApp()); } + diff --git a/lib/model/cat.dart b/lib/model/cat.dart index e9ecae7b..5ac493f4 100644 --- a/lib/model/cat.dart +++ b/lib/model/cat.dart @@ -1,107 +1,107 @@ - -import 'dart:async'; - -import 'package:flutter_go/utils/sql.dart'; - -abstract class CatInterface{ - int get id; - //类目名称 - String get name; - //描述 - String get desc; - //第几级类目,默认 1 - int get depth; - //父类目id,没有为 0 - int get parentId; -} - -class Cat implements CatInterface { - int id; - String name; - String desc; - int depth; - int parentId; - - Cat({this.id, this.name, this.desc, this.depth, this.parentId}); - - Cat.fromJSON(Map json) - : id = json['id'], - name = json['name'], - desc = json['desc'], - depth = json['depth'], - parentId = json['parentId']; - - String toString() { - return '(Cat $name)'; - } - - Map toMap() { - return { - 'id': id, - 'name': name, - 'desc': desc, - 'depth': depth, - 'parentId': parentId - }; - } - Map toSqlCondition() { - Map _map = this.toMap(); - Map condition = {}; - _map.forEach((k, value) { - - if (value != null) { - - condition[k] = value; - } - }); - - if (condition.isEmpty) { - return {}; - } - - return condition; - } -} - - -class CatControlModel{ - final String table = 'cat'; - Sql sql; - CatControlModel() { - sql = Sql.setTable(table); - } - - /// 获取一级类目 - Future mainList() async{ - List listJson = await sql.getByCondition(conditions: {'parentId': 0}); - List cats = listJson.map((json) { - return new Cat.fromJSON(json); - }).toList(); - return cats; - } - - // 获取Cat不同深度与parent的列表 - Future> getList([Cat cat]) async{ - - - if (cat == null) { - cat = new Cat(depth: 1, parentId: 0); - } - // print("cat in getList ${cat.toMap()}"); - List listJson = await sql.getByCondition(conditions: cat.toSqlCondition()); - List cats = listJson.map((json) { - return new Cat.fromJSON(json); - }).toList(); - return cats; - } - - // 通过name获取Cat对象信息 - Future getCatByName(String name) async { - List json = await sql.getByCondition(conditions: {'name': name}); - if (json.isEmpty) { - return null; - } - return new Cat.fromJSON(json.first); - } - -} +// +//import 'dart:async'; +// +//import 'package:flutter_go/utils/sql.dart'; +// +//abstract class CatInterface{ +// int get id; +// //类目名称 +// String get name; +// //描述 +// String get desc; +// //第几级类目,默认 1 +// int get depth; +// //父类目id,没有为 0 +// int get parentId; +//} +// +//class Cat implements CatInterface { +// int id; +// String name; +// String desc; +// int depth; +// int parentId; +// +// Cat({this.id, this.name, this.desc, this.depth, this.parentId}); +// +// Cat.fromJSON(Map json) +// : id = json['id'], +// name = json['name'], +// desc = json['desc'], +// depth = json['depth'], +// parentId = json['parentId']; +// +// String toString() { +// return '(Cat $name)'; +// } +// +// Map toMap() { +// return { +// 'id': id, +// 'name': name, +// 'desc': desc, +// 'depth': depth, +// 'parentId': parentId +// }; +// } +// Map toSqlCondition() { +// Map _map = this.toMap(); +// Map condition = {}; +// _map.forEach((k, value) { +// +// if (value != null) { +// +// condition[k] = value; +// } +// }); +// +// if (condition.isEmpty) { +// return {}; +// } +// +// return condition; +// } +//} +// +// +//class CatControlModel{ +// final String table = 'cat'; +// Sql sql; +// CatControlModel() { +// sql = Sql.setTable(table); +// } +// +// /// 获取一级类目 +// Future mainList() async{ +// List listJson = await sql.getByCondition(conditions: {'parentId': 0}); +// List cats = listJson.map((json) { +// return new Cat.fromJSON(json); +// }).toList(); +// return cats; +// } +// +// // 获取Cat不同深度与parent的列表 +// Future> getList([Cat cat]) async{ +// +// +// if (cat == null) { +// cat = new Cat(depth: 1, parentId: 0); +// } +// // print("cat in getList ${cat.toMap()}"); +// List listJson = await sql.getByCondition(conditions: cat.toSqlCondition()); +// List cats = listJson.map((json) { +// return new Cat.fromJSON(json); +// }).toList(); +// return cats; +// } +// +// // 通过name获取Cat对象信息 +// Future getCatByName(String name) async { +// List json = await sql.getByCondition(conditions: {'name': name}); +// if (json.isEmpty) { +// return null; +// } +// return new Cat.fromJSON(json.first); +// } +// +//} diff --git a/lib/model/widget.dart b/lib/model/widget.dart index 25e0a9af..3cc757be 100644 --- a/lib/model/widget.dart +++ b/lib/model/widget.dart @@ -2,7 +2,7 @@ import 'dart:async'; import "package:flutter/material.dart"; - +import "package:flutter_go/routers/application.dart"; import 'package:flutter_go/utils/sql.dart'; enum treeNode { @@ -188,14 +188,16 @@ class CategoryComponent extends CommonItem { @required this.id, @required this.name, @required this.parentId, + this.type = 'categoryw', this.children, this.parent }); CategoryComponent.fromJson(Map json) { - this.id = int.parse(json['id']); + print(json['id'].runtimeType); + this.id = json['id']; this.name = json['name']; this.parentId = json['parentId']; - this.token = json['id'] + json['type']; + this.token = json['id'].toString() + json['type']; } void addChildren(Object item) { if (item is CategoryComponent) { @@ -265,13 +267,13 @@ class WidgetLeaf extends CommonItem { }); WidgetLeaf.fromJson(Map json) { - this.id = int.parse(json['id']); + this.id = json['id']; this.name = json['name']; this.display = json['display']; this.author = json['author'] ?? null; this.path = json['path'] ?? null; this.pageId = json['pageId'] ?? null; - this.token = json['id'] + json['type']; + this.token = json['id'].toString() + json['type']; } @override CommonItem getChild(String token) { @@ -289,6 +291,7 @@ class WidgetLeaf extends CommonItem { } class WidgetTree { + // 构建树型结构 static CategoryComponent buildWidgetTree(List json, [parent]){ CategoryComponent current; if (parent != null) { @@ -297,7 +300,6 @@ class WidgetTree { current = CategoryComponent(id: 0, name: 'root', parentId: null, children: []); } json.forEach((item) { - // 归属分类级别 if (['root', 'category'].indexOf(item['type']) != -1) { CategoryComponent cate = CategoryComponent.fromJson(item); @@ -313,6 +315,41 @@ class WidgetTree { }); return current; } + + static insertDevPagesToList(List list, List devPages) { + List devChildren = []; + int index = 9999999; + if (Application.env == ENV.PRODUCTION) { + return list; + } + devPages.forEach((item) { + index++; + if (item['id'] != null) { + devChildren.add({ + "id": index.toString(), + "name": item['name'], + "parentId": "99999999999", + "type": "widget", + "display": "standard", + "author": item['author'], + "pageId": item['id'] + }); + } + }); + list.forEach((item) { + if (item['name'].toString().toUpperCase() == 'DEVELOPER') { + List children = item['children']; + children.insert(0, { + "id": "99999999999", + "name": "本地代码", + "parentId": item['id'], + "type": "category", + "children": devChildren + }); + } + }); + return list; + } static CategoryComponent getCommonItemById(List path, CategoryComponent root) { print("getCommonItemByPath $path"); print("root $root"); diff --git a/lib/page_demo_package/.demo.json b/lib/page_demo_package/.demo.json index 0e45bee1..1967c339 100644 --- a/lib/page_demo_package/.demo.json +++ b/lib/page_demo_package/.demo.json @@ -1 +1 @@ -[{"name":"demoName","screenShot":"","author":"yourName","email":"yourEmail","desc":"这是一个测试的标准demo","id":"1a29aa8e_32ae_4241_9c8a_5c9e1f92b096"}] \ No newline at end of file +[{"name":"demoName","screenShot":"","author":"yourName","email":"yourEmail","desc":"这是一个测试的标准demo","id":"1a29aa8e_32ae_4241_9c8a_5c9e1f92b096"},{"name":"local","screenShot":"","author":"ab","email":"email","desc":"ags","id":"2c1d57d0_42ae_4241_9c8a_5c9e1f92b096"}] \ No newline at end of file diff --git a/lib/page_demo_package/index.dart b/lib/page_demo_package/index.dart index 3a4a6f72..1e6a4966 100644 --- a/lib/page_demo_package/index.dart +++ b/lib/page_demo_package/index.dart @@ -1,4 +1,6 @@ import 'demoName_yourName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardDemo_demoName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096; +import 'local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardDemo_local_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096; var demoObjects = { - '1a29aa8e_32ae_4241_9c8a_5c9e1f92b096': StandardDemo_demoName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096.demoWidgets + '1a29aa8e_32ae_4241_9c8a_5c9e1f92b096': StandardDemo_demoName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096.demoWidgets, + '2c1d57d0_42ae_4241_9c8a_5c9e1f92b096': StandardDemo_local_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096.demoWidgets }; \ No newline at end of file diff --git a/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/.demo.json b/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/.demo.json new file mode 100644 index 00000000..e6e8114d --- /dev/null +++ b/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/.demo.json @@ -0,0 +1,9 @@ +{ + "name": "local", + "screenShot": "", + "author":"ab", + "email": "email", + "desc": "ags", + "id": "2c1d57d0_42ae_4241_9c8a_5c9e1f92b096" +} + \ No newline at end of file diff --git a/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/index.dart b/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/index.dart new file mode 100644 index 00000000..4e315373 --- /dev/null +++ b/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/index.dart @@ -0,0 +1,15 @@ +// +// Created with flutter go cli +// User: ab +// Time: 2019-08-06 17:26:02.905889 +// email: email +// desc: ags +// + +import 'src/index.dart'; + +var demoWidgets = [ + new Demo() +]; + + \ No newline at end of file diff --git a/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/src/index.dart b/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/src/index.dart new file mode 100644 index 00000000..d0d3921e --- /dev/null +++ b/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/src/index.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; + +class Demo extends StatefulWidget { + @override + _State createState() => _State(); +} + +class _State extends State { + @override + Widget build(BuildContext context) { + return Container( + child: Text("this is flutter go init demo"), + ); + } +} + \ No newline at end of file diff --git a/lib/routers/routers.dart b/lib/routers/routers.dart index dc1183a5..711e2285 100644 --- a/lib/routers/routers.dart +++ b/lib/routers/routers.dart @@ -10,6 +10,7 @@ class Routes { static String home = "/home"; static String widgetDemo = '/widget-demo'; static String codeView = '/code-view'; + static String githubCodeView = '/github-code-view'; static String webViewPage = '/web-view-page'; static String loginPage = '/loginpage'; static String issuesMessage='/issuesMessage'; diff --git a/lib/standard_pages/.pages.json b/lib/standard_pages/.pages.json index e5fdc536..18e4f686 100644 --- a/lib/standard_pages/.pages.json +++ b/lib/standard_pages/.pages.json @@ -1,11 +1 @@ -[ - { - "name": "standard", - "screenShot": "", - "author": "sanfan", - "title": "介绍页", - "email": "hanxu317@qq.com", - "desc": "desc", - "id": "ee4feb8e_32ae_4241_9c8a_5c9e1f92b096" - } -] \ No newline at end of file +[{"name":"local","screenShot":"","author":"hnaxu","title":"本地","email":"hanxu@qq.com","desc":"desc","id":"5d7178d0_42ae_4241_9c8a_5c9e1f92b096"},{"name":"test","screenShot":"","author":"abc","title":"ya","email":"adsf.com","desc":"desc","id":"84f38e00_42ae_4241_9c8a_5c9e1f92b096"},{"name":"standard","screenShot":"","author":"sanfan","title":"介绍页","email":"hanxu317@qq.com","desc":"desc","id":"ee4feb8e_32ae_4241_9c8a_5c9e1f92b096"}] \ No newline at end of file diff --git a/lib/standard_pages/index.dart b/lib/standard_pages/index.dart index 9d537fdd..eb5ac663 100644 --- a/lib/standard_pages/index.dart +++ b/lib/standard_pages/index.dart @@ -1,11 +1,30 @@ + +import 'local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardPage_local_5d7178d0_42ae_4241_9c8a_5c9e1f92b096; +import 'test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardPage_test_84f38e00_42ae_4241_9c8a_5c9e1f92b096; import 'standard_sanfan_ee4feb8e_32ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardPage_standard_ee4feb8e_32ae_4241_9c8a_5c9e1f92b096; class StandardPages { Map standardPages; Map getPages() { return { - 'ee4feb8e_32ae_4241_9c8a_5c9e1f92b096': StandardPage_standard_ee4feb8e_32ae_4241_9c8a_5c9e1f92b096.getMd() + "0": "0" , + "5d7178d0_42ae_4241_9c8a_5c9e1f92b096" : StandardPage_local_5d7178d0_42ae_4241_9c8a_5c9e1f92b096.getMd() +, + "84f38e00_42ae_4241_9c8a_5c9e1f92b096" : StandardPage_test_84f38e00_42ae_4241_9c8a_5c9e1f92b096.getMd() +, + "ee4feb8e_32ae_4241_9c8a_5c9e1f92b096" : StandardPage_standard_ee4feb8e_32ae_4241_9c8a_5c9e1f92b096.getMd() }; } -} + List> getLocalList() { + return [ + {}, + { "id": "5d7178d0_42ae_4241_9c8a_5c9e1f92b096", "name": "local", "email": "hanxu@qq.com", "author": "hnaxu"} +, + { "id": "84f38e00_42ae_4241_9c8a_5c9e1f92b096", "name": "test", "email": "adsf.com", "author": "abc"} +, + { "id": "ee4feb8e_32ae_4241_9c8a_5c9e1f92b096", "name": "standard", "email": "hanxu317@qq.com", "author": "sanfan"} + ]; + } - \ No newline at end of file +} + + \ No newline at end of file diff --git a/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/.page.json b/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/.page.json new file mode 100644 index 00000000..d6a9e3d0 --- /dev/null +++ b/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/.page.json @@ -0,0 +1,10 @@ +{ + "name": "local", + "screenShot": "", + "author":"hnaxu", + "title":"本地", + "email": "hanxu@qq.com", + "desc": "desc", + "id": "5d7178d0_42ae_4241_9c8a_5c9e1f92b096" +} + \ No newline at end of file diff --git a/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.dart b/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.dart new file mode 100644 index 00000000..6e506d10 --- /dev/null +++ b/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.dart @@ -0,0 +1,52 @@ +String getMd() { + return """ + # 标准的详情页 + +您可以在这个界面中, 编写大多数的markdown文案, 他会在 **goCli watch** 下同步被编译成 **dart** 文件 + +您可以通过goCli创建详情页所需要的demo + +``` +goCLi createDemo +``` + +在flutter go 根文件下通过命令行输入以上命令可以进行以下操作 + +[✓] 请输入新增加的demo名称? demoName + +[✓] 请输入您的姓名(使用英文) yourName + +[✓] 请输入您的github的email地址 yourEmail + +[✓] 请输入您demo的描述 这是一个测试的标准demo + + +在完成以上操作后, 可以得到这样的输出: + + +``` +------------------ +您新增的组件信息如下 +================== +{ + name : demoName + author : yourName + email : yourEmail + desc : 这是一个测试的标准demo +} +================== +[✓] Is this the config you want ? (Y/n) y +{ + 新建的demo文件位于 : /flutter go/lib/page_demo_package/demoName_yourName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096 + demoId为 : 1a29aa8e_32ae_4241_9c8a_5c9e1f92b096 + markdown中调用方式 : [demo:1a29aa8e_32ae_4241_9c8a_5c9e1f92b096] +} + +``` +您可以在任意详情页中, 通过以下方式调用 + +``` +[demo: 1a29aa8e_32ae_4241_9c8a_5c9e1f92b096] +```"""; + +} diff --git a/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.md b/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.md new file mode 100644 index 00000000..61a5f516 --- /dev/null +++ b/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.md @@ -0,0 +1,48 @@ +# 标准的详情页 + +您可以在这个界面中, 编写大多数的markdown文案, 他会在 **goCli watch** 下同步被编译成 **dart** 文件 + +您可以通过goCli创建详情页所需要的demo + +``` +goCLi createDemo +``` + +在flutter go 根文件下通过命令行输入以上命令可以进行以下操作 + +[✓] 请输入新增加的demo名称? demoName + +[✓] 请输入您的姓名(使用英文) yourName + +[✓] 请输入您的github的email地址 yourEmail + +[✓] 请输入您demo的描述 这是一个测试的标准demo + + +在完成以上操作后, 可以得到这样的输出: + + +``` +------------------ +您新增的组件信息如下 +================== +{ + name : demoName + author : yourName + email : yourEmail + desc : 这是一个测试的标准demo +} +================== +[✓] Is this the config you want ? (Y/n) y +{ + 新建的demo文件位于 : /flutter go/lib/page_demo_package/demoName_yourName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096 + demoId为 : 1a29aa8e_32ae_4241_9c8a_5c9e1f92b096 + markdown中调用方式 : [demo:1a29aa8e_32ae_4241_9c8a_5c9e1f92b096] +} + +``` +您可以在任意详情页中, 通过以下方式调用 + +``` +[demo: 1a29aa8e_32ae_4241_9c8a_5c9e1f92b096] +``` \ No newline at end of file diff --git a/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/.page.json b/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/.page.json new file mode 100644 index 00000000..297b026e --- /dev/null +++ b/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/.page.json @@ -0,0 +1,10 @@ +{ + "name": "test", + "screenShot": "", + "author":"abc", + "title":"ya", + "email": "adsf.com", + "desc": "desc", + "id": "84f38e00_42ae_4241_9c8a_5c9e1f92b096" +} + \ No newline at end of file diff --git a/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.dart b/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.dart new file mode 100644 index 00000000..6e506d10 --- /dev/null +++ b/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.dart @@ -0,0 +1,52 @@ +String getMd() { + return """ + # 标准的详情页 + +您可以在这个界面中, 编写大多数的markdown文案, 他会在 **goCli watch** 下同步被编译成 **dart** 文件 + +您可以通过goCli创建详情页所需要的demo + +``` +goCLi createDemo +``` + +在flutter go 根文件下通过命令行输入以上命令可以进行以下操作 + +[✓] 请输入新增加的demo名称? demoName + +[✓] 请输入您的姓名(使用英文) yourName + +[✓] 请输入您的github的email地址 yourEmail + +[✓] 请输入您demo的描述 这是一个测试的标准demo + + +在完成以上操作后, 可以得到这样的输出: + + +``` +------------------ +您新增的组件信息如下 +================== +{ + name : demoName + author : yourName + email : yourEmail + desc : 这是一个测试的标准demo +} +================== +[✓] Is this the config you want ? (Y/n) y +{ + 新建的demo文件位于 : /flutter go/lib/page_demo_package/demoName_yourName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096 + demoId为 : 1a29aa8e_32ae_4241_9c8a_5c9e1f92b096 + markdown中调用方式 : [demo:1a29aa8e_32ae_4241_9c8a_5c9e1f92b096] +} + +``` +您可以在任意详情页中, 通过以下方式调用 + +``` +[demo: 1a29aa8e_32ae_4241_9c8a_5c9e1f92b096] +```"""; + +} diff --git a/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.md b/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.md new file mode 100644 index 00000000..61a5f516 --- /dev/null +++ b/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.md @@ -0,0 +1,48 @@ +# 标准的详情页 + +您可以在这个界面中, 编写大多数的markdown文案, 他会在 **goCli watch** 下同步被编译成 **dart** 文件 + +您可以通过goCli创建详情页所需要的demo + +``` +goCLi createDemo +``` + +在flutter go 根文件下通过命令行输入以上命令可以进行以下操作 + +[✓] 请输入新增加的demo名称? demoName + +[✓] 请输入您的姓名(使用英文) yourName + +[✓] 请输入您的github的email地址 yourEmail + +[✓] 请输入您demo的描述 这是一个测试的标准demo + + +在完成以上操作后, 可以得到这样的输出: + + +``` +------------------ +您新增的组件信息如下 +================== +{ + name : demoName + author : yourName + email : yourEmail + desc : 这是一个测试的标准demo +} +================== +[✓] Is this the config you want ? (Y/n) y +{ + 新建的demo文件位于 : /flutter go/lib/page_demo_package/demoName_yourName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096 + demoId为 : 1a29aa8e_32ae_4241_9c8a_5c9e1f92b096 + markdown中调用方式 : [demo:1a29aa8e_32ae_4241_9c8a_5c9e1f92b096] +} + +``` +您可以在任意详情页中, 通过以下方式调用 + +``` +[demo: 1a29aa8e_32ae_4241_9c8a_5c9e1f92b096] +``` \ No newline at end of file diff --git a/lib/utils/data_utils.dart b/lib/utils/data_utils.dart index dc0d9036..6d67b865 100644 --- a/lib/utils/data_utils.dart +++ b/lib/utils/data_utils.dart @@ -109,7 +109,7 @@ class DataUtils { static Future getWidgetTreeList() async { try { var response = await NetUtils.get(Api.GET_WIDGET_TREE); - print('组件树:$response'); + print('组件树dddd:$response'); if (response != null && response['success']) { return response['data']; } else { diff --git a/lib/views/standard_demo_page/const.dart b/lib/views/standard_demo_page/const.dart deleted file mode 100644 index d874f270..00000000 --- a/lib/views/standard_demo_page/const.dart +++ /dev/null @@ -1,12 +0,0 @@ -const title = 'titie1'; -Map titleObjs = { - 'title': 'haha33' -}; -class Maps { - Map list; - getList() { - return { - "title": "1111" - }; - } -} \ No newline at end of file diff --git a/lib/views/standard_demo_page/index.dart b/lib/views/standard_demo_page/index.dart index bb1810b2..f3e5fe57 100644 --- a/lib/views/standard_demo_page/index.dart +++ b/lib/views/standard_demo_page/index.dart @@ -15,6 +15,13 @@ import '../../components/flutter_markdown/lib/flutter_markdown.dart'; import '../../standard_pages/index.dart'; import '../../page_demo_package/index.dart'; import 'package:flutter_go/routers/application.dart'; +import 'package:flutter_go/utils/net_utils.dart'; +import 'package:flutter_go/components/loading.dart'; + +const githubUrl = 'https://raw.githubusercontent.com/alibaba/flutter-go/beta/lib/standard_pages/'; +const PagesUrl = 'https://raw.githubusercontent.com/alibaba/flutter-go/beta/lib/standard_pages/.pages.json'; +const DemosUrl = 'https://raw.githubusercontent.com/alibaba/flutter-go/beta/lib/page_demo_package/.demo.json'; + // ONLINE || LOCAL ENV env = Application.env; @@ -28,25 +35,24 @@ class StandardView extends StatefulWidget { } class _StandardView extends State { - String markdownDesc = '# this is header'; - String pageTitle = "XXX"; - + String markdownDesc = ''; + String pageTitle = ''; + bool isLoading = false; String author = ''; String email = ''; StandardPages standardPage = new StandardPages(); @override void initState() { super.initState(); - this.getDetail(); + this.getPageInfo(); } - // 本地调用的获取基本信息 - Future getPagesInfo() async { - String jsonString = await DefaultAssetBundle.of(context) - .loadString('lib/standard_pages/.pages.json'); + /// 本地调用的获取文章属性的基本信息 + Future localGetPagesAttrsInfo() async { + String jsonString = await DefaultAssetBundle.of(context).loadString('lib/standard_pages/.pages.json'); List jsonList = json.decode(jsonString); - Map pageDetail = - jsonList.firstWhere((item) => item['id'] == widget.id); + Map pageDetail = jsonList.firstWhere((item) => item['id'] == widget.id); + if (pageDetail != null) { setState(() { pageTitle = pageDetail['title'] ?? '请加入title'; @@ -56,27 +62,56 @@ class _StandardView extends State { } } - String _getContentFromLocal() { + /// 从本地获取基本文章信息 + String localGetPagesMarkdown() { + String pageId = widget.id; Map pagesList = standardPage.getPages(); return pagesList[pageId]; } + Future getContentOnline() async { - Future _getContentOnline() async { String content = 'online content'; + this.setState(() { + isLoading = true; + }); - return Future(() => content); + List response = jsonDecode(await NetUtils.get(PagesUrl)); + + + + Map targetPage = response.firstWhere((page) => page['id'] == widget.id); + if (targetPage == null) { + setState(() { + isLoading = false; + }); + return Future(() => '未获取界面相当信息'); + } + setState(() { + pageTitle = targetPage['title'] ?? 'xxx'; + author = targetPage['author']; + email = targetPage['email']; + }); + + String pageName = targetPage['name'] + "_" +targetPage['author']+ "_" +targetPage['id']; + String pageContent = await NetUtils.get(githubUrl + pageName + "/index.md"); + setState(() { + isLoading = false; + }); + return Future(() => pageContent); } - - Future getDetail() async { + /// 获取当面界面的相关信息. 需要区分环境 + /// 本地环境下, 从本地获取 standard_pages的目录中互殴 + /// 线上环境. 从github的api中获取 + Future getPageInfo() async { String conent = ''; print("env:::: $env"); if (env == ENV.PRODUCTION) { - conent = await _getContentOnline(); + conent = await getContentOnline(); } else { - getPagesInfo(); - conent = _getContentFromLocal(); + conent = localGetPagesMarkdown(); + localGetPagesAttrsInfo(); } if (this.mounted) { setState(() { @@ -84,19 +119,33 @@ class _StandardView extends State { }); } return Future(() => conent); -// this.rebuild(); + } + Widget buildFootInfo() { + if (!isLoading) { + return Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('创建者: $author'), + Text('邮箱: $email'), + Text('界面id: ${widget.id}') + ], + ), + ); + } + return Container(); } Widget buildMarkdown() { - Map contentList = new StandardPages().getPages(); - if (contentList[widget.id] == null) { - contentList[widget.id] = ''; + + if (markdownDesc == null) { + return null; } return MarkdownBody( - data: contentList[widget.id], - syntaxHighlighter: new mdCopy.HighLight(), + data: markdownDesc, + syntaxHighlighter:new mdCopy.HighLight(), demoBuilder: (Map attrs) { List demo = demoObjects[attrs['id']]; if (demo == null) { @@ -109,20 +158,22 @@ class _StandardView extends State { }); } + @override Widget build(BuildContext context) { return new WidgetDemo( title: pageTitle, - codeUrl: 'elements/Form/Button/DropdownButton/demo.dart', +// codeUrl: 'elements/Form/Button/DropdownButton/demo.dart', contentList: [ + NetLoadingDialog( + loading: isLoading, + outsideDismiss: false, + ), buildMarkdown(), SizedBox(height: 30), - '创建者: $author', - '创建者: $email', - 'id: ${widget.id}', + buildFootInfo(), + SizedBox(height: 30) ], - docUrl: - 'https://docs.flutter.io/flutter/material/DropdownButton-class.html', ); } } diff --git a/lib/views/widget_page/widget_page.dart b/lib/views/widget_page/widget_page.dart index 860d1466..5df042cb 100644 --- a/lib/views/widget_page/widget_page.dart +++ b/lib/views/widget_page/widget_page.dart @@ -53,7 +53,6 @@ class SecondPageState extends State with AutomaticKeepAliveClientMix @override Widget build(BuildContext context) { super.build(context); - print("build in widget page"); return Container( color: Theme.of(context).backgroundColor, child: this.buildGrid(), diff --git a/pubspec.lock b/pubspec.lock index 7cd78d61..4bc7b1b4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,105 +5,105 @@ packages: dependency: transitive description: name: args - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.5.2" async: dependency: transitive description: name: async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.2.0" bloc: dependency: "direct main" description: name: bloc - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.12.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.4" charcode: dependency: transitive description: name: charcode - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.2" city_pickers: dependency: "direct main" description: name: city_pickers - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.0.4" collection: dependency: transitive description: name: collection - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.14.11" cookie_jar: dependency: "direct main" description: name: cookie_jar - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" csslib: dependency: transitive description: name: csslib - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.16.1" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.1.2" dio: dependency: "direct main" description: name: dio - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.13" event_bus: dependency: "direct main" description: name: event_bus - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" firebase_analytics: dependency: "direct main" description: name: firebase_analytics - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0+1" firebase_core: dependency: "direct main" description: name: firebase_core - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.3.4" fluro: dependency: "direct main" description: name: fluro - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.5.1" flutter: @@ -115,28 +115,28 @@ packages: dependency: "direct main" description: name: flutter_bloc - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.11.1" flutter_downloader: dependency: "direct main" description: name: flutter_downloader - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.9" flutter_jpush: dependency: "direct main" description: name: flutter_jpush - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.0.4" flutter_spinkit: dependency: "direct main" description: name: flutter_spinkit - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.1.0" flutter_test: @@ -148,154 +148,154 @@ packages: dependency: "direct main" description: name: flutter_webview_plugin - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.3.5" fluttertoast: dependency: "direct main" description: name: fluttertoast - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.1.0" html: dependency: "direct main" description: name: html - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.14.0+2" image_picker: dependency: "direct main" description: name: image_picker - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.5.4+3" intl: dependency: "direct main" description: name: intl - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.15.7" lpinyin: dependency: transitive description: name: lpinyin - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.7" markdown: dependency: "direct main" description: name: markdown - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.3" matcher: dependency: transitive description: name: matcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.12.5" meta: dependency: "direct main" description: name: meta - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.6" notus: dependency: transitive description: name: notus - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.1.3" open_file: dependency: "direct main" description: name: open_file - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.3" package_info: dependency: "direct main" description: name: package_info - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.4.0+6" path: dependency: "direct main" description: name: path - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.6.2" path_provider: dependency: "direct main" description: name: path_provider - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" pedantic: dependency: transitive description: name: pedantic - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.7.0" permission_handler: dependency: "direct main" description: name: permission_handler - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.2.1+1" quill_delta: dependency: transitive description: name: quill_delta - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" quiver: dependency: transitive description: name: quiver - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.3" quiver_hashcode: dependency: transitive description: name: quiver_hashcode - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" rxdart: dependency: transitive description: name: rxdart - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.21.0" share: dependency: "direct main" description: name: share - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.6.2+1" shared_preferences: dependency: "direct main" description: name: shared_preferences - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.4.3" sky_engine: @@ -307,77 +307,77 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.5.5" sqflite: dependency: "direct main" description: name: sqflite - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.6+3" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.9.3" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" string_scanner: dependency: "direct main" description: name: string_scanner - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.4" synchronized: dependency: transitive description: name: synchronized - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0+1" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.2.5" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.6" url_launcher: dependency: "direct main" description: name: url_launcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "5.1.2" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.8" zefyr: From e0846510c91e43d150966bed27174b722052c663 Mon Sep 17 00:00:00 2001 From: "xiaojia.dxj" Date: Thu, 8 Aug 2019 19:22:48 +0800 Subject: [PATCH 04/11] ios project.pbxproj --- ios/Runner.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index d32645ca..2b500e72 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -329,7 +329,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"/Users/xj.deng/development/flutter/packages/flutter_tools/bin/xcode_backend.sh\" thin\n"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin\n"; }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; From e8475c77153a83fe3843ef1ea2149baf75da1bf9 Mon Sep 17 00:00:00 2001 From: "yifeng.yl" Date: Thu, 8 Aug 2019 19:41:07 +0800 Subject: [PATCH 05/11] =?UTF-8?q?bottomBar=20=E6=B7=BB=E5=8A=A0=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/views/first_page/drawer_page.dart | 2 +- lib/views/home.dart | 24 ++++++++++------------ lib/views/user_page/user_page.dart | 29 +++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 14 deletions(-) create mode 100644 lib/views/user_page/user_page.dart diff --git a/lib/views/first_page/drawer_page.dart b/lib/views/first_page/drawer_page.dart index 52a9da0c..80f4980d 100644 --- a/lib/views/first_page/drawer_page.dart +++ b/lib/views/first_page/drawer_page.dart @@ -155,7 +155,7 @@ class _DrawerPageState extends State { size: 27.0, ), title: Text( - '搜索', + '全网搜', style: textStyle, ), onTap: () { diff --git a/lib/views/home.dart b/lib/views/home.dart index 1355d7a5..862d66b2 100644 --- a/lib/views/home.dart +++ b/lib/views/home.dart @@ -12,6 +12,7 @@ import 'package:flutter_go/utils/shared_preferences.dart'; import 'package:flutter_go/views/first_page/first_page.dart'; import 'package:flutter_go/views/first_page/main_page.dart'; import 'package:fluro/fluro.dart'; +import 'package:flutter_go/views/user_page/user_page.dart'; import 'package:flutter_go/views/widget_page/widget_page.dart'; import 'package:flutter_go/views/welcome_page/fourth_page.dart'; import 'package:flutter_go/views/collection_page/collection_page.dart'; @@ -24,9 +25,7 @@ import 'package:flutter_go/model/search_history.dart'; import 'package:flutter_go/resources/widget_name_to_icon.dart'; import 'package:flutter_go/model/user_info.dart'; - class AppPage extends StatefulWidget { - final UserInformation userInfo; AppPage(this.userInfo); @@ -49,8 +48,9 @@ class _MyHomePageState extends State static List tabData = [ {'text': '业界动态', 'icon': Icon(Icons.language)}, {'text': 'WIDGET', 'icon': Icon(Icons.extension)}, - {'text': '组件收藏', 'icon': Icon(Icons.favorite)}, {'text': '关于手册', 'icon': Icon(Icons.import_contacts)}, + {'text': '个人中心', 'icon': Icon(Icons.account_circle)}, + ]; List _myTabs = []; @@ -72,8 +72,8 @@ class _MyHomePageState extends State // ..add(FirstPage()) ..add(MainPage(userInfo: widget.userInfo)) ..add(WidgetPage()) - ..add(CollectionPage()) - ..add(FourthPage()); + ..add(FourthPage()) + ..add(UserPage(userInfo: widget.userInfo)); } @override @@ -90,12 +90,11 @@ class _MyHomePageState extends State void onWidgetTap(WidgetPoint widgetPoint, BuildContext context) { String targetName = widgetPoint.name; - searchHistoryList - .add(SearchHistory(name: targetName, targetRouter: widgetPoint.routerName)); + searchHistoryList.add( + SearchHistory(name: targetName, targetRouter: widgetPoint.routerName)); print("searchHistoryList1 ${searchHistoryList.toString()}"); - Application.router.navigateTo( - context, widgetPoint.routerName, - transition: TransitionType.inFromRight); + Application.router.navigateTo(context, widgetPoint.routerName, + transition: TransitionType.inFromRight); } Widget buildSearchInput(BuildContext context) { @@ -121,10 +120,9 @@ class _MyHomePageState extends State } renderAppBar(BuildContext context, Widget widget, int index) { - if (index == 0) { - return null; + if (index == 1) { + return AppBar(title: buildSearchInput(context)); } - return AppBar(title: buildSearchInput(context)); } @override diff --git a/lib/views/user_page/user_page.dart b/lib/views/user_page/user_page.dart new file mode 100644 index 00000000..885e2c1f --- /dev/null +++ b/lib/views/user_page/user_page.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_go/model/user_info.dart'; +import 'package:flutter_go/views/first_page/drawer_page.dart'; + +class UserPage extends StatefulWidget { + final UserInformation userInfo; + + UserPage({Key key, this.userInfo}) : super(key: key); + + @override + _UserPageState createState() => _UserPageState(); +} + +class _UserPageState extends State { + @override + Widget build(BuildContext context) { + print(widget.userInfo); + return Scaffold( + appBar: AppBar( + title: Text('个人中心'), + ), + body: Container( + child: DrawerPage( + userInfo: widget.userInfo, + ), + ), + ); + } +} From fcb8cc238dbe8385f8e76d5e91d2d291255e7e03 Mon Sep 17 00:00:00 2001 From: "yifeng.yl" Date: Thu, 8 Aug 2019 19:45:58 +0800 Subject: [PATCH 06/11] remove user appBar --- lib/views/user_page/user_page.dart | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/views/user_page/user_page.dart b/lib/views/user_page/user_page.dart index 885e2c1f..74924c58 100644 --- a/lib/views/user_page/user_page.dart +++ b/lib/views/user_page/user_page.dart @@ -16,9 +16,6 @@ class _UserPageState extends State { Widget build(BuildContext context) { print(widget.userInfo); return Scaffold( - appBar: AppBar( - title: Text('个人中心'), - ), body: Container( child: DrawerPage( userInfo: widget.userInfo, From b1cc850fbb2e59d1316a600d229cf58a80ab95a5 Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 9 Aug 2019 23:48:49 +0800 Subject: [PATCH 07/11] =?UTF-8?q?Modfiy:=20=E8=B0=83=E6=95=B4=E6=A0=8F?= =?UTF-8?q?=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 18 +++++ lib/components/list_refresh.dart | 1 + lib/views/first_page/first_page.dart | 4 +- lib/views/first_page/main_page.dart | 112 ++++++++++++++++++++------ lib/views/first_page/search_page.dart | 6 +- pubspec.yaml | 2 +- 6 files changed, 112 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 2512a8a8..bd2f01d0 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,25 @@ Language: [English](https://github.com/alibaba/flutter-go/blob/master/README-en. +## 运行方式 +- 查看一下版本号是否正确 +```dart + flutter --version +``` +- 运行以下命令查看是否需要安装其它依赖项来完成安装 +```dart + flutter doctor +``` +- 运行启动您的应用 +```dart + flutter packages get + flutter run +``` + +- 如果有其他问题,请参考 + - https://flutterchina.club/setup-macos/ + - https://flutter.dev/docs/get-started/install/macos ## Release安装包下载地址 diff --git a/lib/components/list_refresh.dart b/lib/components/list_refresh.dart index b4a13244..c5d3b0d8 100644 --- a/lib/components/list_refresh.dart +++ b/lib/components/list_refresh.dart @@ -174,6 +174,7 @@ class _ListRefreshState extends State { return widget.renderItem(index, items[index]); } } + return null; }, controller: _scrollController, ), diff --git a/lib/views/first_page/first_page.dart b/lib/views/first_page/first_page.dart index 8c7f66ea..38840ba1 100644 --- a/lib/views/first_page/first_page.dart +++ b/lib/views/first_page/first_page.dart @@ -50,7 +50,9 @@ class FirstPageState extends State with AutomaticKeepAliveClientMixin Future getIndexListData([Map params]) async { - const juejin_flutter = 'https://timeline-merger-ms.juejin.im/v1/get_tag_entry?src=web&tagId=5a96291f6fb9a0535b535438'; + /// const juejin_flutter = 'https://timeline-merger-ms.juejin.im/v1/get_tag_entry?src=web&tagId=5a96291f6fb9a0535b535438'; + const juejin_flutter = 'https://fluttergo.pub:9527/juejin.im/v1/get_tag_entry?src=web&tagId=5a96291f6fb9a0535b535438'; + var pageIndex = (params is Map) ? params['pageIndex'] : 0; final _param = {'page':pageIndex,'pageSize':20,'sort':'rankIndex'}; var responseList = []; diff --git a/lib/views/first_page/main_page.dart b/lib/views/first_page/main_page.dart index 1630c994..d2f9f63a 100644 --- a/lib/views/first_page/main_page.dart +++ b/lib/views/first_page/main_page.dart @@ -6,18 +6,24 @@ import './sub_page.dart'; import './main_app_bar.dart'; import './search_page.dart'; import 'package:flutter_go/model/user_info.dart'; +import 'package:flutter_go/routers/application.dart' show Application; +import 'package:flutter_go/routers/routers.dart' show Routes; + +DefaultTabController _tabController; +TabBar _tabBar; class _Page { final String labelId; + final int labelIndex; - _Page(this.labelId); + _Page(this.labelId,this.labelIndex); } final List<_Page> _allPages = <_Page>[ - _Page('项目1'), - _Page('项目2'), - _Page('项目3'), - _Page('项目4'), + _Page('热门资讯', 1), + _Page('FG-官网', 2), + _Page('FG-web版', 3), + ///_Page('项目4'), ]; class MainPage extends StatelessWidget { @@ -27,12 +33,12 @@ class MainPage extends StatelessWidget { @override Widget build(BuildContext context) { print("MainPagess build......"); - return DefaultTabController( + _tabController = DefaultTabController( length: _allPages.length, child: Scaffold( - appBar: new MyAppBar( + appBar: MyAppBar( leading: Container( - child: new ClipOval( + child: ClipOval( child: Image.network( userInfo.id == 0?'https://hbimg.huabanimg.com/9bfa0fad3b1284d652d370fa0a8155e1222c62c0bf9d-YjG0Vt_fw658':userInfo.avatarPic, scale: 15.0, @@ -54,10 +60,8 @@ class MainPage extends StatelessWidget { ), ), body: TabBarViewLayout(), -// drawer: Drawer( -// child: MainLeftPage(), -// ), )); + return _tabController; } } @@ -66,37 +70,93 @@ void pushPage(BuildContext context, Widget page, {String pageName}) { Navigator.push(context, CupertinoPageRoute(builder: (ctx) => page)); } +void showAlertDialog(BuildContext context) { + showDialog( + context: context, + barrierDismissible: false, // user must tap button! + builder: (BuildContext context) { + return AlertDialog( + //title: Text('免责声明'), + content: SingleChildScrollView( + child: ListBody( + children: [ + Container( + padding: EdgeInsets.fromLTRB(5.0, 5.0, 10.0, 10.0), + //width: 100, + height: 35, + child: Text('免责声明', + style: TextStyle( + fontSize: 18, fontWeight: FontWeight.w700)), + decoration: BoxDecoration( + //color: Colors.blue, + image: DecorationImage( + fit: BoxFit.fitWidth, + image: AssetImage('assets/images/paimaiLogo.png')), + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + //alignment: Alignment.bottomRight, + )), + SizedBox(height: 20), + Text('111111111'), + Text('222222222'), + ], + ), + ), + shape: RoundedRectangleBorder( + borderRadius: new BorderRadius.circular(20.0)), // 圆角 + + actions: [ + new Container( + width: 250, + /// child: _create(), + ) + ], + ); + }, + ); +} + class TabLayout extends StatelessWidget { @override Widget build(BuildContext context) { - return TabBar( + _tabBar = TabBar( isScrollable: true, //labelPadding: EdgeInsets.all(12.0), labelPadding: EdgeInsets.only(top: 12.0, left: 12.0, right: 12.0), indicatorSize: TabBarIndicatorSize.label, - tabs: _allPages - .map((_Page page) => - Tab(text: page.labelId)) - .toList(), + tabs: _allPages.map((_Page page) => Tab(text: page.labelId)).toList(), + onTap: (index) { + if (index == 1) { + DefaultTabController.of(context).animateTo(0); + Application.router.navigateTo(context, '${Routes.webViewPage}?title=${Uri.encodeComponent('Flutter Go 官方网站')}&url=${Uri.encodeComponent('https://flutter-go.pub')}'); + } else if (index == 2) { + +// new Future.delayed(const Duration(seconds: 1),(){ +// showAlertDialog(Application.globalContext); +// }); + + DefaultTabController.of(context).animateTo(0); + Application.router.navigateTo(context, '${Routes.webViewPage}?title=${Uri.encodeComponent('Flutter Go web版(H5)')}&url=${Uri.encodeComponent('https://flutter-go.pub/flutter_go_web')}'); + } + } ); + return _tabBar; } } class TabBarViewLayout extends StatelessWidget { Widget buildTabView(BuildContext context, _Page page) { - String labelId = page.labelId; - switch (labelId) { - case '项目1': + int labelIndex = page.labelIndex; + switch (labelIndex) { + case 1: return FirstPage(); break; - case '项目2': - return SubPage(); + case 2: + return Container(child:Text('1')); break; - case '项目3': - return SubPage(); - break; - case '项目4': - return SubPage(); + case 3: + return Container(child:Text('2')); break; default: return Container(); diff --git a/lib/views/first_page/search_page.dart b/lib/views/first_page/search_page.dart index 6d519738..e3d751c8 100644 --- a/lib/views/first_page/search_page.dart +++ b/lib/views/first_page/search_page.dart @@ -23,7 +23,7 @@ final _industryPage = Industry.IndustryPage(itemTitle: (state){ ), subtitle: Text(state.res[index].source), onTap: () { - // 在这里对选中的结果进行解析,因为我目前是用golang实现的,所以就没贴代码了。 + // 在这里对选中的结果进行解析 print(state.res[index].source); final itemTitle = state.res[index].title; final itemUrl = state.res[index].source; @@ -44,7 +44,7 @@ class SearchPage extends StatelessWidget { /// print('suggestion::${Industry.suggestion}'); return Scaffold( appBar: PreferredSize( - preferredSize: Size(double.infinity, 52), // 44 is the height + preferredSize: Size(double.infinity, 52), // is the height child: AppBar(title: searchBarPage) ), //body: ProgressView(), @@ -160,7 +160,7 @@ class _SearchBarPageState extends State { controller: controller, decoration: InputDecoration( contentPadding: EdgeInsets.only(top: 0.0), - hintText: '搜索全局flutter知识库', + hintText: '全网搜索 Flutter 相关知识库', hintStyle:TextStyle(fontSize: 12.0), border: InputBorder.none ), diff --git a/pubspec.yaml b/pubspec.yaml index 7dba5e7f..6401c44a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -30,7 +30,7 @@ dependencies: flutter_spinkit: "^3.1.0" fluttertoast: ^3.1.0 dio: ^2.0.15 - flutter_webview_plugin: ^0.3.4 + flutter_webview_plugin: ^0.3.5 cookie_jar: ^1.0.0 # 日期格式化 intl: 0.15.7 From 9b8238377c252e0bf4062849a0714642dab07825 Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 10 Aug 2019 00:08:35 +0800 Subject: [PATCH 08/11] + --- .github/issue_template.md | 0 docs/contribute.md | 52 +---- go-cli/pubspec.yaml | 1 + go-cli/src/build/build_page_list.dart | 65 ++++-- go-cli/src/cli_command_runder.dart | 2 + go-cli/src/command/build.dart | 32 +++ ios/Flutter/Debug.xcconfig | 1 - ios/Flutter/Release.xcconfig | 1 - lib/api/api.dart | 2 +- lib/components/full_screen_code_dialog.dart | 3 +- lib/components/loading.dart | 94 ++++++++ lib/components/widget_demo.dart | 101 +++++---- lib/main.dart | 10 +- lib/model/cat.dart | 214 +++++++++--------- lib/model/widget.dart | 49 +++- lib/page_demo_package/.demo.json | 2 +- lib/page_demo_package/index.dart | 4 +- .../.demo.json | 9 + .../index.dart | 15 ++ .../src/index.dart | 16 ++ lib/routers/routers.dart | 1 + lib/standard_pages/.pages.json | 12 +- lib/standard_pages/index.dart | 25 +- .../.page.json | 10 + .../index.dart | 52 +++++ .../index.md | 48 ++++ .../.page.json | 10 + .../index.dart | 52 +++++ .../index.md | 48 ++++ lib/utils/data_utils.dart | 2 +- lib/views/first_page/drawer_page.dart | 2 +- lib/views/home.dart | 24 +- .../issuse_message_page.dart | 2 +- lib/views/standard_demo_page/const.dart | 12 - lib/views/standard_demo_page/index.dart | 111 ++++++--- lib/views/user_page/user_page.dart | 26 +++ lib/views/widget_page/widget_page.dart | 1 - pubspec.lock | 104 ++++----- 38 files changed, 855 insertions(+), 360 deletions(-) delete mode 100644 .github/issue_template.md create mode 100644 go-cli/src/command/build.dart create mode 100644 lib/components/loading.dart create mode 100644 lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/.demo.json create mode 100644 lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/index.dart create mode 100644 lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/src/index.dart create mode 100644 lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/.page.json create mode 100644 lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.dart create mode 100644 lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.md create mode 100644 lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/.page.json create mode 100644 lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.dart create mode 100644 lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.md delete mode 100644 lib/views/standard_demo_page/const.dart create mode 100644 lib/views/user_page/user_page.dart diff --git a/.github/issue_template.md b/.github/issue_template.md deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/contribute.md b/docs/contribute.md index 6ce5f0a5..78d14868 100644 --- a/docs/contribute.md +++ b/docs/contribute.md @@ -12,56 +12,14 @@ # Issue -PR的第一步就是提交issue,即提交你发现的BUG 或者 想加入的功能, 选择你issue在类型 +pr的第一步是先提交issue,即提交你发现的BUG 或者 想加入的功能, 选择你issue在类型 ![](https://img.alicdn.com/tfs/TB1r3LEbKL2gK0jSZFmXXc7iXXa-858-317.png) -您的 Pull Request 可能包含以下几种 +您的 Issue 可能包含以下几种 -- 当前项目逻辑代码的问题修复或者优化 -- widget 示例的完善 -- widget 文档的完善与更新 - - -# 文档与DEMO的完善 -一个widget的demo实例与文档说明, 由以下目录构成, 我们以**/lib/widgets/components/Tab/Tab**组件举例, 在此文件目录下构建您的demo运行即可看到效果 - -- index.dart -- demo.dart - - - -# 撰写 Pull Request - -为了更好的将 *flutter* 的各种使用方法分享给大家, 我们欢迎第三方提交个人Pull Request(简称为PR)到开源仓库中. 提交的PR需要满足以下规则: - -- PR 的提交名称, 请使用有意义可以理解的词汇, 否则我们请直接关闭它. - - 例如: 增加了XX功能, 优化..., 修复在 XX 状态下对 XX 的异常处理 -- PR 只能被提交合并到 *develop* 分支, 被提交到master的 PR, 我们将会直接关闭. -- PR 的描述区,需要描述本次改动的主要内容, 以及为什么要如此改动. -- 避免超大的 PR 提交 - - 当 PR 的改动 **change** 超过1000行(暂定为1000)时, 请尽量拆分后进行提交. -- 规范化的commit信息 - - commit规范参照[develop规范](https://github.com/alibbaba/flutter-go/blob/master/develop.md#commit-%E6%8F%90%E4%BA%A4%E8%A7%84%E8%8C%83) - - commit列表, 请在提交PR之前做好整理, 避免出现一个功能点的多条commit.[如何整理commit](https://help.github.com/en/articles/using-git-rebase-on-the-command-line) - -# 如何提交PR -* fork项目到自己仓库 -* git clone (您的仓库地址)到本地 -* 建立上游源 - * git remote add upStream git@github.com:alibaba/flutter-go.git - * 创建开发分支(非必须) - * git checkout -b develop -* 修改提交代码 - * git status - * git add . - * git commit -m 'feat: message' - * git push origin develop -* 同步代码 - * git fetch upstream - * git merge upstream/develop - * git push origin develop -* 提交PR - * 到自己github仓库对应fork的项目下new pull request +- bug report (修复逻辑相关bug) +- feature (增加新的功能) +- widget (关于widget示例展示) diff --git a/go-cli/pubspec.yaml b/go-cli/pubspec.yaml index f2725f4a..dfc961c2 100644 --- a/go-cli/pubspec.yaml +++ b/go-cli/pubspec.yaml @@ -17,6 +17,7 @@ dependencies: args: '^1.5.1' dart_inquirer: '^1.0.0' watcher: ^0.9.7+10 + mustache: ^1.1.1 dev_dependencies: diff --git a/go-cli/src/build/build_page_list.dart b/go-cli/src/build/build_page_list.dart index 212acffd..a8757444 100644 --- a/go-cli/src/build/build_page_list.dart +++ b/go-cli/src/build/build_page_list.dart @@ -1,11 +1,23 @@ import 'dart:io'; import 'dart:convert'; +import 'package:mustache/mustache.dart'; import 'package:path/path.dart' as p; import '../../utils/util.dart'; import '../config.dart'; import '../exception/demo.dart'; +String prettyJson(Map json) { + String res = "{"; + json.forEach((k, v) { + res += ( + "\t'$k': '$v'"); + }); + res +='}'; + return res; +} + + Future buildPageListJson() async { List childList = await readeDirChildren(TARGET_PAGE_DIC, false); List pagePathList = []; @@ -55,36 +67,45 @@ Future buildPageListJson() async { } String renderPagesDart(List> data) { - // 自定义前缀 避免出现数字非法字符等 - String pre = "StandardPage"; - String head = ''; - String foot = """ + print('data>>> $data'); + var source = ''' + + {{# pages }} +import '{{ name }}_{{ author }}_{{ id }}/index.dart' as StandardPage_{{ name }}_{{ id }}; + {{/ pages }} class StandardPages { Map standardPages; Map getPages() { return { -"""; - - for (int i = 0; i < data.length; i++) { - Map item = data[i]; - String demoImportName = '${item['name']}_${item['id']}'; - head += "import '${item['name']}_${item['author']}_${item['id']}/index.dart' as ${pre}_$demoImportName;\r\n"; - - foot += "\t\t\t'${item['id']}': ${pre}_${demoImportName}.getMd()"; - - if (i != data.length - 1) { - foot += ',\r\n'; - } - - } - foot += """\r + "0": "0" {{# pages }}, + "{{ id }}" : StandardPage_{{ name }}_{{ id }}.getMd() + {{/ pages }} }; } -} + List> getLocalList() { + return [ + {}{{# pages }}, + { "id": "{{ id }}", "name": "{{ name }}", "email": "{{ email }}", "author": "{{ author }}"} + {{/ pages }} + ]; + } - """; +} + + '''; + var template = new Template(source, name: 'template-filename.html'); + + + // 自定义前缀 避免出现数字非法字符等 + Map formatData = { + "pages": data + }; + + String output = template.renderString(formatData); + + +return output; - return head + foot; } Future checkPage(String path) async { List files = [ diff --git a/go-cli/src/cli_command_runder.dart b/go-cli/src/cli_command_runder.dart index b27b85f7..d9581573 100644 --- a/go-cli/src/cli_command_runder.dart +++ b/go-cli/src/cli_command_runder.dart @@ -6,6 +6,7 @@ import './version.dart'; import './command/create_demo.dart'; import './command/create_page.dart'; import './command/watch_md.dart'; +import './command/build.dart'; @@ -18,6 +19,7 @@ class _CommandRunner extends CommandRunner { addCommand(CreateDemoCommand()); addCommand(CreatePageCommand()); addCommand(WatchCommand()); + addCommand(Build()); } diff --git a/go-cli/src/command/build.dart b/go-cli/src/command/build.dart new file mode 100644 index 00000000..5502cc33 --- /dev/null +++ b/go-cli/src/command/build.dart @@ -0,0 +1,32 @@ +// +// Created with Android Studio. +// User: 三帆 +// Date: 30/07/2019 +// Time: 16:51 +// email: sanfan.hx@alibaba-inc.com +// target: build +// + + +import 'package:args/command_runner.dart'; +import '../build/build_demo_list.dart'; +import '../build/build_page_list.dart'; + + +import 'dart:async'; + + +class Build extends Command { + @override + final name = 'build'; + @override + final description = '生成索引等'; + + + @override + Future run() async { + buildPageListJson(); + buildDemoListJson(); + return 0; + } +} \ No newline at end of file diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig index ae516c8c..e8efba11 100644 --- a/ios/Flutter/Debug.xcconfig +++ b/ios/Flutter/Debug.xcconfig @@ -1,3 +1,2 @@ #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" -#include "../Pods/Target\ Support\ Files/Pods-Runner/Pods-Runner.debug.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig index 3e14f624..399e9340 100644 --- a/ios/Flutter/Release.xcconfig +++ b/ios/Flutter/Release.xcconfig @@ -1,3 +1,2 @@ #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" -#include "../Pods/Target\ Support\ Files/Pods-Runner/Pods-Runner.release.xcconfig" diff --git a/lib/api/api.dart b/lib/api/api.dart index bfac51fc..748e3422 100644 --- a/lib/api/api.dart +++ b/lib/api/api.dart @@ -29,7 +29,7 @@ class Api{ static const String GET_THEMECOLOR = BASE_URL +'/getThemeColor';//获取主题颜色 - static const String GET_WIDGET_TREE = 'http://flutter-go.alibaba.net/' + 'getCateList';//获取widget列表树 + static const String GET_WIDGET_TREE = BASE_URL + 'getCateList';//获取widget列表树 static const String SEARCH_WIDGET = BASE_URL+'searchWidget';//搜索组件 } diff --git a/lib/components/full_screen_code_dialog.dart b/lib/components/full_screen_code_dialog.dart index 76147749..c8f05476 100644 --- a/lib/components/full_screen_code_dialog.dart +++ b/lib/components/full_screen_code_dialog.dart @@ -9,9 +9,10 @@ import 'package:flutter_go/utils/example_code_parser.dart'; import 'package:flutter_go/utils/syntax_highlighter.dart'; class FullScreenCodeDialog extends StatefulWidget { - const FullScreenCodeDialog({this.filePath}); + const FullScreenCodeDialog({this.filePath, this.remoteFilePath}); final String filePath; + final String remoteFilePath; _FullScreenCodeDialogState createState() => _FullScreenCodeDialogState(); } diff --git a/lib/components/loading.dart b/lib/components/loading.dart new file mode 100644 index 00000000..659b2ff8 --- /dev/null +++ b/lib/components/loading.dart @@ -0,0 +1,94 @@ +// +// Created with Android Studio. +// User: 三帆 +// Date: 07/08/2019 +// Time: 08:40 +// email: sanfan.hx@alibaba-inc.com +// tartget: 代码获取自: https://blog.csdn.net/O_time/article/details/86496537 +// +import 'dart:async'; +import 'package:flutter/material.dart'; + +// ignore: must_be_immutable +class NetLoadingDialog extends StatefulWidget { + String loadingText; + bool outsideDismiss; + bool loading; + Function dismissCallback; + Future requestCallBack; + + NetLoadingDialog( + {Key key, + this.loadingText = "loading...", + this.outsideDismiss = true, + this.dismissCallback, + this.loading, + this.requestCallBack}) + : super(key: key); + + @override + State createState() => _LoadingDialog(); +} + +class _LoadingDialog extends State { + _dismissDialog() { + if (widget.dismissCallback != null) { + widget.dismissCallback(); + } + Navigator.of(context).pop(); + } + + @override + void initState() { + super.initState(); + if (widget.requestCallBack != null) { + widget.requestCallBack.then((_) { + Navigator.pop(context); + }); + } + } + + @override + Widget build(BuildContext context) { + if (!widget.loading) { + return Container(); + } + return new GestureDetector( + onTap: widget.outsideDismiss ? _dismissDialog : null, + child: Material( + type: MaterialType.transparency, + child: new Center( + child: new SizedBox( + width: 120.0, + height: 120.0, + child: new Container( + decoration: ShapeDecoration( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all( + Radius.circular(8.0), + ), + ), + ), + child: new Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + new CircularProgressIndicator(), + new Padding( + padding: const EdgeInsets.only( + top: 20.0, + ), + child: new Text( + widget.loadingText, + style: new TextStyle(fontSize: 12.0), + ), + ), + ], + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/components/widget_demo.dart b/lib/components/widget_demo.dart index 5c75bb32..8783b18a 100644 --- a/lib/components/widget_demo.dart +++ b/lib/components/widget_demo.dart @@ -25,8 +25,8 @@ class WidgetDemo extends StatefulWidget { {Key key, @required this.title, @required this.contentList, - @required this.codeUrl, - @required this.docUrl, + this.codeUrl, + this.docUrl, this.bottomNaviBar}) : super(key: key); @@ -141,7 +141,38 @@ class _WidgetDemoState extends State { '${Routes.codeView}?filePath=${Uri.encodeComponent(widget.codeUrl)}'); } } - + List> buildPopupMenu() { + List> comps = []; + if (widget.docUrl != null) { + comps.add( + PopupMenuItem( + value: 'doc', + child: ListTile( + leading: Icon( + Icons.library_books, + size: 22.0, + ), + title: Text('查看文档'), + ), + ) + ); + } + if (widget.codeUrl != null) { + comps.add( + PopupMenuItem( + value: 'code', + child: ListTile( + leading: Icon( + Icons.code, + size: 22.0, + ), + title: Text('查看Demo'), + ), + ) + ); + } + return comps; + } @override Widget build(BuildContext context) { if (_hasCollected) { @@ -149,50 +180,34 @@ class _WidgetDemoState extends State { } else { _collectionIcons = Icons.favorite_border; } + List> menus = buildPopupMenu(); + List actions = [ + new IconButton( + tooltip: 'goBack home', + onPressed: () { + Navigator.popUntil(context, ModalRoute.withName('/')); + }, + icon: Icon(Icons.home), + ), + new IconButton( + tooltip: 'collection', + onPressed: _getCollection, + icon: Icon(_collectionIcons), + ), + ]; + if (menus.length > 0) { + actions.add( + PopupMenuButton( + onSelected: _selectValue, + itemBuilder: (BuildContext context) => menus, + ) + ); + } return Scaffold( key: _scaffoldKey, appBar: AppBar( title: Text(widget.title), - actions: [ - new IconButton( - tooltip: 'goBack home', - onPressed: () { - Navigator.popUntil(context, ModalRoute.withName('/')); - }, - icon: Icon(Icons.home), - ), - new IconButton( - tooltip: 'collection', - onPressed: _getCollection, - icon: Icon(_collectionIcons), - ), - PopupMenuButton( - onSelected: _selectValue, - itemBuilder: (BuildContext context) => >[ - const PopupMenuItem( - value: 'doc', - child: ListTile( - leading: Icon( - Icons.library_books, - size: 22.0, - ), - title: Text('查看文档'), - ), - ), - const PopupMenuDivider(), - const PopupMenuItem( - value: 'code', - child: ListTile( - leading: Icon( - Icons.code, - size: 22.0, - ), - title: Text('查看Demo'), - ), - ), - ], - ), - ], + actions: actions, ), body: Container( padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0), diff --git a/lib/main.dart b/lib/main.dart index 95c7f3f9..52082f22 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -17,7 +17,7 @@ import 'package:flutter_go/event/event_bus.dart'; import 'package:flutter_go/event/event_model.dart'; import 'package:event_bus/event_bus.dart'; import 'package:flutter_go/model/widget.dart'; - +import 'package:flutter_go/standard_pages/index.dart'; //import 'views/welcome_page/index.dart'; SpUtil sp; @@ -28,7 +28,6 @@ class MyApp extends StatefulWidget { final router = new Router(); Routes.configureRoutes(router); // 这里设置项目环境 - Application.env = ENV.PRODUCTION; Application.router = router; } @@ -189,10 +188,13 @@ void main() async { await provider.init(true); sp = await SpUtil.getInstance(); new SearchHistoryList(sp); + await DataUtils.getWidgetTreeList().then((List json) { - if (json == null) return; - Application.widgetTree = WidgetTree.buildWidgetTree(json); + List data = WidgetTree.insertDevPagesToList(json, StandardPages().getLocalList()); + Application.widgetTree = WidgetTree.buildWidgetTree(data); + print("Application.widgetTree>>>> ${Application.widgetTree}"); }); db = Provider.db; runApp(new MyApp()); } + diff --git a/lib/model/cat.dart b/lib/model/cat.dart index e9ecae7b..5ac493f4 100644 --- a/lib/model/cat.dart +++ b/lib/model/cat.dart @@ -1,107 +1,107 @@ - -import 'dart:async'; - -import 'package:flutter_go/utils/sql.dart'; - -abstract class CatInterface{ - int get id; - //类目名称 - String get name; - //描述 - String get desc; - //第几级类目,默认 1 - int get depth; - //父类目id,没有为 0 - int get parentId; -} - -class Cat implements CatInterface { - int id; - String name; - String desc; - int depth; - int parentId; - - Cat({this.id, this.name, this.desc, this.depth, this.parentId}); - - Cat.fromJSON(Map json) - : id = json['id'], - name = json['name'], - desc = json['desc'], - depth = json['depth'], - parentId = json['parentId']; - - String toString() { - return '(Cat $name)'; - } - - Map toMap() { - return { - 'id': id, - 'name': name, - 'desc': desc, - 'depth': depth, - 'parentId': parentId - }; - } - Map toSqlCondition() { - Map _map = this.toMap(); - Map condition = {}; - _map.forEach((k, value) { - - if (value != null) { - - condition[k] = value; - } - }); - - if (condition.isEmpty) { - return {}; - } - - return condition; - } -} - - -class CatControlModel{ - final String table = 'cat'; - Sql sql; - CatControlModel() { - sql = Sql.setTable(table); - } - - /// 获取一级类目 - Future mainList() async{ - List listJson = await sql.getByCondition(conditions: {'parentId': 0}); - List cats = listJson.map((json) { - return new Cat.fromJSON(json); - }).toList(); - return cats; - } - - // 获取Cat不同深度与parent的列表 - Future> getList([Cat cat]) async{ - - - if (cat == null) { - cat = new Cat(depth: 1, parentId: 0); - } - // print("cat in getList ${cat.toMap()}"); - List listJson = await sql.getByCondition(conditions: cat.toSqlCondition()); - List cats = listJson.map((json) { - return new Cat.fromJSON(json); - }).toList(); - return cats; - } - - // 通过name获取Cat对象信息 - Future getCatByName(String name) async { - List json = await sql.getByCondition(conditions: {'name': name}); - if (json.isEmpty) { - return null; - } - return new Cat.fromJSON(json.first); - } - -} +// +//import 'dart:async'; +// +//import 'package:flutter_go/utils/sql.dart'; +// +//abstract class CatInterface{ +// int get id; +// //类目名称 +// String get name; +// //描述 +// String get desc; +// //第几级类目,默认 1 +// int get depth; +// //父类目id,没有为 0 +// int get parentId; +//} +// +//class Cat implements CatInterface { +// int id; +// String name; +// String desc; +// int depth; +// int parentId; +// +// Cat({this.id, this.name, this.desc, this.depth, this.parentId}); +// +// Cat.fromJSON(Map json) +// : id = json['id'], +// name = json['name'], +// desc = json['desc'], +// depth = json['depth'], +// parentId = json['parentId']; +// +// String toString() { +// return '(Cat $name)'; +// } +// +// Map toMap() { +// return { +// 'id': id, +// 'name': name, +// 'desc': desc, +// 'depth': depth, +// 'parentId': parentId +// }; +// } +// Map toSqlCondition() { +// Map _map = this.toMap(); +// Map condition = {}; +// _map.forEach((k, value) { +// +// if (value != null) { +// +// condition[k] = value; +// } +// }); +// +// if (condition.isEmpty) { +// return {}; +// } +// +// return condition; +// } +//} +// +// +//class CatControlModel{ +// final String table = 'cat'; +// Sql sql; +// CatControlModel() { +// sql = Sql.setTable(table); +// } +// +// /// 获取一级类目 +// Future mainList() async{ +// List listJson = await sql.getByCondition(conditions: {'parentId': 0}); +// List cats = listJson.map((json) { +// return new Cat.fromJSON(json); +// }).toList(); +// return cats; +// } +// +// // 获取Cat不同深度与parent的列表 +// Future> getList([Cat cat]) async{ +// +// +// if (cat == null) { +// cat = new Cat(depth: 1, parentId: 0); +// } +// // print("cat in getList ${cat.toMap()}"); +// List listJson = await sql.getByCondition(conditions: cat.toSqlCondition()); +// List cats = listJson.map((json) { +// return new Cat.fromJSON(json); +// }).toList(); +// return cats; +// } +// +// // 通过name获取Cat对象信息 +// Future getCatByName(String name) async { +// List json = await sql.getByCondition(conditions: {'name': name}); +// if (json.isEmpty) { +// return null; +// } +// return new Cat.fromJSON(json.first); +// } +// +//} diff --git a/lib/model/widget.dart b/lib/model/widget.dart index 25e0a9af..3cc757be 100644 --- a/lib/model/widget.dart +++ b/lib/model/widget.dart @@ -2,7 +2,7 @@ import 'dart:async'; import "package:flutter/material.dart"; - +import "package:flutter_go/routers/application.dart"; import 'package:flutter_go/utils/sql.dart'; enum treeNode { @@ -188,14 +188,16 @@ class CategoryComponent extends CommonItem { @required this.id, @required this.name, @required this.parentId, + this.type = 'categoryw', this.children, this.parent }); CategoryComponent.fromJson(Map json) { - this.id = int.parse(json['id']); + print(json['id'].runtimeType); + this.id = json['id']; this.name = json['name']; this.parentId = json['parentId']; - this.token = json['id'] + json['type']; + this.token = json['id'].toString() + json['type']; } void addChildren(Object item) { if (item is CategoryComponent) { @@ -265,13 +267,13 @@ class WidgetLeaf extends CommonItem { }); WidgetLeaf.fromJson(Map json) { - this.id = int.parse(json['id']); + this.id = json['id']; this.name = json['name']; this.display = json['display']; this.author = json['author'] ?? null; this.path = json['path'] ?? null; this.pageId = json['pageId'] ?? null; - this.token = json['id'] + json['type']; + this.token = json['id'].toString() + json['type']; } @override CommonItem getChild(String token) { @@ -289,6 +291,7 @@ class WidgetLeaf extends CommonItem { } class WidgetTree { + // 构建树型结构 static CategoryComponent buildWidgetTree(List json, [parent]){ CategoryComponent current; if (parent != null) { @@ -297,7 +300,6 @@ class WidgetTree { current = CategoryComponent(id: 0, name: 'root', parentId: null, children: []); } json.forEach((item) { - // 归属分类级别 if (['root', 'category'].indexOf(item['type']) != -1) { CategoryComponent cate = CategoryComponent.fromJson(item); @@ -313,6 +315,41 @@ class WidgetTree { }); return current; } + + static insertDevPagesToList(List list, List devPages) { + List devChildren = []; + int index = 9999999; + if (Application.env == ENV.PRODUCTION) { + return list; + } + devPages.forEach((item) { + index++; + if (item['id'] != null) { + devChildren.add({ + "id": index.toString(), + "name": item['name'], + "parentId": "99999999999", + "type": "widget", + "display": "standard", + "author": item['author'], + "pageId": item['id'] + }); + } + }); + list.forEach((item) { + if (item['name'].toString().toUpperCase() == 'DEVELOPER') { + List children = item['children']; + children.insert(0, { + "id": "99999999999", + "name": "本地代码", + "parentId": item['id'], + "type": "category", + "children": devChildren + }); + } + }); + return list; + } static CategoryComponent getCommonItemById(List path, CategoryComponent root) { print("getCommonItemByPath $path"); print("root $root"); diff --git a/lib/page_demo_package/.demo.json b/lib/page_demo_package/.demo.json index 0e45bee1..1967c339 100644 --- a/lib/page_demo_package/.demo.json +++ b/lib/page_demo_package/.demo.json @@ -1 +1 @@ -[{"name":"demoName","screenShot":"","author":"yourName","email":"yourEmail","desc":"这是一个测试的标准demo","id":"1a29aa8e_32ae_4241_9c8a_5c9e1f92b096"}] \ No newline at end of file +[{"name":"demoName","screenShot":"","author":"yourName","email":"yourEmail","desc":"这是一个测试的标准demo","id":"1a29aa8e_32ae_4241_9c8a_5c9e1f92b096"},{"name":"local","screenShot":"","author":"ab","email":"email","desc":"ags","id":"2c1d57d0_42ae_4241_9c8a_5c9e1f92b096"}] \ No newline at end of file diff --git a/lib/page_demo_package/index.dart b/lib/page_demo_package/index.dart index 3a4a6f72..1e6a4966 100644 --- a/lib/page_demo_package/index.dart +++ b/lib/page_demo_package/index.dart @@ -1,4 +1,6 @@ import 'demoName_yourName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardDemo_demoName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096; +import 'local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardDemo_local_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096; var demoObjects = { - '1a29aa8e_32ae_4241_9c8a_5c9e1f92b096': StandardDemo_demoName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096.demoWidgets + '1a29aa8e_32ae_4241_9c8a_5c9e1f92b096': StandardDemo_demoName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096.demoWidgets, + '2c1d57d0_42ae_4241_9c8a_5c9e1f92b096': StandardDemo_local_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096.demoWidgets }; \ No newline at end of file diff --git a/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/.demo.json b/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/.demo.json new file mode 100644 index 00000000..e6e8114d --- /dev/null +++ b/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/.demo.json @@ -0,0 +1,9 @@ +{ + "name": "local", + "screenShot": "", + "author":"ab", + "email": "email", + "desc": "ags", + "id": "2c1d57d0_42ae_4241_9c8a_5c9e1f92b096" +} + \ No newline at end of file diff --git a/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/index.dart b/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/index.dart new file mode 100644 index 00000000..4e315373 --- /dev/null +++ b/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/index.dart @@ -0,0 +1,15 @@ +// +// Created with flutter go cli +// User: ab +// Time: 2019-08-06 17:26:02.905889 +// email: email +// desc: ags +// + +import 'src/index.dart'; + +var demoWidgets = [ + new Demo() +]; + + \ No newline at end of file diff --git a/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/src/index.dart b/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/src/index.dart new file mode 100644 index 00000000..d0d3921e --- /dev/null +++ b/lib/page_demo_package/local_ab_2c1d57d0_42ae_4241_9c8a_5c9e1f92b096/src/index.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; + +class Demo extends StatefulWidget { + @override + _State createState() => _State(); +} + +class _State extends State { + @override + Widget build(BuildContext context) { + return Container( + child: Text("this is flutter go init demo"), + ); + } +} + \ No newline at end of file diff --git a/lib/routers/routers.dart b/lib/routers/routers.dart index dc1183a5..711e2285 100644 --- a/lib/routers/routers.dart +++ b/lib/routers/routers.dart @@ -10,6 +10,7 @@ class Routes { static String home = "/home"; static String widgetDemo = '/widget-demo'; static String codeView = '/code-view'; + static String githubCodeView = '/github-code-view'; static String webViewPage = '/web-view-page'; static String loginPage = '/loginpage'; static String issuesMessage='/issuesMessage'; diff --git a/lib/standard_pages/.pages.json b/lib/standard_pages/.pages.json index e5fdc536..18e4f686 100644 --- a/lib/standard_pages/.pages.json +++ b/lib/standard_pages/.pages.json @@ -1,11 +1 @@ -[ - { - "name": "standard", - "screenShot": "", - "author": "sanfan", - "title": "介绍页", - "email": "hanxu317@qq.com", - "desc": "desc", - "id": "ee4feb8e_32ae_4241_9c8a_5c9e1f92b096" - } -] \ No newline at end of file +[{"name":"local","screenShot":"","author":"hnaxu","title":"本地","email":"hanxu@qq.com","desc":"desc","id":"5d7178d0_42ae_4241_9c8a_5c9e1f92b096"},{"name":"test","screenShot":"","author":"abc","title":"ya","email":"adsf.com","desc":"desc","id":"84f38e00_42ae_4241_9c8a_5c9e1f92b096"},{"name":"standard","screenShot":"","author":"sanfan","title":"介绍页","email":"hanxu317@qq.com","desc":"desc","id":"ee4feb8e_32ae_4241_9c8a_5c9e1f92b096"}] \ No newline at end of file diff --git a/lib/standard_pages/index.dart b/lib/standard_pages/index.dart index 9d537fdd..eb5ac663 100644 --- a/lib/standard_pages/index.dart +++ b/lib/standard_pages/index.dart @@ -1,11 +1,30 @@ + +import 'local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardPage_local_5d7178d0_42ae_4241_9c8a_5c9e1f92b096; +import 'test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardPage_test_84f38e00_42ae_4241_9c8a_5c9e1f92b096; import 'standard_sanfan_ee4feb8e_32ae_4241_9c8a_5c9e1f92b096/index.dart' as StandardPage_standard_ee4feb8e_32ae_4241_9c8a_5c9e1f92b096; class StandardPages { Map standardPages; Map getPages() { return { - 'ee4feb8e_32ae_4241_9c8a_5c9e1f92b096': StandardPage_standard_ee4feb8e_32ae_4241_9c8a_5c9e1f92b096.getMd() + "0": "0" , + "5d7178d0_42ae_4241_9c8a_5c9e1f92b096" : StandardPage_local_5d7178d0_42ae_4241_9c8a_5c9e1f92b096.getMd() +, + "84f38e00_42ae_4241_9c8a_5c9e1f92b096" : StandardPage_test_84f38e00_42ae_4241_9c8a_5c9e1f92b096.getMd() +, + "ee4feb8e_32ae_4241_9c8a_5c9e1f92b096" : StandardPage_standard_ee4feb8e_32ae_4241_9c8a_5c9e1f92b096.getMd() }; } -} + List> getLocalList() { + return [ + {}, + { "id": "5d7178d0_42ae_4241_9c8a_5c9e1f92b096", "name": "local", "email": "hanxu@qq.com", "author": "hnaxu"} +, + { "id": "84f38e00_42ae_4241_9c8a_5c9e1f92b096", "name": "test", "email": "adsf.com", "author": "abc"} +, + { "id": "ee4feb8e_32ae_4241_9c8a_5c9e1f92b096", "name": "standard", "email": "hanxu317@qq.com", "author": "sanfan"} + ]; + } - \ No newline at end of file +} + + \ No newline at end of file diff --git a/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/.page.json b/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/.page.json new file mode 100644 index 00000000..d6a9e3d0 --- /dev/null +++ b/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/.page.json @@ -0,0 +1,10 @@ +{ + "name": "local", + "screenShot": "", + "author":"hnaxu", + "title":"本地", + "email": "hanxu@qq.com", + "desc": "desc", + "id": "5d7178d0_42ae_4241_9c8a_5c9e1f92b096" +} + \ No newline at end of file diff --git a/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.dart b/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.dart new file mode 100644 index 00000000..6e506d10 --- /dev/null +++ b/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.dart @@ -0,0 +1,52 @@ +String getMd() { + return """ + # 标准的详情页 + +您可以在这个界面中, 编写大多数的markdown文案, 他会在 **goCli watch** 下同步被编译成 **dart** 文件 + +您可以通过goCli创建详情页所需要的demo + +``` +goCLi createDemo +``` + +在flutter go 根文件下通过命令行输入以上命令可以进行以下操作 + +[✓] 请输入新增加的demo名称? demoName + +[✓] 请输入您的姓名(使用英文) yourName + +[✓] 请输入您的github的email地址 yourEmail + +[✓] 请输入您demo的描述 这是一个测试的标准demo + + +在完成以上操作后, 可以得到这样的输出: + + +``` +------------------ +您新增的组件信息如下 +================== +{ + name : demoName + author : yourName + email : yourEmail + desc : 这是一个测试的标准demo +} +================== +[✓] Is this the config you want ? (Y/n) y +{ + 新建的demo文件位于 : /flutter go/lib/page_demo_package/demoName_yourName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096 + demoId为 : 1a29aa8e_32ae_4241_9c8a_5c9e1f92b096 + markdown中调用方式 : [demo:1a29aa8e_32ae_4241_9c8a_5c9e1f92b096] +} + +``` +您可以在任意详情页中, 通过以下方式调用 + +``` +[demo: 1a29aa8e_32ae_4241_9c8a_5c9e1f92b096] +```"""; + +} diff --git a/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.md b/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.md new file mode 100644 index 00000000..61a5f516 --- /dev/null +++ b/lib/standard_pages/local_hnaxu_5d7178d0_42ae_4241_9c8a_5c9e1f92b096/index.md @@ -0,0 +1,48 @@ +# 标准的详情页 + +您可以在这个界面中, 编写大多数的markdown文案, 他会在 **goCli watch** 下同步被编译成 **dart** 文件 + +您可以通过goCli创建详情页所需要的demo + +``` +goCLi createDemo +``` + +在flutter go 根文件下通过命令行输入以上命令可以进行以下操作 + +[✓] 请输入新增加的demo名称? demoName + +[✓] 请输入您的姓名(使用英文) yourName + +[✓] 请输入您的github的email地址 yourEmail + +[✓] 请输入您demo的描述 这是一个测试的标准demo + + +在完成以上操作后, 可以得到这样的输出: + + +``` +------------------ +您新增的组件信息如下 +================== +{ + name : demoName + author : yourName + email : yourEmail + desc : 这是一个测试的标准demo +} +================== +[✓] Is this the config you want ? (Y/n) y +{ + 新建的demo文件位于 : /flutter go/lib/page_demo_package/demoName_yourName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096 + demoId为 : 1a29aa8e_32ae_4241_9c8a_5c9e1f92b096 + markdown中调用方式 : [demo:1a29aa8e_32ae_4241_9c8a_5c9e1f92b096] +} + +``` +您可以在任意详情页中, 通过以下方式调用 + +``` +[demo: 1a29aa8e_32ae_4241_9c8a_5c9e1f92b096] +``` \ No newline at end of file diff --git a/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/.page.json b/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/.page.json new file mode 100644 index 00000000..297b026e --- /dev/null +++ b/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/.page.json @@ -0,0 +1,10 @@ +{ + "name": "test", + "screenShot": "", + "author":"abc", + "title":"ya", + "email": "adsf.com", + "desc": "desc", + "id": "84f38e00_42ae_4241_9c8a_5c9e1f92b096" +} + \ No newline at end of file diff --git a/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.dart b/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.dart new file mode 100644 index 00000000..6e506d10 --- /dev/null +++ b/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.dart @@ -0,0 +1,52 @@ +String getMd() { + return """ + # 标准的详情页 + +您可以在这个界面中, 编写大多数的markdown文案, 他会在 **goCli watch** 下同步被编译成 **dart** 文件 + +您可以通过goCli创建详情页所需要的demo + +``` +goCLi createDemo +``` + +在flutter go 根文件下通过命令行输入以上命令可以进行以下操作 + +[✓] 请输入新增加的demo名称? demoName + +[✓] 请输入您的姓名(使用英文) yourName + +[✓] 请输入您的github的email地址 yourEmail + +[✓] 请输入您demo的描述 这是一个测试的标准demo + + +在完成以上操作后, 可以得到这样的输出: + + +``` +------------------ +您新增的组件信息如下 +================== +{ + name : demoName + author : yourName + email : yourEmail + desc : 这是一个测试的标准demo +} +================== +[✓] Is this the config you want ? (Y/n) y +{ + 新建的demo文件位于 : /flutter go/lib/page_demo_package/demoName_yourName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096 + demoId为 : 1a29aa8e_32ae_4241_9c8a_5c9e1f92b096 + markdown中调用方式 : [demo:1a29aa8e_32ae_4241_9c8a_5c9e1f92b096] +} + +``` +您可以在任意详情页中, 通过以下方式调用 + +``` +[demo: 1a29aa8e_32ae_4241_9c8a_5c9e1f92b096] +```"""; + +} diff --git a/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.md b/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.md new file mode 100644 index 00000000..61a5f516 --- /dev/null +++ b/lib/standard_pages/test_abc_84f38e00_42ae_4241_9c8a_5c9e1f92b096/index.md @@ -0,0 +1,48 @@ +# 标准的详情页 + +您可以在这个界面中, 编写大多数的markdown文案, 他会在 **goCli watch** 下同步被编译成 **dart** 文件 + +您可以通过goCli创建详情页所需要的demo + +``` +goCLi createDemo +``` + +在flutter go 根文件下通过命令行输入以上命令可以进行以下操作 + +[✓] 请输入新增加的demo名称? demoName + +[✓] 请输入您的姓名(使用英文) yourName + +[✓] 请输入您的github的email地址 yourEmail + +[✓] 请输入您demo的描述 这是一个测试的标准demo + + +在完成以上操作后, 可以得到这样的输出: + + +``` +------------------ +您新增的组件信息如下 +================== +{ + name : demoName + author : yourName + email : yourEmail + desc : 这是一个测试的标准demo +} +================== +[✓] Is this the config you want ? (Y/n) y +{ + 新建的demo文件位于 : /flutter go/lib/page_demo_package/demoName_yourName_1a29aa8e_32ae_4241_9c8a_5c9e1f92b096 + demoId为 : 1a29aa8e_32ae_4241_9c8a_5c9e1f92b096 + markdown中调用方式 : [demo:1a29aa8e_32ae_4241_9c8a_5c9e1f92b096] +} + +``` +您可以在任意详情页中, 通过以下方式调用 + +``` +[demo: 1a29aa8e_32ae_4241_9c8a_5c9e1f92b096] +``` \ No newline at end of file diff --git a/lib/utils/data_utils.dart b/lib/utils/data_utils.dart index dc0d9036..6d67b865 100644 --- a/lib/utils/data_utils.dart +++ b/lib/utils/data_utils.dart @@ -109,7 +109,7 @@ class DataUtils { static Future getWidgetTreeList() async { try { var response = await NetUtils.get(Api.GET_WIDGET_TREE); - print('组件树:$response'); + print('组件树dddd:$response'); if (response != null && response['success']) { return response['data']; } else { diff --git a/lib/views/first_page/drawer_page.dart b/lib/views/first_page/drawer_page.dart index 52a9da0c..80f4980d 100644 --- a/lib/views/first_page/drawer_page.dart +++ b/lib/views/first_page/drawer_page.dart @@ -155,7 +155,7 @@ class _DrawerPageState extends State { size: 27.0, ), title: Text( - '搜索', + '全网搜', style: textStyle, ), onTap: () { diff --git a/lib/views/home.dart b/lib/views/home.dart index 1355d7a5..862d66b2 100644 --- a/lib/views/home.dart +++ b/lib/views/home.dart @@ -12,6 +12,7 @@ import 'package:flutter_go/utils/shared_preferences.dart'; import 'package:flutter_go/views/first_page/first_page.dart'; import 'package:flutter_go/views/first_page/main_page.dart'; import 'package:fluro/fluro.dart'; +import 'package:flutter_go/views/user_page/user_page.dart'; import 'package:flutter_go/views/widget_page/widget_page.dart'; import 'package:flutter_go/views/welcome_page/fourth_page.dart'; import 'package:flutter_go/views/collection_page/collection_page.dart'; @@ -24,9 +25,7 @@ import 'package:flutter_go/model/search_history.dart'; import 'package:flutter_go/resources/widget_name_to_icon.dart'; import 'package:flutter_go/model/user_info.dart'; - class AppPage extends StatefulWidget { - final UserInformation userInfo; AppPage(this.userInfo); @@ -49,8 +48,9 @@ class _MyHomePageState extends State static List tabData = [ {'text': '业界动态', 'icon': Icon(Icons.language)}, {'text': 'WIDGET', 'icon': Icon(Icons.extension)}, - {'text': '组件收藏', 'icon': Icon(Icons.favorite)}, {'text': '关于手册', 'icon': Icon(Icons.import_contacts)}, + {'text': '个人中心', 'icon': Icon(Icons.account_circle)}, + ]; List _myTabs = []; @@ -72,8 +72,8 @@ class _MyHomePageState extends State // ..add(FirstPage()) ..add(MainPage(userInfo: widget.userInfo)) ..add(WidgetPage()) - ..add(CollectionPage()) - ..add(FourthPage()); + ..add(FourthPage()) + ..add(UserPage(userInfo: widget.userInfo)); } @override @@ -90,12 +90,11 @@ class _MyHomePageState extends State void onWidgetTap(WidgetPoint widgetPoint, BuildContext context) { String targetName = widgetPoint.name; - searchHistoryList - .add(SearchHistory(name: targetName, targetRouter: widgetPoint.routerName)); + searchHistoryList.add( + SearchHistory(name: targetName, targetRouter: widgetPoint.routerName)); print("searchHistoryList1 ${searchHistoryList.toString()}"); - Application.router.navigateTo( - context, widgetPoint.routerName, - transition: TransitionType.inFromRight); + Application.router.navigateTo(context, widgetPoint.routerName, + transition: TransitionType.inFromRight); } Widget buildSearchInput(BuildContext context) { @@ -121,10 +120,9 @@ class _MyHomePageState extends State } renderAppBar(BuildContext context, Widget widget, int index) { - if (index == 0) { - return null; + if (index == 1) { + return AppBar(title: buildSearchInput(context)); } - return AppBar(title: buildSearchInput(context)); } @override diff --git a/lib/views/issuse_message_page/issuse_message_page.dart b/lib/views/issuse_message_page/issuse_message_page.dart index 60a0cdde..c8c0a4b8 100644 --- a/lib/views/issuse_message_page/issuse_message_page.dart +++ b/lib/views/issuse_message_page/issuse_message_page.dart @@ -46,10 +46,10 @@ class _IssuesMessagePageState extends State { } _submit() { - String mk = notusMarkdown.encode(_delta); if (_title.trim().isEmpty) { _show('标题不能为空'); } else { + String mk = (_delta==null)?'No description provided.':notusMarkdown.encode(_delta); DataUtils.feedback({'title': _title, "body": mk},context).then((result) { _show('提交成功'); Navigator.maybePop(context); diff --git a/lib/views/standard_demo_page/const.dart b/lib/views/standard_demo_page/const.dart deleted file mode 100644 index d874f270..00000000 --- a/lib/views/standard_demo_page/const.dart +++ /dev/null @@ -1,12 +0,0 @@ -const title = 'titie1'; -Map titleObjs = { - 'title': 'haha33' -}; -class Maps { - Map list; - getList() { - return { - "title": "1111" - }; - } -} \ No newline at end of file diff --git a/lib/views/standard_demo_page/index.dart b/lib/views/standard_demo_page/index.dart index bb1810b2..f3e5fe57 100644 --- a/lib/views/standard_demo_page/index.dart +++ b/lib/views/standard_demo_page/index.dart @@ -15,6 +15,13 @@ import '../../components/flutter_markdown/lib/flutter_markdown.dart'; import '../../standard_pages/index.dart'; import '../../page_demo_package/index.dart'; import 'package:flutter_go/routers/application.dart'; +import 'package:flutter_go/utils/net_utils.dart'; +import 'package:flutter_go/components/loading.dart'; + +const githubUrl = 'https://raw.githubusercontent.com/alibaba/flutter-go/beta/lib/standard_pages/'; +const PagesUrl = 'https://raw.githubusercontent.com/alibaba/flutter-go/beta/lib/standard_pages/.pages.json'; +const DemosUrl = 'https://raw.githubusercontent.com/alibaba/flutter-go/beta/lib/page_demo_package/.demo.json'; + // ONLINE || LOCAL ENV env = Application.env; @@ -28,25 +35,24 @@ class StandardView extends StatefulWidget { } class _StandardView extends State { - String markdownDesc = '# this is header'; - String pageTitle = "XXX"; - + String markdownDesc = ''; + String pageTitle = ''; + bool isLoading = false; String author = ''; String email = ''; StandardPages standardPage = new StandardPages(); @override void initState() { super.initState(); - this.getDetail(); + this.getPageInfo(); } - // 本地调用的获取基本信息 - Future getPagesInfo() async { - String jsonString = await DefaultAssetBundle.of(context) - .loadString('lib/standard_pages/.pages.json'); + /// 本地调用的获取文章属性的基本信息 + Future localGetPagesAttrsInfo() async { + String jsonString = await DefaultAssetBundle.of(context).loadString('lib/standard_pages/.pages.json'); List jsonList = json.decode(jsonString); - Map pageDetail = - jsonList.firstWhere((item) => item['id'] == widget.id); + Map pageDetail = jsonList.firstWhere((item) => item['id'] == widget.id); + if (pageDetail != null) { setState(() { pageTitle = pageDetail['title'] ?? '请加入title'; @@ -56,27 +62,56 @@ class _StandardView extends State { } } - String _getContentFromLocal() { + /// 从本地获取基本文章信息 + String localGetPagesMarkdown() { + String pageId = widget.id; Map pagesList = standardPage.getPages(); return pagesList[pageId]; } + Future getContentOnline() async { - Future _getContentOnline() async { String content = 'online content'; + this.setState(() { + isLoading = true; + }); - return Future(() => content); + List response = jsonDecode(await NetUtils.get(PagesUrl)); + + + + Map targetPage = response.firstWhere((page) => page['id'] == widget.id); + if (targetPage == null) { + setState(() { + isLoading = false; + }); + return Future(() => '未获取界面相当信息'); + } + setState(() { + pageTitle = targetPage['title'] ?? 'xxx'; + author = targetPage['author']; + email = targetPage['email']; + }); + + String pageName = targetPage['name'] + "_" +targetPage['author']+ "_" +targetPage['id']; + String pageContent = await NetUtils.get(githubUrl + pageName + "/index.md"); + setState(() { + isLoading = false; + }); + return Future(() => pageContent); } - - Future getDetail() async { + /// 获取当面界面的相关信息. 需要区分环境 + /// 本地环境下, 从本地获取 standard_pages的目录中互殴 + /// 线上环境. 从github的api中获取 + Future getPageInfo() async { String conent = ''; print("env:::: $env"); if (env == ENV.PRODUCTION) { - conent = await _getContentOnline(); + conent = await getContentOnline(); } else { - getPagesInfo(); - conent = _getContentFromLocal(); + conent = localGetPagesMarkdown(); + localGetPagesAttrsInfo(); } if (this.mounted) { setState(() { @@ -84,19 +119,33 @@ class _StandardView extends State { }); } return Future(() => conent); -// this.rebuild(); + } + Widget buildFootInfo() { + if (!isLoading) { + return Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('创建者: $author'), + Text('邮箱: $email'), + Text('界面id: ${widget.id}') + ], + ), + ); + } + return Container(); } Widget buildMarkdown() { - Map contentList = new StandardPages().getPages(); - if (contentList[widget.id] == null) { - contentList[widget.id] = ''; + + if (markdownDesc == null) { + return null; } return MarkdownBody( - data: contentList[widget.id], - syntaxHighlighter: new mdCopy.HighLight(), + data: markdownDesc, + syntaxHighlighter:new mdCopy.HighLight(), demoBuilder: (Map attrs) { List demo = demoObjects[attrs['id']]; if (demo == null) { @@ -109,20 +158,22 @@ class _StandardView extends State { }); } + @override Widget build(BuildContext context) { return new WidgetDemo( title: pageTitle, - codeUrl: 'elements/Form/Button/DropdownButton/demo.dart', +// codeUrl: 'elements/Form/Button/DropdownButton/demo.dart', contentList: [ + NetLoadingDialog( + loading: isLoading, + outsideDismiss: false, + ), buildMarkdown(), SizedBox(height: 30), - '创建者: $author', - '创建者: $email', - 'id: ${widget.id}', + buildFootInfo(), + SizedBox(height: 30) ], - docUrl: - 'https://docs.flutter.io/flutter/material/DropdownButton-class.html', ); } } diff --git a/lib/views/user_page/user_page.dart b/lib/views/user_page/user_page.dart new file mode 100644 index 00000000..74924c58 --- /dev/null +++ b/lib/views/user_page/user_page.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_go/model/user_info.dart'; +import 'package:flutter_go/views/first_page/drawer_page.dart'; + +class UserPage extends StatefulWidget { + final UserInformation userInfo; + + UserPage({Key key, this.userInfo}) : super(key: key); + + @override + _UserPageState createState() => _UserPageState(); +} + +class _UserPageState extends State { + @override + Widget build(BuildContext context) { + print(widget.userInfo); + return Scaffold( + body: Container( + child: DrawerPage( + userInfo: widget.userInfo, + ), + ), + ); + } +} diff --git a/lib/views/widget_page/widget_page.dart b/lib/views/widget_page/widget_page.dart index 860d1466..5df042cb 100644 --- a/lib/views/widget_page/widget_page.dart +++ b/lib/views/widget_page/widget_page.dart @@ -53,7 +53,6 @@ class SecondPageState extends State with AutomaticKeepAliveClientMix @override Widget build(BuildContext context) { super.build(context); - print("build in widget page"); return Container( color: Theme.of(context).backgroundColor, child: this.buildGrid(), diff --git a/pubspec.lock b/pubspec.lock index 7cd78d61..4bc7b1b4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,105 +5,105 @@ packages: dependency: transitive description: name: args - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.5.2" async: dependency: transitive description: name: async - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.2.0" bloc: dependency: "direct main" description: name: bloc - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.12.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.4" charcode: dependency: transitive description: name: charcode - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.2" city_pickers: dependency: "direct main" description: name: city_pickers - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.0.4" collection: dependency: transitive description: name: collection - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.14.11" cookie_jar: dependency: "direct main" description: name: cookie_jar - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" csslib: dependency: transitive description: name: csslib - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.16.1" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.1.2" dio: dependency: "direct main" description: name: dio - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.13" event_bus: dependency: "direct main" description: name: event_bus - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" firebase_analytics: dependency: "direct main" description: name: firebase_analytics - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0+1" firebase_core: dependency: "direct main" description: name: firebase_core - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.3.4" fluro: dependency: "direct main" description: name: fluro - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.5.1" flutter: @@ -115,28 +115,28 @@ packages: dependency: "direct main" description: name: flutter_bloc - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.11.1" flutter_downloader: dependency: "direct main" description: name: flutter_downloader - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.9" flutter_jpush: dependency: "direct main" description: name: flutter_jpush - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.0.4" flutter_spinkit: dependency: "direct main" description: name: flutter_spinkit - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.1.0" flutter_test: @@ -148,154 +148,154 @@ packages: dependency: "direct main" description: name: flutter_webview_plugin - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.3.5" fluttertoast: dependency: "direct main" description: name: fluttertoast - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.1.0" html: dependency: "direct main" description: name: html - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.14.0+2" image_picker: dependency: "direct main" description: name: image_picker - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.5.4+3" intl: dependency: "direct main" description: name: intl - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.15.7" lpinyin: dependency: transitive description: name: lpinyin - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.7" markdown: dependency: "direct main" description: name: markdown - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.3" matcher: dependency: transitive description: name: matcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.12.5" meta: dependency: "direct main" description: name: meta - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.6" notus: dependency: transitive description: name: notus - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.1.3" open_file: dependency: "direct main" description: name: open_file - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.3" package_info: dependency: "direct main" description: name: package_info - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.4.0+6" path: dependency: "direct main" description: name: path - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.6.2" path_provider: dependency: "direct main" description: name: path_provider - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" pedantic: dependency: transitive description: name: pedantic - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.7.0" permission_handler: dependency: "direct main" description: name: permission_handler - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "3.2.1+1" quill_delta: dependency: transitive description: name: quill_delta - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" quiver: dependency: transitive description: name: quiver - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.3" quiver_hashcode: dependency: transitive description: name: quiver_hashcode - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" rxdart: dependency: transitive description: name: rxdart - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.21.0" share: dependency: "direct main" description: name: share - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.6.2+1" shared_preferences: dependency: "direct main" description: name: shared_preferences - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.4.3" sky_engine: @@ -307,77 +307,77 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.5.5" sqflite: dependency: "direct main" description: name: sqflite - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.6+3" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.9.3" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" string_scanner: dependency: "direct main" description: name: string_scanner - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.0.4" synchronized: dependency: transitive description: name: synchronized - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0+1" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "0.2.5" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "1.1.6" url_launcher: dependency: "direct main" description: name: url_launcher - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "5.1.2" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.flutter-io.cn" + url: "https://pub.dartlang.org" source: hosted version: "2.0.8" zefyr: From cd708b5682daf5957f652db7d697353f1db21fb0 Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 10 Aug 2019 00:10:51 +0800 Subject: [PATCH 09/11] + --- pubspec.lock | 104 +++++++++++++++++++++++++-------------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 4bc7b1b4..7cd78d61 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,105 +5,105 @@ packages: dependency: transitive description: name: args - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.5.2" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.2.0" bloc: dependency: "direct main" description: name: bloc - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.12.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.4" charcode: dependency: transitive description: name: charcode - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.2" city_pickers: dependency: "direct main" description: name: city_pickers - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.0.4" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.14.11" cookie_jar: dependency: "direct main" description: name: cookie_jar - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.1" csslib: dependency: transitive description: name: csslib - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.16.1" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.2" dio: dependency: "direct main" description: name: dio - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.13" event_bus: dependency: "direct main" description: name: event_bus - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" firebase_analytics: dependency: "direct main" description: name: firebase_analytics - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0+1" firebase_core: dependency: "direct main" description: name: firebase_core - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.4" fluro: dependency: "direct main" description: name: fluro - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.5.1" flutter: @@ -115,28 +115,28 @@ packages: dependency: "direct main" description: name: flutter_bloc - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.11.1" flutter_downloader: dependency: "direct main" description: name: flutter_downloader - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.9" flutter_jpush: dependency: "direct main" description: name: flutter_jpush - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.0.4" flutter_spinkit: dependency: "direct main" description: name: flutter_spinkit - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.0" flutter_test: @@ -148,154 +148,154 @@ packages: dependency: "direct main" description: name: flutter_webview_plugin - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.3.5" fluttertoast: dependency: "direct main" description: name: fluttertoast - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.1.0" html: dependency: "direct main" description: name: html - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.14.0+2" image_picker: dependency: "direct main" description: name: image_picker - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.5.4+3" intl: dependency: "direct main" description: name: intl - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.15.7" lpinyin: dependency: transitive description: name: lpinyin - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.7" markdown: dependency: "direct main" description: name: markdown - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.3" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.12.5" meta: dependency: "direct main" description: name: meta - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.6" notus: dependency: transitive description: name: notus - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.1.3" open_file: dependency: "direct main" description: name: open_file - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.3" package_info: dependency: "direct main" description: name: package_info - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.0+6" path: dependency: "direct main" description: name: path - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.6.2" path_provider: dependency: "direct main" description: name: path_provider - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.2.0" pedantic: dependency: transitive description: name: pedantic - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.7.0" permission_handler: dependency: "direct main" description: name: permission_handler - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "3.2.1+1" quill_delta: dependency: transitive description: name: quill_delta - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" quiver: dependency: transitive description: name: quiver - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.3" quiver_hashcode: dependency: transitive description: name: quiver_hashcode - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" rxdart: dependency: transitive description: name: rxdart - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.21.0" share: dependency: "direct main" description: name: share - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.6.2+1" shared_preferences: dependency: "direct main" description: name: shared_preferences - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.4.3" sky_engine: @@ -307,77 +307,77 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.5.5" sqflite: dependency: "direct main" description: name: sqflite - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.6+3" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.9.3" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" string_scanner: dependency: "direct main" description: name: string_scanner - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.0.4" synchronized: dependency: transitive description: name: synchronized - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0+1" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "0.2.5" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "1.1.6" url_launcher: dependency: "direct main" description: name: url_launcher - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "5.1.2" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + url: "https://pub.flutter-io.cn" source: hosted version: "2.0.8" zefyr: From 3507cf4a27196cf5a8f1b4018a7b86c7cf58472a Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 10 Aug 2019 00:41:06 +0800 Subject: [PATCH 10/11] + --- lib/views/first_page/main_page.dart | 53 ---------------- lib/views/web_page/web_view_page.dart | 89 ++++++++++++++++++++++----- 2 files changed, 75 insertions(+), 67 deletions(-) diff --git a/lib/views/first_page/main_page.dart b/lib/views/first_page/main_page.dart index d2f9f63a..9301ab55 100644 --- a/lib/views/first_page/main_page.dart +++ b/lib/views/first_page/main_page.dart @@ -70,53 +70,6 @@ void pushPage(BuildContext context, Widget page, {String pageName}) { Navigator.push(context, CupertinoPageRoute(builder: (ctx) => page)); } -void showAlertDialog(BuildContext context) { - showDialog( - context: context, - barrierDismissible: false, // user must tap button! - builder: (BuildContext context) { - return AlertDialog( - //title: Text('免责声明'), - content: SingleChildScrollView( - child: ListBody( - children: [ - Container( - padding: EdgeInsets.fromLTRB(5.0, 5.0, 10.0, 10.0), - //width: 100, - height: 35, - child: Text('免责声明', - style: TextStyle( - fontSize: 18, fontWeight: FontWeight.w700)), - decoration: BoxDecoration( - //color: Colors.blue, - image: DecorationImage( - fit: BoxFit.fitWidth, - image: AssetImage('assets/images/paimaiLogo.png')), - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - //alignment: Alignment.bottomRight, - )), - SizedBox(height: 20), - Text('111111111'), - Text('222222222'), - ], - ), - ), - shape: RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(20.0)), // 圆角 - - actions: [ - new Container( - width: 250, - /// child: _create(), - ) - ], - ); - }, - ); -} - class TabLayout extends StatelessWidget { @override Widget build(BuildContext context) { @@ -152,12 +105,6 @@ class TabBarViewLayout extends StatelessWidget { case 1: return FirstPage(); break; - case 2: - return Container(child:Text('1')); - break; - case 3: - return Container(child:Text('2')); - break; default: return Container(); break; diff --git a/lib/views/web_page/web_view_page.dart b/lib/views/web_page/web_view_page.dart index 57b069b0..196ddb35 100644 --- a/lib/views/web_page/web_view_page.dart +++ b/lib/views/web_page/web_view_page.dart @@ -4,7 +4,7 @@ /// @Last Modified time: 2019-01-14 19:47:14 import 'dart:core'; - +import 'dart:math'; import 'package:flutter/material.dart'; import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; @@ -12,6 +12,7 @@ import 'package:flutter_go/model/collection.dart'; import 'package:flutter_go/event/event_bus.dart'; import 'package:flutter_go/event/event_model.dart'; import 'package:flutter_go/api/api.dart'; +import 'package:flutter_go/routers/application.dart' show Application; class WebViewPage extends StatefulWidget { final String url; @@ -21,15 +22,21 @@ class WebViewPage extends StatefulWidget { _WebViewPageState createState() => _WebViewPageState(); } -class _WebViewPageState extends State { +class _WebViewPageState extends State with AutomaticKeepAliveClientMixin{ + @override + bool get wantKeepAlive => true; + final flutterWebviewPlugin = new FlutterWebviewPlugin(); final GlobalKey _scaffoldKey = GlobalKey(); + @override void initState() { super.initState(); + dialog = dialogContext(false); flutterWebviewPlugin.onUrlChanged.listen((String url) { + print('url change:$url'); if (url.indexOf('loginSuccess') > -1) { String urlQuery = url.substring(url.indexOf('?') + 1); @@ -50,7 +57,7 @@ class _WebViewPageState extends State { .fire(UserGithubOAuthEvent(loginName, token, true)); } print('ready close'); - + flutterWebviewPlugin.close(); // 验证成功 } else if (url.indexOf('${Api.BASE_URL}loginFail') == 0) { @@ -61,21 +68,75 @@ class _WebViewPageState extends State { flutterWebviewPlugin.close(); } }); + flutterWebviewPlugin.onStateChanged.listen((state) async { + print('url state:$state'); + if(state.type == WebViewState.finishLoad) { + } + }); } + Widget dialogContext(bool isShow){ + if(!isShow){ + return Container(child:Text("")); + } + return Container( + height: 200, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox(height: 20), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text('分享到',style: TextStyle(fontSize:16,color: Colors.deepOrange)), + FlatButton( + child: Text('取消',style: TextStyle(fontSize:16,color: Colors.black45),), + onPressed: (){ + setState(() { + dialog = dialogContext(false); + + }); + } + ) + ] + ) + ]) + ); + } + + Container dialog; @override Widget build(BuildContext context) { return Scaffold( - key: _scaffoldKey, - appBar: AppBar( - title: Text(widget.title), - ), - body: WebviewScaffold( - url: widget.url, - withZoom: false, - withLocalStorage: true, - withJavascript: true, - ), - ); + key: _scaffoldKey, + appBar: AppBar( + title: Text(widget.title), +// actions: [ +// IconButton( +// icon: Icon(Icons.announcement), +// onPressed: () { +// /// flutterWebviewPlugin.evalJavascript("alert('Flutter Go H5 版本')"); +// setState(() { +// dialog = dialogContext(true); +// }); +// }, +// ) +// ], + ), + body: WebviewScaffold( + url: widget.url, + withZoom: true, + withLocalStorage: true, + withJavascript: true, + userAgent: "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Mobile Safari/537.36", + bottomNavigationBar:dialog, + initialChild: Container( + color: Colors.white, + child: const Center( + child: Text("Loading...."), + ), + ), + )); + } } From 8eaae2c756baf5cc866c50163ef474a227166540 Mon Sep 17 00:00:00 2001 From: "yifeng.yl" Date: Mon, 12 Aug 2019 10:02:03 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=99=BB=E9=99=86?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/views/first_page/drawer_page.dart | 2 +- lib/views/login_page/login_page.dart | 50 +++++++++++++++++---------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/lib/views/first_page/drawer_page.dart b/lib/views/first_page/drawer_page.dart index 80f4980d..f0fc1be0 100644 --- a/lib/views/first_page/drawer_page.dart +++ b/lib/views/first_page/drawer_page.dart @@ -223,7 +223,7 @@ class _DrawerPageState extends State { style: textStyle, ), onTap: () { - Share.share('https://github.com/alibaba/flutter-go'); + Share.share('https://flutter-go.pub/website/'); }, ), new Divider(), diff --git a/lib/views/login_page/login_page.dart b/lib/views/login_page/login_page.dart index 5be7d3c7..d0025764 100644 --- a/lib/views/login_page/login_page.dart +++ b/lib/views/login_page/login_page.dart @@ -67,7 +67,9 @@ class _LoginPageState extends State { setState(() { isLoading = true; }); - DataUtils.getUserInfo({'loginName': event.loginName,'token':event.token}).then((result) { + DataUtils.getUserInfo( + {'loginName': event.loginName, 'token': event.token}) + .then((result) { setState(() { isLoading = false; }); @@ -215,7 +217,7 @@ class _LoginPageState extends State { // 如果输入都检验通过,则进行登录操作 // Scaffold.of(context) // .showSnackBar(new SnackBar(content: new Text("执行登录操作"))); - //调用所有自孩子的save回调,保存表单内容 + //调用所有自孩子��save回调,保存表单内容 doLogin(); } }, @@ -234,22 +236,33 @@ class _LoginPageState extends State { setState(() { isLoading = false; }); - try { - _userInfoControlModel.deleteAll().then((result) { - // print('删除结果:$result'); - _userInfoControlModel - .insert(UserInfo(password: password, username: username)) - .then((value) { - print('存储成功:$value'); - Navigator.of(context).pushAndRemoveUntil( - MaterialPageRoute(builder: (context) => AppPage(userResult)), - (route) => route == null); + if (userResult.runtimeType == UserInformation) { + try { + _userInfoControlModel.deleteAll().then((result) { + // print('删除结果:$result'); + _userInfoControlModel + .insert(UserInfo(password: password, username: username)) + .then((value) { + print('存储成功:$value'); + Navigator.of(context).pushAndRemoveUntil( + MaterialPageRoute(builder: (context) => AppPage(userResult)), + (route) => route == null); + }); }); - }); - } catch (err) { - Navigator.of(context).pushAndRemoveUntil( - MaterialPageRoute(builder: (context) => AppPage(userResult)), - (route) => route == null); + } catch (err) { + Navigator.of(context).pushAndRemoveUntil( + MaterialPageRoute(builder: (context) => AppPage(userResult)), + (route) => route == null); + } + }else if(userResult.runtimeType == String){ + Fluttertoast.showToast( + msg: userResult, + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.CENTER, + timeInSecForIos: 1, + backgroundColor: Theme.of(context).primaryColor, + textColor: Colors.white, + fontSize: 16.0); } }).catchError((errorMsg) { setState(() { @@ -375,7 +388,8 @@ class _LoginPageState extends State { onPressed: () { Navigator.of(context).pushAndRemoveUntil( MaterialPageRoute( - builder: (context) => AppPage(UserInformation(id: 0))), + builder: (context) => + AppPage(UserInformation(id: 0))), (route) => route == null); }, )