How to use Flutter Positioned Widget – Example Code



Flutter use Positioned widget to position a child relative to the top, right, bottom, or left edge of a Stack container. Here is an example of positioned widget:

Stack(
  children: [
    Positioned(
      left: 10,
      top: 10,
      child: Text("I am positioned"),
    ),
  ],
)

n this example, the Text widget with the message “I am positioned” will be positioned 10 pixels from the top and 10 pixels from the left edge of the Stack container.

You can also use the right and bottom properties to position a child relative to the right and bottom edges of the container.

Stack(
  children: [
    Positioned(
      right: 10,
      bottom: 10,
      child: Text("I am positioned"),
    ),
  ],
)

Learn more Flutter widget:

  1. How to use flutter pdf viewer
  2. How to use flutter scroll text
  3. Flutter Notification Widget Example

Leave a Comment