@@ -30,20 +30,24 @@ class _IndexState extends State<Index> {
3030 }
3131
3232 Widget _bottomNavigationBar () {
33- return BottomNavigationBar (
34- items: < BottomNavigationBarItem > [
35- BottomNavigationBarItem (
36- title: Text (AppLocalizations .$t ('title_component' )),
37- icon: Icon (Icons .dashboard)),
38- BottomNavigationBarItem (
39- title: Text (AppLocalizations .$t ('title_my' )),
40- icon: Icon (Icons .person_outline)),
41- ],
42- type: BottomNavigationBarType .fixed,
43- currentIndex: _currentIndex,
44- onTap: (int index) {
45- _pageController.jumpToPage (index);
46- },
33+ return BottomAppBar (
34+ shape: CircularNotchedRectangle (),
35+ clipBehavior: Clip .antiAlias,
36+ child: BottomNavigationBar (
37+ items: < BottomNavigationBarItem > [
38+ BottomNavigationBarItem (
39+ title: Text (AppLocalizations .$t ('title_component' )),
40+ icon: Icon (Icons .dashboard)),
41+ BottomNavigationBarItem (
42+ title: Text (AppLocalizations .$t ('title_my' )),
43+ icon: Icon (Icons .person_outline)),
44+ ],
45+ // type: BottomNavigationBarType.fixed,
46+ currentIndex: _currentIndex,
47+ onTap: (int index) {
48+ _pageController.jumpToPage (index);
49+ },
50+ ),
4751 );
4852 }
4953
@@ -55,6 +59,7 @@ class _IndexState extends State<Index> {
5559 title: Text (AppLocalizations .$t ('common.logout' )),
5660 onTap: () {
5761 Store .value <UserModel >(context).clearUserInfo ();
62+ Store .value <UserModel >(context).changeIsStar (false );
5863 },
5964 ),
6065 ];
@@ -122,12 +127,55 @@ class _IndexState extends State<Index> {
122127 );
123128 }
124129
130+ Widget _floatingActionButton () {
131+ return Store .connect <UserModel >(
132+ builder: (context, child, model) {
133+ return FloatingActionButton (
134+ backgroundColor: Theme .of (context).primaryColor,
135+ onPressed: () {
136+ if (! model.isStar&& model.user.id != null ) {
137+ print ('进行star' );
138+ model.setStarFlutterUI ();
139+ } else {
140+ print ('不满足进行star条件' );
141+ if (model.user.id == null ) {
142+ Navigator .of (context).push (
143+ MaterialPageRoute (
144+ builder: (BuildContext context) {
145+ return LoginIndex .Index ();
146+ }
147+ )
148+ );
149+ }
150+ }
151+ },
152+ child: Container (
153+ child: Column (
154+ mainAxisAlignment: MainAxisAlignment .center,
155+ children: < Widget > [
156+ model.isStar
157+ ? Icon (Icons .star,size: 20 , color: Colors .white)
158+ : Icon (Icons .star_border, size: 20 , color: Colors .white),
159+ Text (
160+ '${model .flutter_ui_info .stargazersCount .toString ()}' ,
161+ style: TextStyle (color: Colors .white)
162+ )
163+ ],
164+ ),
165+ ),
166+ );
167+ }
168+ );
169+ }
170+
125171 @override
126172 Widget build (BuildContext context) {
127173 Store .setWidgetCtx (context); // 初始化scaffold的上下文作为全局上下文,提供弹窗等使用。
128174 return Scaffold (
129175 drawer: renderDrawer (),
130176 bottomNavigationBar: _bottomNavigationBar (),
177+ floatingActionButtonLocation: FloatingActionButtonLocation .centerDocked,
178+ floatingActionButton: _floatingActionButton (),
131179 body: PageView (
132180 controller: _pageController,
133181 physics: NeverScrollableScrollPhysics (),
0 commit comments