MaterialApp 继承自StatefulWidget
class MaterialApp extends StatefulWidget
this.navigatorKey,
this.home,//--->tag1<---
this.routes = const {},
this.initialRoute,
this.onGenerateRoute,
this.onUnknownRoute,
this.navigatorObservers = const [],
this.builder,
this.title = '',//--->tag2<---
this.onGenerateTitle,
this.color,
this.theme,//--->tag3<---
this.locale,
this.localizationsDelegates,
this.localeListResolutionCallback,
this.localeResolutionCallback,
this.supportedLocales = const [Locale('en', 'US')],
this.debugShowMaterialGrid = false,
this.showPerformanceOverlay = false,
this.checkerboardRasterCacheImages = false,
this.checkerboardOffscreenLayers = false,
this.showSemanticsDebugger = false,
this.debugShowCheckedModeBanner = true,
Scaffold--脚手架
PreferredSizeWidget this.appBar,
Widget this.body,
Widget this.floatingActionButton,
FloatingActionButtonLocation this.floatingActionButtonLocation,
FloatingActionButtonAnimator this.floatingActionButtonAnimator,
List this.persistentFooterButtons,
Widget this.drawer,
Widget this.endDrawer,
Widget this.bottomNavigationBar,
Widget this.bottomSheet,
Color this.backgroundColor,
bool this.resizeToAvoidBottomPadding = true,
bool this.primary = true,
AppBar--App的Bar
Widget this.leading,
bool this.automaticallyImplyLeading = true,
Widget this.title,
List this.actions,
Widget this.flexibleSpace,
PreferredSizeWidget this.bottom,
double this.elevation = 4.0,
Color this.backgroundColor,
Brightness this.brightness,
IconThemeData this.iconTheme,
TextTheme this.textTheme,
bool this.primary = true,
bool this.centerTitle,
double this.titleSpacing = NavigationToolbar.kMiddleSpacing,
double this.toolbarOpacity = 1.0,
double this.bottomOpacity = 1.0,
Text--文字
const Text(this.data, {
TextStyle this.style,
TextAlign this.textAlign,
TextDirection this.textDirection,
Locale this.locale,
bool this.softWrap,
TextOverflow this.overflow,
double this.textScaleFactor,
int this.maxLines,
String this.semanticsLabel,
/// Creates a text widget with a [TextSpan].
const Text.rich(this.textSpan, {
//同上
})
//---->[TextStyle]----------------
bool this.inherit = true,
Color this.color,
double this.fontSize,
FontWeight this.fontWeight,
FontStyle this.fontStyle,
double this.letterSpacing,
double this.wordSpacing,
TextBaseline this.textBaseline,
double this.height,
Locale this.locale,
Paint this.foreground,
Paint this.background,
List this.shadows,
TextDecoration this.decoration,
Color this.decorationColor,
TextDecorationStyle this.decorationStyle,
String this.debugLabel,
String String fontFamily,
//---->[TextAlign]----------------
enum TextAlign {
left,right,center,justify,start,end,
}
//---->[TextOverflow]----------------
enum TextOverflow {
clip,fade,ellipsis,
}
FloatingActionButton--浮动动作按钮
Widget this.child,
String this.tooltip,
Color this.foregroundColor,
Color this.backgroundColor,
Object this.heroTag = const _DefaultHeroTag(),
double this.elevation = 6.0,
double this.highlightElevation = 12.0,
VoidCallback @required this.onPressed,
bool this.mini = false,
ShapeBorder this.shape = const CircleBorder(),
Clip this.clipBehavior = Clip.none,
MaterialTapTargetSize this.materialTapTargetSize,
bool this.isExtended = false,
Icon--图标
double this.size,
Color this.color,
String this.semanticLabel,------This label does not show in the UI.
TextDirection this.textDirection,
Row --行
A widget that displays its children in a horizontal array.
一个以水平数组的形式显示其子部件的Widget。
Row({
Key key,
MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
MainAxisSize mainAxisSize = MainAxisSize.max,
CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center,
TextDirection textDirection,
VerticalDirection verticalDirection = VerticalDirection.down,
TextBaseline textBaseline,
List children = const [],
Column--列
A widget that displays its children in a vertical array.
一个以竖直数组的形式显示其子部件的Widget。
Column({
Key key,
MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
MainAxisSize mainAxisSize = MainAxisSize.max,
CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center,
TextDirection textDirection,
VerticalDirection verticalDirection = VerticalDirection.down,
TextBaseline textBaseline,
List children = const [],
Container--容器
A convenience widget that combines common painting, positioning, and sizing widgets.
一个方便的widget,它组合了常见的painting、positioning和sizing 控件。
Color color,
double width,
double height,
Widget this.child,
EdgeInsetsGeometry this.margin,
EdgeInsetsGeometry this.padding,
AlignmentGeometry this.alignment,
Decoration Decoration decoration,
Decoration this.foregroundDecoration,
BoxConstraints BoxConstraints constraints,
Matrix4 this.transform,
Stack -- 堆叠
A widget that positions its children relative to the edges of its box.
一个相对于它的框的边缘来定位它的子部件的Widget。
this.alignment = AlignmentDirectional.topStart,
this.textDirection,
this.fit = StackFit.loose,
this.overflow = Overflow.clip,
List children = const [],
IndexedStack--定索引显示
Transform--变换
Offstage--显隐控制
Table--表格
this.children = const [],
this.columnWidths,
this.defaultColumnWidth = const FlexColumnWidth(1.0),
this.textDirection,
this.border,
this.defaultVerticalAlignment = TableCellVerticalAlignment.top,
this.textBaseline,
Flow--流动容器
FlowDelegate @required this.delegate,
List children = const [],
Warp--包裹
Wrap({
Key key,
this.direction = Axis.horizontal,
this.alignment = WrapAlignment.start,
this.spacing = 0.0,
this.runAlignment = WrapAlignment.start,
this.runSpacing = 0.0,
this.crossAxisAlignment = WrapCrossAlignment.start,
this.textDirection,
this.verticalDirection = VerticalDirection.down,
List children = const [],
})
ListView
ListView.builder({
Key key,
Axis scrollDirection = Axis.vertical,
bool reverse = false,
ScrollController controller,
bool primary,
ScrollPhysics physics,
bool shrinkWrap = false,
EdgeInsetsGeometry padding,
this.itemExtent,
@required IndexedWidgetBuilder itemBuilder,
int itemCount,
bool addAutomaticKeepAlives = true,
bool addRepaintBoundaries = true,
bool addSemanticIndexes = true,
double cacheExtent,
int semanticChildCount,
GridView
GridView.count({
Key key,
Axis scrollDirection = Axis.vertical,
bool reverse = false,
ScrollController controller,
bool primary,
ScrollPhysics physics,
bool shrinkWrap = false,
EdgeInsetsGeometry padding,
@required int crossAxisCount,
double mainAxisSpacing = 0.0,
double crossAxisSpacing = 0.0,
double childAspectRatio = 1.0,
bool addAutomaticKeepAlives = true,
bool addRepaintBoundaries = true,
bool addSemanticIndexes = true,
double cacheExtent,
List children = const [],
int semanticChildCount,
ListBody
A widget that arranges its children sequentially along a given axis,
forcing them to the dimension of the parent in the other axis.
一个widget,它按照给定的轴顺序排列它的子部件,并迫使它们位于另一个轴上的父轴的维度。
ListBody({
Key key,
this.mainAxis = Axis.vertical,
this.reverse = false,
List children = const [],
Baseline
const Baseline({
Key key,
@required this.baseline,
@required this.baselineType,
Widget child
FractionallySizedBox
const FractionallySizedBox({
Key key,
this.alignment = Alignment.center,
this.widthFactor,
this.heightFactor,
Widget child,
AspectRatio--设定一个定比例的容器
const AspectRatio({
Key key,
@required this.aspectRatio,
Widget child
const Image({
Key key,
ImageProvider @required this.image,----图片提供器
double this.width,----宽
double this.height,----高
Color this.color,----颜色
BoxFit this.fit,----适应模式
colorBlendMode this.colorBlendMode,----颜色混合模式
AlignmentGeometry this.alignment = Alignment.center,----对齐模式
ImageRepeat this.repeat = ImageRepeat.noRepeat,----重复模式
String this.semanticLabel,----语义标签
bool this.excludeFromSemantics = false,----是否从语义中排除该图像
Rect this.centerSlice,----.图的中心区域切片
bool this.matchTextDirection = false,----是否匹配文字分析
bool this.gaplessPlayback = false,----图片提供器改变
FilterQuality this.filterQuality = FilterQuality.low,---过滤器品质
颜色混合模式--colorBlendMode
var colorBlendMode = [
BlendMode.clear,BlendMode.src,BlendMode.dst,
BlendMode.srcOver,BlendMode.dstOver,BlendMode.srcIn,
BlendMode.dstIn,BlendMode.srcOut,BlendMode.dstOut,
BlendMode.srcATop,BlendMode.dstATop,BlendMode.xor,
BlendMode.plus, BlendMode.modulate,BlendMode.screen,
BlendMode.overlay,BlendMode.darken,BlendMode.lighten,
BlendMode.colorDodge,BlendMode.colorBurn,BlendMode.hardLight,
BlendMode.softLight,BlendMode.difference,BlendMode.exclusion,
BlendMode.multiply,BlendMode.hue,BlendMode.saturation,
BlendMode.color, BlendMode.luminosity,
];
使用Image的方法加载图片
资源:Image.asset(String name,
文件:Image.file(File file,
网络:Image.network(String src,
内存:Image.memory(Uint8List bytes,
IconButton
const IconButton({
double this.iconSize = 24.0,
EdgeInsetsGeometry this.padding = const EdgeInsets.all(8.0),
AlignmentGeometry this.alignment = Alignment.center,
Widget @required this.icon,
Color this.color,
Color this.highlightColor, //点击时间稍长的时候背景渐变到这个颜色
Color this.splashColor,//点击时一闪而过的颜色
Color this.disabledColor,
VoidCallback @required this.onPressed,
String this.tooltip
MaterialButton
const MaterialButton({
@required this.onPressed,----点击事件----VoidCallback
this.onHighlightChanged,
this.textTheme,----按钮文字主题----ButtonTextTheme
this.textColor,----文字颜色----Color
this.disabledTextColor,----不可用时文字颜色----Color
this.color,----背景颜色----Color
this.disabledColor,----
this.highlightColor,----
this.splashColor,----
this.colorBrightness,
this.elevation,-----阴影高----
this.highlightElevation,
this.disabledElevation,
this.padding,-----内边距----
this.shape,-----形状----
this.clipBehavior = Clip.none,
this.materialTapTargetSize,
this.animationDuration,
this.minWidth,
this.height,
this.child,