Learn how to use barcode and generate barcode in Flutter.
Container(
decoration: BoxDecoration(
color:Colors.white,
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(21),
bottomLeft: Radius.circular(21)
)
),
margin: EdgeInsets.only(left: 15, right: 15),
padding: EdgeInsets.only(top:20, bottom: 20),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 15),
child: ClipRRect(
borderRadius:BorderRadius.circular(15),
child: BarcodeWidget(
barcode: Barcode.code128(),
data: 'https://dbestech.com',
drawText: false,
color: Styles.textColor,
width: double.infinity,
height: 70,
),
),
),
You can use it anywhere inside your stateful or stateless class. Use it inside the body or a container.
The work is done using BarcodeWidget(), and it takes some properties. It’s a plugin which you can download from pub.dev
barcode_widget: ^2.0.2
The complete app could be found here