StyledMessage

StyledMessage

StyledMessage is a convenient and visually appealing way to display informative or feedback messages to users in the Flood toolkit. It provides a simple and consistent approach to showing temporary messages, such as success notifications, warnings, or general information. StyledMessage can be easily displayed using the context.showStyledMessage() method, which takes an instance of StyledMessage as its argument.

StyledButton(
  labelText: 'Show Message',
  onPressed: () {
    context.showStyledMessage(StyledMessage(labelText: 'Hello World!'));
  },
),

In the above example, when the StyledButton is pressed, it triggers the onPressed callback. Inside the callback, context.showStyledMessage() is called with a StyledMessage instance. The labelText property of StyledMessage is set to 'Hello World!', which represents the content of the message to be displayed.

When context.showStyledMessage() is called, the Flood toolkit takes care of presenting the message to the user in a visually consistent and non-intrusive manner. The message typically appears at the bottom of the screen and automatically disappears after a certain duration.

StyledMessage Demonstration