`
Widget build(BuildContext context) {
double height=MediaQuery.of(context).size.height;
double width=MediaQuery.of(context).size.width;
return Scaffold(
appBar: AppBar(
title: Text("Device Details"),
backgroundColor: Colors.black,
),
body : SingleChildScrollView(
child: Container(
**Column**: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
getImageWidget(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
MaterialButton(
color: Colors.green,
child: Text(
"Camera",
style: TextStyle(color: Colors.white),
),
onPressed: () {
getImage(ImageSource.camera);
}),
`未定义命名参数“ column”。尝试将名称更正为现有命名参数的名称,或使用名称“ column”定义命名参数。打开文档。
如果我在 column:SingleChildScrollView(
这就是说命名参数'body'的参数已经指定。
请通过提供您宝贵的建议来解决我的问题。
class _MyFormPageState extends State<MyFormPage> {
File _selectedFile;
bool _inProcess = false;
Widget getImageWidget() {
if (_selectedFile != null) {
return Image.file(
_selectedFile,
width: 250,
height: 250,
fit: BoxFit.cover,
);
} else {
return Image.asset(
"assets/placeholder.jpg",
width: 250,
height: 250,
fit: BoxFit.cover,
);
}
}
getImage(ImageSource source) async {
this.setState((){
_inProcess = true;
});
File image = await ImagePicker.pickImage(source: source);
if(image != null){
File cropped = await ImageCropper.cropImage(
sourcePath: image.path,
aspectRatio: CropAspectRatio(
ratioX: 1, ratioY: 1),
compressQuality: 100,
maxWidth: 700,
maxHeight: 700,
compressFormat: ImageCompressFormat.jpg,
androidUiSettings: AndroidUiSettings(
toolbarColor: Colors.deepOrange,
toolbarTitle: "RPS Cropper",
statusBarColor: Colors.deepOrange.shade900,
backgroundColor: Colors.white,
)
);
this.setState((){
_selectedFile = cropped;
_inProcess = false;
});
} else {
this.setState((){
_inProcess = false;
});
}
}
final dbHelper = DatabaseHelper.instance;
String companyname,modelname,series,mfgyear;
@override
Widget build(BuildContext context) {
double height=MediaQuery.of(context).size.height;
double width=MediaQuery.of(context).size.width;
return Scaffold(
body: Stack(
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
getImageWidget(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
MaterialButton(
color: Colors.green,
child: Text(
"Camera",
style: TextStyle(color: Colors.white),
),
onPressed: () {
getImage(ImageSource.camera);
}),
MaterialButton(
color: Colors.deepOrange,
child: Text(
"Device",
style: TextStyle(color: Colors.white),
),
onPressed: () {
getImage(ImageSource.gallery);
})
],
)
],
),
(_inProcess)?Container(
color: Colors.white,
height: MediaQuery.of(context).size.height * 0.95,
child: Center(
child: CircularProgressIndicator(),
),
):Center()
],
),
appBar: AppBar(
title: Text(" Details"),
backgroundColor: Colors.black,
),
**column** : SingleChildScrollView(
child: Container(
decoration: new BoxDecoration(
color: Colors.black,
image: new DecorationImage(
fit: BoxFit.cover,
colorFilter: new ColorFilter.mode(Colors.grey.withOpacity(.5),BlendMode.dstATop),
image: new AssetImage(
"asset/bg00.jpg"
),
),
),
height: height,
width: width,
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,
),
),
TextField(
onChanged: (val){
companyname=val;
},
cursorColor: Colors.black,
style: TextStyle(
height: 1
),
decoration: InputDecoration(
filled: true,
fillColor: Colors.grey[500],
prefixIcon: Icon(Icons.edit,color: Colors.blue[900],),
hintStyle: TextStyle(
color:Colors.black,
),
hintText: "Enter the Company Name",
),
),
SizedBox(
height: 5,
),
答案 0 :(得分:0)
正在查看Scaffold的文档。确实没有名为column
的属性。
我认为您的SingleChildScrollView放置在错误的位置。
应该是包含Stack
和当前Column
的主体。不确定您要在视觉上实现什么,但是您可能需要朝这个方向检查。 (也许将SingleChildScrollView放在所说的Column
的末尾)