未定义名称“颜色”。在 Flutter 中使用 TextStyle 类时

Tha*_*iri 2 colors dart flutter

我是颤振新手,收到错误未定义名称“颜色”。使用颜色时。在 TextStyle 类中

Widget nameCode() => Expanded(
  flex: 1,
  child: Center(
    child: Text(
      'GAIN',
      style: TextStyle(
          color: Colors.blue),
    ),
  ),
);
Run Code Online (Sandbox Code Playgroud)

IDE 中显示错误

小智 5

请确保您已包含:

import 'package:flutter/material.dart';
Run Code Online (Sandbox Code Playgroud)