有什么错误?而我该如何解决呢?

时间:2019-12-05 18:26:28

标签: flutter flutter-test

我正在学习颤动。我已经做了一个应用程序名称聊天x(title)。代码在下面

import 'package:flutter/material.dart';

void main() => runApp(MyApp());


class MyApp extends StatelessWidget {
  @override
Widget build(BuildContext context) {
return MaterialApp(
  home: Scaffold(
    appBar: AppBar(
      title: Text('Chat X'),
    ),
  body: Card(child: Column(children: <Widget>[
    Text('hey! this one is new');
  ],),),
  ),
);
 }
 }

每当我要调试此代码时,都会出现此错误

  

预期会找到']'。

2 个答案:

答案 0 :(得分:0)

您不应该拥有;在文本小部件之后。像这样:

Text('hey! this one is new')

答案 1 :(得分:0)

;中删除Text('hey! this one is new');,或者如果您想在,内放置更多小部件,则可以放置Column

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Chat X'),
        ),
        body: Card(child: Column(children: <Widget>[
            Text('hey! this one is new'),
            Text('hey! this one is second new'),
          ],),),
    ),
    );
  }
}