中心小部件出现问题

时间:2019-02-17 19:01:48

标签: dart flutter

在Windows 10中编写Center小部件时遇到错误,错误消息显示:

  

“预计需要1个自变量,但要找到0个。”

发生了一件有趣的事情,当我复制代码并将其放入Linux PC时,它可以正常工作,但在Windows上却不能。

源代码:

import 'package:flutter/material.dart';

class Home extends StatelessWidget{

  @override
  Widget build(BuildContext context) {
    return Center(child:Container(
      alignment: Alignment.center,
      color: Colors.deepPurple,
    ));

  }
}

扑扑医生:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version 10.0.17134.590], locale en-GB)
[!] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    X Android license status unknown.
[√] Android Studio (version 3.3)
[!] IntelliJ IDEA Community Edition (version 2017.2)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[√] Connected device (1 available)

谢谢。

0 个答案:

没有答案