Skip to content
Open

NNBD #30

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
2 changes: 1 addition & 1 deletion qrcode/example/.flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"qrcode","path":"/home/vytor/projetos/mobile/qrcode/qrcode/","dependencies":[]}],"android":[{"name":"qrcode","path":"/home/vytor/projetos/mobile/qrcode/qrcode/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"qrcode","dependencies":[]}],"date_created":"2020-06-24 16:02:25.633378","version":"1.17.3"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"qrcode","path":"/home/luke/Projects/JTE/qrcode/qrcode/","dependencies":[]}],"android":[{"name":"qrcode","path":"/home/luke/Projects/JTE/qrcode/qrcode/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"qrcode","dependencies":[]}],"date_created":"2021-01-15 15:27:33.514642","version":"1.26.0-8.0.pre"}
10 changes: 6 additions & 4 deletions qrcode/example/ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/home/vytor/flutter"
export "FLUTTER_APPLICATION_PATH=/home/vytor/projetos/mobile/qrcode/qrcode/example"
export "FLUTTER_ROOT=/home/luke/Android/flutter"
export "FLUTTER_APPLICATION_PATH=/home/luke/Projects/JTE/qrcode/qrcode/example"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
export "FLUTTER_FRAMEWORK_DIR=/home/vytor/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=false"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.packages"
64 changes: 32 additions & 32 deletions qrcode/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class MyApp extends StatefulWidget {

class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
QRCaptureController _captureController = QRCaptureController();
Animation<Alignment> _animation;
AnimationController _animationController;
late Animation<Alignment> _animation;
late AnimationController _animationController;

bool _isTorchOn = false;

Expand Down Expand Up @@ -66,8 +66,8 @@ class _MyAppState extends State<MyApp> with TickerProviderStateMixin {
width: 250,
height: 250,
child: QRCaptureView(
controller: _captureController,
),
controller: _captureController,
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 56),
Expand Down Expand Up @@ -97,33 +97,33 @@ class _MyAppState extends State<MyApp> with TickerProviderStateMixin {

Widget _buildToolBar() {
return Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
onPressed: () {
_captureController.pause();
},
child: Text('pause'),
),
FlatButton(
onPressed: () {
if (_isTorchOn) {
_captureController.torchMode = CaptureTorchMode.off;
} else {
_captureController.torchMode = CaptureTorchMode.on;
}
_isTorchOn = !_isTorchOn;
},
child: Text('torch'),
),
FlatButton(
onPressed: () {
_captureController.resume();
},
child: Text('resume'),
),
],
);
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FlatButton(
onPressed: () {
_captureController.pause();
},
child: Text('pause'),
),
FlatButton(
onPressed: () {
if (_isTorchOn) {
_captureController.torchMode = CaptureTorchMode.off;
} else {
_captureController.torchMode = CaptureTorchMode.on;
}
_isTorchOn = !_isTorchOn;
},
child: Text('torch'),
),
FlatButton(
onPressed: () {
_captureController.resume();
},
child: Text('resume'),
),
],
);
}
}
2 changes: 1 addition & 1 deletion qrcode/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Demonstrates how to use the qrcode plugin.
publish_to: 'none'

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

dependencies:
flutter:
Expand Down
4 changes: 2 additions & 2 deletions qrcode/example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ void main() {
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) => widget is Text &&
widget.data.startsWith('Running on:'),
(Widget widget) =>
widget is Text && widget.data!.startsWith('Running on:'),
),
findsOneWidget,
);
Expand Down
26 changes: 13 additions & 13 deletions qrcode/lib/qrcode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ typedef CaptureCallback(String data);
enum CaptureTorchMode { on, off }

class QRCaptureController {
MethodChannel _methodChannel;
CaptureCallback _capture;
MethodChannel? _methodChannel;
CaptureCallback? _capture;

QRCaptureController();

void _onPlatformViewCreated(int id) {
_methodChannel = MethodChannel('plugins/qr_capture/method_$id');
_methodChannel.setMethodCallHandler((MethodCall call) async {
if (call.method == 'onCaptured') {
_methodChannel?.setMethodCallHandler((MethodCall call) async {
if (call.method == 'onCaptured') {
if (_capture != null && call.arguments != null) {
_capture(call.arguments.toString());
_capture!(call.arguments.toString());
}
}
});
Expand All @@ -44,7 +44,7 @@ class QRCaptureController {

class QRCaptureView extends StatefulWidget {
final QRCaptureController controller;
QRCaptureView({Key key, this.controller}) : super(key: key);
QRCaptureView({Key? key, required this.controller}) : super(key: key);

@override
State<StatefulWidget> createState() {
Expand All @@ -53,24 +53,24 @@ class QRCaptureView extends StatefulWidget {
}

class QRCaptureViewState extends State<QRCaptureView> {

@override
Widget build(BuildContext context) {
if (Platform.isIOS) {
return UiKitView(
viewType: 'plugins/qr_capture_view',
creationParamsCodec: StandardMessageCodec(),
onPlatformViewCreated: (id) {
viewType: 'plugins/qr_capture_view',
creationParamsCodec: StandardMessageCodec(),
onPlatformViewCreated: (id) {
widget.controller._onPlatformViewCreated(id);
},
);
} else {
return AndroidView(viewType: 'plugins/qr_capture_view',
return AndroidView(
viewType: 'plugins/qr_capture_view',
creationParamsCodec: StandardMessageCodec(),
onPlatformViewCreated: (id) {
widget.controller._onPlatformViewCreated(id);
},
);
}
}
}
}
4 changes: 2 additions & 2 deletions qrcode/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: qrcode
description: A flutter plugin for scanning QR codes. Use AVCaptureSession in iOS and zxing in Android.
version: 1.0.5
version: 2.0.0-nullsafety.0
author: chendaxin <dxchen321@gmail.com>
homepage: https://github.com/SiriDx/qrcode

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

dependencies:
flutter:
Expand Down