我想使附加的布局混乱,但给我错误。
我如何将垂直可滚动ListView
放在具有父垂直可滚动视图SingleChildScrollView
的任何可水平滚动的容器中
这是我的代码:
WillPopScope(
onWillPop: () async => false,
child: SafeArea(
child: Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
centerTitle: true,
title: Text(
S.of(context).fullfilmentheading,
style: Theme.of(context)
.textTheme
.title
.merge(TextStyle(letterSpacing: 1.3)),
),
),
key: _con.scaffoldKey,
body: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: config.App(context).appWidth(3),
vertical: config.App(context).appHeight(1)),
//height: config.App(context).appHeight(100),
child: Container(
// color: Colors.green,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
// alignment: Alignment.center,
children: <Widget>[
SingleChildScrollView(
scrollDirection: Axis.horizontal,
physics: ClampingScrollPhysics(),
child: SizedBox(
child: ListView.builder(
itemCount: data.length,
itemBuilder: (context,index){
return Row(
children: [
Text(data[index]),
SizedBox(width:config.App(context).appWidth(5)),
Text(data[index]),
SizedBox(width:config.App(context).appWidth(5)),
Text(data[index]),
SizedBox(width:config.App(context).appWidth(5)),
Text(data[index]),
SizedBox(width:config.App(context).appWidth(5)),
Text(data[index]),
SizedBox(width:config.App(context).appWidth(5)),
Text(data[index]),
],
);
}),
),
),
ButtonTheme(
height: 50,
child: RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0),
side: BorderSide(
color: Theme.of(context).buttonColor)),
onPressed: () => {},
color: Theme.of(context).buttonColor,
// Colors.black,
child: Text(
"add".toUpperCase(),
// style:Theme.of(context).textTheme.button,// TextStyle(fontSize: 15)
),
),
),
],
),
),
),
),
),
),
)
这是我得到的错误:
The relevant error-causing widget was:
SingleChildScrollView file:///Users/shaikhawais/Projects/DTMerchantFlutter/lib/src/pages/fullfilment_details_page.dart:57:21
When the exception was thrown, this was the stack:
#2 RenderObject.layout (package:flutter/src/rendering/object.dart:1697:12)
#3 _RenderSingleChildViewport.performLayout (package:flutter/src/widgets/single_child_scroll_view.dart:512:13)
#4 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
#5 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:111:13)
#6 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
...
The following RenderObject was being processed when the exception was fired: _RenderSingleChildViewport#47dc5 relayoutBoundary=up16 NEEDS-LAYOUT NEEDS-PAINT