Browse Source

code refactoring

pull/76/head
Khoren Markosyan 2 years ago
parent
commit
5314292eb1
  1. 14
      example/lib/main.dart
  2. 11
      ffigen.yaml
  3. 9
      lib/generated_bindings.dart
  4. 13
      pubspec.yaml
  5. 1
      src/zxing
  6. 5
      zxscanner/analysis_options.yaml

14
example/lib/main.dart

@ -62,14 +62,16 @@ class _DemoPageState extends State<DemoPage> {
children: [ children: [
if (kIsWeb) if (kIsWeb)
const UnsupportedPlatformWidget() const UnsupportedPlatformWidget()
else else if (!isCameraSupported)
if (!isCameraSupported)
const Center( const Center(
child: Text('Camera not supported on this platform'), child: Text('Camera not supported on this platform'),
) else )
if (result != null) else if (result != null)
ScanResultWidget(
result: result?.text,
onScanAgain: () => setState(() => result = null),
)
else if (result != null)
ScanResultWidget( ScanResultWidget(
result: result?.text, result: result?.text,
onScanAgain: () => setState(() => result = null), onScanAgain: () => setState(() => result = null),

11
ffigen.yaml

@ -1,15 +1,18 @@
# Run with `flutter pub run ffigen --config ffigen.yaml`. # Run with `flutter pub run ffigen --config ffigen.yaml`.
name: FlutterZxingBindings name: GeneratedBindings
description: | description: |
Bindings for `src/native_zxing.h`. Bindings for `src/native_zxing.h`.
Regenerate bindings with `flutter pub run ffigen --config ffigen.yaml`. Regenerate bindings with `flutter pub run ffigen --config ffigen.yaml`.
output: 'lib/flutter_zxing_bindings_generated.dart' output: "lib/generated_bindings.dart"
headers: headers:
entry-points: entry-points:
- 'src/native_zxing.h' - "src/native_zxing.h"
include-directives: include-directives:
- 'src/native_zxing.h' - "src/native_zxing.h"
functions:
exclude:
- "resultToCodeResult"
preamble: | preamble: |
// ignore_for_file: always_specify_types // ignore_for_file: always_specify_types
// ignore_for_file: camel_case_types // ignore_for_file: camel_case_types

9
lib/generated_bindings.dart

@ -1,9 +1,16 @@
// ignore_for_file: always_specify_types
// ignore_for_file: camel_case_types
// ignore_for_file: non_constant_identifier_names
// AUTO GENERATED FILE, DO NOT EDIT. // AUTO GENERATED FILE, DO NOT EDIT.
// //
// Generated by `package:ffigen`. // Generated by `package:ffigen`.
import 'dart:ffi' as ffi; import 'dart:ffi' as ffi;
/// Bindings to `native_verokit.h`. /// Bindings for `src/native_zxing.h`.
///
/// Regenerate bindings with `flutter pub run ffigen --config ffigen.yaml`.
///
class GeneratedBindings { class GeneratedBindings {
/// Holds the symbol lookup function. /// Holds the symbol lookup function.
final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName) final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)

13
pubspec.yaml

@ -33,17 +33,4 @@ flutter:
ffiPlugin: true ffiPlugin: true
windows: windows:
ffiPlugin: true ffiPlugin: true
ffigen:
name: GeneratedBindings
description: Bindings to `native_verokit.h`.
output: "lib/generated_bindings.dart"
headers:
entry-points:
- "ios/Classes/src/native_zxing.h"
functions:
exclude:
- 'resultToCodeResult'
# flutter pub publish --dry-run # flutter pub publish --dry-run

1
src/zxing

@ -0,0 +1 @@
Subproject commit 86b253d699b13b1da8fca0c5e4fbd62691582d5a

5
zxscanner/analysis_options.yaml

@ -26,10 +26,7 @@ analyzer:
# Turned off until null-safe rollout is complete. # Turned off until null-safe rollout is complete.
unnecessary_null_comparison: warning unnecessary_null_comparison: warning
exclude: exclude:
- "bin/cache/**" - "lib/generated/"
# Ignore protoc generated files
- "dev/conductor/lib/proto/*"
- "lib/generated_bindings.dart"
linter: linter:
rules: rules:

Loading…
Cancel
Save