when I am not giving the height property in a container of tabBarView it is giving an error and when wrapping with SingleChildScrollView
it is not scrollable and the bottom gets overflowed when input keyboard is raised. But, when I place SingleChildScrollView
above the tabBar, it is working and both the tabBar and tabview is scrolling but I want only the tabBarView should be scrolled and not the bar
My code
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(),
],
),
),
],
),
)
],
),
)
],
),
),
),
)
],
),
),
);
}
}
Thanks in advance
add a you code ListView, it resolver you problem, example:
Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height;
return ListView(
Scaffold(
body: Container(
i hope resolver you problem!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.