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

Add textBuilder param #85

Closed
wants to merge 4 commits into from

Conversation

esDotDev
Copy link

Adds ability to supply our own TextWidget.

Addresses: #84

@esDotDev esDotDev changed the title Add autoSizeText Add textBuilder param Feb 14, 2021
@esDotDev
Copy link
Author

esDotDev commented Mar 4, 2021

Would you be able to land this?? It's extremely non-invasive and a nice add.

@simc
Copy link
Owner

simc commented Mar 4, 2021

Yes looks good. Would you mind adding a small section to the readme? And maybe document the new property. Thanks :)

@esDotDev
Copy link
Author

Should be good to go

@esDotDev
Copy link
Author

I tweaked it a bit to include the size in the Style, and add the Data param for more flexible usage.

@esDotDev
Copy link
Author

Yes looks good. Would you mind adding a small section to the readme? And maybe document the new property. Thanks :)

Hi can we land this pretty-please!? Would love to remove this fork dep from my yaml file

@esDotDev
Copy link
Author

Bump?

@simc
Copy link
Owner

simc commented Nov 3, 2021

It's probably a better idea to create a dedicated widget for this purpose. TextFields have margin and padding that would result in incorrect font sizes.

@simc simc closed this Nov 3, 2021
@esDotDev
Copy link
Author

esDotDev commented Nov 3, 2021

Not if you zero them out... which you would likely do in this use case.

@esDotDev
Copy link
Author

esDotDev commented Nov 3, 2021

Also TextField is just one example use case, so it's not important to get into details on TextField. Basically in any use case where we want to lean on your widget to calculate the target fontSize number, but then do "whatever else" after that point, this would enable that. Like SelectableText for instance, or any custom widget we want to plugin to wrap Text.

@esDotDev
Copy link
Author

esDotDev commented Nov 3, 2021

Here you can see we used it to do some quite advanced logic, it worked awesome. We switch between a regular Text and a TextField when the thing is tapped, and have styled the TextField to exactly match the padding you get with Text:

https://github.com/gskinnerTeam/flutter-folio/blob/f1a42df97609e0b28b03422a02b5b7a4cb04745b/lib/views/editor_page/placed_scrap_renderer.dart#L132

@simc
Copy link
Owner

simc commented Nov 3, 2021

@esDotDev That's really cool thanks for sharing. I started working on an AutoSizeBuilder widget that can be used for anything and also AutoSizeTextField and AutoSizeSelectableText. What do you think about that?

@esDotDev
Copy link
Author

esDotDev commented Nov 3, 2021

Sounds cool! So that would really just focus on producing double size value, and then we can do anything we need with it?

@simc
Copy link
Owner

simc commented Nov 3, 2021

Yes exactly. It's mostly used as a common builder for all the other AutoSize widgets and it should communicate with the AutoSizeGroup

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.

None yet

2 participants