- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在ListView
中使用PageView
。
我正在尝试创建两个可滚动的页面,如果我使用的PageView
错误,请提供建议。
这是我到目前为止可以做的。
class ProductDetail extends StatefulWidget {
@override
State<StatefulWidget> createState() => ProductDetailState();
}
class ProductDetailState extends State {
int selectedBarIndex = 0;
PageController _pageController;
@override
void initState() {
super.initState();
_pageController = PageController();
}
@override
void dispose() {
_pageController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
title: Text('Lime new-entries', style: TextStyle(color: Colors.black),),
),
body: SizedBox(
child: PageView(
controller: _pageController,
onPageChanged: (index) {
setState(() => selectedBarIndex= index);
},
children: <Widget>[
ListView(
shrinkWrap: true,
children: <Widget>[
// Container(color: Colors.purple, child: NewEntryPage(),),
Container(
padding: EdgeInsets.symmetric(vertical: 20.0, horizontal: 0.0),
alignment: Alignment.topLeft,
child: NewEntryPage()),
],),
Container(color: Colors.red,),
],
),
),
bottomNavigationBar: BottomNavyBar(
selectedIndex: selectedBarIndex,
onItemSelected: (index) {
setState(() => selectedBarIndex = index);
_pageController.jumpToPage(index);
},
items: <BottomNavyBarItem>[
BottomNavyBarItem(
title: Text('Sold-entries'),
icon: Icon(Icons.assignment_returned)
),
BottomNavyBarItem(
title: Text('New-entries'),
icon: Icon(Icons.apps)
),
],
),
);
}
}
这是我得到的错误,如果有帮助
An Observatory debugger and profiler on itel S12 is available at: http://127.0.0.1:38337/QVxHZaGGG2Y=/
I/flutter ( 5479): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 5479): The following assertion was thrown while applying parent data.:
I/flutter ( 5479): Incorrect use of ParentDataWidget.
I/flutter ( 5479): The ParentDataWidget Expanded(flex: 1) wants to apply ParentData of type FlexParentData to a
I/flutter ( 5479): RenderObject, which has been set up to accept ParentData of incompatible type BoxParentData.
I/flutter ( 5479): Usually, this means that the Expanded widget has the wrong ancestor RenderObjectWidget. Typically,
I/flutter ( 5479): Expanded widgets are placed directly inside Flex widgets.
I/flutter ( 5479): The offending Expanded is currently placed inside a Padding widget.
I/flutter ( 5479): The ownership chain for the RenderObject that received the incompatible parent data was:
I/flutter ( 5479): ClipPath ← Expanded ← Chart ← Padding ← ColoredBox ← ConstrainedBox ← Padding ← Container ←
I/flutter ( 5479): RepaintBoundary ← IndexedSemantics ← ⋯
I/flutter ( 5479):
I/flutter ( 5479): When the exception was thrown, this was the stack:
I/flutter ( 5479): #0 RenderObjectElement._updateParentData.<anonymous closure> (package:flutter/src/widgets/framework.dart:5645:11)
I/flutter ( 5479): #1 RenderObjectElement._updateParentData (package:flutter/src/widgets/framework.dart:5661:6)
I/flutter ( 5479): #2 RenderObjectElement.attachRenderObject (package:flutter/src/widgets/framework.dart:5682:7)
I/flutter ( 5479): #3 RenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5376:5)
I/flutter ( 5479): #4 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5829:11)
I/flutter ( 5479): ... Normal element mounting (63 frames)
I/flutter ( 5479): #67 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
I/flutter ( 5479): #68 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
I/flutter ( 5479): #69 SliverMultiBoxAdaptorElement.updateChild (package:flutter/src/widgets/sliver.dart:1162:36)
I/flutter ( 5479): #70 SliverMultiBoxAdaptorElement.createChild.<anonymous closure> (package:flutter/src/widgets/sliver.dart:1147:20)
I/flutter ( 5479): #71 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2607:19)
I/flutter ( 5479): #72 SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1140:11)
I/flutter ( 5479): #73 RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:354:23)
I/flutter ( 5479): #74 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1866:58)
I/flutter ( 5479): #75 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:918:15)
I/flutter ( 5479): #76 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1866:13)
I/flutter ( 5479): #77 RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:343:5)
I/flutter ( 5479): #78 RenderSliverMultiBoxAdaptor.insertAndLayoutChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:489:5)
I/flutter ( 5479): #79 RenderSliverList.performLayout.advance (package:flutter/src/rendering/sliver_list.dart:219:19)
I/flutter ( 5479): #80 RenderSliverList.performLayout (package:flutter/src/rendering/sliver_list.dart:262:19)
I/flutter ( 5479): #81 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #82 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:135:11)
I/flutter ( 5479): #83 RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:375:11)
I/flutter ( 5479): #84 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #85 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:452:13)
I/flutter ( 5479): #86 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1444:12)
I/flutter ( 5479): #87 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1353:20)
I/flutter ( 5479): #88 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #89 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #90 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #91 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #92 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #93 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #94 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #95 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #96 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #97 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #98 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #99 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #100 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #101 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #102 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #103 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #104 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #105 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #106 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #107 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:11)
I/flutter ( 5479): #108 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:484:7)
I/flutter ( 5479): #109 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7)
I/flutter ( 5479): #110 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:399:14)
I/flutter ( 5479): #111 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #112 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #113 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #114 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #115 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1248:11)
I/flutter ( 5479): #116 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #117 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #118 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #119 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #120 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #121 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #122 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #123 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #124 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #125 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #126 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #127 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #128 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #129 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #130 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #131 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #132 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3225:13)
I/flutter ( 5479): #133 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #134 _RenderTheatre.performLayout (package:flutter/src/widgets/overlay.dart:700:15)
I/flutter ( 5479): #135 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #136 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #137 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #138 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #139 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #140 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #141 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #142 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #143 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #144 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #145 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #146 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
I/flutter ( 5479): #147 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter ( 5479): #148 RenderView.performLayout (package:flutter/src/rendering/view.dart:167:13)
I/flutter ( 5479): #149 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1630:7)
I/flutter ( 5479): #150 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:887:18)
I/flutter ( 5479): #151 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:402:19)
I/flutter ( 5479): #152 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:884:13)
I/flutter ( 5479): #153 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:284:5)
I/flutter ( 5479): #154 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1113:15)
I/flutter ( 5479): #155 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1052:9)
I/flutter ( 5479): #156 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:861:7)
I/flutter ( 5479): (elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
I/flutter ( 5479): ════════════════════════════════════════════════════════════════════════════════════════════════════
D/GraphicBuffer( 5479): register, handle(0x91ff7d50) (w:480 h:854 s:480 f:0x1 u:0x000f02)
D/GraphicBuffer( 5479): register, handle(0x91ff7ea0) (w:480 h:854 s:480 f:0x1 u:0x000f02)
I/flutter ( 5479): value:2
I/flutter ( 5479): Another exception was thrown: RenderCustomMultiChildLayoutBox object was given an infinite size during layout.
I/flutter ( 5479): Another exception was thrown: _RenderInkFeatures object was given an infinite size during layout.
I/flutter ( 5479): Another exception was thrown: RenderPhysicalModel object was given an infinite size during layout.
I/flutter ( 5479): Another exception was thrown: RenderFlex object was given an infinite size during layout.
I/flutter ( 5479): Another exception was thrown: RenderPositionedBox object was given an infinite size during layout.
I/flutter ( 5479): Another exception was thrown: RenderPadding object was given an infinite size during layout.
I/flutter ( 5479): Another exception was thrown: RenderRepaintBoundary object was given an infinite size during layout.
I/flutter ( 5479): Another exception was thrown: RenderIndexedSemantics object was given an infinite size during layout.
I/flutter ( 5479): Another exception was thrown: NoSuchMethodError: The method '>' was called on null.
这是返回列的newEntryPage代码
class NewEntryPage extends StatefulWidget {
@override
State<StatefulWidget> createState() => NewEntryPageState();
}
class NewEntryPageState extends State<NewEntryPage>
with SingleTickerProviderStateMixin {
final List<Tab> myTabs = <Tab>[
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
Tab(text: 'bro'),
];
TabController _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(vsync: this, length: myTabs.length);
}
@override
void dispose() {
_tabController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
return Column(
children: <Widget>[
TopSummaryCard(),
Container(
margin: EdgeInsets.symmetric(vertical: 20.0),
padding: const EdgeInsets.all(10.0),
color: Colors.white,
child: Column(
children: <Widget>[
Container(
child: Row(
children: [
IconButton(
icon: Icon(Icons.arrow_back_ios),
onPressed: () {
if (_tabController.index > 0) {
_tabController.animateTo(_tabController.index - 1);
} else {
Scaffold.of(context).showSnackBar(SnackBar(
content: Text("Can't go back"),
));
}
},
),
Expanded(
child: TabBar(
isScrollable: true,
controller: _tabController,
labelStyle: TextStyle(color: Colors.black),
unselectedLabelColor: Colors.black,
labelColor: Colors.blue,
tabs: List.generate(
20,
(index) {
return Tab(
text: "Tab $index",
);
},
),
),
),
IconButton(
icon: Icon(Icons.arrow_forward_ios),
onPressed: () {
if (_tabController.index + 1 < 20) {
_tabController.animateTo(_tabController.index + 1);
} else {
Scaffold.of(context).showSnackBar(SnackBar(
content: Text("Can't move forward"),
));
}
},
),
],
),
// }
),
// )
BarChartSample1()
],
),
),
BottomBarNavigationPatternExample(),
],
);
}
}
最佳答案
在ListView
上,将shrinkWrap
设置为true
。这将使ListView仅占用其所需的空间而不是扩展。
ListView(
shrinkWrap: true,
children: <Widget>[
Container(
color: Colors.purple,
child: NewEntryPage(),),
],
),
关于flutter - 如何在页面 View 中嵌套一个 ListView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63380549/
我需要将文本放在 中在一个 Div 中,在另一个 Div 中,在另一个 Div 中。所以这是它的样子: #document Change PIN
奇怪的事情发生了。 我有一个基本的 html 代码。 html,头部, body 。(因为我收到了一些反对票,这里是完整的代码) 这是我的CSS: html { backgroun
我正在尝试将 Assets 中的一组图像加载到 UICollectionview 中存在的 ImageView 中,但每当我运行应用程序时它都会显示错误。而且也没有显示图像。 我在ViewDidLoa
我需要根据带参数的 perl 脚本的输出更改一些环境变量。在 tcsh 中,我可以使用别名命令来评估 perl 脚本的输出。 tcsh: alias setsdk 'eval `/localhome/
我使用 Windows 身份验证创建了一个新的 Blazor(服务器端)应用程序,并使用 IIS Express 运行它。它将显示一条消息“Hello Domain\User!”来自右上方的以下 Ra
这是我的方法 void login(Event event);我想知道 Kotlin 中应该如何 最佳答案 在 Kotlin 中通配符运算符是 * 。它指示编译器它是未知的,但一旦知道,就不会有其他类
看下面的代码 for story in book if story.title.length < 140 - var story
我正在尝试用 C 语言学习字符串处理。我写了一个程序,它存储了一些音乐轨道,并帮助用户检查他/她想到的歌曲是否存在于存储的轨道中。这是通过要求用户输入一串字符来完成的。然后程序使用 strstr()
我正在学习 sscanf 并遇到如下格式字符串: sscanf("%[^:]:%[^*=]%*[*=]%n",a,b,&c); 我理解 %[^:] 部分意味着扫描直到遇到 ':' 并将其分配给 a。:
def char_check(x,y): if (str(x) in y or x.find(y) > -1) or (str(y) in x or y.find(x) > -1):
我有一种情况,我想将文本文件中的现有行包含到一个新 block 中。 line 1 line 2 line in block line 3 line 4 应该变成 line 1 line 2 line
我有一个新项目,我正在尝试设置 Django 调试工具栏。首先,我尝试了快速设置,它只涉及将 'debug_toolbar' 添加到我的已安装应用程序列表中。有了这个,当我转到我的根 URL 时,调试
在 Matlab 中,如果我有一个函数 f,例如签名是 f(a,b,c),我可以创建一个只有一个变量 b 的函数,它将使用固定的 a=a1 和 c=c1 调用 f: g = @(b) f(a1, b,
我不明白为什么 ForEach 中的元素之间有多余的垂直间距在 VStack 里面在 ScrollView 里面使用 GeometryReader 时渲染自定义水平分隔线。 Scrol
我想知道,是否有关于何时使用 session 和 cookie 的指南或最佳实践? 什么应该和什么不应该存储在其中?谢谢! 最佳答案 这些文档很好地了解了 session cookie 的安全问题以及
我在 scipy/numpy 中有一个 Nx3 矩阵,我想用它制作一个 3 维条形图,其中 X 轴和 Y 轴由矩阵的第一列和第二列的值、高度确定每个条形的 是矩阵中的第三列,条形的数量由 N 确定。
假设我用两种不同的方式初始化信号量 sem_init(&randomsem,0,1) sem_init(&randomsem,0,0) 现在, sem_wait(&randomsem) 在这两种情况下
我怀疑该值如何存储在“WORD”中,因为 PStr 包含实际输出。? 既然Pstr中存储的是小写到大写的字母,那么在printf中如何将其给出为“WORD”。有人可以吗?解释一下? #include
我有一个 3x3 数组: var my_array = [[0,1,2], [3,4,5], [6,7,8]]; 并想获得它的第一个 2
我意识到您可以使用如下方式轻松检查焦点: var hasFocus = true; $(window).blur(function(){ hasFocus = false; }); $(win
我是一名优秀的程序员,十分优秀!