feat:增加底部标题栏
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
import 'package:blog_app/apis/blog.dart';
|
||||
import 'package:blog_app/layout/drawer.dart';
|
||||
import 'package:blog_app/layout/menu.dart';
|
||||
import 'package:blog_app/layout/nav_bar.dart';
|
||||
import 'package:blog_app/models/blog.dart';
|
||||
import 'package:blog_app/widget/search.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
const HomePage({super.key});
|
||||
|
||||
@override
|
||||
_HomePageState createState() => _HomePageState();
|
||||
}
|
||||
@@ -162,6 +165,20 @@ class _HomePageState extends State<HomePage> {
|
||||
return buildSearchResultList(context, _searchResults);
|
||||
}
|
||||
|
||||
void _onBottomNavTap(int index) {
|
||||
setState(() {
|
||||
_currentPageIndex = index;
|
||||
if (_isSearching) {
|
||||
_exitSearch();
|
||||
}
|
||||
});
|
||||
_pageController.animateToPage(
|
||||
index,
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
}
|
||||
|
||||
void onTapDrawerItem(int index) {
|
||||
setState(() {
|
||||
_currentPageIndex = index;
|
||||
@@ -220,6 +237,11 @@ class _HomePageState extends State<HomePage> {
|
||||
),
|
||||
drawer: _buildDrawer(),
|
||||
body: Padding(padding: EdgeInsets.all(10), child: _buildPageView()),
|
||||
bottomNavigationBar: buildBottomNavigationBar(
|
||||
context: context,
|
||||
index: _currentPageIndex,
|
||||
onTap: _onBottomNavTap,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user