'ListView In TabBarView In Container not scrolling dart
I have the following flutter/dart code where the listView which is inside a tabBarView and also inside a container isn't scrollable
Container(
height: MediaQuery.of(context).size.height,
child: TabBarView(controller: _controller, children: [
ListView(
physics: const AlwaysScrollableScrollPhysics(), // new
controller: _controllerView,
children: [
Padding(
padding: const EdgeInsets.all(16.0),
child: CustomText(
text: "User Details",
size: 20,
weight: FontWeight.bold,
color: darkPrimary,
),
),
ListTile(
leading: Icon(Icons.date_range_rounded),
title: CustomText(
text: "Joined",
color: grey,
size: 15,
weight: FontWeight.bold,
),
subtitle: CustomText(
text: "Jan 2020",
size: 18,
color: darkPrimary,
weight: FontWeight.bold,
),
dense: true,
),
ListTile(
leading: Icon(Icons.remove_red_eye_rounded),
title: CustomText(
text: "Active",
color: grey,
size: 15,
weight: FontWeight.bold,
),
subtitle: CustomText(
text: "3 days ago",
size: 18,
color: darkPrimary,
weight: FontWeight.bold,
),
dense: true,
),
Padding(
padding: const EdgeInsets.all(16.0),
child: CustomText(
text: "Description",
size: 20,
weight: FontWeight.bold,
color: darkPrimary,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: CustomText(
text:
"khfkjsh dkjash dkjash kdhask dhkas dkashkd askd asdh aksjhdkasj dkhhas dk askdh ask dhas hdas dh ask daskhh daskj daks dka asdh as dasjh",
size: 15,
weight: FontWeight.bold,
color: grey[700],
),
),
]),
ListView(children: [])
]),
)
This is the controller code
TabController _controller;
ScrollController _controllerView = new ScrollController();
@override
void initState() {
super.initState();
_controller = new TabController(length: 2, vsync: this);
}
Is there any problem with this code that is making it not scrollable instead the screen looks as if it is fixed. please help me out am a beginner in flutter/dart
Update: Instead I used Litview on like this and changed the other to column. even though its not what i want its still ok
body: SafeArea(
child: ListView(),
)
Solution 1:[1]
try to wrap the ListView in Expanded or Stack
Solution 2:[2]
Wrap your container with
SingleChildScrollView
Solution 3:[3]
try to wrap the ListView
in Expanded
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | CHRONOSTEC DEV |
Solution 2 | Firaun |
Solution 3 | M.M.Hasibuzzaman |