Skip to content

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

@wer-mathurin

Description

@wer-mathurin

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)}

Metadata

Metadata

Assignees

Labels

feature-requestNew feature idea, implementation details

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions