添加收藏功能

This commit is contained in:
yifeng.yl
2019-06-10 16:33:14 +08:00
parent 8741871f5b
commit f849102cb6
8 changed files with 255 additions and 24 deletions

View File

@ -8,6 +8,9 @@ import 'package:flutter_go/views/web_page/web_view_page.dart';
import 'package:flutter_go/views/home.dart';
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';
// app的首页
var homeHandler = new Handler(
@ -16,6 +19,20 @@ var homeHandler = new Handler(
},
);
var collectionFullHandler = new Handler(
handlerFunc: (BuildContext context,Map<String,List<String>> params){
bool hasLogined = params['hasLogin']?.first == 'true';
return CollectionFullPage(hasLogined: hasLogined);
}
);
var collectionHandler = new Handler(
handlerFunc: (BuildContext context,Map<String,List<String>> params){
bool hasLogined = params['hasLogin']?.first == 'true';
return CollectionPage(hasLogined: hasLogined);
}
);
var categoryHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
String name = params["type"]?.first;

View File

@ -13,6 +13,8 @@ class Routes {
static String codeView = '/code-view';
static String webViewPage = '/web-view-page';
static String loginPage = '/loginpage';
static String collectionPage = '/collection-page';
static String collectionFullPage = '/collection-full-page';
static void configureRoutes(Router router) {
List widgetDemosList = new WidgetDemoList().getDemos();
@ -20,7 +22,8 @@ class Routes {
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
});
router.define(home, handler: homeHandler);
router.define(collectionPage,handler:collectionHandler);
router.define(collectionFullPage,handler:collectionFullHandler);
router.define('/category/:type', handler: categoryHandler);
router.define('/category/error/404', handler: widgetNotFoundHandler);
router.define(loginPage, handler: loginPageHandler);