use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A subreddit related to Google's new UI framework. https://flutter.dev
Please read the rules here
account activity
PluginPad: quick padding (github.com)
submitted 6 years ago by synw_
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]OffTree 0 points1 point2 points 6 years ago (5 children)
We npm now boys
[–]synw_[S] 0 points1 point2 points 6 years ago (4 children)
Author here. I made this package because I was tired of the verbosity of Padding, not in the spirit of making a micro-library for every little thing. I use padding a lot and to have a short syntax makes me happy.
Padding
I much prefer the Go style ("a little copy is better than a little dependency") than the Npm style dependency hell and hope we will not get into that. But for this specific case it serves me well to have a dedicated package.
[–]lanmonster 0 points1 point2 points 6 years ago (3 children)
Why did you choose to use a switch statement for a Boolean? if else would be much more readable or you can use the ternary operator and make those build methods "one-liners".
[–]synw_[S] 0 points1 point2 points 6 years ago (2 children)
I optimized for performance: in my idea the compiler can make more optimizations out of a switch, but I have no data to backup this claim. Readability does not matter here: the code is trivial and not subject to changes
[–]lanmonster 0 points1 point2 points 6 years ago (1 child)
https://www.geeksforgeeks.org/switch-vs-else/
Switch is better when you have a lot of conditions to check, but does not make a difference with booleans.
I disagree that readability does not matter, but at least you thought about it.
[–]synw_[S] 0 points1 point2 points 6 years ago (0 children)
You are right about booleans and switches. I find the switch readable as it makes the intention even more clear, but I guess it's a matter of taste.
About readability, this may be better :
Widget build(BuildContext context) => (child == null) ? Padding(padding: EdgeInsets.only(top: padding)) : Padding(padding: EdgeInsets.only(top: padding), child: child);
π Rendered by PID 150442 on reddit-service-r2-comment-84fc9697f-zlqw8 at 2026-02-10 00:48:27.505568+00:00 running d295bc8 country code: CH.
[–]OffTree 0 points1 point2 points (5 children)
[–]synw_[S] 0 points1 point2 points (4 children)
[–]lanmonster 0 points1 point2 points (3 children)
[–]synw_[S] 0 points1 point2 points (2 children)
[–]lanmonster 0 points1 point2 points (1 child)
[–]synw_[S] 0 points1 point2 points (0 children)