Refactor TextBuilder initialization#916
Open
CopeFiend wants to merge 1 commit into
Open
Conversation
TextBuilder can now be initialized without `widget_builder` which means calls like:
```rust
TextBuilder::new()
.with_font(font)
.with_font_size(font_size)
```
are now possible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TextBuilder can now be initialized without
widget_builder, which means calls like:are now possible.
Description
Scaffolding for #911 .
Instead carrying fields/methods that do nothing but pass data down to internal
TextBuilders, builders that require aTextBuilderinstance should take them as parameters instead (likeWidgetBuilder), this allows caller to customize values ofTextBuilder, and parentBuilderto override values if necessary. For example:Problem 1
Problem 2
Solution
This allows a higher degree of flexibility between caller and implementation.
Review Guidance
TextBuilder::new(widget_builder)are nowTextBuilder::new().with_widget_builder(widget_builder)TextBuilder::new(WidgetBuilder::new())are nowTextBuilder::new()TextBuilder::widget_builderis now anOption<WidgetBuilder>type (default:None)TextBuilder::build(), ifwidget_builderisNone, useWidgetBuilder::new()instead.Screenshots/GIFs
N/A
Checklist