SwishButton class
A Material Design "Swish button"
When adding Swish widgets to the UI, special care should be taken to
the official Swish design guide.
The SwishButton
already follows the official style guide provided
by Swish and should not be styled further! If necessary, the design
can be overridden with its style parameter.
Swish elevated button
Use Swish elevated buttons to add dimension to otherwise mostly flat layouts, e.g. in long busy lists of content, or in wide spaces. Avoid using Swish elevated buttons on already-elevated content such as dialogs or cards.
Swish text button
Use Swish text buttons on toolbars, in dialogs, or inline with other content but offset from that content with padding so that the button's presence is obvious. Swish text buttons do not have visible borders and must therefore rely on their position relative to other content for context. In dialogs and cards, they should be grouped together in one of the bottom corners. Avoid using Swish text buttons where they would blend in with other content, for example in the middle of lists.
General information
If onPressed callback is null, then the button will be disabled.
This sample produces a SwishButton.secondaryElevatedButton
and a
SwishButton.secondaryTextButton
.
@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
SwishButton.secondaryElevatedButton(
onPressed: () {},
),
SwishButton.secondaryTextButton(
onPressed: () {},
),
],
),
);
}
See also:
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- SwishButton
Constructors
- SwishButton.primaryElevatedButton({Key? key, required VoidCallback? onPressed, ButtonStyle? style})
-
Create an elevated button with the primary logo of Swish.
const
- SwishButton.primaryTextButton({Key? key, required VoidCallback? onPressed, ButtonStyle? style})
-
Create an text button with the primary logo of Swish.
const
- SwishButton.secondaryElevatedButton({Key? key, required VoidCallback? onPressed, ButtonStyle? style})
-
Create an elevated button with the secondary logo of Swish.
const
- SwishButton.secondaryTextButton({Key? key, required VoidCallback? onPressed, ButtonStyle? style})
-
Create an text button with the secondary logo of Swish.
const
Properties
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- logo → _LogoType
-
final
- onPressed → VoidCallback?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → ButtonStyle?
-
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