Skip to content

Committed all the syncfusion flutter widget packages. #166

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

Merged
merged 2 commits into from
Mar 30, 2021
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 3 additions & 5 deletions packages/syncfusion_flutter_barcodes/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
![syncfusion_flutter_barcode_banner](https://cdn.syncfusion.com/content/images/FTControl/Flutter/Barcode%20Banner.png)

# Syncfusion Flutter Barcodes
# Flutter Barcodes library

The Syncfusion Flutter Barcode Generator is a data visualization widget used to generate and display data in a machine-readable format. It provides a perfect approach to encoding input values using supported symbology types.
Flutter Barcode Generator package is a data visualization widget used to generate and display data in a machine-readable format. It provides a perfect approach to encoding input values using supported symbology types.

**Disclaimer:** This is a commercial package. To use this package, you need to have either a Syncfusion commercial license or Syncfusion Community License. For more details, please check the [LICENSE](https://github.com/syncfusion/flutter-examples/blob/master/LICENSE) file.

**Note:** Our packages are now compatible with Flutter for Web. However, this will be in Beta until Flutter for Web becomes stable.
**Disclaimer:** This is a commercial package. To use this package, you need to have either a Syncfusion commercial license or [Free Syncfusion Community license](https://www.syncfusion.com/products/communitylicense). For more details, please check the [LICENSE](https://github.com/syncfusion/flutter-examples/blob/master/LICENSE) file.

## Table of contents
- [Barcode Generator feature](#barcode-generator-feature)
Expand Down
1 change: 1 addition & 0 deletions packages/syncfusion_flutter_barcodes/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ analyzer:
errors:
include_file_not_found: ignore
lines_longer_than_80_chars: ignore
avoid_as: false
4 changes: 2 additions & 2 deletions packages/syncfusion_flutter_barcodes/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ description: A new Flutter project.
version: 1.0.0+1

environment:
sdk: ">=2.1.0 <3.0.0"
sdk: ">=2.12.0 <3.0.0"

dependencies:
flutter:
Expand All @@ -24,7 +24,7 @@ dependencies:

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
cupertino_icons: ^1.0.2

dev_dependencies:
flutter_test:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ import '../one_dimensional/upca_symbology.dart';
import '../one_dimensional/upce_symbology.dart';

import '../renderers/one_dimensional/codabar_renderer.dart';

import '../renderers/one_dimensional/code128A_renderer.dart';
import '../renderers/one_dimensional/code128B_renderer.dart';
import '../renderers/one_dimensional/code128C_renderer.dart';
import '../renderers/one_dimensional/code128_renderer.dart';
import '../renderers/one_dimensional/code128a_renderer.dart';
import '../renderers/one_dimensional/code128b_renderer.dart';
import '../renderers/one_dimensional/code128c_renderer.dart';
import '../renderers/one_dimensional/code39_extended_renderer.dart';
import '../renderers/one_dimensional/code39_renderer.dart';
import '../renderers/one_dimensional/code93_renderer.dart';
Expand Down Expand Up @@ -87,9 +86,9 @@ class SfBarcodeGenerator extends StatefulWidget {
///
/// Default symbology is [Code128].
SfBarcodeGenerator(
{Key key,
@required this.value,
Symbology symbology,
{Key? key,
required this.value,
Symbology? symbology,
this.barColor,
this.backgroundColor,
this.showValue = false,
Expand All @@ -115,7 +114,7 @@ class SfBarcodeGenerator extends StatefulWidget {
/// child: SfBarcodeGenerator(value:'123456'));
///}
/// ```dart
final String value;
final String? value;

/// Define the barcode symbology that will be used to encode the input value
/// to the visual barcode representation.
Expand Down Expand Up @@ -160,7 +159,7 @@ class SfBarcodeGenerator extends StatefulWidget {
/// barColor : Colors.red));
///}
/// ```dart
final Color barColor;
final Color? barColor;

/// The background color to fill the background of the [SfBarcodeGenerator].
///
Expand All @@ -176,7 +175,7 @@ class SfBarcodeGenerator extends StatefulWidget {
/// backgroundColor : Colors.red));
///}
/// ```dart
final Color backgroundColor;
final Color? backgroundColor;

/// Whether to show a human readable text (input value) along with a barcode.
///
Expand Down Expand Up @@ -261,12 +260,12 @@ class SfBarcodeGenerator extends StatefulWidget {
/// Represents the barcode generator state
class _SfBarcodeGeneratorState extends State<SfBarcodeGenerator> {
/// Specifies the theme data
SfBarcodeThemeData _barcodeTheme;
late SfBarcodeThemeData _barcodeTheme;

/// Specifies the text size
Size _textSize;
Size? _textSize;

SymbologyRenderer _symbologyRenderer;
late SymbologyRenderer _symbologyRenderer;

@override
void didChangeDependencies() {
Expand Down Expand Up @@ -332,12 +331,12 @@ class _SfBarcodeGeneratorState extends State<SfBarcodeGenerator> {
if (widget.showValue && _textSize == null) {
_textSize = measureText(widget.value.toString(), widget.textStyle);
}
_symbologyRenderer.getIsValidateInput(widget.value);
_symbologyRenderer.getIsValidateInput(widget.value!);
_symbologyRenderer.textSize = _textSize;
return Container(
color: widget.backgroundColor ?? _barcodeTheme.backgroundColor,
child: SfBarcodeGeneratorRenderObjectWidget(
value: widget.value,
value: widget.value!,
symbology: widget.symbology,
foregroundColor: widget.barColor ?? _barcodeTheme.barColor,
showText: widget.showValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ abstract class Symbology {
/// symbology: UPCE(module: 2)));
///}
/// ```dart
final int module;
final int? module;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import '../renderers/one_dimensional/symbology_base_renderer.dart';
class SfBarcodeGeneratorRenderObjectWidget extends LeafRenderObjectWidget {
/// Creates the render object widget
const SfBarcodeGeneratorRenderObjectWidget(
{Key key,
{Key? key,
this.value,
this.symbology,
this.foregroundColor,
Expand All @@ -21,75 +21,75 @@ class SfBarcodeGeneratorRenderObjectWidget extends LeafRenderObjectWidget {
: super(key: key);

///Defines the value of the barcode to be rendered.
final String value;
final String? value;

///Define anyone of barcode symbology that will be used to
///convert input value into visual barcode representation
final Symbology symbology;
final Symbology? symbology;

/// Define the color for barcode elements.
final Color foregroundColor;
final Color? foregroundColor;

/// Specifies whether to show the value along with the barcode.
final bool showText;
final bool? showText;

/// Specifies the spacing between the text and the barcode.
final double textSpacing;
final double? textSpacing;

///Defines the text alignment for the text to be rendered in the barcode.
final TextStyle textStyle;
final TextStyle? textStyle;

/// Add style to customize the text.
final Size textSize;
final Size? textSize;

/// Specifies the spacing between the text and the barcode.
final TextAlign textAlign;
final TextAlign? textAlign;

/// Specifies the corresponding renderer class
final SymbologyRenderer symbologyRenderer;
final SymbologyRenderer? symbologyRenderer;

@override
RenderObject createRenderObject(BuildContext context) {
return _RenderBarcode(
value: value,
symbology: symbology,
foregroundColor: foregroundColor,
showText: showText,
textSpacing: textSpacing,
symbologyRenderer: symbologyRenderer,
textStyle: textStyle,
value: value!,
symbology: symbology!,
foregroundColor: foregroundColor!,
showText: showText!,
textSpacing: textSpacing!,
symbologyRenderer: symbologyRenderer!,
textStyle: textStyle!,
textSize: textSize,
textAlign: textAlign);
textAlign: textAlign!);
}

@override
void updateRenderObject(BuildContext context, _RenderBarcode renderObject) {
renderObject
..value = value
..symbology = symbology
..symbologyRenderer = symbologyRenderer
..foregroundColor = foregroundColor
..showText = showText
..textSpacing = textSpacing
..textStyle = textStyle
..value = value!
..symbology = symbology!
..symbologyRenderer = symbologyRenderer!
..foregroundColor = foregroundColor!
..showText = showText!
..textSpacing = textSpacing!
..textStyle = textStyle!
..textSize = textSize
..textAlign = textAlign;
..textAlign = textAlign!;
}
}

/// Represents the RenderBarcode class
class _RenderBarcode extends RenderBox {
/// Creates the RenderBarcode
_RenderBarcode(
{@required String value,
Symbology symbology,
SymbologyRenderer symbologyRenderer,
Color foregroundColor,
bool showText,
double textSpacing,
TextStyle textStyle,
Size textSize,
TextAlign textAlign})
{required String value,
required Symbology symbology,
required SymbologyRenderer symbologyRenderer,
required Color foregroundColor,
required bool showText,
required double textSpacing,
required TextStyle textStyle,
Size? textSize,
required TextAlign textAlign})
: _value = value,
_symbology = symbology,
_symbologyRenderer = symbologyRenderer,
Expand Down Expand Up @@ -120,7 +120,7 @@ class _RenderBarcode extends RenderBox {
TextStyle _textStyle;

/// Add style to customize the text.
Size _textSize;
Size? _textSize;

/// Specifies the spacing between the text and the barcode.
TextAlign _textAlign;
Expand All @@ -147,7 +147,7 @@ class _RenderBarcode extends RenderBox {
TextStyle get textStyle => _textStyle;

/// Returns the text size value
Size get textSize => _textSize;
Size get textSize => _textSize!;

/// Returns the text align value
TextAlign get textAlign => _textAlign;
Expand Down Expand Up @@ -204,7 +204,7 @@ class _RenderBarcode extends RenderBox {
}

/// Sets the text size value
set textSize(Size value) {
set textSize(Size? value) {
if (_textSize != value) {
_textSize = value;
markNeedsPaint();
Expand Down Expand Up @@ -252,7 +252,7 @@ class _RenderBarcode extends RenderBox {
size.height -
(showText
? (_textSpacing +
(_textSize != null ? _textSize.height : 0))
(_textSize != null ? _textSize!.height : 0))
: 0)),
offset,
value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ class Codabar extends Symbology {
///
/// The arguments [module] must be non-negative and greater than 0.
///
Codabar({int module}) : super(module: module);
Codabar({int? module}) : super(module: module);
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Code128 extends Symbology {
/// This is a very large method. This method could be
/// refactor to a smaller methods, but it degrades the performance.Since it
/// adds the character corresponding to this symbology is added in to the list
Code128({int module})
Code128({int? module})
: super(
module: module,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ class Code128A extends Code128 {
///
/// The arguments [module] must be non-negative and greater than 0.
///
Code128A({int module}) : super(module: module);
Code128A({int? module}) : super(module: module);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ class Code128B extends Code128 {
///
/// The arguments [module] must be non-negative and greater than 0.
///
Code128B({int module}) : super(module: module);
Code128B({int? module}) : super(module: module);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ class Code128C extends Code128 {
///
/// The arguments [module] must be non-negative and greater than 0.
///
Code128C({int module}) : super(module: module);
Code128C({int? module}) : super(module: module);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ class Code39Extended extends Code39 {
/// This is a very large method. This method could be
/// refactored to a smaller methods, but it degrades the performance.Since it
/// adds character corresponding to this symbology is added in to the list
Code39Extended({int module, bool enableCheckSum})
Code39Extended({int? module, bool? enableCheckSum})
: super(module: module, enableCheckSum: enableCheckSum ?? true);
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Code39 extends Symbology {
/// a modulo 43 checksum can be added,
/// if the [enableCheckSum] is true.
///
Code39({int module, this.enableCheckSum = true}) : super(module: module);
Code39({int? module, this.enableCheckSum = true}) : super(module: module);

/// Whether to add a checksum on the far right side of the barcode.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ class Code93 extends Symbology {
/// high level of accuracy.
/// The checksum character is the modulo 47 remainder of the sum of the
/// weighted value of the data characters.
Code93({int module}) : super(module: module);
Code93({int? module}) : super(module: module);
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ class EAN13 extends Symbology {
/// valid check digit otherwise remove it, since it has been calculated
/// automatically.
///
EAN13({int module}) : super(module: module);
EAN13({int? module}) : super(module: module);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ class EAN8 extends Symbology {
/// valid check digit otherwise remove it, since it has been calculated
/// automatically.
///
EAN8({int module}) : super(module: module);
EAN8({int? module}) : super(module: module);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ class UPCA extends Symbology {
/// be valid check digit otherwise remove it, since it has been calculated
/// automatically.
///
UPCA({int module}) : super(module: module);
UPCA({int? module}) : super(module: module);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ class UPCE extends Symbology {
/// By default, the number system(0) will add at the front and check digit
/// at the end along with 6 digits of the input product code.
///
UPCE({int module}) : super(module: module);
UPCE({int? module}) : super(module: module);
}
Loading