weta-vn / advance_image_picker

Flutter plugin for selecting multiple images from the Android and iOS image library, taking new pictures with the camera, and edit them before using such as rotating, cropping, adding sticker/filters.
BSD 3-Clause "New" or "Revised" License
110 stars 49 forks source link

AppBar color of Image Cropper does not follow theme and is not adjustable #10

Closed rydmike closed 3 years ago

rydmike commented 3 years ago

Thanks for this wonderful camera/image picker, best one I have tried. Sure it has a lot of dependencies, but it also solves a bunch of bad UX with most other separate camera and image pickers. Love it! 👍🏻

I noticed a small design issue. The AppBar in the advanced_image_picker follows the active AppBar theme nicely, so that is fine. Eg:

However the image cropper is always using the cropper package's default blue color, which does not look so good if you are not using a blue theme.

I did not find any interface for adjusting the AppBar background of the image cropper in the picker.

Solution Proposal

I think adding a nullable property to ImagePickerConfigs, eg

Color? appBarBackgroundColor;

Would be a nice addition, users can then set it if they want a defined color or leave as null for current AppBar theme based color.

Then you can wherever you now build AppBar's, set their background color to:

backgroundColor: _configs.appBarBackgroundColor??
  Theme.of(context).appBarTheme.backgroundColor ??
  Theme.of(context).primaryColor:

Based on the code there are a few places where the above would be needed.

The image cropper for Android has its own way of setting the AppBar color in its androidUiSettings,

image

but we can use the same concept:

       androidUiSettings: AndroidUiSettings(
          :
          toolbarColor: _configs.appBarBackgroundColor??
            Theme.of(context).appBarTheme.backgroundColor ??
            Theme.of(context).primaryColor,
          toolbarWidgetColor: _configs.appBarTextColor,
          :
        ),

We then get default AppBar's that behave as now, following the Theme, but also the Image Cropper's AppBar does so now too, and we can also set the AppBar background to any specified not theme based color, similar to how Flutter widgets usually behave.

The above implementation would be a none breaking change.

This is just a proposal for a small improvement. If you want, I can also make the fix and submit a pull request.

weta-vn commented 3 years ago

@rydmike Thank you very much. We'll try your suggestion in the next release of plugin. Or if you already fixed it, please submit a pull request. We are very grateful for your help.

rydmike commented 3 years ago

Hi again @weta-vn I made a pull request. It contains the above fix and improvement, plus updating deprecated buttons that will soon go away in Flutter SDK. Did some cleanup to that should help with pub.dev score and documentation score % completeness.

Also made an adjustment to the log utility so it does not log in release mode and also so it does not drop prints, that standard print may do in the console if Flutter is too busy with other things and it prints a lot.

https://github.com/weta-vn/advance_image_picker/pull/11

I know, it is a lot, but maybe it helps. 😃

weta-vn commented 3 years ago

@rydmike Thank you very much. We're merged your commit in latest released version. About your suggestion, we'll investigate to improve in next version.