mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-05-21 06:46:23 +08:00
refactor(delete no use code):
This commit is contained in:
@ -65,31 +65,17 @@ class _CategoryHome extends State<CategoryHome> {
|
||||
}
|
||||
|
||||
void searchCatOrWidget() async {
|
||||
print("searchCatOrWidget>>>");
|
||||
CommonItem widgetTree = Application.widgetTree;
|
||||
// // 假设进入这个界面的parent一定存在
|
||||
// 假设进入这个界面的parent一定存在
|
||||
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(() {
|
||||
title = targetGroup.name;
|
||||
// widgetPoints = targetGroup.children;
|
||||
});
|
||||
}
|
||||
|
||||
void onCatgoryTap(CommonItem cat) {
|
||||
print("onCatgoryTap: ${cat}");
|
||||
go(cat);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ class WidgetItemContainer extends StatelessWidget {
|
||||
title: item.name,
|
||||
onTap: () {
|
||||
String type = item.type;
|
||||
print("type>>>>$type");
|
||||
|
||||
if (type == "category") {
|
||||
return tapToGroup(item as CategoryComponent, context);
|
||||
}
|
||||
@ -78,21 +78,9 @@ class WidgetItemContainer extends StatelessWidget {
|
||||
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
|
||||
.navigateTo(context, "/category/${item.token}", transition: TransitionType.inFromRight);
|
||||
.navigateTo(context, "/category/error/404", transition: TransitionType.inFromRight);
|
||||
},
|
||||
index: addI,
|
||||
totalCount: length,
|
||||
|
@ -28,7 +28,7 @@ class MyApp extends StatefulWidget {
|
||||
final router = new Router();
|
||||
Routes.configureRoutes(router);
|
||||
// 这里设置项目环境
|
||||
Application.env = ENV.DEV;
|
||||
Application.env = ENV.PRODUCTION;
|
||||
Application.router = router;
|
||||
}
|
||||
|
||||
@ -131,7 +131,6 @@ void main() async {
|
||||
sp = await SpUtil.getInstance();
|
||||
new SearchHistoryList(sp);
|
||||
await DataUtils.getWidgetTreeList().then((List json) {
|
||||
print("树型结构返回数据: $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 '../../standard_pages/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';
|
||||
|
||||
// ONLINE || LOCAL
|
||||
const Env = 'LOCAL' ;
|
||||
ENV env = Application.env;
|
||||
|
||||
class StandardView extends StatefulWidget {
|
||||
final String id;
|
||||
@ -35,6 +31,7 @@ class StandardView extends StatefulWidget {
|
||||
class _StandardView extends State<StandardView> {
|
||||
String markdownDesc = '# this is header';
|
||||
String pageTitle = "XXX";
|
||||
|
||||
String author = '';
|
||||
String email = '';
|
||||
StandardPages standardPage = new StandardPages();
|
||||
@ -42,11 +39,9 @@ class _StandardView extends State<StandardView> {
|
||||
void initState() {
|
||||
|
||||
super.initState();
|
||||
getPagesInfo();
|
||||
this.getContent();
|
||||
this.getDetail();
|
||||
}
|
||||
|
||||
|
||||
// 本地调用的获取基本信息
|
||||
Future<void> getPagesInfo() async {
|
||||
String jsonString = await DefaultAssetBundle.of(context).loadString('lib/standard_pages/.pages.json');
|
||||
List jsonList = json.decode(jsonString);
|
||||
@ -74,11 +69,14 @@ class _StandardView extends State<StandardView> {
|
||||
return Future(() => content);
|
||||
}
|
||||
|
||||
Future<String> getContent() async {
|
||||
Future<String> getDetail() async {
|
||||
String conent = '';
|
||||
if (Env == 'PRODUCTION') {
|
||||
print("env:::: $env");
|
||||
|
||||
if (env == ENV.PRODUCTION) {
|
||||
conent = await _getContentOnline();
|
||||
} else {
|
||||
getPagesInfo();
|
||||
conent = _getContentFromLocal();
|
||||
}
|
||||
setState(() {
|
||||
|
Reference in New Issue
Block a user