factor:布局颜色重构
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'package:blog_app/apis/blog.dart';
|
||||
import 'package:blog_app/layout/drawer.dart';
|
||||
import 'package:blog_app/layout/app_drawer.dart';
|
||||
import 'package:blog_app/layout/app_navbar.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';
|
||||
@@ -165,7 +165,7 @@ class _HomePageState extends State<HomePage> {
|
||||
return buildSearchResultList(context, _searchResults);
|
||||
}
|
||||
|
||||
void _onBottomNavTap(int index) {
|
||||
void _onTapNavbarItem(int index) {
|
||||
setState(() {
|
||||
_currentPageIndex = index;
|
||||
if (_isSearching) {
|
||||
@@ -194,37 +194,6 @@ class _HomePageState extends State<HomePage> {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
||||
Widget _buildDrawerBody() {
|
||||
return ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
...List.generate(
|
||||
pages.length,
|
||||
(index) => buildDrawerItem(
|
||||
context: context,
|
||||
page: pages[index],
|
||||
isSelected: index == _currentPageIndex,
|
||||
onTap: () => onTapDrawerItem(index),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDrawer() {
|
||||
return Drawer(
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
buildDrawerHeader(context),
|
||||
Expanded(child: _buildDrawerBody()),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -235,12 +204,14 @@ class _HomePageState extends State<HomePage> {
|
||||
leading: _buildLeading(),
|
||||
actions: _buildAppBarActions(),
|
||||
),
|
||||
drawer: _buildDrawer(),
|
||||
drawer: AppDrawer(
|
||||
currentPageIndex: _currentPageIndex,
|
||||
onTapDrawerItem: onTapDrawerItem,
|
||||
),
|
||||
body: Padding(padding: EdgeInsets.all(10), child: _buildPageView()),
|
||||
bottomNavigationBar: buildBottomNavigationBar(
|
||||
context: context,
|
||||
index: _currentPageIndex,
|
||||
onTap: _onBottomNavTap,
|
||||
bottomNavigationBar: AppNavbar(
|
||||
currentPageIndex: _currentPageIndex,
|
||||
onTapNavbarItem: _onTapNavbarItem,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user