FButton class
FButton 提供了一个常用按钮效果的实现集合。支持配置圆角、各种特效、边角、边框以及 Loading等。 FButton 让开发者可以只熟悉一个按钮组件,就能实现常见的按钮。而无需掌握多种不同类型的按钮组件。
FButton provides a collection of commonly used button effects. Support for configuring rounded corners, various special effects, corners, borders, and loading. FButton allows developers to familiarize themselves with just one button component and implement common buttons. No need to master many different types of button components.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- FButton
Constructors
-
FButton({Key? key, VoidCallback? onPressed, String? text, Color color = Colors.transparent, Color? disabledColor, Color? hoverColor, required Color highlightColor, EdgeInsetsGeometry? padding, double? width, double? height, FCorner? corner, FCornerStyle cornerStyle = FCornerStyle.round, Color? strokeColor, double? strokeWidth, Color? shadowColor, Offset? shadowOffset, double shadowBlur = 0.0, Gradient? gradient, Widget? image, double imageMargin = 6.0, ImageAlignment imageAlignment = ImageAlignment.left, bool loading = false, Color? loadingColor, double loadingStrokeWidth = 4.0, bool clickLoading = false, bool hideTextOnLoading = false, String? loadingText, double loadingSize = 12, bool clickEffect = false, TextStyle? style, TextStyle? disableStyle, Alignment? alignment, Color activeMaskColor = Colors.transparent, FSurface surfaceStyle = FSurface.Flat, ValueChanged<
bool> ? onHover, VoidCallback? onPressedDown, VoidCallback? onPressedUp, VoidCallback? onPressedCancel, bool isSupportNeumorphism = false, Color? highlightShadowColor, Widget? loadingWidget, FLightOrientation lightOrientation = FLightOrientation.LeftTop})
Properties
- activeMaskColor → Color
-
按压按钮时的蒙层颜色。调整颜色值的 alpha,以确保背后的视图能够展示。
final
- alignment → Alignment?
-
文本在组件中的相对位置。Alignment
final
- clickEffect → bool
-
是否开启基于阴影的点击特效。
final
- clickLoading → bool
-
是否启用点击进入 Loading 状态的模式
final
- color → Color
-
按钮的颜色
final
- corner → FCorner?
-
为组件设置边角。
final
- cornerStyle → FCornerStyle
-
设置边角风格,默认
FCornerStyle.round
final - disabledColor → Color?
-
按钮不可用颜色
final
- disableStyle → TextStyle?
-
禁用按钮文本样式
final
- gradient → Gradient?
-
设置组件渐变色背景。会覆盖 color 配置
你可选择 LinearGradient,RadialGradient,SweepGradient 等..
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
高度。
final
- hideTextOnLoading → bool
-
Loading 状态下是否隐藏文本
final
- highlightColor → Color
-
按压按钮时的按钮颜色。
final
- highlightShadowColor → Color?
-
开启 Neumorphism 风格后的,亮部阴影颜色
final
- hoverColor → Color?
-
鼠标进入按钮范围时,按钮的颜色。
final
- image → Widget?
-
设置图标
final
- imageAlignment → ImageAlignment
-
设置图标与文本的相对位置。详见 ImageAlignment
final
- imageMargin → double
-
设置图标与文本的间距
final
- isSupportNeumorphism → bool
-
是否支持 Neumorphism 风格。开启该项 highlightColor 将会失效
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- lightOrientation → FLightOrientation
-
当 isSupportNeumorphism 为 true 时有效。光源方向,分为左上、左下、右上、右下四个方向。用来控制光源照射方向,会影响高亮方向和阴影方向
final
- loading → bool
-
是否启动 Loading 状态。Loading 状态会覆盖 image 配置
final
- loadingColor → Color?
-
Loading 的颜色
final
- loadingSize → double
-
Loading 的大小
final
- loadingStrokeWidth → double
-
Loading 的宽度
final
- loadingText → String?
-
Loading 状态下展示的文本
final
- loadingWidget → Widget?
-
loading 状态时的 Loading 小部件。会覆盖默认的 Loading 效果
final
-
onHover
→ ValueChanged<
bool> ? -
鼠标进入/退出组件范围时会回调
final
- onPressed → VoidCallback?
-
当按下按钮时,会触发该函数。如果未设置该函数,按钮将进入不可用状态。
final
- onPressedCancel → VoidCallback?
-
按下取消时会回调
final
- onPressedDown → VoidCallback?
-
按下时会回调
final
- onPressedUp → VoidCallback?
-
抬起时会回调
final
- padding → EdgeInsetsGeometry?
-
内间距。
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shadowBlur → double
-
设置组件高斯与阴影形状卷积的标准偏差。
final
- shadowColor → Color?
-
设置组件阴影颜色
final
- shadowOffset → Offset?
-
设置组件阴影偏移
final
- strokeColor → Color?
-
设置边框颜色。
final
- strokeWidth → double?
-
设置边框宽
final
- style → TextStyle?
-
按钮文本样式
final
- surfaceStyle → FSurface
-
表面的风格。默认
FSurface.Flat
。详见FSurface
final - text → String?
-
按钮上的文字。
final
- width → double?
-
宽度。
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< StatefulWidget> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited