Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make text box decorations affected by the current widget state #987

Merged
merged 9 commits into from
Nov 22, 2024

Conversation

hassony105
Copy link
Contributor

@hassony105 hassony105 commented Dec 11, 2023

Before:

TextBox(
  decoration: BoxDecoration(
    color: Colors.red,
  ),
  foregroundDecoration: BoxDecoration(
    color: Colors.blue,
  ),
),

After:

TextBox(
  decoration: WidgetStateProperty.all(BoxDecoration(
    color: Colors.red,
  )),
  foregroundDecoration: WidgetStateProperty.all(BoxDecoration(
    color: Colors.blue,
  )),
),

separates the decoration of TextBox into:
1- focusedDecoration
2- unFocusedDecoration
3- focusedForegroundDecoration
4- unFocusedForegroundDecoration
@bdlukaa
Copy link
Owner

bdlukaa commented Dec 20, 2023

Hello! Thank you for this pull request.

I like the idea of having a different decoration for different states, but the way you proposed is a bit limiting. It'd be nice to have it like buttons do: with a ButtonState.

TextBox(
  decoration: ButtonState.all(BoxDecoration(
    ...
  )),
)

@hassony105
Copy link
Contributor Author

do you mean that you want me to replace these:

focusedDecoration
unFocusedDecoration

focusedForegroundDecoration
unFocusedForegroundDecoration

with ButtonState<BoxDecoration> decoration, ButtonState<BoxDecoration> foregroundDecoration ?

@bdlukaa
Copy link
Owner

bdlukaa commented Dec 21, 2023

yes! what do you think?

@hassony105
Copy link
Contributor Author

OK, It is a pretty idea. I will do it.

@bdlukaa bdlukaa changed the title Separated TextBox Decorations Make text box decorations affected by the current widget state Nov 20, 2024
@bdlukaa bdlukaa merged commit 5f8abe3 into bdlukaa:master Nov 22, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants