Logo

K-Learn

Flutter OutlinedButton Widget

< Previous Next >

Flutter OutlinedButton widget is a basic button widget that provides an outlined border. It is similar to the TextButton, but with a border around it. It is useful when you want to give a less prominent appearance to a button as compared to the ElevatedButton.

Here's an example of how to use the OutlinedButton widget:

@override
  Widget build(BuildContext context) {
    return OutlinedButton(
      onPressed: () {
        debugPrint('Received click');
      },
      child: const Text('Click Me'),
    );
  }
}

Some common properties of the OutlinedButton widget:

onPressed: This is a required property that defines the action to be performed when the button is pressed.

child: This is a required property that defines the child widget of the button.

style: This property is used to define the style of the button. It can be used to set the text color, font size, button padding, and more. The OutlinedButton.styleFrom() method is used to create a style for the button. The side property of the styleFrom() method is used to set the border properties of the button.

autofocus: If set to true, the button will automatically get the focus when the page is loaded.

clipBehavior: This property is used to define how the button should clip its content. It can be set to Clip.none, Clip.hardEdge, or Clip.antiAlias.

focusNode: This property is used to specify the FocusNode of the button.

onLongPress: This property is used to define the action to be performed when the button is long-pressed.

style: This property is used to define the style of the button. It can be used to set the text color, font size, button padding, and more.

autofocus: If set to true, the button will automatically get the focus when the page is loaded.

clipBehavior: This property is used to define how the button should clip its content. It can be set to Clip.none, Clip.hardEdge, or Clip.antiAlias.

focusNode: This property is used to specify the FocusNode of the button.

onHighlightChanged: This property is used to define the action to be performed when the button's highlight changes.

textTheme: This property is used to set the text theme of the button.

textColor: This property is used to set the text color of the button.

icon: This property is used to set the icon of the button.

label: This property is used to set the label of the button.

focusColor: This property is used to set the color of the button when it is focused.

hoverColor: This property is used to set the color of the button when the mouse is hovering over it.

splashColor: This property is used to set the splash color of the button.

hoverElevation: This property is used to set the elevation of the button when the mouse is hovering over it.

highlightColor: This property is used to set the highlight color of the button.

shape: This property is used to set the shape of the button. It can be set to RoundedRectangleBorder, StadiumBorder, and more.

padding: This property is used to set the padding of the button.

borderSide: This property is used to set the width and color of the button's border.


< Previous Next >