任何人都请提供一些信息为什么会这样?
当我尝试添加实现appBar flutter 的类AppBarDesign时,出现以下错误。
错误:参数类型'AppBarDesign'无法分配给参数类型'PreferredSizeWidget'。(argument_type_not_assignable位于[flutterbyrajath] lib \ main.dart:27)
import 'package:flutter/material.dart';
main() {
runApp(new MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Rajath\'s design ',
debugShowCheckedModeBanner: false,
theme: new ThemeData(primarySwatch: Colors.amber),
home: new MyHomePage(key, 'App is Fun'),
);
}
}
class MyHomePage extends StatelessWidget {
MyHomePage(Key key, this.title) : super(key: key);
final title;
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBarDesign(key, title),
);
}
}
class AppBarDesign extends …Run Code Online (Sandbox Code Playgroud) 这是当前的AppBar代码:
AppBar(
iconTheme: IconThemeData(
color: Colors.black,
size: 100 // This isn't performing any changes
),
centerTitle: false,
backgroundColor: Colors.white,
title: Text(
title,
style: TextStyle(color: Colors.black87,
),
elevation: 1.0,
);
Run Code Online (Sandbox Code Playgroud)
当前尺寸属性不做IconThemeData任何改变。