<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Giorgio Bertolotti</title>
    <description>The latest articles on DEV Community by Giorgio Bertolotti (@giorgiobertolotti).</description>
    <link>https://dev.to/giorgiobertolotti</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F176980%2F83ef56c2-446e-468b-9121-45e9b64fd9c0.jpeg</url>
      <title>DEV Community: Giorgio Bertolotti</title>
      <link>https://dev.to/giorgiobertolotti</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/giorgiobertolotti"/>
    <language>en</language>
    <item>
      <title>Flutter tips and tricks I use</title>
      <dc:creator>Giorgio Bertolotti</dc:creator>
      <pubDate>Sun, 29 Sep 2019 16:58:47 +0000</pubDate>
      <link>https://dev.to/giorgiobertolotti/flutter-tips-and-tricks-i-use-116o</link>
      <guid>https://dev.to/giorgiobertolotti/flutter-tips-and-tricks-i-use-116o</guid>
      <description>&lt;h1&gt;
  
  
  A little intro
&lt;/h1&gt;

&lt;p&gt;Hello everybody!&lt;/p&gt;

&lt;p&gt;My name is Giorgio Bertolotti and I'm a 20yo software developer.&lt;br&gt;&lt;br&gt;
I'm currently enrolled in a BS degree in computer science and in my free time I love playing with Flutter. And that's the reason I'm writing this article, just wanted to share some tricks and tips I've found very useful about Flutter programming.&lt;/p&gt;
&lt;h1&gt;
  
  
  Tips and tricks
&lt;/h1&gt;
&lt;h2&gt;
  
  
  1: SizedBox
&lt;/h2&gt;

&lt;p&gt;I know it may sound obvious to some of you, but it happens that I see people spacing widgets inside Columns using Paddings, so what I want to suggest you now is to try out &lt;strong&gt;SizedBox&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
Let's say you want to put a space between two Text widgets using the SizedBox, what you've to do is simply:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Column(
  children: [
    Text("Text1"),
    SizedBox(height: 20.0),
    Text("Text1"),
  ],
)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Easy, right?&lt;br&gt;&lt;br&gt;
And now let's say you want that space to become the 20% of the column height, let's see how with &lt;strong&gt;FractionallySizedBox:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Column(
  children: [
    Text("Text1"),
    FractionallySizedBox(heightFactor: 0.2),
    Text("Text1"),
  ],
)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  2: InkWell and Container
&lt;/h2&gt;

&lt;p&gt;Okay, this is a trick that often happens that I use... We want to achieve something like this in the picture, but at the same time we want the material touch ripples we get from InkWell.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9GCfZKkI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/shl3r92eco5oon3ml1ck.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9GCfZKkI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/shl3r92eco5oon3ml1ck.png" alt="Image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How do we do that?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Container(
  decoration: BoxDecoration(
    borderRadius: BorderRadius.circular(30.0),
    color: Colors.yellow,
    boxShadow: [
      BoxShadow(
        color: Colors.black26,
        blurRadius: 2.0,
        offset: Offset(0.0, 4.0),
      )
    ],
  ),
  child: Material(
    color: Colors.transparent,
    child: InkWell(
      onTap: () {},
      borderRadius: BorderRadius.circular(30.0),
      child: Container(
        padding: EdgeInsets.symmetric(vertical: 15.0),
        child: Center(
          child: Text(
              "Text",
              style: TextStyle(
                color: Colors.black,
                fontSize: 30.0,
                fontWeight: FontWeight.w900,
              ),
            ),
        ),
      ),
    ),
  ),
);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The trick stays all in the &lt;strong&gt;Material&lt;/strong&gt; widget wrapping InkWell, without that nothing will work.&lt;/p&gt;

&lt;h2&gt;
  
  
  3: Line height
&lt;/h2&gt;

&lt;p&gt;The next tip is something I use when I want a multi-line text to be as "condensed" as possible. This is how to reduce the line height in Flutter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RichText(
  text: TextSpan(
    style: TextStyle(color: textColor),
    children: [
      TextSpan(
          text: "Text1\n",
          style: TextStyle(height: 0.9)),
      TextSpan(
          text: "Text2",
          style: TextStyle(height: 0.9)),
    ],
  ),
),
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The "&lt;em&gt;height&lt;/em&gt;" argument for TextStyle is a multiplier you apply to the base height of the Text widget you're creating, so setting the factor to 0.9 scales the height to the 90% of the default one.&lt;/p&gt;

&lt;h2&gt;
  
  
  4: Dismissible
&lt;/h2&gt;

&lt;p&gt;This is something very useful if you want to achieve a "vertical swipe to close" effect, like when you open a profile image in Whatsapp.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Dismissible(
  key: Key('dismissible'),
  direction: DismissDirection.vertical,
  onDismissed: (direction) {
    Navigator.pop(context);
  },
  background: Container(
    color: Colors.black,
  ),
  movementDuration: Duration(milliseconds: 100),
  resizeDuration: Duration(milliseconds: 100),
  child: ...
);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  5: Blink effect
&lt;/h2&gt;

&lt;p&gt;I understand this is something that doesn't often happen to use, but I needed it recently and that's how I achieved it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Timer _blinkTimer;
Duration _halfSec = const Duration(milliseconds: 500);
bool _visibility = true;

@override
void dispose() {
  if (_blinkTimer != null) _blinkTimer.cancel();
  super.dispose();
}

@override
Widget build(BuildContext context) {
  ...
  Opacity(
    opacity: _visibility ? 1 : 0,
    child: ...
  ),
  ...
}

_startBlink() {
  _blinkTimer = Timer.periodic(
    _halfSec,
    (Timer timer) =&amp;gt; setState(() {
      _visibility = !_visibility;
    }),
  );
}

_stopBlink() {
  _blinkTimer.cancel();
  setState(() {
    _visibility = true;
  });
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;If you have any tip or trick you want to share or you have any better way to achieve what I've done above, please take a moment to comment down here!&lt;/p&gt;

&lt;p&gt;Thanks a lot for reading, I hope you've found something interesting!&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>tricks</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Looking for online courses for mobile design</title>
      <dc:creator>Giorgio Bertolotti</dc:creator>
      <pubDate>Thu, 25 Jul 2019 20:26:30 +0000</pubDate>
      <link>https://dev.to/giorgiobertolotti/looking-for-online-courses-for-mobile-design-4g7f</link>
      <guid>https://dev.to/giorgiobertolotti/looking-for-online-courses-for-mobile-design-4g7f</guid>
      <description>&lt;p&gt;Hello everybody!&lt;br&gt;
Can anyone suggest me some online platform where I can follow courses to design the UI for a mobile applications?&lt;/p&gt;

&lt;p&gt;I just recently realized that in order to develop a good looking app I should first throw down a design that convinces me and then apply it instead of continuing to make small adjustments that I'm never satisfied with.&lt;/p&gt;

&lt;p&gt;If anyone has any general advice about the ui/ux on mobile applications, any suggestions are appreciated!&lt;/p&gt;

&lt;p&gt;Thanks a lot!&lt;/p&gt;

</description>
      <category>help</category>
      <category>ui</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
