LeGoffMael / insta_assets_picker

An image (and videos) picker similar with Instagram, supports multi picking, crop and aspect ratio.
https://pub.dev/packages/insta_assets_picker
MIT License
79 stars 34 forks source link

bug: Setting the bodySmall and bodyLarge TextTheme paramaters does not affect the confirm button text color #13

Closed ibrahimcaj closed 1 year ago

ibrahimcaj commented 1 year ago

When creating theme data with the following parameters:

textTheme: TextTheme(
    bodyLarge: TextStyle(color: Colors.white),
    bodySmall: TextStyle(color: Colors.white),
)

...the confirm button text style does not get affected.

ibrahimcaj commented 1 year ago

Decided to apply the fix myself, see #14. Should be fixed, hopefully.

LeGoffMael commented 1 year ago

Hello, thank you for trying this package.

I think using textButtonTheme might be better to edit this button, (we might not want to affect the other texts) Would something like this works for you ?

pickerTheme: InstaAssetPicker.themeData(Theme.of(context).primaryColor).copyWith(
  // using `textButtonTheme` to edit the confirm button
  textButtonTheme: TextButtonThemeData(
    style: TextButton.styleFrom(
      foregroundColor: Colors.blue,
      disabledForegroundColor: Colors.red,
    ),
  ),
),

If this solution works for you, i will close your PR and push the changes and release a new version

ibrahimcaj commented 1 year ago

Not sure why, but the foregroundColor parameter does not affect the Confirm text color when a picture is selected, stays blue no matter what. The disabledForegroundColor parameter works fine. Here's how I'm applying the picker theme below:

pickerTheme: theme.copyWith(
    canvasColor: Colors.black, // body background color
    splashColor: Colors.white.withOpacity(.25), // ontap splash color
    textButtonTheme: TextButtonThemeData(
        style: TextButton.styleFrom(
            foregroundColor: Colors.pink,
            disabledForegroundColor: Colors.amber,
        ),
    ),
    colorScheme: theme.colorScheme.copyWith(
        background: Colors.black, // albums list background color
    ),
    appBarTheme: theme.appBarTheme.copyWith(
        backgroundColor: Colors.black, // app bar background color
        titleTextStyle:
            Theme.of(context).appBarTheme.titleTextStyle?.copyWith(
                color: Colors.white,
            ), // change app bar title text style to be like app theme
    ),
),

(I'm using pink and amber for testing purposes)

LeGoffMael commented 1 year ago

Did the version you used included the change i mentioned ?

insta_assets_picker:
  git:
    url: https://github.com/LeGoffMael/insta_assets_picker
    ref: fix/confirm-btn-textButtonTheme
ibrahimcaj commented 1 year ago

Yep! Did manage to fix it later though, had an unrelated bug. Everything seems to be working, I appreciate it! You can push the new version now

LeGoffMael commented 1 year ago

Change published in the new 1.5.1 version