From 2414c08539b66230189ad95c465b11e0b70c5a07 Mon Sep 17 00:00:00 2001 From: Aniq Hussain Syed Date: Mon, 14 Jul 2025 20:42:46 +0200 Subject: [PATCH 1/5] [image_picker][ios] redesign example app --- .../image_picker_ios/example/lib/main.dart | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/packages/image_picker/image_picker_ios/example/lib/main.dart b/packages/image_picker/image_picker_ios/example/lib/main.dart index 28d0ea2540e..e91b87e60d6 100755 --- a/packages/image_picker/image_picker_ios/example/lib/main.dart +++ b/packages/image_picker/image_picker_ios/example/lib/main.dart @@ -284,15 +284,17 @@ class _MyHomePageState extends State { appBar: AppBar( title: Text(widget.title!), ), - body: Center( + body: Align( + alignment: Alignment.topCenter, child: _handlePreview(), ), floatingActionButton: Column( mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.end, children: [ Semantics( label: 'image_picker_example_from_gallery', - child: FloatingActionButton( + child: FloatingActionButton.extended( key: const Key('image_picker_example_from_gallery'), onPressed: () { _isVideo = false; @@ -300,12 +302,13 @@ class _MyHomePageState extends State { }, heroTag: 'image0', tooltip: 'Pick Image from gallery', - child: const Icon(Icons.photo), + label: const Text('Pick Image from gallery'), + icon: const Icon(Icons.photo), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed( @@ -317,12 +320,13 @@ class _MyHomePageState extends State { }, heroTag: 'multipleMedia', tooltip: 'Pick Multiple Media from gallery', - child: const Icon(Icons.photo_library), + label: const Text('Pick Multiple Media from gallery'), + icon: const Icon(Icons.photo_library), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed( @@ -333,12 +337,13 @@ class _MyHomePageState extends State { }, heroTag: 'media', tooltip: 'Pick Single Media from gallery', - child: const Icon(Icons.photo_library), + label: const Text('Pick Single Media from gallery'), + icon: const Icon(Icons.photo_library), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed( @@ -349,24 +354,26 @@ class _MyHomePageState extends State { }, heroTag: 'image1', tooltip: 'Pick Multiple Image from gallery', - child: const Icon(Icons.photo_library), + label: const Text('Pick Multiple Image from gallery'), + icon: const Icon(Icons.photo_library), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed(ImageSource.camera, context: context); }, heroTag: 'image2', tooltip: 'Take a Photo', - child: const Icon(Icons.camera_alt), + label: const Text('Take a Photo'), + icon: const Icon(Icons.camera_alt), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( backgroundColor: Colors.red, onPressed: () { _isVideo = true; @@ -374,12 +381,13 @@ class _MyHomePageState extends State { }, heroTag: 'video0', tooltip: 'Pick Video from gallery', - child: const Icon(Icons.video_library), + label: const Text('Pick Video from gallery'), + icon: const Icon(Icons.video_library), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( backgroundColor: Colors.red, onPressed: () { _isVideo = true; @@ -387,7 +395,8 @@ class _MyHomePageState extends State { }, heroTag: 'video1', tooltip: 'Take a Video', - child: const Icon(Icons.videocam), + label: const Text('Take a Video'), + icon: const Icon(Icons.videocam), ), ), ], From d4c59242850e842da4b9f93fd426c75276239e65 Mon Sep 17 00:00:00 2001 From: Aniq Hussain Syed Date: Tue, 15 Jul 2025 09:23:16 +0200 Subject: [PATCH 2/5] [image_picker] Update CHANGELOG.md The iOS example now uses FloatingActionButton.extended --- packages/image_picker/image_picker_ios/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/image_picker/image_picker_ios/CHANGELOG.md b/packages/image_picker/image_picker_ios/CHANGELOG.md index de2edfd411f..0ef0e8ea075 100644 --- a/packages/image_picker/image_picker_ios/CHANGELOG.md +++ b/packages/image_picker/image_picker_ios/CHANGELOG.md @@ -1,5 +1,6 @@ ## NEXT +* Use FloatingActionButton.extended in iOS example to add descriptive labels for each action. * Updates minimum supported SDK version to Flutter 3.27/Dart 3.6. ## 0.8.12+2 From ecbbf8f1f180ea70be00232850a7807d35e4dd38 Mon Sep 17 00:00:00 2001 From: Aniq Hussain Syed Date: Tue, 15 Jul 2025 23:43:04 +0200 Subject: [PATCH 3/5] Revert "[image_picker] Update CHANGELOG.md" This reverts commit d4c59242850e842da4b9f93fd426c75276239e65. --- packages/image_picker/image_picker_ios/CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/image_picker/image_picker_ios/CHANGELOG.md b/packages/image_picker/image_picker_ios/CHANGELOG.md index 0ef0e8ea075..de2edfd411f 100644 --- a/packages/image_picker/image_picker_ios/CHANGELOG.md +++ b/packages/image_picker/image_picker_ios/CHANGELOG.md @@ -1,6 +1,5 @@ ## NEXT -* Use FloatingActionButton.extended in iOS example to add descriptive labels for each action. * Updates minimum supported SDK version to Flutter 3.27/Dart 3.6. ## 0.8.12+2 From 741bdea8542962e7400783230bb7aa25a4540ad0 Mon Sep 17 00:00:00 2001 From: Aniq Hussain Syed Date: Tue, 15 Jul 2025 23:55:14 +0200 Subject: [PATCH 4/5] [image_picker][android] redesign example app --- .../example/lib/main.dart | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/packages/image_picker/image_picker_android/example/lib/main.dart b/packages/image_picker/image_picker_android/example/lib/main.dart index 8218f2d5ae2..c28c7729df9 100755 --- a/packages/image_picker/image_picker_android/example/lib/main.dart +++ b/packages/image_picker/image_picker_android/example/lib/main.dart @@ -336,7 +336,8 @@ class _MyHomePageState extends State { appBar: AppBar( title: Text(widget.title!), ), - body: Center( + body: Align( + alignment: Alignment.topCenter, child: !kIsWeb && defaultTargetPlatform == TargetPlatform.android ? FutureBuilder( future: retrieveLostData(), @@ -372,7 +373,7 @@ class _MyHomePageState extends State { children: [ Semantics( label: 'image_picker_example_from_gallery', - child: FloatingActionButton( + child: FloatingActionButton.extended( key: const Key('image_picker_example_from_gallery'), onPressed: () { _isVideo = false; @@ -380,12 +381,13 @@ class _MyHomePageState extends State { }, heroTag: 'image0', tooltip: 'Pick Image from gallery', - child: const Icon(Icons.photo), + label: const Text('Pick Image from gallery'), + icon: const Icon(Icons.photo), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed( @@ -397,12 +399,13 @@ class _MyHomePageState extends State { }, heroTag: 'multipleMedia', tooltip: 'Pick Multiple Media from gallery', - child: const Icon(Icons.photo_library), + label: const Text('Pick Multiple Media from gallery'), + icon: const Icon(Icons.photo_library), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed( @@ -413,12 +416,13 @@ class _MyHomePageState extends State { }, heroTag: 'media', tooltip: 'Pick Single Media from gallery', - child: const Icon(Icons.photo_library), + label: const Text('Pick Single Media from gallery'), + icon: const Icon(Icons.photo_library), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed( @@ -429,24 +433,26 @@ class _MyHomePageState extends State { }, heroTag: 'image1', tooltip: 'Pick Multiple Image from gallery', - child: const Icon(Icons.photo_library), + label: const Text('Pick Multiple Image from gallery'), + icon: const Icon(Icons.photo_library), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed(ImageSource.camera, context: context); }, heroTag: 'image2', tooltip: 'Take a Photo', - child: const Icon(Icons.camera_alt), + label: const Text('Take a Photo'), + icon: const Icon(Icons.camera_alt), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( backgroundColor: Colors.red, onPressed: () { _isVideo = true; @@ -454,12 +460,13 @@ class _MyHomePageState extends State { }, heroTag: 'video0', tooltip: 'Pick Video from gallery', - child: const Icon(Icons.video_library), + label: const Text('Pick Video from gallery'), + icon: const Icon(Icons.video_library), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( backgroundColor: Colors.red, onPressed: () { _isVideo = true; @@ -467,7 +474,8 @@ class _MyHomePageState extends State { }, heroTag: 'video1', tooltip: 'Take a Video', - child: const Icon(Icons.videocam), + label: const Text('Take a Video'), + icon: const Icon(Icons.videocam), ), ), ], From d8d8b4213af718bb67b7905abf24d9d5fb9b38ff Mon Sep 17 00:00:00 2001 From: Aniq Hussain Syed Date: Wed, 16 Jul 2025 01:08:19 +0200 Subject: [PATCH 5/5] [image_picker][desktop] redesign example apps Replaces FloatingActionButton with FloatingActionButton.extended in Linux, macOS, and Windows example apps for improved button labeling. --- .../image_picker_linux/example/lib/main.dart | 38 +++++++++++-------- .../image_picker_macos/example/lib/main.dart | 38 +++++++++++-------- .../example/lib/main.dart | 38 +++++++++++-------- 3 files changed, 69 insertions(+), 45 deletions(-) diff --git a/packages/image_picker/image_picker_linux/example/lib/main.dart b/packages/image_picker/image_picker_linux/example/lib/main.dart index 8f4887095c1..acec8f8b360 100644 --- a/packages/image_picker/image_picker_linux/example/lib/main.dart +++ b/packages/image_picker/image_picker_linux/example/lib/main.dart @@ -277,7 +277,8 @@ class _MyHomePageState extends State { appBar: AppBar( title: Text(widget.title!), ), - body: Center( + body: Align( + alignment: Alignment.topCenter, child: _handlePreview(), ), floatingActionButton: Column( @@ -285,7 +286,7 @@ class _MyHomePageState extends State { children: [ Semantics( label: 'image_picker_example_from_gallery', - child: FloatingActionButton( + child: FloatingActionButton.extended( key: const Key('image_picker_example_from_gallery'), onPressed: () { _isVideo = false; @@ -293,12 +294,13 @@ class _MyHomePageState extends State { }, heroTag: 'image0', tooltip: 'Pick Image from gallery', - child: const Icon(Icons.photo), + label: const Text('Pick Image from gallery'), + icon: const Icon(Icons.photo), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed( @@ -310,12 +312,13 @@ class _MyHomePageState extends State { }, heroTag: 'multipleMedia', tooltip: 'Pick Multiple Media from gallery', - child: const Icon(Icons.photo_library), + label: const Text('Pick Multiple Media from gallery'), + icon: const Icon(Icons.photo_library), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed( @@ -326,12 +329,13 @@ class _MyHomePageState extends State { }, heroTag: 'media', tooltip: 'Pick Single Media from gallery', - child: const Icon(Icons.photo_library), + label: const Text('Pick Single Media from gallery'), + icon: const Icon(Icons.photo_library), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed( @@ -342,25 +346,27 @@ class _MyHomePageState extends State { }, heroTag: 'image1', tooltip: 'Pick Multiple Image from gallery', - child: const Icon(Icons.photo_library), + label: const Text('Pick Multiple Image from gallery'), + icon: const Icon(Icons.photo_library), ), ), if (_picker.supportsImageSource(ImageSource.camera)) Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed(ImageSource.camera, context: context); }, heroTag: 'image2', tooltip: 'Take a Photo', - child: const Icon(Icons.camera_alt), + label: const Text('Take a Photo'), + icon: const Icon(Icons.camera_alt), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( backgroundColor: Colors.red, onPressed: () { _isVideo = true; @@ -368,13 +374,14 @@ class _MyHomePageState extends State { }, heroTag: 'video0', tooltip: 'Pick Video from gallery', - child: const Icon(Icons.video_library), + label: const Text('Pick Video from gallery'), + icon: const Icon(Icons.video_library), ), ), if (_picker.supportsImageSource(ImageSource.camera)) Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( backgroundColor: Colors.red, onPressed: () { _isVideo = true; @@ -382,7 +389,8 @@ class _MyHomePageState extends State { }, heroTag: 'video1', tooltip: 'Take a Video', - child: const Icon(Icons.videocam), + label: const Text('Take a Video'), + icon: const Icon(Icons.videocam), ), ), ], diff --git a/packages/image_picker/image_picker_macos/example/lib/main.dart b/packages/image_picker/image_picker_macos/example/lib/main.dart index 8f4887095c1..acec8f8b360 100644 --- a/packages/image_picker/image_picker_macos/example/lib/main.dart +++ b/packages/image_picker/image_picker_macos/example/lib/main.dart @@ -277,7 +277,8 @@ class _MyHomePageState extends State { appBar: AppBar( title: Text(widget.title!), ), - body: Center( + body: Align( + alignment: Alignment.topCenter, child: _handlePreview(), ), floatingActionButton: Column( @@ -285,7 +286,7 @@ class _MyHomePageState extends State { children: [ Semantics( label: 'image_picker_example_from_gallery', - child: FloatingActionButton( + child: FloatingActionButton.extended( key: const Key('image_picker_example_from_gallery'), onPressed: () { _isVideo = false; @@ -293,12 +294,13 @@ class _MyHomePageState extends State { }, heroTag: 'image0', tooltip: 'Pick Image from gallery', - child: const Icon(Icons.photo), + label: const Text('Pick Image from gallery'), + icon: const Icon(Icons.photo), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed( @@ -310,12 +312,13 @@ class _MyHomePageState extends State { }, heroTag: 'multipleMedia', tooltip: 'Pick Multiple Media from gallery', - child: const Icon(Icons.photo_library), + label: const Text('Pick Multiple Media from gallery'), + icon: const Icon(Icons.photo_library), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed( @@ -326,12 +329,13 @@ class _MyHomePageState extends State { }, heroTag: 'media', tooltip: 'Pick Single Media from gallery', - child: const Icon(Icons.photo_library), + label: const Text('Pick Single Media from gallery'), + icon: const Icon(Icons.photo_library), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed( @@ -342,25 +346,27 @@ class _MyHomePageState extends State { }, heroTag: 'image1', tooltip: 'Pick Multiple Image from gallery', - child: const Icon(Icons.photo_library), + label: const Text('Pick Multiple Image from gallery'), + icon: const Icon(Icons.photo_library), ), ), if (_picker.supportsImageSource(ImageSource.camera)) Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed(ImageSource.camera, context: context); }, heroTag: 'image2', tooltip: 'Take a Photo', - child: const Icon(Icons.camera_alt), + label: const Text('Take a Photo'), + icon: const Icon(Icons.camera_alt), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( backgroundColor: Colors.red, onPressed: () { _isVideo = true; @@ -368,13 +374,14 @@ class _MyHomePageState extends State { }, heroTag: 'video0', tooltip: 'Pick Video from gallery', - child: const Icon(Icons.video_library), + label: const Text('Pick Video from gallery'), + icon: const Icon(Icons.video_library), ), ), if (_picker.supportsImageSource(ImageSource.camera)) Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( backgroundColor: Colors.red, onPressed: () { _isVideo = true; @@ -382,7 +389,8 @@ class _MyHomePageState extends State { }, heroTag: 'video1', tooltip: 'Take a Video', - child: const Icon(Icons.videocam), + label: const Text('Take a Video'), + icon: const Icon(Icons.videocam), ), ), ], diff --git a/packages/image_picker/image_picker_windows/example/lib/main.dart b/packages/image_picker/image_picker_windows/example/lib/main.dart index 8f4887095c1..acec8f8b360 100644 --- a/packages/image_picker/image_picker_windows/example/lib/main.dart +++ b/packages/image_picker/image_picker_windows/example/lib/main.dart @@ -277,7 +277,8 @@ class _MyHomePageState extends State { appBar: AppBar( title: Text(widget.title!), ), - body: Center( + body: Align( + alignment: Alignment.topCenter, child: _handlePreview(), ), floatingActionButton: Column( @@ -285,7 +286,7 @@ class _MyHomePageState extends State { children: [ Semantics( label: 'image_picker_example_from_gallery', - child: FloatingActionButton( + child: FloatingActionButton.extended( key: const Key('image_picker_example_from_gallery'), onPressed: () { _isVideo = false; @@ -293,12 +294,13 @@ class _MyHomePageState extends State { }, heroTag: 'image0', tooltip: 'Pick Image from gallery', - child: const Icon(Icons.photo), + label: const Text('Pick Image from gallery'), + icon: const Icon(Icons.photo), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed( @@ -310,12 +312,13 @@ class _MyHomePageState extends State { }, heroTag: 'multipleMedia', tooltip: 'Pick Multiple Media from gallery', - child: const Icon(Icons.photo_library), + label: const Text('Pick Multiple Media from gallery'), + icon: const Icon(Icons.photo_library), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed( @@ -326,12 +329,13 @@ class _MyHomePageState extends State { }, heroTag: 'media', tooltip: 'Pick Single Media from gallery', - child: const Icon(Icons.photo_library), + label: const Text('Pick Single Media from gallery'), + icon: const Icon(Icons.photo_library), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed( @@ -342,25 +346,27 @@ class _MyHomePageState extends State { }, heroTag: 'image1', tooltip: 'Pick Multiple Image from gallery', - child: const Icon(Icons.photo_library), + label: const Text('Pick Multiple Image from gallery'), + icon: const Icon(Icons.photo_library), ), ), if (_picker.supportsImageSource(ImageSource.camera)) Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( onPressed: () { _isVideo = false; _onImageButtonPressed(ImageSource.camera, context: context); }, heroTag: 'image2', tooltip: 'Take a Photo', - child: const Icon(Icons.camera_alt), + label: const Text('Take a Photo'), + icon: const Icon(Icons.camera_alt), ), ), Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( backgroundColor: Colors.red, onPressed: () { _isVideo = true; @@ -368,13 +374,14 @@ class _MyHomePageState extends State { }, heroTag: 'video0', tooltip: 'Pick Video from gallery', - child: const Icon(Icons.video_library), + label: const Text('Pick Video from gallery'), + icon: const Icon(Icons.video_library), ), ), if (_picker.supportsImageSource(ImageSource.camera)) Padding( padding: const EdgeInsets.only(top: 16.0), - child: FloatingActionButton( + child: FloatingActionButton.extended( backgroundColor: Colors.red, onPressed: () { _isVideo = true; @@ -382,7 +389,8 @@ class _MyHomePageState extends State { }, heroTag: 'video1', tooltip: 'Take a Video', - child: const Icon(Icons.videocam), + label: const Text('Take a Video'), + icon: const Icon(Icons.videocam), ), ), ],