GaspardMerten / date_field

Flutter DateField and DateFormField
Other
45 stars 32 forks source link

Expose styling to cupertino options to help style save, cancel and modal title #59

Closed david-legend closed 5 months ago

david-legend commented 5 months ago

I have been trying to style the save button on the picker. There's no styling exposed in the API and I can't see to find which theme color affecting it

torbenkeller commented 5 months ago

middle defaults to: CupertinoTheme.of(context).textTheme.navTitleTextStyle.color! save defaults to the default color of CupertinoButton. This should be themeData.primaryColor cancel is hardcoded to CupertinoColors.destructiveRed, unfortunately. We could think about being more open here

torbenkeller commented 5 months ago

For middle we should use the full style of navTitleTextStyle and not only the color For cancel we could add a style to the CupertinoOptions class

Beside the color of the cancel button, all three buttons should be able to style by overriding the theme. If you only want to change the style for the modal, you can use the builder function in the options for that

GaspardMerten commented 5 months ago

Hello @david-legend, @torbenkeller,

Based on your inputs the package now provides the possibility to specify styling options for the 3 texts through the style property of the CupertinoDatePickerOptions.

@immutable
class CupertinoDatePickerOptionsStyle {
  const CupertinoDatePickerOptionsStyle({
    this.saveButton,
    this.cancelButton = kDefaultCancelStyle,
    this.modalTitle,
  });

  final TextStyle? saveButton;
  final TextStyle cancelButton;
  final TextStyle? modalTitle;
}