Skip to content

FLUT-965289 - [Feature] Updated ug pages for barcode widget #1272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Flutter/barcode/accessibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ documentation: ug

## Sufficient contrast

The `SfBarcodeGenerator` [theming](https://help.syncfusion.com/flutter/themes) support offers a consistent and standardized look, as well as the ability to customize colors for all UI elements.
The [`SfBarcodeGenerator`](https://pub.dev/documentation/syncfusion_flutter_barcodes/latest/barcodes/SfBarcodeGenerator-class.html) [theming](https://help.syncfusion.com/flutter/themes) support offers a consistent and standardized look, as well as the ability to customize colors for all UI elements.

You can customize colors for the following elements:
* [Bar color](https://help.syncfusion.com/flutter/barcode/barcode-customization)
* [Background color](https://help.syncfusion.com/flutter/barcode/barcode-customization)

## Large fonts

The `SfBarcodeGenerator` automatically adjusts font size based on device settings and scales according to the `MediaQueryData.textScaleFactor`. It also allows you to change the font size of all text elements in the barcode generator.
The [`SfBarcodeGenerator`](https://pub.dev/documentation/syncfusion_flutter_barcodes/latest/barcodes/SfBarcodeGenerator-class.html) automatically adjusts font size based on device settings and scales according to the [`MediaQueryData.textScaleFactor`](https://api.flutter.dev/flutter/widgets/MediaQueryData/textScaleFactor.html). It also allows you to change the font size of all text elements in the barcode generator.
* [Input value of barcode](https://help.syncfusion.com/flutter/barcode/barcode-customization#text-customization)
287 changes: 147 additions & 140 deletions Flutter/barcode/barcode-customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,19 @@ To display the input value of the barcode, enable its [`showValue`](https://pub.

{% highlight dart %}

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Container(
height: 150,
width: 300,
child: SfBarcodeGenerator(
value: '12634388927',
showValue: true)
)
)
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Container(
height: 150,
width: 300,
child: SfBarcodeGenerator(value: '12634388927', showValue: true),
),
),
);
}

{% endhighlight %}

Expand All @@ -44,24 +42,27 @@ The text style can be customized using the [`textStyle`](https://pub.dev/documen

{% highlight dart %}

@override
Widget build(BuildContext context) {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Container(
height: 150,
width: 300,
child: SfBarcodeGenerator(
value: '12634388927',

textStyle: TextStyle(fontFamily: 'Times',
fontSize: 16, fontStyle: FontStyle.italic,
fontWeight: FontWeight.bold,
color: Colors.red),
showValue: true)
)
)
backgroundColor: Colors.white,
body: Center(
child: Container(
height: 150,
width: 300,
child: SfBarcodeGenerator(
value: '12634388927',
textStyle: TextStyle(
fontFamily: 'Times',
fontSize: 16,
fontStyle: FontStyle.italic,
fontWeight: FontWeight.bold,
color: Colors.red,
),
showValue: true,
),
),
),
);
}

Expand All @@ -75,20 +76,21 @@ Control the space between the text and the barcode with the [`textSpacing`](http

{% highlight dart %}

@override
Widget build(BuildContext context) {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Container(
height: 150,
width: 300,
child: SfBarcodeGenerator(
value: '12634388927',
textSpacing: 25,
showValue: true)
)
)
backgroundColor: Colors.white,
body: Center(
child: Container(
height: 150,
width: 300,
child: SfBarcodeGenerator(
value: '12634388927',
textSpacing: 25,
showValue: true,
),
),
),
);
}

Expand All @@ -98,26 +100,27 @@ Control the space between the text and the barcode with the [`textSpacing`](http

**Horizontal text alignment**

The horizontal text alignment can be managed with the [`textAlign`](https://pub.dev/documentation/syncfusion_flutter_barcodes/latest/barcodes/SfBarcodeGenerator/textAlign.html) property of barcode generator. Position the displayed text at the `start`, `center` or `end` of the control. The default value of [`textAlign`](https://pub.dev/documentation/syncfusion_flutter_barcodes/latest/barcodes/SfBarcodeGenerator/textAlign.html) property is center.
The horizontal text alignment can be managed with the [`textAlign`](https://pub.dev/documentation/syncfusion_flutter_barcodes/latest/barcodes/SfBarcodeGenerator/textAlign.html) property of barcode generator. Position the displayed text at the [`start`](https://api.flutter.dev/flutter/dart-ui/TextAlign.html#start), [`center`](https://api.flutter.dev/flutter/dart-ui/TextAlign.html#center) or [`end`](https://api.flutter.dev/flutter/dart-ui/TextAlign.html#end) of the control. The default value of [`textAlign`](https://pub.dev/documentation/syncfusion_flutter_barcodes/latest/barcodes/SfBarcodeGenerator/textAlign.html) property is center.

{% highlight dart %}

@override
Widget build(BuildContext context) {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Container(
height: 150,
width: 240,
child: SfBarcodeGenerator(
value: '12634',
textAlign: TextAlign.end,
showValue: true)
)
)
);
}
backgroundColor: Colors.white,
body: Center(
child: Container(
height: 150,
width: 240,
child: SfBarcodeGenerator(
value: '12634',
textAlign: TextAlign.end,
showValue: true,
),
),
),
);
}

{% endhighlight %}

Expand All @@ -135,23 +138,24 @@ The following code snippet shows the one dimensional barcode with [`module`](htt

{% highlight dart %}

@override
Widget build(BuildContext context) {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Container(
height: 150,
width: 230,
child: SfBarcodeGenerator(
backgroundColor: Color.fromRGBO(193, 250, 250, 1),
value: '123456789',
showValue: true,
symbology: Codabar(module: 1)),
)
child: Container(
height: 150,
width: 230,
child: SfBarcodeGenerator(
backgroundColor: Color.fromRGBO(193, 250, 250, 1),
value: '123456789',
showValue: true,
symbology: Codabar(module: 1),
),
),
);
}
),
);
}

{% endhighlight %}

Expand All @@ -163,20 +167,21 @@ Below code snippet shows the one dimensional barcode without the [`module`](http

{% highlight dart %}

@override
Widget build(BuildContext context) {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Container(
height: 150,
width: 230,
child: SfBarcodeGenerator(
backgroundColor: Color.fromRGBO(193, 250, 250, 1),
value: '123456789',
showValue: true,
symbology: Codabar()),
)
child: Container(
height: 150,
width: 230,
child: SfBarcodeGenerator(
backgroundColor: Color.fromRGBO(193, 250, 250, 1),
value: '123456789',
showValue: true,
symbology: Codabar(),
),
),
),
);
}
Expand All @@ -191,22 +196,23 @@ The following code snippet shows the two dimensional barcode with [`module`](htt

{% highlight dart %}

@override
Widget build(BuildContext context) {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Container(
height: 150,
width: 230,
child: SfBarcodeGenerator(
backgroundColor: Color.fromRGBO(193, 250, 250, 1),
value: '123456789',
symbology: QRCode(module: 2),),
)
child: Container(
height: 150,
width: 230,
child: SfBarcodeGenerator(
backgroundColor: Color.fromRGBO(193, 250, 250, 1),
value: '123456789',
symbology: QRCode(module: 2),
),
),
);
}
),
);
}

{% endhighlight %}

Expand All @@ -216,22 +222,23 @@ The following code snippet shows the two dimensional barcode with [`module`](htt

{% highlight dart %}

@override
Widget build(BuildContext context) {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Container(
height: 150,
width: 230,
child: SfBarcodeGenerator(
backgroundColor: Color.fromRGBO(193, 250, 250, 1),
value: '123456789',
symbology: QRCode(),),
)
child: Container(
height: 150,
width: 230,
child: SfBarcodeGenerator(
backgroundColor: Color.fromRGBO(193, 250, 250, 1),
value: '123456789',
symbology: QRCode(),
),
),
);
}
),
);
}

{% endhighlight %}

Expand All @@ -243,22 +250,22 @@ Customize the barcode's bar color using the [`barColor`](https://pub.dev/documen

{% highlight dart %}

@override
Widget build(BuildContext context) {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Container(
height: 150,
width: 240,
child: SfBarcodeGenerator(
value: '12634',
barColor: Colors.deepPurple,
)
)
)
);
}
backgroundColor: Colors.white,
body: Center(
child: Container(
height: 150,
width: 240,
child: SfBarcodeGenerator(
value: '12634',
barColor: Colors.deepPurple,
),
),
),
);
}

{% endhighlight %}

Expand All @@ -270,24 +277,24 @@ You can customize the barcode's background color with the [`backgroundColor`](ht

{% highlight dart %}

@override
Widget build(BuildContext context) {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Container(
height: 150,
width: 230,
child: SfBarcodeGenerator(
backgroundColor: Color.fromRGBO(193, 250, 250, 1),
value: '123456789',
symbology: Codabar(),),
)
),
);
}

{% endhighlight %}
child: Container(
height: 150,
width: 230,
child: SfBarcodeGenerator(
backgroundColor: Color.fromRGBO(193, 250, 250, 1),
value: '123456789',
symbology: Codabar(),
),
),
),
);
}

![background color](images/text-customization/background-color.jpg)
{% endhighlight %}

![background color](images/text-customization/background-color.jpg)
Loading