【发布时间】:2019-02-25 00:05:19
【问题描述】:
我正在尝试为应用使用自定义颜色主题。
这是 main.dart 文件
import 'package:flutter/material.dart';
import 'pages/HomePage.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: new ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or press Run > Flutter Hot Reload in IntelliJ). Notice that the
// counter didn't reset back to zero; the application is not restarted.
primarySwatch: MaterialColor(0xFF990000, {
50: Color(0xFF990001),
300: Color(0xFF990002),
900: Color(0xFF990003)
}),
),
home: new HomePage(),
);
}
}
我收到以下错误:
颤振:══╡小部件库╞══════════════════════════════ ═══════════════════════ 颤振:在构建 MyApp(脏)时引发了以下 NoSuchMethodError: 颤振:在 null 上调用了“computeLuminance”方法。 颤振:接收者:空 颤振:尝试调用:computeLuminance()
我做错了什么?
【问题讨论】:
标签: flutter