Reputation: 552
Widget build(BuildContext context) {
super.build(context);
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
return AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
),
child: Scaffold(
key: _scaffoldKeyProfilePage,
backgroundColor: Colors.white,
body: user == null
? Center(
child: CircularProgressIndicator(),
)
: RefreshIndicator(
onRefresh: _onRefresh,
child: ListView(
shrinkWrap: true,
padding: EdgeInsets.all(0),
children: [
BuildMainProfile(
....//build profile (with heiht = ScreenHeight/1.4)
),
Container(
...//to build bio section
),
Flexible(
child: PageView(
children: [
ListView.builder(
shrinkWrap: true,
itemCount: 30,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(color: index%2==0?Colors.red:Colors.green,height: 30.0,width: double.infinity,),
);
},
),
Container(height: 400,width: 200,color: Colors.green,),
Container(height: 400,width: 200,color: Colors.blue,),
Container(height: 400,width: 200,color: Colors.pink,)
],
),
)
],
),
),
),
);
I am getting an error saying :
The ParentDataWidget Flexible(flex: 1) wants to apply ParentData of type FlexParentData to a I/flutter ( 9926): RenderObject, which has been set up to accept ParentData of incompatible type ParentData. I/flutter ( 9926): Usually, this means that the Flexible widget has the wrong ancestor RenderObjectWidget. Typically, I/flutter ( 9926): Flexible widgets are placed directly inside Flex widgets. I/flutter ( 9926): The offending Flexible is currently placed inside a RepaintBoundary widget.
.
.
.
.
Another exception was thrown: Horizontal viewport was given unbounded height. I/flutter ( 9926): Another exception was thrown: RenderBox was not laid out: RenderViewport#4dd2b NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE I/flutter ( 9926): Another exception was thrown: RenderBox was not laid out: RenderViewport#4dd2b NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
How can this error be removed, I have even used Flexible over PageView and shrinkWrap in listView.
Upvotes: 0
Views: 270
Reputation: 1
PageView(
children: [HomeScreen(), XodimlarScreen(), SizedBox(
height: MediaQuery.of(context).size.height,
child: DavomatScreen()),HomeScreen(),],
controller: _pageControllerrr,
// physics: BouncingScrollPhysics(),
onPageChanged: (page) {
index = page;
},
),
Upvotes: 0
Reputation: 4773
You cannot directly use Flexible
in ListView
. Maybe you must try something like this
return DefaultTabController(
length: 3,
child: Scaffold(
appBar: AppBar(
title: Text(Translator.of(context).translate("ratingsandreviews"),),
bottom: TabBar(
indicator: UnderlineTabIndicator(),
tabs: <Widget>[
Tab(child: Icon(Icons.grid_on_outlined),),
Tab(child: Icon(Icons.timeline),),
Tab(child: Icon(Icons.account_box),),
],
),
),
body: TabBarView(
children: <Widget>[
ListView(
children: [
BuildMainProfile(),
Container(
//to build bio section
),
Expanded(
child: GridView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: POSTLIST.length,
itemBuilder: (context, index) {
return Container(); // or what you want
},
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
childAspectRatio: 1.0,
),
),
),
],
),
SecondPage(), // second page
ThirdPage(), // third page
Fourth(), // fourth page
// RideSharingReviewsPage(),
],
),
),
);
Upvotes: 1