-
Notifications
You must be signed in to change notification settings - Fork 42
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
Adding control properties API #49
Conversation
example/lib/stories.dart
Outdated
errorColor: ctx.colorProperty( | ||
'errorColor', | ||
const Color(0xFFCC6941), | ||
controlProperty: ControlProperty('type', MessageCardType.error), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it could help if this property had a name related with “visibility” or something like that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the author of #47 this does exactly what I was looking for, thank you! There's some room for expansion later (maybe hiding if it doesn't match the type verses including if it does), but this helps tremendously.
There's one missing property that doesn't currently respect the ControlProperty
but allows the consumer to define it (TextProperty
) and some minor grammar suggestions. I added support for it locally to verify that passing in that ControlProperty
to the Property
works.
final List<Widget> children = []; | ||
|
||
for (var entry in widget.currentChapter.ctx.properties.entries) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: we could break this out into a method
lib/src/story.dart
Outdated
String textProperty(String name, String defaultValue, | ||
{ControlProperty? controlProperty}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chore (blocking): we need to utilize the controlProperty
here and pass it to the Property
like we added for the other property types.
https://github.com/erickzanardo/dashbook/blob/0de95e01ae6898d27deb4e5f0b7fedcae763fad1/lib/src/story.dart#L33-L34
final property = Property<String>(name, defaultValue,
controlProperty: controlProperty);
properties[name] = property;
Co-authored-by: Jeff Scaturro <53348890+jeffs-sf@users.noreply.github.com>
This PR adds the control properties API.
Fixes #47
Gravacao.de.Tela.2021-04-20.as.15.27.10.mov