-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
fix: remove unused child argument #1272
fix: remove unused child argument #1272
Conversation
@@ -8,13 +8,6 @@ import 'package:mobile_scanner/src/objects/barcode_capture.dart'; | |||
import 'package:mobile_scanner/src/objects/mobile_scanner_state.dart'; | |||
import 'package:mobile_scanner/src/scan_window_calculation.dart'; | |||
|
|||
/// The function signature for the error builder. | |||
typedef MobileScannerErrorBuilder = Widget Function( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that the function signature is short enough to fit on one line, I opted to remove the typedef
@@ -73,7 +66,7 @@ class MobileScanner extends StatefulWidget { | |||
/// If this is null, a black [ColoredBox] is used as placeholder. | |||
/// | |||
/// The placeholder is displayed when the camera preview is being initialized. | |||
final Widget Function(BuildContext, Widget?)? placeholderBuilder; | |||
final WidgetBuilder? placeholderBuilder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reusing an exiting typedef from the framework here
@@ -203,12 +196,11 @@ class _MobileScannerState extends State<MobileScanner> | |||
Widget build(BuildContext context) { | |||
return ValueListenableBuilder<MobileScannerState>( | |||
valueListenable: controller, | |||
builder: (BuildContext context, MobileScannerState value, Widget? child) { | |||
builder: (BuildContext context, MobileScannerState value, _) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users can create a child widget above the MobileScanner
widget in their build method, which makes passing in a child widget redundant here. And as reported, the child
parameter was unused, so it didn't add any value to the function signatures
@@ -65,7 +65,7 @@ class _BarcodeScannerWithControllerState | |||
child: Container( | |||
alignment: Alignment.bottomCenter, | |||
height: 100, | |||
color: Colors.black.withOpacity(0.4), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
withOpacity is deprecated, so I replaced it everywhere
@@ -19,7 +19,6 @@ class ScannerErrorWidget extends StatelessWidget { | |||
errorMessage = 'Scanning is unsupported on this device'; | |||
default: | |||
errorMessage = 'Generic Error'; | |||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linter now reports an obsolete break statement here
Fixes #1256