Flutter 在颤振中对齐元件不是';行不通

Flutter 在颤振中对齐元件不是';行不通,flutter,computer-vision,flutter-layout,morse-code,Flutter,Computer Vision,Flutter Layout,Morse Code,我写了一个代码,它使用flatter\u mobile\u vision和morse通过移动摄像机扫描文本,并将扫描的文本转换成摩尔斯电码。 这是我的密码: import 'dart:async'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobile_vision/flutter_mobile_vision.dart'; im

我写了一个代码,它使用
flatter\u mobile\u vision
morse
通过移动摄像机扫描文本,并将扫描的文本转换成摩尔斯电码。
这是我的密码:

import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mobile_vision/flutter_mobile_vision.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:lottie/lottie.dart';
import 'package:morse/morse.dart';

class OCRPage extends StatefulWidget {
  @override
  _OCRPageState createState() => _OCRPageState();
}

class _OCRPageState extends State<OCRPage> {

  int _ocrCamera = FlutterMobileVision.CAMERA_BACK;
  String _text = "TEXT";

  Future<Null> _read() async {
    List<OcrText> texts = [];
    try {
      texts = await FlutterMobileVision.read(
        camera: _ocrCamera,
        waitTap: true,
      );

      setState(() {
        _text = texts[0].value;
      });
    } on Exception {
      texts.add( OcrText('Failed to recognize text'));
    }
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return SingleChildScrollView(
      child: Center(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          Lottie.asset('assets/scan-some-words.json', repeat: false),
          SizedBox(height: 20),
          Text(_text, style: GoogleFonts.orbitron(textStyle: TextStyle(color: Colors.white, fontSize: 20, fontWeight: FontWeight.w500)), textAlign: TextAlign.center,),
          SizedBox(height: 10),
          Text(Morse(_text).encode(), style: GoogleFonts.orbitron(textStyle: TextStyle(color: Colors.white, fontSize: 20, fontWeight: FontWeight.w500)),textAlign: TextAlign.center,),
          SizedBox(height: 30),
          ElevatedButton(
            onPressed: _read,
            child: new Text('Start Scanning'),
            // color: Color(0xFFFF16CD),
            // splashColor: Colors.orangeAccent,
          ),
          SizedBox(height: 10),
          Text('Tap on the text to convert into Morse Code', style: TextStyle(color: Color(0xffE6BBFC)),)
        ]

      )
    );


    throw UnimplementedError();
  }
}    
导入'dart:async';
进口“包装:颤振/cupertino.dart”;
进口“包装:颤振/材料.省道”;
进口“包装:flatter_mobile_vision/flatter_mobile_vision.dart”;
导入“package:google_fonts/google_fonts.dart”;
导入“包:lottie/lottie.dart”;
进口“包装:morse/morse.dart”;
类OCRPage扩展StatefulWidget{
@凌驾
_OCRPageState createState()=>\u OCRPageState();
}
类_OCRPageState扩展状态{
int _ocrCamera=flutmobilevision.CAMERA\u BACK;
字符串_text=“text”;
Future\u read()异步{
列表文本=[];
试一试{
text=等待mobilevision.read(
摄像机:摄像机,
waitTap:是的,
);
设置状态(){
_text=文本[0]。值;
});
}例外{
text.add(OcrText(‘无法识别文本’);
}
}
@凌驾
小部件构建(构建上下文){
//TODO:实现构建
返回SingleChildScrollView(
儿童:中心(
mainAxisAlignment:mainAxisAlignment.center,
儿童:[
Lottie.asset('assets/scan some words.json',重复:false),
尺寸箱(高度:20),
文本(_Text,style:GoogleFonts.orbitron(textStyle:textStyle(颜色:Colors.white,fontSize:20,fontWeight:fontWeight.w500)),textAlign:textAlign.center,),
尺寸箱(高度:10),
文本(Morse(_Text).encode(),样式:GoogleFonts.orbitron(textStyle:textStyle(颜色:Colors.white,fontSize:20,fontWeight:fontWeight.w500)),textAlign:textAlign.center,),
尺寸箱(高度:30),
升降按钮(
按下按钮:_读取,
子项:新文本(“开始扫描”),
//颜色:颜色(0xFFFF16CD),
//splashColor:Colors.orangeAccent,
),
尺寸箱(高度:10),
Text('点击文本以转换为莫尔斯电码',样式:TextStyle(颜色:color(0xffE6BBFC)),)
]
)
);
抛出未实现的错误();
}
}    
我指的是对齐小部件的链接:
我试图将子元素对齐为
子元素:[]
。但我得到的错误是

未定义命名参数“mainAxisAlignment”。(文档)尝试将名称更正为现有命名参数的名称,或使用名称“mainAxisAlignment”定义命名参数。
未定义命名参数“children”。(文档)尝试将名称更正为现有命名参数的名称,或使用名称“children”定义命名参数


我错过了什么?

mainAxisAlignment属性是在flex布局中如何沿主轴放置子对象。
Center
小部件没有
mainAxisAlignment
属性,因为它不是flex布局


在这里您可以使用
小部件。

中心
更改为
您正在使用的
中心
,将其更改为
。哦,好的,谢谢。。。