Home > database >  How to make a horizontal bar in flutter
How to make a horizontal bar in flutter

Time:08-25

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?

CodePudding user response:

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")
  ],
),

CodePudding user response:

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

  • Related