当我没有在 tabBarView 的容器中给出 height 属性时,它会给出一个错误,并且当用它包装时SingleChildScrollView
它是不可滚动的,并且当输入键盘被抬起时底部会溢出。但是,当我放在SingleChildScrollView
tabBar 上方时,它正在工作并且 tabBar 和 tabview 都在滚动,但我只希望 tabBarView 应该滚动而不是栏
我的代码
import 'package:copackd/screens/Shipment.dart';
import 'package:flutter/material.dart';
class TrackingPage extends StatefulWidget {
@override
_TrackingPageState createState() => _TrackingPageState();
}
class _TrackingPageState extends State<TrackingPage> {
@override
Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height;
return Scaffold(
body: Container(
width: double.infinity,
decoration: BoxDecoration(
color: Color.fromRGBO(247, 68, 78, .9),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(height: 80,),
Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("Track Your Shipment",style: TextStyle(color: Colors.white,fontSize: 25,fontWeight: FontWeight.bold),),
SizedBox(height: 10,),
Row(
children: <Widget>[
new Expanded(
flex: 8,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
boxShadow: [BoxShadow(
color: Color.fromRGBO(247, 68, 78, .3),
blurRadius: 20,
offset: Offset(0,10)
)]
),
child: Column(
children: <Widget>[
Container(
padding: EdgeInsets.fromLTRB(10, 0, 0, 0),
child: TextField(
decoration: InputDecoration(
hintText: "Enter tracking id",
hintStyle: TextStyle(color: Colors.grey),
border: InputBorder.none
),
),
),
],
),
),
),
Spacer(),
new Expanded(
flex: 2,
child: Container(
decoration: BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.circular(10),
boxShadow: [BoxShadow(
color: Color.fromRGBO(247, 68, 78, .3),
blurRadius: 20,
offset: Offset(0,10)
)]
),
child: IconButton(
icon: Icon(Icons.search),
iconSize: 25,
color: Colors.white,
onPressed: () {},
)
),
)
],
),
],
),
),
Expanded(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(topLeft: Radius.circular(60),topRight: Radius.circular(60))
),
child: Padding(
padding: EdgeInsets.all(20),
child: Column(
children: <Widget>[
DefaultTabController(
length: 2,
initialIndex: 0,
child: Column(
children: <Widget>[
TabBar(
indicatorColor: Colors.blue,
labelColor: Colors.black,
labelStyle: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
tabs: [Tab(text: "Sending"),Tab(text: "Receiving",)]
),
SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
height: height * 0.5,
child: TabBarView(
children: <Widget>[
Sending(),
Receiving(),
],
),
),
],
),
)
],
),
)
],
),
),
),
)
],
),
),
);
}
}
提前致谢