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

FEATURE REQUEST - Builder pattern when appropriate (Welcome, Register, etc..) #79

Open
wer-mathurin opened this issue Feb 9, 2024 · 0 comments
Assignees
Labels
feature-request New feature idea, implementation details

Comments

@wer-mathurin
Copy link
Collaborator

wer-mathurin commented Feb 9, 2024

Let takes this example
image

I don<t think there is a way to add the logo on top of the Welcome string.

I we add the ability to have something like this:

typedef WelcomeBuilder = Widget Function(String localizedString);

AnimatedLogin(
       welcomeBuilder : (localizedString) => Column(...)...
typedef WelcomeBuilder = Widget Function(Widget defaultChild);
AnimatedLogin(
       welcomeBuilder : (defaultChild) => Column(...)...
typedef LabelBuilder = Widget Function(LabelType type, String localizedString, Widget defaultChild);
AnimatedLogin(
       labelBuilder : (type, localizedString, defaultChild) => switch(type) { LabelType.welcome => ..., _ => defaultChild}

This labelBuilder or welcomeBuilder is optional, so it will not break the API :-)

Another idea is use this feature to return a Record to make the alignment as well !!!

typedef LabelBuilder = (Widget, Alignment) Function(LabelType type, String localizedString, Widget defaultChild, DisplayType mobileOrDesktop);

AnimatedLogin(
       labelBuilder : (type, localizedString, defaultChild, displayType) => switch(type) { 
LabelType.forgotPassword => (Alignment.centerRight, defaultChild) 
_ => (null, defaultChild)}
@wer-mathurin wer-mathurin added the feature-request New feature idea, implementation details label Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature idea, implementation details
Projects
None yet
Development

No branches or pull requests

2 participants