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. 15
      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: [
if (kIsWeb)
const UnsupportedPlatformWidget()
else
if (!isCameraSupported)
else if (!isCameraSupported)
const Center(
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(
result: result?.text,
onScanAgain: () => setState(() => result = null),

11
ffigen.yaml

@ -1,15 +1,18 @@
# Run with `flutter pub run ffigen --config ffigen.yaml`.
name: FlutterZxingBindings
name: GeneratedBindings
description: |
Bindings for `src/native_zxing.h`.
Regenerate bindings with `flutter pub run ffigen --config ffigen.yaml`.
output: 'lib/flutter_zxing_bindings_generated.dart'
output: "lib/generated_bindings.dart"
headers:
entry-points:
- 'src/native_zxing.h'
- "src/native_zxing.h"
include-directives:
- 'src/native_zxing.h'
- "src/native_zxing.h"
functions:
exclude:
- "resultToCodeResult"
preamble: |
// ignore_for_file: always_specify_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.
//
// Generated by `package:ffigen`.
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 {
/// Holds the symbol lookup function.
final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)

15
pubspec.yaml

@ -33,17 +33,4 @@ flutter:
ffiPlugin: true
windows:
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.
unnecessary_null_comparison: warning
exclude:
- "bin/cache/**"
# Ignore protoc generated files
- "dev/conductor/lib/proto/*"
- "lib/generated_bindings.dart"
- "lib/generated/"
linter:
rules:

Loading…
Cancel
Save