命名参数 'body' 的参数已经是 specified.What 当我们在 flutter 的脚手架中有两个“主体”时我们应该这样做
The argument for the named parameter 'body' was already specified.What we should do when we have two "bodys' in a scaffold in flutter
错误:命名参数 'body' 的参数已经 specified.What 当我们在 flutter 的脚手架中有两个“主体”时我们应该这样做
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Flexible(
child: gridView(),
)
],
),
),
body: SingleChildScrollView(
child : Container(
child: Padding(
padding: const EdgeInsets.all(5),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"Enter the Device Details",
style: TextStyle(
color: Colors.white,
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
可能是这样的:
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title)),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Flexible(
child: child: gridView(),
),
Container(
child: Padding(
padding: const EdgeInsets.all(5),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"Enter the Device Details",
style: TextStyle(
color: Colors.white,
fontSize: 30,
fontWeight: FontWeight.bold,
)
)
]
)
)
),
],
),
)
);
}
错误:命名参数 'body' 的参数已经 specified.What 当我们在 flutter 的脚手架中有两个“主体”时我们应该这样做
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Flexible(
child: gridView(),
)
],
),
),
body: SingleChildScrollView(
child : Container(
child: Padding(
padding: const EdgeInsets.all(5),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"Enter the Device Details",
style: TextStyle(
color: Colors.white,
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
可能是这样的:
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title)),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Flexible(
child: child: gridView(),
),
Container(
child: Padding(
padding: const EdgeInsets.all(5),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
"Enter the Device Details",
style: TextStyle(
color: Colors.white,
fontSize: 30,
fontWeight: FontWeight.bold,
)
)
]
)
)
),
],
),
)
);
}