BottomButtonPanel class

用于页面底部的组合按钮,由固定的一个主按钮(主题色按钮)、最多一个次按钮、数量不定的图标按钮组成。

布局规则: 主按钮 mainButtonName 必须存在 主按钮和次按钮的宽度大小是 不固定的,随着icon按钮的多少而变化

布局步骤(从左至右): 第一步:摆放icon按钮,如果iconButtonList为null,那么表示没有icon按钮。可用空间为 父节点分配。

第二步:摆放次按钮,如果[secondaryButtonName]为null,那么表示没有次按钮。可用空间为 父节点分配-icon按钮的空间
       如果没有icon按钮,那么可用空间为 父节点分的配空间

第三步:摆放主按钮,可用空间为 父节点分配空间分配完第一步和第二步的剩余空间

       如果只有一个主按钮,那么主按钮的宽度是 可用空间的最大宽度
       如果存在次按钮,那么两个按钮平分 可用的最大宽度
       如果存在次按钮和icon按钮,那么主按钮占满 剩余空间

组合按钮有一个白色的背景,并且存在一个右20, 左8, 底18, 上16的内边距,因此开发者不需要关注安全区域

  BrnBottomButtonPanel(
     mainButtonName: '主按钮',
     mainButtonOnTap: () {
         BrnToast.show('主按钮', context);
     },
  )

  BrnBottomButtonPanel(
     mainButtonName: '主按钮',
     secondaryButtonName: '次按钮',
     mainButtonOnTap: () {
         BrnToast.show('主按钮', context);
     },
     secondaryButtonOnTap: () {
         BrnToast.show('次按钮', context);
     },
     iconButtonList: [
         BrnVerticalIconButton(
            name: '写备注',
            iconWidget: Icon(Icons.add),
         ),
     ],
  )


相关按钮如下:

Inheritance

Constructors

BottomButtonPanel({Key? key, required String mainButtonName, required VoidCallback mainButtonOnTap, String? secondaryButtonName, VoidCallback? secondaryButtonOnTap, bool enableMainButton = true, bool enableSecondaryButton = true, List<VerticalIconButton>? iconButtonList})
const

Properties

enableMainButton bool
主按钮是否可用 默认可用 如果设置为false,按钮置灰且不响应mainButtonOnTap
final
enableSecondaryButton bool
次按钮是否可用 默认可用 如果设置为false,按钮置灰且不响应secondaryButtonName
final
hashCode int
The hash code for this object.
no setterinherited
iconButtonList List<VerticalIconButton>?
icon按钮的集合
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
mainButtonName String
主按钮的文案
final
mainButtonOnTap VoidCallback
主按钮点击的回调
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secondaryButtonName String?
次按钮的文案
final
secondaryButtonOnTap VoidCallback?
次按钮的点击回调
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
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}) 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

Static Methods

createByList(List<String> buttonTitleList, {VoidCallback? mainButtonOnTap, VoidCallback? secondaryButtonOnTap, bool enableMainButton = true, List<VerticalIconButton>? iconButtonList}) Widget
新增快捷的数组使用方式 注意事项:由于该只支持主按钮和次按钮,因此如果数组长度大于2,也只会取出来第一个和第二个显示 如果数组的长度是1,那么只显示主按钮 如果数组的长度是0,那么不显示 数组的第1个是 主按钮 数组的第2个是 次按钮 buttonTitleList 数组显示文案 mainButtonOnTap 主按钮的点击事件 secondaryButtonOnTap 次按钮的点击事件 iconButtonList icon按钮