Home > Software design >  How to have Label text with graphics over image(product image of e commerce app) in flutter?
How to have Label text with graphics over image(product image of e commerce app) in flutter?

Time:03-28

I am trying to get a text label with graphics over the image. Labels like new arrival, best seller, limited, on sale just like on the pic attached. enter image description here

in this image ,i mentioned 0 and one .

for all 1

solution 1

you can use image like this way

            Stack(
              children: [
                Container(
                  width: 200,
                  height: 200,
                  color: Colors.amber,// added only for view this example 
                  child:Image() // add Product image here
                ),
                Positioned(
                    top: 20, //change  according to your use case position
                    left: 0,// change  according to your use case position
                    child: Container(
                    color: Colors.black, // added only for view this example 
                      decoration: BoxDecoration(image: ),// add label image here
                      width: 100,
                      height: 50,
                      child: Row(
                        children: [Text('hi')],
                      ),
                    ))
              ],
            )

solution 2

you can use custom paint for label layout

not that

in both solution you have to use stack and position widgets , you can control position according to your use case

for all 0

you can use RotationTransition widgets to achieve this

enter image description here

not that

you have to use stack and position widgets , you can control position according to your use case

for the vertical Text

use this example

String exText = "meta";

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('hi'),
      ),
      body: Container(
        width: 200,
        height: 200,
        color: Colors.amber,
        child: Column(
            children: exText.characters
                .map((e) => Container(
                      child: Text('$e'),
                    ))
                .toList()),
      ),


out put will be

enter image description here

  • Related