PlatformDetectByName class
PlatformDetectByName Widget Documentation:
The PlatformDetectByName
widget allows you to conditionally render different widgets based on the platform name.
Example1:
PlatformDetectByName(
android: YourAndroidWidget("This widget will be shown on Android."),
webAndroid: YourWebAndroidWidget("This widget will be shown on Web for Android."),
iOS: YourIOSWidget("This widget will be shown on iOS."),
webIOS: YourWebIOSWidget("This widget will be shown on Web for iOS."),
macOs: YourMacOsWidget("This widget will be shown on macOS."),
webMacOs: YourWebMacOsWidget("This widget will be shown on Web for macOS."),
windows: YourWindowsWidget("This widget will be shown on Windows."),
webWindows: YourWebWindowsWidget("This widget will be shown on Web for Windows."),
linux: YourLinuxWidget("This widget will be shown on Linux."),
webLinux: YourWebLinuxWidget("This widget will be shown on Web for Linux."),
)
Example2:
PlatformDetectByName(
android: YourAndroidWidget("This widget will be shown on Android."),
)
Widget Overview:
- This widget is designed to simplify the process of displaying different content based on the platform name.
- It takes several optional parameters, each representing the widget to be displayed on a specific platform name.
Properties:
- android : The widget to be displayed on Android. If not provided, a
SizedBox
is used. - webAndroid : The widget to be displayed on Web for Android. If not provided, a
SizedBox
is used. - iOS : The widget to be displayed on iOS. If not provided, a
SizedBox
is used. - webIOS : The widget to be displayed on Web for iOS. If not provided, a
SizedBox
is used. - macOs : The widget to be displayed on macOS. If not provided, a
SizedBox
is used. - webMacOs : The widget to be displayed on Web for macOS. If not provided, a
SizedBox
is used. - windows : The widget to be displayed on Windows. If not provided, a
SizedBox
is used. - webWindows : The widget to be displayed on Web for Windows. If not provided, a
SizedBox
is used. - linux : The widget to be displayed on Linux. If not provided, a
SizedBox
is used. - webLinux : The widget to be displayed on Web for Linux. If not provided, a
SizedBox
is used.
This widget simplifies the process of handling platform-specific UI by allowing you to specify different widgets for each platform name. It's particularly useful when you want to provide a tailored user experience based on the user's device and platform.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- PlatformDetectByName
Constructors
- PlatformDetectByName.new({Key? key, Widget? android = const SizedBox(), Widget? webAndroid = const SizedBox(), Widget? iOS = const SizedBox(), Widget? webIOS = const SizedBox(), Widget? macOs = const SizedBox(), Widget? webMacOs = const SizedBox(), Widget? windows = const SizedBox(), Widget? webWindows = const SizedBox(), Widget? linux = const SizedBox(), Widget? webLinux = const SizedBox()})
-
const
Properties
- android → Widget?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- iOS → Widget?
-
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- linux → Widget?
-
final
- macOs → Widget?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- webAndroid → Widget?
-
final
- webIOS → Widget?
-
final
- webLinux → Widget?
-
final
- webMacOs → Widget?
-
final
- webWindows → Widget?
-
final
- windows → Widget?
-
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, 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