File tree Expand file tree Collapse file tree 5 files changed +85
-1
lines changed
Expand file tree Collapse file tree 5 files changed +85
-1
lines changed Original file line number Diff line number Diff line change 1+ import 'package:flutter/material.dart' ;
2+ import 'package:flutter_book/widgets/Category/CategoryContent.dart' ;
3+
4+ class Category extends StatefulWidget {
5+ @override
6+ _CategoryState createState () => _CategoryState ();
7+ }
8+
9+ class _CategoryState extends State <Category > {
10+ @override
11+ Widget build (BuildContext context) {
12+ return Scaffold (
13+ appBar: AppBar (
14+ title: Text ("书籍类别" ),
15+ centerTitle: true ,
16+ elevation: 0 ,
17+ ),
18+ body: CategoryContent (),
19+ );
20+ }
21+ }
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import 'package:flutter_book/containers/Login.dart';
66import 'package:flutter_book/containers/Register.dart' ;
77import 'package:flutter_book/containers/Search.dart' ;
88import 'package:flutter_book/containers/Leaderboard.dart' ;
9+ import 'package:flutter_book/containers/Category.dart' ;
910
1011// import 'package:flutter/painting.dart';
1112import 'package:fluro/fluro.dart' ;
@@ -59,6 +60,12 @@ Handler leaderboardRouterHandler = Handler(
5960 handlerFunc: (BuildContext context, Map <String , List <String >> params) {
6061 return Leaderboard ();
6162});
63+ // 类别
64+ Handler categoryRouterHandler = Handler (
65+ handlerFunc: (BuildContext context, Map <String , List <String >> params) {
66+ return Category ();
67+ });
68+
6269// var demoFunctionHandler = Handler(
6370// type: HandlerType.function,
6471// handlerFunc: (BuildContext context, Map<String, List<String>> params) {
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ class Routes {
1919 static String search = "/search" ;
2020 // 排行榜
2121 static String leaderboard = "/leaderboard" ;
22+ // 类别
23+ static String category = "/category" ;
2224
2325 static void configureRoutes (Router router) {
2426 router.notFoundHandler = Handler (
@@ -33,6 +35,7 @@ class Routes {
3335 router.define (register, handler: registerRouterHandler);
3436 router.define (search, handler: searchRouterHandler);
3537 router.define (leaderboard, handler: leaderboardRouterHandler);
38+ router.define (category, handler: categoryRouterHandler);
3639 // router.define(demoSimpleFixedTrans,
3740 // handler: demoRouteHandler, transitionType: TransitionType.inFromLeft);
3841 }
Original file line number Diff line number Diff line change 1+ import 'package:flutter/material.dart' ;
2+ import 'package:flutter_book/widgets/common/SearchInputBox.dart' ;
3+
4+ class CategoryContent extends StatefulWidget {
5+ const CategoryContent ({Key key}) : super (key: key);
6+ @override
7+ _CategoryContentState createState () => _CategoryContentState ();
8+ }
9+
10+ class _CategoryContentState extends State <CategoryContent >
11+ with SingleTickerProviderStateMixin {
12+ final List <Tab > myTabs = < Tab > [
13+ Tab (text: 'Economic02' ),
14+ Tab (text: 'Military' ),
15+ Tab (text: 'Art' ),
16+ Tab (text: 'Movement' ),
17+ Tab (text: 'Design' ),
18+ Tab (text: 'Science and technology' ),
19+ ];
20+
21+ @override
22+ Widget build (BuildContext context) {
23+ return ListView (
24+ children: < Widget > [
25+ SearchInputBox (),
26+ Container (
27+ height: 600.0 ,
28+ child: DefaultTabController (
29+ length: myTabs.length,
30+ child: Scaffold (
31+ appBar: AppBar (
32+ leading: Text ("" ),
33+ bottom: TabBar (
34+ tabs: myTabs,
35+ isScrollable: true ,
36+ ),
37+ ),
38+ body: TabBarView (
39+ children: myTabs.map ((Tab tab) {
40+ return Center (child: Text (tab.text));
41+ }).toList (),
42+ ),
43+ ),
44+ ))
45+ ],
46+ );
47+ }
48+ }
Original file line number Diff line number Diff line change @@ -52,7 +52,12 @@ class FirstScreenNavBar extends StatelessWidget {
5252 height: Constants .appBarIconSize,
5353 ),
5454 onPressed: () {
55- print ("ok6" );
55+ // 跳到分类页面
56+ Application .router.navigateTo (
57+ context,
58+ "/category" ,
59+ transition: TransitionType .native ,
60+ );
5661 },
5762 )
5863 ],
You can’t perform that action at this time.
0 commit comments