我是编码和颤动的新手,我一直在尝试将我的bottomNavigationBar
页面从home page
to更改为chatroom
但我尝试的任何方法都不起作用,我观看了很多视频,但它们bottomNavigationBar
在他们的身体内,当我应用他们正在做的事情时,我得到了红线在我padding
的正文后面和return Scaffold(
括号下面,在我的appBar:
图片链接位于代码末尾之前
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:trading/core/const.dart';
import 'package:trading/models/apartment_model.dart';
import 'package:trading/pages/chat.dart';
import 'package:trading/pages/detail_page.dart';
class Homepage extends StatefulWidget {
@override
_HomepageState createState() => _HomepageState();
}
class _HomepageState extends State<Homepage> {
var data = ApartmentModel.list;
int _selectedIndex = 0;
List<Widget> `enter code here`pages=[
Homepage(),
Chatroom(),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
title: Text(
"find your product",
style: TextStyle(color: Colors.black87, fontWeight: FontWeight.bold),
),
actions: <Widget>[
IconButton(
icon: Icon(
Icons.search,
color: Colors.black38,
),
onPressed: () {}),
IconButton(
icon: Icon(
Icons.filter_list,
color: Colors.black38,
),
onPressed: () {}),
],
),
bottomNavigationBar:
BottomNavigationBar(
showSelectedLabels: false,
showUnselectedLabels: false,
type: BottomNavigationBarType.fixed,
selectedItemColor: AppColors.stylecolor,
unselectedItemColor: Colors.black38,
currentIndex: _selectedIndex,
items: [
BottomNavigationBarItem(
icon: Icon(Icons.home), title: Text("datsa")),
BottomNavigationBarItem(
icon: Icon(Icons.chat), title: Text("data"),),
BottomNavigationBarItem(
icon: Icon(Icons.person), title: Text("data")),
],
),
body:
pages.elementAt(_selectedIndex),
Padding(
padding: EdgeInsets.all(16.0),
child:
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"65 result in your area",
style: TextStyle(color: Colors.black38),
),
Expanded(
child: ListView.builder(
physics: BouncingScrollPhysics(),
itemCount: data.length,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => DetailPage(
data[index]
),
),
);
},
child: _buildItem(context, index));
},
),
),
// Container( child: _builBottomNavigationBar),
],
),
),
);
}