mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-05-21 14:56:27 +08:00
refactor(delete no use code):
This commit is contained in:
@ -65,31 +65,17 @@ class _CategoryHome extends State<CategoryHome> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void searchCatOrWidget() async {
|
void searchCatOrWidget() async {
|
||||||
print("searchCatOrWidget>>>");
|
|
||||||
CommonItem widgetTree = Application.widgetTree;
|
CommonItem widgetTree = Application.widgetTree;
|
||||||
// // 假设进入这个界面的parent一定存在
|
// 假设进入这个界面的parent一定存在
|
||||||
CommonItem targetGroup = catHistory.last;
|
CommonItem targetGroup = catHistory.last;
|
||||||
//
|
|
||||||
//
|
|
||||||
// // 继续搜索显示下一级depth: depth + 1, parentId: parentCat.id
|
|
||||||
// List<Cat> _categories =
|
|
||||||
// await catControl.getList(new Cat(parentId: parentCat.id));
|
|
||||||
// List<WidgetPoint> _widgetPoints = new List();
|
|
||||||
// if (_categories.isEmpty) {
|
|
||||||
// _widgetPoints =
|
|
||||||
// await widgetControl.getList(new WidgetPoint(catId: parentCat.id));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
print("targetGroup >>> $targetGroup");
|
|
||||||
|
|
||||||
this.setState(() {
|
this.setState(() {
|
||||||
title = targetGroup.name;
|
title = targetGroup.name;
|
||||||
// widgetPoints = targetGroup.children;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void onCatgoryTap(CommonItem cat) {
|
void onCatgoryTap(CommonItem cat) {
|
||||||
print("onCatgoryTap: ${cat}");
|
|
||||||
go(cat);
|
go(cat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ class WidgetItemContainer extends StatelessWidget {
|
|||||||
title: item.name,
|
title: item.name,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
String type = item.type;
|
String type = item.type;
|
||||||
print("type>>>>$type");
|
|
||||||
if (type == "category") {
|
if (type == "category") {
|
||||||
return tapToGroup(item as CategoryComponent, context);
|
return tapToGroup(item as CategoryComponent, context);
|
||||||
}
|
}
|
||||||
@ -78,21 +78,9 @@ class WidgetItemContainer extends StatelessWidget {
|
|||||||
return tapToOldWidget(leaf, context);
|
return tapToOldWidget(leaf, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// print("display $display");
|
|
||||||
if (type == 'widget') {
|
|
||||||
WidgetLeaf _item = item;
|
|
||||||
String targetName = _item.name;
|
|
||||||
String targetRouter = '/category/error/404';
|
|
||||||
widgetDemosList.forEach((item) {
|
|
||||||
if (item.name == targetName) {
|
|
||||||
targetRouter = item.routerName;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
print("targetRouter>>> $targetRouter");
|
|
||||||
|
|
||||||
}
|
|
||||||
Application.router
|
Application.router
|
||||||
.navigateTo(context, "/category/${item.token}", transition: TransitionType.inFromRight);
|
.navigateTo(context, "/category/error/404", transition: TransitionType.inFromRight);
|
||||||
},
|
},
|
||||||
index: addI,
|
index: addI,
|
||||||
totalCount: length,
|
totalCount: length,
|
||||||
|
@ -28,7 +28,7 @@ class MyApp extends StatefulWidget {
|
|||||||
final router = new Router();
|
final router = new Router();
|
||||||
Routes.configureRoutes(router);
|
Routes.configureRoutes(router);
|
||||||
// 这里设置项目环境
|
// 这里设置项目环境
|
||||||
Application.env = ENV.DEV;
|
Application.env = ENV.PRODUCTION;
|
||||||
Application.router = router;
|
Application.router = router;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,6 @@ void main() async {
|
|||||||
sp = await SpUtil.getInstance();
|
sp = await SpUtil.getInstance();
|
||||||
new SearchHistoryList(sp);
|
new SearchHistoryList(sp);
|
||||||
await DataUtils.getWidgetTreeList().then((List json) {
|
await DataUtils.getWidgetTreeList().then((List json) {
|
||||||
print("树型结构返回数据: $json");
|
|
||||||
Application.widgetTree = WidgetTree.buildWidgetTree(json);
|
Application.widgetTree = WidgetTree.buildWidgetTree(json);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -14,14 +14,10 @@ import '../../components/markdown.dart' as mdCopy;
|
|||||||
import '../../components/flutter_markdown/lib/flutter_markdown.dart';
|
import '../../components/flutter_markdown/lib/flutter_markdown.dart';
|
||||||
import '../../standard_pages/index.dart';
|
import '../../standard_pages/index.dart';
|
||||||
import '../../page_demo_package/index.dart';
|
import '../../page_demo_package/index.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'package:flutter_go/routers/application.dart';
|
import 'package:flutter_go/routers/application.dart';
|
||||||
|
|
||||||
// ONLINE || LOCAL
|
// ONLINE || LOCAL
|
||||||
const Env = 'LOCAL' ;
|
ENV env = Application.env;
|
||||||
|
|
||||||
class StandardView extends StatefulWidget {
|
class StandardView extends StatefulWidget {
|
||||||
final String id;
|
final String id;
|
||||||
@ -35,6 +31,7 @@ class StandardView extends StatefulWidget {
|
|||||||
class _StandardView extends State<StandardView> {
|
class _StandardView extends State<StandardView> {
|
||||||
String markdownDesc = '# this is header';
|
String markdownDesc = '# this is header';
|
||||||
String pageTitle = "XXX";
|
String pageTitle = "XXX";
|
||||||
|
|
||||||
String author = '';
|
String author = '';
|
||||||
String email = '';
|
String email = '';
|
||||||
StandardPages standardPage = new StandardPages();
|
StandardPages standardPage = new StandardPages();
|
||||||
@ -42,11 +39,9 @@ class _StandardView extends State<StandardView> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
getPagesInfo();
|
this.getDetail();
|
||||||
this.getContent();
|
|
||||||
}
|
}
|
||||||
|
// 本地调用的获取基本信息
|
||||||
|
|
||||||
Future<void> getPagesInfo() async {
|
Future<void> getPagesInfo() async {
|
||||||
String jsonString = await DefaultAssetBundle.of(context).loadString('lib/standard_pages/.pages.json');
|
String jsonString = await DefaultAssetBundle.of(context).loadString('lib/standard_pages/.pages.json');
|
||||||
List jsonList = json.decode(jsonString);
|
List jsonList = json.decode(jsonString);
|
||||||
@ -74,11 +69,14 @@ class _StandardView extends State<StandardView> {
|
|||||||
return Future(() => content);
|
return Future(() => content);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> getContent() async {
|
Future<String> getDetail() async {
|
||||||
String conent = '';
|
String conent = '';
|
||||||
if (Env == 'PRODUCTION') {
|
print("env:::: $env");
|
||||||
|
|
||||||
|
if (env == ENV.PRODUCTION) {
|
||||||
conent = await _getContentOnline();
|
conent = await _getContentOnline();
|
||||||
} else {
|
} else {
|
||||||
|
getPagesInfo();
|
||||||
conent = _getContentFromLocal();
|
conent = _getContentFromLocal();
|
||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
|
Reference in New Issue
Block a user