class MaterialApp extends StatefulWidget abstract class StatefulWidget extends Widget { abstract class Widget extends DiagnosticableTree { abstract class DiagnosticableTree with Diagnosticable { mixin Diagnosticable {
Scaffold
1 2 3 4 5 6
class Scaffold extends StatefulWidget { abstract class StatefulWidget extends Widget { abstract class Widget extends DiagnosticableTree { abstract class DiagnosticableTree with Diagnosticable { mixin Diagnosticable {
StatelessWidget
1 2 3 4
abstract class StatelessWidget extends Widget abstract class Widget extends DiagnosticableTree abstract class DiagnosticableTree with Diagnosticable mixin Diagnosticable
StatefulWidget
1 2 3 4
abstract class StatefulWidget extends Widget abstract class Widget extends DiagnosticableTree abstract class DiagnosticableTree with Diagnosticable mixin Diagnosticable
AppBar
1 2 3 4 5 6
class AppBar extends StatefulWidget implements PreferredSizeWidget { abstract class StatefulWidget extends Widget { abstract class Widget extends DiagnosticableTree { abstract class DiagnosticableTree with Diagnosticable { mixin Diagnosticable {
Text
1 2 3 4 5 6
class Text extends StatelessWidget { abstract class StatelessWidget extends Widget { abstract class Widget extends DiagnosticableTree { abstract class DiagnosticableTree with Diagnosticable { mixin Diagnosticable {
Column
1 2 3 4 5 6 7 8
class Column extends Flex { class Flex extends MultiChildRenderObjectWidget { abstract class MultiChildRenderObjectWidget extends RenderObjectWidget { abstract class RenderObjectWidget extends Widget { abstract class Widget extends DiagnosticableTree { abstract class DiagnosticableTree with Diagnosticable { mixin Diagnosticable {
Row
1 2 3 4 5 6 7 8
class Row extends Flex { class Flex extends MultiChildRenderObjectWidget { abstract class MultiChildRenderObjectWidget extends RenderObjectWidget { abstract class RenderObjectWidget extends Widget { abstract class Widget extends DiagnosticableTree { abstract class DiagnosticableTree with Diagnosticable { mixin Diagnosticable {
Image
1 2 3 4 5 6
class Image extends StatefulWidget { abstract class StatefulWidget extends Widget { abstract class Widget extends DiagnosticableTree { abstract class DiagnosticableTree with Diagnosticable { mixin Diagnosticable {
ListView
1 2 3 4 5 6 7 8
class ListView extends BoxScrollView { abstract class BoxScrollView extends ScrollView { abstract class ScrollView extends StatelessWidget { abstract class StatelessWidget extends Widget { abstract class Widget extends DiagnosticableTree { abstract class DiagnosticableTree with Diagnosticable { mixin Diagnosticable {
Container
1 2 3 4 5
class Container extends StatelessWidget { abstract class StatelessWidget extends Widget { abstract class Widget extends DiagnosticableTree { abstract class DiagnosticableTree with Diagnosticable { mixin Diagnosticable {
从以上可以看出来大部分widget都有个通用的继承关系。
1 2 3 4 5 6
class XXXX extends StatelessWidget/StatefulWidget { abstract class StatelessWidget/StatefulWidget extends Widget { abstract class Widget extends DiagnosticableTree { abstract class DiagnosticableTree with Diagnosticable { mixin Diagnosticable {
/// A short, textual description of this widget. @override String toStringShort() { final String type = objectRuntimeType(this, 'Widget'); return key == null ? type : '$type-$key'; }