From 9ec7bd78ceec4c23da991f921477b0864c240c9c Mon Sep 17 00:00:00 2001 From: commitimpush Date: Thu, 1 Sep 2022 17:00:59 +0200 Subject: [PATCH] Documentation updates --- README.md | 23 +++++++++++--------- example/lib/main.dart | 2 +- lib/src/models/image_picker_theme.dart | 29 +++++++++++++++++++++++++- lib/src/ui/image_picker_ui.dart | 4 ++-- 4 files changed, 44 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 9b34495..227d181 100644 --- a/README.md +++ b/README.md @@ -18,16 +18,19 @@ See the [Example Code](example/lib/main.dart) for an example on how to use this You can add optional parameters to the `showImagePickerDialog(context)` function call. These are: | Parameter | Explaination | |-------------------|----------------| -| title | The title that's shown at the top of the Image Picker Dialog in the bottom of the screen | -| titleTextSize | The font size of the title mentioned above | -| iconSize | The size of the icons that are shown in the Image Picker Dialog | -| iconTextSize | The font size of the text underneath the icons in the Image Picker Dialog | -| spaceBetweenIcons | The space in pixels between the two icons in the Image Picker Dialog | -| makePhotoIcon | The icon that is shown as the Make Photo button | -| makePhotoText | The text that is shown underneath the Make Photo icon in the Image Picker Dialog | -| selectImageIcon | The icon that is shown as the Select Image button | -| selectImageText | The text that is shown underneath the Select Image icon in the Image Picker Dialog | -| closeButtonText | The text that is visible on the button that is shown at the bottom of the Image Picker Dialog that closes the dialog | +| title | The title displayed at the top of the Image Picker Dialog. | +| titleTextSize | The font size of the title mentioned above. | +| iconSize | The size of the icons that are visible in the Image Picker Dialog. | +| iconTextSize | The font size of the text underneath the icon buttons. | +| spaceBetweenIcons | The size of the space between the two icons in the Image Picker Dialog. | +| makePhotoIcon | The icon that is displayed for the 'Make Photo' functionality of the Image Picker Dialog. | +| makePhotoText | The text that is displayed underneath the 'Make Photo' icon. | +| selectImageIcon | The icon that is displayed for the 'Select Image From Gallery' functionality of the Image Picker Dialog. | +| selectImageText | The text that is displayed underneath the 'Select Image From Gallery' icon. | +| closeButtonText | The text that is shown on the 'Close Dialog' button at the bottom of the Image Picker Dialog. | +| closeButtonWidth | The width of the 'Close Dialog' button at the bottom of the Image Picker Dialog. | +| closeButtonHeight | The height of the 'Close Dialog' button at the bottom of the Image Picker Dialog. | + The `showImagePickerDialog(context)` function returns an `Uint8List` as value which you can use in your application. diff --git a/example/lib/main.dart b/example/lib/main.dart index bab28ee..d65c105 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -42,7 +42,7 @@ class _ImagePickerExampleHomePageState final double imageWidth = 300; final String placeholder = 'assets/images/placeholder.png'; final String imageAlreadyDisplayedMessage = - 'Selected image is already being displayed!'; + 'The selected image is already being displayed!'; @override Widget build(BuildContext context) { diff --git a/lib/src/models/image_picker_theme.dart b/lib/src/models/image_picker_theme.dart index dbe9253..4bec1e9 100644 --- a/lib/src/models/image_picker_theme.dart +++ b/lib/src/models/image_picker_theme.dart @@ -13,16 +13,43 @@ class ImagePickerTheme { this.makePhotoText = "Take a Picture", this.selectImageIcon = Icons.image, this.selectImageText = "Select File", - this.closeButtonText = "Close"}); + this.closeButtonText = "Close", + this.closeButtonWidth = 300, + this.closeButtonHeight = 40}); + /// The title displayed at the top of the Image Picker Dialog. final String title; + + /// The font size of the title mentioned above. final double titleTextSize; + + /// The size of the icons that are visible in the Image Picker Dialog. final double iconSize; + + /// The font size of the text underneath the icon buttons. final double iconTextSize; + + /// The size of the space between the two icons in the Image Picker Dialog. final double spaceBetweenIcons; + + /// The icon that is displayed for the 'Make Photo' functionality of the Image Picker Dialog. final IconData makePhotoIcon; + + /// The text that is displayed underneath the 'Make Photo' icon. final String makePhotoText; + + /// The icon that is displayed for the 'Select Image From Gallery' functionality of the Image Picker Dialog. final IconData selectImageIcon; + + /// The text that is displayed underneath the 'Select Image From Gallery' icon. final String selectImageText; + + /// The text that is shown on the 'Close Dialog' button at the bottom of the Image Picker Dialog. final String closeButtonText; + + /// The width of the 'Close Dialog' button at the bottom of the Image Picker Dialog. + final double closeButtonWidth; + + /// The height of the 'Close Dialog' button at the bottom of the Image Picker Dialog. + final double closeButtonHeight; } diff --git a/lib/src/ui/image_picker_ui.dart b/lib/src/ui/image_picker_ui.dart index 64ed1fc..92a9799 100644 --- a/lib/src/ui/image_picker_ui.dart +++ b/lib/src/ui/image_picker_ui.dart @@ -48,8 +48,8 @@ class ImagePicker extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( - width: 300, - height: 40, + width: imagePickerTheme.closeButtonWidth, + height: imagePickerTheme.closeButtonHeight, child: ElevatedButton( onPressed: () => Navigator.of(context).pop(), child: Text(imagePickerTheme.closeButtonText)),