-
Notifications
You must be signed in to change notification settings - Fork 126
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
For example app make number of emoji columns dynamic based on screen width #134
Conversation
@timmaffett Thanks for your improvements to the example ! Code-wise it looks good to me, but I would like to avoid too much complexity in the basic example. I would prefer to create an extra example e.g. |
@Fintasys I have moved the dynamic column sizing to it's own file. |
I was just trying to illustrate it was a 9 pixel margin on both sides of
the emoji.
The compiler does the math so it is identical to writing 18.
Maybe I need to explain that in a comment or just put 18.. 😜
…On Sun, Jun 4, 2023, 6:01 AM Stefan Humm ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In example/lib/main-dynamic-columns.dart
<#134 (comment)>
:
> +}
+
+class _MyAppState extends State<MyApp> {
+ final TextEditingController _controller = TextEditingController();
+ bool emojiShowing = false;
+
+ @OverRide
+ void dispose() {
+ _controller.dispose();
+ super.dispose();
+ }
+
+ @OverRide
+ Widget build(BuildContext context) {
+ final screenSize = MediaQuery.of(context).size;
+ final emojiPadding = 9*2;
Any reason for not just writing 18 ? 🤔
—
Reply to this email directly, view it on GitHub
<#134 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA3YUSLVVKELO4DUVP6HDPLXJSBLBANCNFSM6AAAAAAXRD4OFA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Comment makes more sense. After that I gonna merge, thanks for the work! |
done and I ran |
This change makes the number of columns for the emoji picker dynamic based on screen width. When running the example on windows I was surpised to see this ridiculous result:
Here instead is a more expected behavior for an emoji picker (this is the example with this PR added):
For clarity I split out all of the emoji size related calculations to the top of the build method to better illustrate to the users what is going on.
For mobile versions the number of columns remains a reasonable number (for Pixel3 emulator it remains 7 as it was hard coded, for more modern phones the number of emoji columns increases as one would expect).
Thanks for the nice package!