PlatformDetectMatchedType class
PlatformDetectMatchedType Widget Documentation:
The PlatformDetectMatchedType
widget conditionally renders different widgets based on a specific platform type.
Example1:
PlatformDetectMatchedType(
match: YourMatchedWidget("Displayed on the specified platform type."),
notMatch: YourNotMatchedWidget("Displayed on platforms other than the specified type."),
platformType: PlatformType.web,
)
Example2:
PlatformDetectMatchedType(
match: YourMatchedWidget("Displayed on the specified platform type."),
platformType: PlatformType.web,
)
Widget Overview:
- This widget simplifies the process of displaying different widgets based on a specified platform type.
- It takes three parameters (
match
,notMatch
, andplatformType
) representing the widgets to display on match, not match, and the specified platform type.
Properties:
- match : The widget displayed when the platform type matches the specified type.
- notMatch : The widget displayed when the platform type does not match the specified type. If not provided, a
SizedBox
is used. - platformType : The specific platform type to match against.
This widget streamlines handling platform-specific UI, allowing you to show different widgets based on a specific platform type. It's particularly useful for providing a custom user experience tailored to a particular platform.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- PlatformDetectMatchedType
Constructors
- PlatformDetectMatchedType({Key? key, required Widget match, Widget? notMatch = const SizedBox(), required PlatformType platformType})
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- match → Widget
-
final
- notMatch → Widget?
-
final
- platformType → PlatformType
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
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