Merge branch 'cli' of github.com:alibaba/flutter-go

This commit is contained in:
sanfan.hx
2019-07-25 12:16:14 +08:00
66 changed files with 2877 additions and 268 deletions

View File

@ -1,12 +1,20 @@
import 'package:flutter/material.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter_go/utils/shared_preferences.dart';
import '../model/widget.dart';
enum ENV {
PRODUCTION,
DEV,
}
class Application {
/// 通过Application设计环境变量
static ENV env = ENV.PRODUCTION;
static Router router;
static TabController controller;
static SpUtil sharePeferences;
static SpUtil sharePeference;
static CategoryComponent widgetTree;
static Map<String, String> github = {
'widgetsURL':'https://github.com/alibaba/flutter-go/blob/develop/lib/widgets/',
@ -14,4 +22,15 @@ class Application {
//'master':'https://github.com/alibaba-paimai-frontend/flutter-common-widgets-app/tree/master/lib/widgets/'
};
/// 所有获取配置的唯一入口
Map<String, String> get config {
if (Application.env == ENV.PRODUCTION) {
return {};
}
if (Application.env == ENV.DEV) {
return {};
}
return {};
}
}

View File

@ -10,7 +10,7 @@ import 'package:flutter_go/views/login_page/login_page.dart';
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';
// app的首页
var homeHandler = new Handler(
@ -35,9 +35,9 @@ var collectionHandler = new Handler(
var categoryHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
String name = params["type"]?.first;
String ids = params["ids"]?.first;
return new CategoryHome(name);
return new CategoryHome(ids);
},
);
@ -60,12 +60,15 @@ var fullScreenCodeDialog = new Handler(
var webViewPageHand = new Handler(
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
String title = params['title']?.first;
String url = params['url']?.first;
return new WebViewPage(url, title);
});
String title = params['title']?.first;
String url = params['url']?.first;
return new WebViewPage(url, title);
});
// var issuesMessageHandler = new Handler(
// handlerFunc: (BuildContext context, Map<String, List<String>> params) {
// return issuesMessagePage();
// });
var standardPageHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
String id = params['id']?.first;
return StandardView(id: id);
}
);

View File

@ -2,10 +2,9 @@
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter_go/utils/analytics.dart' show analytics;
import '../widgets/index.dart';
import './router_handler.dart';
import '../standard_pages/index.dart';
class Routes {
static String root = "/";
static String home = "/home";
@ -16,6 +15,7 @@ class Routes {
static String issuesMessage='/issuesMessage';
static String collectionPage = '/collection-page';
static String collectionFullPage = '/collection-full-page';
static String standardPage = '/standard-page/:id';
static void configureRoutes(Router router) {
List widgetDemosList = new WidgetDemoList().getDemos();
@ -26,6 +26,8 @@ class Routes {
router.define(collectionPage,handler:collectionHandler);
router.define(collectionFullPage,handler:collectionFullHandler);
router.define('/category/:type', handler: categoryHandler);
router.define('/category/:ids', handler: categoryHandler);
router.define('/category/error/404', handler: widgetNotFoundHandler);
router.define(loginPage, handler: loginPageHandler);
router.define(codeView,handler:fullScreenCodeDialog);
@ -41,5 +43,10 @@ class Routes {
});
router.define('${demo.routerName}', handler: handler);
});
router.define(standardPage,handler:standardPageHandler);
// router.define(webViewPage,handler:webViewPageHand);
// standardPages.forEach((String id, String md) => {
//
// });
}
}