在flutter中使用 onTap 时出现以下错误。我得到的错误是:
Crash when compiling file:///C:/Users/Angel/Desktop/01502039_Velkov_A3/test_app/lib/pages/landing_page.dart,
at character offset 135:
lib/pages/landing_page.dart:10:16: Internal problem: Unhandled () → void => dart.core::print("We tapped") in defaultTreeNode.
onTap: ()=> print("We tapped"),
我的代码是:
import 'package:flutter/material.dart';
class LandingPage extends StatelessWidget{
@override
Widget build(BuildContext context) {
// TODO: implement build
return new Material(
color: Colors.greenAccent,
child: InkWell(
onTap: ()=> print("We tapped"),
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text("Lets do a quizz", style: new TextStyle(color: Colors.white, fontSize: 50.0, fontWeight: FontWeight.bold),),
new Text("Tap to start!", style: new TextStyle(color: Colors.white, fontSize: 20.0, fontWeight: FontWeight.bold),)
],
),
),
);
}
}
我正在关注一个教程,这个人没有任何问题,但在我的情况下会发生这种情况。我是新手,所以我不知道如何解决这样的问题。箭头功能有问题吗?