Skip to content

Commit

Permalink
feat: Add hide gallery button option to barcode scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
rvndsngwn committed Jul 1, 2024
1 parent ed81ffc commit 8c2c933
Show file tree
Hide file tree
Showing 7 changed files with 178 additions and 148 deletions.
2 changes: 1 addition & 1 deletion .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":"image_picker_ios","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.12/","native_build":true,"dependencies":[]},{"name":"mobile_scanner","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/mobile_scanner-5.1.1/","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.20/","native_build":true,"dependencies":[]},{"name":"image_picker_android","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/image_picker_android-0.8.12+3/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"mobile_scanner","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/mobile_scanner-5.1.1/","native_build":true,"dependencies":[]}],"macos":[{"name":"file_selector_macos","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/file_selector_macos-0.9.4/","native_build":true,"dependencies":[]},{"name":"image_picker_macos","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/image_picker_macos-0.2.1+1/","native_build":false,"dependencies":["file_selector_macos"]},{"name":"mobile_scanner","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/mobile_scanner-5.1.1/","native_build":true,"dependencies":[]}],"linux":[{"name":"file_selector_linux","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/file_selector_linux-0.9.2+1/","native_build":true,"dependencies":[]},{"name":"image_picker_linux","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/image_picker_linux-0.2.1+1/","native_build":false,"dependencies":["file_selector_linux"]}],"windows":[{"name":"file_selector_windows","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/file_selector_windows-0.9.3+1/","native_build":true,"dependencies":[]},{"name":"image_picker_windows","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/image_picker_windows-0.2.1+1/","native_build":false,"dependencies":["file_selector_windows"]}],"web":[{"name":"image_picker_for_web","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/image_picker_for_web-3.0.4/","dependencies":[]},{"name":"mobile_scanner","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/mobile_scanner-5.1.1/","dependencies":[]}]},"dependencyGraph":[{"name":"file_selector_linux","dependencies":[]},{"name":"file_selector_macos","dependencies":[]},{"name":"file_selector_windows","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["image_picker_android","image_picker_for_web","image_picker_ios","image_picker_linux","image_picker_macos","image_picker_windows"]},{"name":"image_picker_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"image_picker_ios","dependencies":[]},{"name":"image_picker_linux","dependencies":["file_selector_linux"]},{"name":"image_picker_macos","dependencies":["file_selector_macos"]},{"name":"image_picker_windows","dependencies":["file_selector_windows"]},{"name":"mobile_scanner","dependencies":[]}],"date_created":"2024-06-27 12:00:39.264106","version":"3.22.2"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"image_picker_ios","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.12/","native_build":true,"dependencies":[]},{"name":"mobile_scanner","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/mobile_scanner-5.1.1/","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.20/","native_build":true,"dependencies":[]},{"name":"image_picker_android","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/image_picker_android-0.8.12+3/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"mobile_scanner","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/mobile_scanner-5.1.1/","native_build":true,"dependencies":[]}],"macos":[{"name":"file_selector_macos","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/file_selector_macos-0.9.4/","native_build":true,"dependencies":[]},{"name":"image_picker_macos","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/image_picker_macos-0.2.1+1/","native_build":false,"dependencies":["file_selector_macos"]},{"name":"mobile_scanner","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/mobile_scanner-5.1.1/","native_build":true,"dependencies":[]}],"linux":[{"name":"file_selector_linux","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/file_selector_linux-0.9.2+1/","native_build":true,"dependencies":[]},{"name":"image_picker_linux","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/image_picker_linux-0.2.1+1/","native_build":false,"dependencies":["file_selector_linux"]}],"windows":[{"name":"file_selector_windows","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/file_selector_windows-0.9.3+1/","native_build":true,"dependencies":[]},{"name":"image_picker_windows","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/image_picker_windows-0.2.1+1/","native_build":false,"dependencies":["file_selector_windows"]}],"web":[{"name":"image_picker_for_web","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/image_picker_for_web-3.0.4/","dependencies":[]},{"name":"mobile_scanner","path":"/Users/arvindsangwan/.pub-cache/hosted/pub.dev/mobile_scanner-5.1.1/","dependencies":[]}]},"dependencyGraph":[{"name":"file_selector_linux","dependencies":[]},{"name":"file_selector_macos","dependencies":[]},{"name":"file_selector_windows","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["image_picker_android","image_picker_for_web","image_picker_ios","image_picker_linux","image_picker_macos","image_picker_windows"]},{"name":"image_picker_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"image_picker_ios","dependencies":[]},{"name":"image_picker_linux","dependencies":["file_selector_linux"]},{"name":"image_picker_macos","dependencies":["file_selector_macos"]},{"name":"image_picker_windows","dependencies":["file_selector_windows"]},{"name":"mobile_scanner","dependencies":[]}],"date_created":"2024-07-01 23:13:36.687833","version":"3.22.2"}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## 5.1.1+1

- Readme updated
- gallery button hide option fixed

## 5.1.1+1

- Readme updated
- gallery button hide option added

Expand Down
41 changes: 29 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,11 @@ You can use the following properties of the Barcode object.
/// Barcode controller (optional)
final MobileScannerController? controller;
/// Show overlay or not (default: true)
final bool showOverlay;
/// You can use your own custom overlay builder
/// to build your own overlay
/// This will override the default custom overlay
final Widget? Function(BuildContext, bool?, MobileScannerController)?
customOverlayBuilder;
/// Overlay border color (default: white)
final Color? borderColor;
Expand Down Expand Up @@ -348,7 +351,14 @@ You can use the following properties of the Barcode object.
/// AppBar widget
/// you can use this to add appBar to the scanner screen
///
final PreferredSizeWidget? appBar;
final PreferredSizeWidget? Function(
BuildContext context, MobileScannerController controller)? appBarBuilder;
/// The builder for the bottom sheet.
/// This is displayed below the camera preview.
final Widget? Function(
BuildContext context, MobileScannerController controller)?
bottomSheetBuilder;
/// The builder for the overlay above the camera preview.
///
Expand Down Expand Up @@ -429,29 +439,36 @@ You can use the following properties of the Barcode object.
final void Function(String?)? onImagePick;
/// Title for the draggable sheet (default: 'Scan any QR code')
final String title;
final String sheetTitle;
/// Child widget for the draggable sheet (default: SizedBox.shrink())
final Widget child;
final Widget sheetChild;
/// Hide drag handler of the draggable sheet (default: false)
final bool hideDragHandler;
final bool hideSheetDragHandler;
/// Hide title of the draggable sheet (default: false)
final bool hideTitle;
final bool hideSheetTitle;
/// Hide gallery button (default: false)
/// This will hide the gallery button at the bottom of the screen
final bool hideGalleryButton;
/// Hide gallery icon (default: false)
/// This will hide the gallery icon in the app bar
final bool hideGalleryIcon;
/// Extend body behind app bar (default: true)
final bool extendBodyBehindAppBar;
/// Upload from gallery button alignment
/// default: bottom center, center, 0.75
final AlignmentGeometry? buttonAlignment;
final AlignmentGeometry? galleryButtonAlignment;
/// actions for the app bar (optional)
/// Camera switch and torch toggle buttons are added by default
/// You can add more actions to the app bar using this parameter
final List<Widget>? actions;
/// Optional function to be called when clicking the back button on the app bar
/// If not provided, the default behavior is to pop the current route from the navigator
final void Function()? onPop;
````

### Contributing to [ai_barcode_scanner](https://pub.dev/packages/ai_barcode_scanner)
Expand Down
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class _HomePageState extends State<HomePage> {
/// You can write your own logic here.
debugPrint("Barcode scanner disposed!");
},
hideGalleryButton: false,
controller: MobileScannerController(
detectionSpeed: DetectionSpeed.noDuplicates,
),
Expand Down
Loading

0 comments on commit 8c2c933

Please sign in to comment.