Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment(-1, 1),
end: Alignment(1, -1), //Alignment(0.5, -0.75),
colors: [
darkGradient,
mediumGraient,
lightGradint,
],
stops: [
0.0,
0.8,
1,
],
),
),
child: CustomScrollView(
slivers: <Widget>[
SliverFillRemaining(
hasScrollBody: false,
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(35.0),
child: Logo(),
),
Padding(
padding: const EdgeInsets.fromLTRB(16.0, 0, 16, 8),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
gradient: LinearGradient(
begin: Alignment(-1, 1),
end: Alignment(1, -1), //Alignment(0.5, -0.75),
colors: [
lightGrey.withOpacity(0.1),
white.withOpacity(0.1),
],
stops: [
0.0,
1,
],
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(
vertical: 16, horizontal: 16),
child: TabBar(
unselectedLabelColor: white.withOpacity(0.5),
labelColor: white,
indicatorColor: Colors.transparent,
tabs: <Widget>[
Text(
"My Scores",
style: TextStyle(
fontFamily: font,
fontSize: 20,
fontWeight: FontWeight.w600),
),
Text(
"All Scores",
style: TextStyle(
fontFamily: font,
fontSize: 20,
fontWeight: FontWeight.w600),
),
],
controller: _tabController,
),
),
Flexible(
fit: FlexFit.loose,
//height: deviceHeight(context),
child: TabBarView(
children: [
MyScores(),
MyScores(),
],
controller: _tabController,
),
),
],
),
),
),
],
),
)
],
),
);
}
}
[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
[38;5;244mThe following assertion was thrown during performResize():[39;49m
Horizontal viewport was given unbounded height.
[38;5;244mViewports expand in the cross axis to fill their container and constrain their children to match their extent in the cross axis. In this case, a horizontal viewport was given an unlimited amount of vertical space in which to expand.[39;49m
[38;5;244mUser-created ancestor of the error-causing widget was[39;49m
[38;5;248mTabBarView[39;49m
[38;5;244mWhen the exception was thrown, this was the stack[39;49m
[38;5;244m#0 RenderViewport.performResize.<anonymous closure>[39;49m
[38;5;244m#1 RenderViewport.performResize[39;49m
[38;5;244m#2 RenderObject.layout[39;49m
[38;5;244m#3 RenderProxyBoxMixin.performLayout[39;49m
[38;5;244m#4 RenderObject.layout[39;49m
[38;5;244m...[39;49m
[38;5;244mThe following RenderObject was being processed when the exception was fired: RenderViewport#bbcf4 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
[38;5;244mRenderObject: RenderViewport#bbcf4 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
[38;5;244mneeds compositing[39;49m
[38;5;244mparentData: <none> (can use size)[39;49m
[38;5;244mconstraints: BoxConstraints(0.0<=w<=379.4, 0.0<=h<=Infinity)[39;49m
[38;5;244msize: MISSING[39;49m
[38;5;244maxisDirection: right[39;49m
[38;5;244mcrossAxisDirection: down[39;49m
[38;5;244moffset: _PagePosition#74920(offset: null, range: null..null, viewport: null, ScrollableState, PageScrollPhysics -> PageScrollPhysics -> ClampingScrollPhysics -> ClampingScrollPhysics, IdleScrollActivity#b98b7, ScrollDirection.idle)[39;49m
[38;5;244manchor: 0.0[39;49m
[38;5;244mcenter child: RenderSliverFillViewport#8749a NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
[38;5;244mparentData: paintOffset=Offset(0.0, 0.0)[39;49m
[38;5;244mconstraints: MISSING[39;49m
[38;5;244mgeometry: null[39;49m
[38;5;244mno children current live[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderViewport#bbcf4 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1681 pos 12: 'hasSize'
[38;5;244mUser-created ancestor of the error-causing widget was[39;49m
[38;5;248mTabBarView[39;49m
[38;5;244mThe following RenderObject was being processed when the exception was fired: RenderViewport#bbcf4 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
[38;5;244mRenderObject: RenderViewport#bbcf4 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
[38;5;244mneeds compositing[39;49m
[38;5;244mparentData: <none> (can use size)[39;49m
[38;5;244mconstraints: BoxConstraints(0.0<=w<=379.4, 0.0<=h<=Infinity)[39;49m
[38;5;244msize: MISSING[39;49m
[38;5;244maxisDirection: right[39;49m
[38;5;244mcrossAxisDirection: down[39;49m
[38;5;244moffset: _PagePosition#74920(offset: null, range: null..null, viewport: null, ScrollableState, PageScrollPhysics -> PageScrollPhysics -> ClampingScrollPhysics -> ClampingScrollPhysics, IdleScrollActivity#b98b7, ScrollDirection.idle)[39;49m
[38;5;244manchor: 0.0[39;49m
[38;5;244mcenter child: RenderSliverFillViewport#8749a NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE[39;49m
[38;5;244mparentData: paintOffset=Offset(0.0, 0.0)[39;49m
[38;5;244mconstraints: MISSING[39;49m
[38;5;244mgeometry: null[39;49m
[38;5;244mno children current live[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderViewport#bbcf4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1681 pos 12: 'hasSize'
[38;5;244mUser-created ancestor of the error-causing widget was[39;49m
[38;5;248mTabBarView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderIgnorePointer#ff54d relayoutBoundary=up14 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1681 pos 12: 'hasSize'
[38;5;244mUser-created ancestor of the error-causing widget was[39;49m
[38;5;248mTabBarView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderSemanticsAnnotations#6db74 relayoutBoundary=up13 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1681 pos 12: 'hasSize'
[38;5;244mUser-created ancestor of the error-causing widget was[39;49m
[38;5;248mTabBarView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderPointerListener#68fa0 relayoutBoundary=up12 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1681 pos 12: 'hasSize'
[38;5;244mUser-created ancestor of the error-causing widget was[39;49m
[38;5;248mTabBarView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderSemanticsGestureHandler#bd9c6 relayoutBoundary=up11 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1681 pos 12: 'hasSize'
[38;5;244mUser-created ancestor of the error-causing widget was[39;49m
[38;5;248mTabBarView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderPointerListener#a80f9 relayoutBoundary=up10 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1681 pos 12: 'hasSize'
[38;5;244mUser-created ancestor of the error-causing widget was[39;49m
[38;5;248mTabBarView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: _RenderScrollSemantics#c6bba relayoutBoundary=up9 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1681 pos 12: 'hasSize'
[38;5;244mUser-created ancestor of the error-causing widget was[39;49m
[38;5;248mTabBarView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderRepaintBoundary#34b09 relayoutBoundary=up8 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1681 pos 12: 'hasSize'
[38;5;244mUser-created ancestor of the error-causing widget was[39;49m
[38;5;248mTabBarView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderCustomPaint#e7174 relayoutBoundary=up7 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1681 pos 12: 'hasSize'
[38;5;244mUser-created ancestor of the error-causing widget was[39;49m
[38;5;248mTabBarView[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderRepaintBoundary#d3231 relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1681 pos 12: 'hasSize'
[38;5;244mUser-created ancestor of the error-causing widget was[39;49m
[38;5;248mContainer[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderFlex#acd87 relayoutBoundary=up5 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1681 pos 12: 'hasSize'
[38;5;244mUser-created ancestor of the error-causing widget was[39;49m
[38;5;248mContainer[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderDecoratedBox#551f9 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1681 pos 12: 'hasSize'
[38;5;244mUser-created ancestor of the error-causing widget was[39;49m
[38;5;248mColumn[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
[38;5;248m════════ Exception caught by rendering library ═════════════════════════════════[39;49m
RenderBox was not laid out: RenderDecoratedBox#551f9 relayoutBoundary=up4
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1681 pos 12: 'hasSize'
[38;5;244mUser-created ancestor of the error-causing widget was[39;49m
[38;5;248mContainer[39;49m
[38;5;248m════════════════════════════════════════════════════════════════════════════════[39;49m
Reloaded 4 of 490 libraries in 2,364ms.
在使用容器给其高度之前,TabBarView是不可见的,“使用扩展”不起作用,柔性也不起作用。我发现了类似的问题,但是他们的解决方案对我不起作用。我希望容器是其子容器的大小(即TabBarView),并使用CustomScrollView()滚动