JunnySectionHeader class
Junny区块标题组件
用于显示区块标题,支持自定义标题装饰和右侧延伸线条
特性
- 支持文本或Widget标题
- 可自定义标题容器装饰(背景、圆角、边框等)
- 可自定义右侧延伸线条样式
- 使用Stack布局避免圆角标题与线条的断联问题
- 默认使用主题色,保持视觉统一
使用示例
// 基础用法
JunnySectionHeader(title: '填写人信息')
// 自定义装饰
JunnySectionHeader(
title: '填写人信息',
titleDecoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(8),
),
dividerColor: Colors.grey,
)
// 渐变分割线
JunnySectionHeader(
title: '渐变效果',
dividerDecoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.transparent],
),
),
)
// Widget标题
JunnySectionHeader(
title: Row(
children: [
Icon(Icons.person),
Text('用户信息'),
],
),
)
// 自定义分割线起始位置(适配圆角装饰)
JunnySectionHeader(
title: '圆角标题',
titleDecoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(12),
),
dividerStartOffset: 50.0, // 从指定位置开始,避免圆角露出
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- JunnySectionHeader
- Available extensions
Constructors
- JunnySectionHeader({Key? key, required dynamic title, Decoration? titleDecoration, EdgeInsets titlePadding = const EdgeInsets.symmetric(horizontal: 16, vertical: 8), TextStyle? titleTextStyle, double? height, bool showDivider = true, Color? dividerColor, Decoration? dividerDecoration, double dividerHeight = 1.0, double? dividerStartOffset, EdgeInsets margin = const EdgeInsets.only(top: 8), double? width, JunnySectionHeaderTitlePosition titlePosition = JunnySectionHeaderTitlePosition.left, Offset titleOffset = Offset.zero})
-
const
Properties
- dividerColor → Color?
-
分割线颜色
final
- dividerDecoration → Decoration?
-
分割线装饰
final
- dividerHeight → double
-
分割线高度
final
- dividerStartOffset → double?
-
分割线起始偏移量
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
组件高度
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- margin → EdgeInsets
-
外边距
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showDivider → bool
-
是否显示右侧分割线
final
- title → dynamic
-
标题内容,支持String或Widget
final
- titleDecoration → Decoration?
-
标题容器装饰
final
- titleOffset → Offset
-
标题偏移量
final
- titlePadding → EdgeInsets
-
标题内边距
final
- titlePosition → JunnySectionHeaderTitlePosition
-
标题位置
final
- titleTextStyle → TextStyle?
-
标题文本样式
final
- width → double?
-
组件宽度
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
buildPageRoute<
T> ({RouteSettings? settings, bool maintainState = true, bool fullscreenDialog = false, bool opaque = true}) → PageRoute< T> -
Available on Widget, provided by the JunnyWidgetExtension extension
构建PageRoute -
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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, int wrapWidth = 65}) → 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