Macdonald
Macdonald

Reputation: 964

How to make a horizontal bar in flutter

enter image description here

I am trying to create a horizontal bar that grows in colour strength given the numbers supplied to it in a flutter app. Does anyone have an idea?

Upvotes: 1

Views: 1231

Answers (2)

Ahmadreza Shamimi
Ahmadreza Shamimi

Reputation: 73

Also you can use stack(). First make bar then on the top put Text() or what ever you want

Upvotes: 0

Md. Yeasin Sheikh
Md. Yeasin Sheikh

Reputation: 63559

You can use row with Expanded and Text

 Row(
  mainAxisAlignment: MainAxisAlignment.spaceBetween,
  children: [
    Expanded(
      child: Padding(
        padding: const EdgeInsets.all(8.0),
        child: SizedBox(
          height: 10,
          child: LinearProgressIndicator(
            value: 200 / 425, //current / max

            backgroundColor: Colors.blue.shade100,
            color: Colors.blue,
          ),
        ),
      ),
    ),
    Text("value")
  ],
),

Upvotes: 5

Related Questions