WidgetConversionExt extension

Widget 转换扩展

on

Methods

asAlign({AlignmentGeometry alignment = Alignment.center, double? widthFactor, double? heightFactor}) Align

Available on Widget, provided by the WidgetConversionExt extension

转换为 Align,对齐布局
asCard({Color? color, double? elevation, ShapeBorder? shape, bool borderOnForeground = true, EdgeInsetsGeometry? margin, Clip? clipBehavior}) Card

Available on Widget, provided by the WidgetConversionExt extension

转换为 Card,卡片布局
asCenter({double? widthFactor, double? heightFactor}) Center

Available on Widget, provided by the WidgetConversionExt extension

转换为 Center,居中布局
asClipRRect({BorderRadius? borderRadius, Clip clipBehavior = Clip.antiAlias}) ClipRRect

Available on Widget, provided by the WidgetConversionExt extension

转换为 ClipRRect,圆角裁剪
asColumn({MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start, CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center, MainAxisSize mainAxisSize = MainAxisSize.min, TextDirection? textDirection, VerticalDirection verticalDirection = VerticalDirection.down, TextBaseline? textBaseline}) Column

Available on Widget, provided by the WidgetConversionExt extension

将单个Widget转换为Column(包装在列表中)
asExpanded({int flex = 1}) Expanded

Available on Widget, provided by the WidgetConversionExt extension

转换为 Expanded,Flex 扩展
asFlexible({int flex = 1, FlexFit fit = FlexFit.loose}) Flexible

Available on Widget, provided by the WidgetConversionExt extension

转换为 Flexible,Flex 弹性
asGestureDetector({GestureTapCallback? onTap, GestureTapCallback? onDoubleTap, GestureLongPressCallback? onLongPress, void onPanUpdate(DragUpdateDetails)?, HitTestBehavior? behavior}) GestureDetector

Available on Widget, provided by the WidgetConversionExt extension

转换为 GestureDetector,手势检测
asHero({required Object tag, CreateRectTween? createRectTween, HeroFlightShuttleBuilder? flightShuttleBuilder, HeroPlaceholderBuilder? placeholderBuilder, bool transitionOnUserGestures = false}) Hero

Available on Widget, provided by the WidgetConversionExt extension

转换为 Hero,英雄动画
asInkWell({GestureTapCallback? onTap, GestureTapCallback? onDoubleTap, GestureLongPressCallback? onLongPress, Color? splashColor, Color? highlightColor, BorderRadius? borderRadius}) InkWell

Available on Widget, provided by the WidgetConversionExt extension

转换为 InkWell,墨水井效果
asLegacyContainer({AlignmentGeometry? alignment, EdgeInsetsGeometry? padding, Color? color, Decoration? decoration, Decoration? foregroundDecoration, double? width, double? height, BoxConstraints? constraints, EdgeInsetsGeometry? margin, Matrix4? transform, AlignmentGeometry? transformAlignment, Clip clipBehavior = Clip.none}) Container

Available on Widget, provided by the WidgetConversionExt extension

转换为 Container,最基础的容器转换 @deprecated 使用新的建造者模式 asContainer() 替代 旧版本的 asContainer 方法,已弃用
asPadding(EdgeInsetsGeometry padding) Padding

Available on Widget, provided by the WidgetConversionExt extension

转换为 Padding,内边距
asPositioned({double? left, double? top, double? right, double? bottom, double? width, double? height}) Positioned

Available on Widget, provided by the WidgetConversionExt extension

转换为 Positioned,Stack 定位
asRow({MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start, CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center, MainAxisSize mainAxisSize = MainAxisSize.min, TextDirection? textDirection, VerticalDirection verticalDirection = VerticalDirection.down, TextBaseline? textBaseline}) Row

Available on Widget, provided by the WidgetConversionExt extension

将单个Widget转换为Row(包装在列表中)
asScrollable({Axis scrollDirection = Axis.vertical, EdgeInsetsGeometry? padding}) SingleChildScrollView

Available on Widget, provided by the WidgetConversionExt extension

转换为 ScrollView,更简洁的调用
asScrollView({Axis scrollDirection = Axis.vertical, bool reverse = false, EdgeInsetsGeometry? padding, bool? primary, ScrollPhysics? physics, ScrollController? controller}) SingleChildScrollView

Available on Widget, provided by the WidgetConversionExt extension

转换为 SingleChildScrollView,支持滚动
asSizedBox({double? width, double? height}) SizedBox

Available on Widget, provided by the WidgetConversionExt extension

转换为 SizedBox,固定尺寸盒子
bg(Color color) Container

Available on Widget, provided by the WidgetConversionExt extension

设置背景色 - 简化调用
boxDecoration({Color? color, DecorationImage? image, Border? border, BorderRadius? borderRadius, List<BoxShadow>? boxShadow, Gradient? gradient, BlendMode? backgroundBlendMode, BoxShape shape = BoxShape.rectangle}) Container

Available on Widget, provided by the WidgetConversionExt extension

设置复杂的 BoxDecoration,支持链式调用
conditionalBorderRadius({bool topLeft = false, bool topRight = false, bool bottomLeft = false, bool bottomRight = false, double radius = 12.0}) Container

Available on Widget, provided by the WidgetConversionExt extension

条件圆角 - 可控制每个角
smartBorderRadius({required bool isFirst, required bool isLast, double radius = 12.0, Axis direction = Axis.vertical}) Container

Available on Widget, provided by the WidgetConversionExt extension

动态圆角 - 根据位置智能设置