> For the complete documentation index, see [llms.txt](https://flutteropen.gitbook.io/flutter-widgets/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://flutteropen.gitbook.io/flutter-widgets/flutter-open-flutter-widgets-10-flutter-placeholder.md).

# Widgets 10 | Placeholder

In this tutorial, you will learn how to use the Placeholder in the flutter.

## Before Start

This widget is simple, but we also need a page to contain our page, so we should create a page first.

```dart
import "package:flutter/material.dart";
import 'package:flutter_widgets/const/_const.dart';

class PlaceHolderPage extends StatefulWidget {
  @override
  _PlaceHolderState createState() => _PlaceHolderState();
}

class _PlaceHolderState extends State<PlaceHolderPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(PageName.PLACE_HOLDER),
      ),
      body: SingleChildScrollView(
        child: Column(
          children: <Widget>[
            //our code here.
            SizedBox(height: 600)
          ],
        ),
      ),
    );
  }
}
```

It will show nothing, but with a title.

![](https://3262132263-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LW5X4rCYpodwj4P1c8s%2F-LWqfzUTFvGCFXY5v0zd%2F-LWqi4JWFqsHIzN5bbjn%2Fplaceholder.png?alt=media\&token=32d05bc5-7fa0-42f6-8b6a-61de9c148bf9)

## Simple Use&#x20;

So what about the Placeholder, it is a widget to note there have some widget need to implement. So its intention is as its name, hold the place to notice people comply it again in the future. It is so simple. Let's look at the codes.

```dart
   Container(
              height: 100,
              child: Placeholder(),
            ),
```

It will show like this.

![](https://3262132263-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LW5X4rCYpodwj4P1c8s%2F-LWqfzUTFvGCFXY5v0zd%2F-LWqjoQ0ggMRGMet1DIm%2Fplaceholder_02.png?alt=media\&token=070104ce-b0a7-4352-a19d-55fd5174227d)

## Constructor

As I often say, if you want to use a widget, you should look at its constructor first. As follows.

```dart
const Placeholder({
    Key key,
    this.color = const Color(0xFF455A64), // Blue Grey 700
    this.strokeWidth = 2.0,
    this.fallbackWidth = 400.0,
    this.fallbackHeight = 400.0,
  })
```

The parameter is so simple, we have learned the types before. Just look at its parameters one by one.

## color

This parameter will set the color of the line in the Placeholder. Let's look at an example as below.

```dart
           SizedBox(height: 10),
            Container(
              height: 100,
              child: Placeholder(color: RED),
            ),
```

![](https://3262132263-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LW5X4rCYpodwj4P1c8s%2F-LWqfzUTFvGCFXY5v0zd%2F-LWql8oCfNLeTMZAOBv3%2Fplaceholder_03.png?alt=media\&token=27ed86a3-e453-4a8a-a952-9c6435f4003d)

## strokeWidth

This parameter will control the width of the line in the Placeholder. The Example is below.

```dart
            SizedBox(height: 20),
            Container(
              height: 100,
              child: Placeholder(
                color: GREEN,
                strokeWidth: 20,
              ),
            ),
```

It will show like this.

![](https://3262132263-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LW5X4rCYpodwj4P1c8s%2F-LWqfzUTFvGCFXY5v0zd%2F-LWqlud5RoPSBp3lT1Hw%2Fplaceholder_04.png?alt=media\&token=5bfe9d64-cd41-423a-9e50-d1dc06fe9685)

## fallbackWidth & fallbackHeight

These two parameters control the width, height of the Placeholder. If you want to set Placeholder with `width =100, height = 100` and just set the fallbackWidth=100,fallbackHeight = 100, it may be not fit your requirement. So you should use with the Container. Let's look at the code as follows.

```dart
         SizedBox(height: 20),
            Placeholder(
              color: RED,
              strokeWidth: 4,
              fallbackWidth: 100,
              fallbackHeight: 100,
            ),
            SizedBox(height: 20),
            Container(
              constraints: BoxConstraints.expand(height: 100, width: 100),
              child: Placeholder(
                color: BLUE_DEEP,
                strokeWidth: 4,
                fallbackWidth: 10,
                fallbackHeight: 100,
              ),
            ),
```

It will show as follows, the second fit your requirements, but the first one doesn't. You should care about that.

![](https://3262132263-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LW5X4rCYpodwj4P1c8s%2F-LWqfzUTFvGCFXY5v0zd%2F-LWqpcrh7VxfQyX3ArGk%2Fplaceholder_05.png?alt=media\&token=d36070d7-aa0d-42ca-a5e0-e33b44067bd3)

## Conclusion

We have learned the simple widget, but I also suggest you code them by yourself.Only code enough, you can easy to use them.

Thanks for your reading!

The end.

#### Whole code in [GitHub](https://github.com/FlutterOpen/flutter-widgets-examples),star to support. <a href="#whole-code-in-github-star-to-support" id="whole-code-in-github-star-to-support"></a>

| Facebook Page                                         | Twitter                                 | GitHub                             | Medium                                        |
| ----------------------------------------------------- | --------------------------------------- | ---------------------------------- | --------------------------------------------- |
| [Flutter Open ](https://www.facebook.com/flutteropen) | [NieBin](https://twitter.com/niebin_gg) | [NieBin](https://github.com/nb312) | [FlutterOpen](https://medium.com/flutteropen) |
