This commit is contained in:
xiaojia.dxj
2019-08-08 17:50:57 +08:00
parent a3dcd6cce2
commit 548dc3d571
35 changed files with 852 additions and 395 deletions

View File

View File

@ -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示例展示)

View File

@ -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:

View File

@ -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<List> buildPageListJson() async {
List<FileSystemEntity> childList = await readeDirChildren(TARGET_PAGE_DIC, false);
List<String> pagePathList = [];
@ -55,36 +67,45 @@ Future<List> buildPageListJson() async {
}
String renderPagesDart(List<Map<String, dynamic>> 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<String, String> standardPages;
Map<String, String> getPages() {
return {
""";
for (int i = 0; i < data.length; i++) {
Map<String, dynamic> 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<Map<String, String>> getLocalList() {
return [
{}{{# pages }},
{ "id": "{{ id }}", "name": "{{ name }}", "email": "{{ email }}", "author": "{{ author }}"}
{{/ pages }}
];
}
}
""";
''';
var template = new Template(source, name: 'template-filename.html');
// 自定义前缀 避免出现数字非法字符等
Map<String, List> formatData = {
"pages": data
};
String output = template.renderString(formatData);
return output;
return head + foot;
}
Future<bool> checkPage(String path) async {
List files = [

View File

@ -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<int> {
addCommand(CreateDemoCommand());
addCommand(CreatePageCommand());
addCommand(WatchCommand());
addCommand(Build());
}

View File

@ -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<int> {
@override
final name = 'build';
@override
final description = '生成索引等';
@override
Future<int> run() async {
buildPageListJson();
buildDemoListJson();
return 0;
}
}

View File

@ -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 = "<group>"; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
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 = "<group>"; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
94722E5B22511D3600F63900 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
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 = "<group>"; };
@ -87,6 +86,7 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
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 = "<group>"; };
FAD0115E22F1B9DF0016E673 /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
FAD0115F22F1B9DF0016E673 /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Flutter.framework; sourceTree = "<group>"; };
FAD0116022F1B9DF0016E673 /* Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
@ -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 = "<group>";
};
7A8DD22A849804A38B883F48 /* Frameworks */ = {
70363EC0C64C41727112751D /* Frameworks */ = {
isa = PBXGroup;
children = (
8CA6E84257C027654D3B0DE2 /* libPods-Runner.a */,
57AAEC56B643BC3DE4EF4F8C /* libPods-Runner.a */,
);
name = Frameworks;
sourceTree = "<group>";
@ -148,7 +148,7 @@
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
F1785F83FDEE22F813679AE5 /* Pods */,
7A8DD22A849804A38B883F48 /* Frameworks */,
70363EC0C64C41727112751D /* Frameworks */,
);
sourceTree = "<group>";
};
@ -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 = "<group>";
@ -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 */

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
</dict>
</plist>

View File

@ -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';//搜索组件
}

View File

@ -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();
}

View File

@ -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<dynamic> requestCallBack;
NetLoadingDialog(
{Key key,
this.loadingText = "loading...",
this.outsideDismiss = true,
this.dismissCallback,
this.loading,
this.requestCallBack})
: super(key: key);
@override
State<NetLoadingDialog> createState() => _LoadingDialog();
}
class _LoadingDialog extends State<NetLoadingDialog> {
_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: <Widget>[
new CircularProgressIndicator(),
new Padding(
padding: const EdgeInsets.only(
top: 20.0,
),
child: new Text(
widget.loadingText,
style: new TextStyle(fontSize: 12.0),
),
),
],
),
),
),
),
),
);
}
}

View File

@ -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<WidgetDemo> {
'${Routes.codeView}?filePath=${Uri.encodeComponent(widget.codeUrl)}');
}
}
List<PopupMenuEntry<String>> buildPopupMenu() {
List<PopupMenuEntry<String>> comps = [];
if (widget.docUrl != null) {
comps.add(
PopupMenuItem<String>(
value: 'doc',
child: ListTile(
leading: Icon(
Icons.library_books,
size: 22.0,
),
title: Text('查看文档'),
),
)
);
}
if (widget.codeUrl != null) {
comps.add(
PopupMenuItem<String>(
value: 'code',
child: ListTile(
leading: Icon(
Icons.code,
size: 22.0,
),
title: Text('查看Demo'),
),
)
);
}
return comps;
}
@override
Widget build(BuildContext context) {
if (_hasCollected) {
@ -149,11 +180,8 @@ class _WidgetDemoState extends State<WidgetDemo> {
} else {
_collectionIcons = Icons.favorite_border;
}
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
title: Text(widget.title),
actions: <Widget>[
List<PopupMenuEntry<String>> menus = buildPopupMenu();
List<Widget> actions = [
new IconButton(
tooltip: 'goBack home',
onPressed: () {
@ -166,33 +194,20 @@ class _WidgetDemoState extends State<WidgetDemo> {
onPressed: _getCollection,
icon: Icon(_collectionIcons),
),
];
if (menus.length > 0) {
actions.add(
PopupMenuButton<String>(
onSelected: _selectValue,
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
const PopupMenuItem<String>(
value: 'doc',
child: ListTile(
leading: Icon(
Icons.library_books,
size: 22.0,
),
title: Text('查看文档'),
),
),
const PopupMenuDivider(),
const PopupMenuItem<String>(
value: 'code',
child: ListTile(
leading: Icon(
Icons.code,
size: 22.0,
),
title: Text('查看Demo'),
),
),
],
),
],
itemBuilder: (BuildContext context) => menus,
)
);
}
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
title: Text(widget.title),
actions: actions,
),
body: Container(
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0),

View File

@ -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());
}

View File

@ -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<List> mainList() async{
List listJson = await sql.getByCondition(conditions: {'parentId': 0});
List<Cat> cats = listJson.map((json) {
return new Cat.fromJSON(json);
}).toList();
return cats;
}
// 获取Cat不同深度与parent的列表
Future<List<Cat>> 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<Cat> cats = listJson.map((json) {
return new Cat.fromJSON(json);
}).toList();
return cats;
}
// 通过name获取Cat对象信息
Future<Cat> 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<List> mainList() async{
// List listJson = await sql.getByCondition(conditions: {'parentId': 0});
// List<Cat> cats = listJson.map((json) {
// return new Cat.fromJSON(json);
// }).toList();
// return cats;
// }
//
// // 获取Cat不同深度与parent的列表
// Future<List<Cat>> 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<Cat> cats = listJson.map((json) {
// return new Cat.fromJSON(json);
// }).toList();
// return cats;
// }
//
// // 通过name获取Cat对象信息
// Future<Cat> getCatByName(String name) async {
// List json = await sql.getByCondition(conditions: {'name': name});
// if (json.isEmpty) {
// return null;
// }
// return new Cat.fromJSON(json.first);
// }
//
//}

View File

@ -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<int> path, CategoryComponent root) {
print("getCommonItemByPath $path");
print("root $root");

View File

@ -1 +1 @@
[{"name":"demoName","screenShot":"","author":"yourName","email":"yourEmail","desc":"这是一个测试的标准demo","id":"1a29aa8e_32ae_4241_9c8a_5c9e1f92b096"}]
[{"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"}]

View File

@ -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
};

View File

@ -0,0 +1,9 @@
{
"name": "local",
"screenShot": "",
"author":"ab",
"email": "email",
"desc": "ags",
"id": "2c1d57d0_42ae_4241_9c8a_5c9e1f92b096"
}

View File

@ -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()
];

View File

@ -0,0 +1,16 @@
import 'package:flutter/material.dart';
class Demo extends StatefulWidget {
@override
_State createState() => _State();
}
class _State extends State<Demo> {
@override
Widget build(BuildContext context) {
return Container(
child: Text("this is flutter go init demo"),
);
}
}

View File

@ -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';

View File

@ -1,11 +1 @@
[
{
"name": "standard",
"screenShot": "",
"author": "sanfan",
"title": "介绍页",
"email": "hanxu317@qq.com",
"desc": "desc",
"id": "ee4feb8e_32ae_4241_9c8a_5c9e1f92b096"
}
]
[{"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"}]

View File

@ -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<String, String> standardPages;
Map<String, String> 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<Map<String, String>> 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"}
];
}
}

View File

@ -0,0 +1,10 @@
{
"name": "local",
"screenShot": "",
"author":"hnaxu",
"title":"本地",
"email": "hanxu@qq.com",
"desc": "desc",
"id": "5d7178d0_42ae_4241_9c8a_5c9e1f92b096"
}

View File

@ -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]
```""";
}

View File

@ -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]
```

View File

@ -0,0 +1,10 @@
{
"name": "test",
"screenShot": "",
"author":"abc",
"title":"ya",
"email": "adsf.com",
"desc": "desc",
"id": "84f38e00_42ae_4241_9c8a_5c9e1f92b096"
}

View File

@ -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]
```""";
}

View File

@ -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]
```

View File

@ -109,7 +109,7 @@ class DataUtils {
static Future<List> 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 {

View File

@ -1,12 +0,0 @@
const title = 'titie1';
Map<String, String> titleObjs = {
'title': 'haha33'
};
class Maps {
Map<String, String> list;
getList() {
return {
"title": "1111"
};
}
}

View File

@ -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<StandardView> {
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<void> getPagesInfo() async {
String jsonString = await DefaultAssetBundle.of(context)
.loadString('lib/standard_pages/.pages.json');
/// 本地调用的获取文章属性的基本信息
Future<void> localGetPagesAttrsInfo() async {
String jsonString = await DefaultAssetBundle.of(context).loadString('lib/standard_pages/.pages.json');
List jsonList = json.decode(jsonString);
Map<String, dynamic> pageDetail =
jsonList.firstWhere((item) => item['id'] == widget.id);
Map<String, dynamic> pageDetail = jsonList.firstWhere((item) => item['id'] == widget.id);
if (pageDetail != null) {
setState(() {
pageTitle = pageDetail['title'] ?? '请加入title';
@ -56,27 +62,56 @@ class _StandardView extends State<StandardView> {
}
}
String _getContentFromLocal() {
/// 从本地获取基本文章信息
String localGetPagesMarkdown() {
String pageId = widget.id;
Map<String, String> pagesList = standardPage.getPages();
return pagesList[pageId];
}
Future<String> getContentOnline() async {
Future<String> _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'];
});
Future<String> getDetail() async {
String pageName = targetPage['name'] + "_" +targetPage['author']+ "_" +targetPage['id'];
String pageContent = await NetUtils.get(githubUrl + pageName + "/index.md");
setState(() {
isLoading = false;
});
return Future(() => pageContent);
}
/// 获取当面界面的相关信息. 需要区分环境
/// 本地环境下, 从本地获取 standard_pages的目录中互殴
/// 线上环境. 从github的api中获取
Future<String> 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<StandardView> {
});
}
return Future(() => conent);
// this.rebuild();
}
Widget buildFootInfo() {
if (!isLoading) {
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('创建者: $author'),
Text('邮箱: $email'),
Text('界面id: ${widget.id}')
],
),
);
}
return Container();
}
Widget buildMarkdown() {
Map<String, String> 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<String, dynamic> attrs) {
List<Widget> demo = demoObjects[attrs['id']];
if (demo == null) {
@ -109,20 +158,22 @@ class _StandardView extends State<StandardView> {
});
}
@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',
);
}
}

View File

@ -53,7 +53,6 @@ class SecondPageState extends State<WidgetPage> 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(),

View File

@ -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: