<?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>Forem: fathidevs</title>
    <description>The latest articles on Forem by fathidevs (@fathidevs).</description>
    <link>https://forem.com/fathidevs</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%2F842857%2Fa53fab0c-4aea-4059-b90e-70f3c41168da.jpg</url>
      <title>Forem: fathidevs</title>
      <link>https://forem.com/fathidevs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/fathidevs"/>
    <language>en</language>
    <item>
      <title>Days 4-7: Busy days</title>
      <dc:creator>fathidevs</dc:creator>
      <pubDate>Sun, 24 Apr 2022 20:50:16 +0000</pubDate>
      <link>https://forem.com/fathidevs/days-4-7-busy-days-5h2e</link>
      <guid>https://forem.com/fathidevs/days-4-7-busy-days-5h2e</guid>
      <description>&lt;p&gt;The past few days I was barely on my laptop, and when I am, I write 2 lines of code that is work related.&lt;/p&gt;

&lt;p&gt;But I was able to prepare the majority of the necessary stuff to get me started to build with appwrite. installed Docker desktop and appwrite backend server, and explored some functions, next, I will make a separate Flutter app as backend playground.&lt;/p&gt;

&lt;p&gt;The past busy days didn't  keep me away from my phone (of course), so I had the chance to explore appwrite docs for Flutter, and I'm surprised by how easy to interact with the backend. after the hackathon, I will try appwrite for Android. &lt;/p&gt;

</description>
      <category>appwritehack</category>
    </item>
    <item>
      <title>Day 3: Still UI/bottom navigation bar (custom)</title>
      <dc:creator>fathidevs</dc:creator>
      <pubDate>Tue, 19 Apr 2022 19:10:17 +0000</pubDate>
      <link>https://forem.com/fathidevs/day-3-still-uibottom-navigation-bar-custom-m7h</link>
      <guid>https://forem.com/fathidevs/day-3-still-uibottom-navigation-bar-custom-m7h</guid>
      <description>&lt;p&gt;I think I moved the biggest rock off the way by finishing up the custom bottom navigation bar, I could make the bottom navigation bar as buttons inside container that takes the screen width and the height of &lt;code&gt;BottomNavigationBar() //kBottomNavigationBarHeight&lt;/code&gt; But because I'm fairly new to Flutter and there are a lot of stuff to learn, I thought to make a widget (and possibly a flutter package) and use it exactly like I'm using the built-in Flutter BottomNavigationBar widget or external package.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;The final result isn't as Flutter's BottomNavigationBar but it does the exact same thing, the only difference is the code implementation and how events are handled. Also before I forget to mention, I made changes in the &lt;code&gt;CustomButton&lt;/code&gt; widget from &lt;a href="https://dev.to/fathidevs/day-2-crafting-hapoc-ui-1p8p"&gt;Day 2&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy4tez0ri2d6v10p068qj.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy4tez0ri2d6v10p068qj.gif" alt="Preview" width="" height=""&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;The funny thing is, the &lt;code&gt;CustomBottomNavigationBar&lt;/code&gt; does not interact with clicks, it is basically a &lt;code&gt;container&lt;/code&gt; with &lt;code&gt;CustomButton&lt;/code&gt; widgets, what interact with clicks is the &lt;code&gt;CustomButton&lt;/code&gt; itself, so in &lt;code&gt;CustomBottomNavigationBar(childeren: _items)&lt;/code&gt; each item has its own &lt;code&gt;onPressed()&lt;/code&gt; and because it is &lt;code&gt;VoidCallback&lt;/code&gt; it does not return any args like in the normal &lt;code&gt;BottomNavigatoinBar&lt;/code&gt; the &lt;code&gt;onPressed(index) =&amp;gt; ...&lt;/code&gt; returns an integer indicating the index of the current bottom navigation bar, in my &lt;code&gt;BottomNavigatoinBar&lt;/code&gt;, this is how I managed to get the index:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;onPressed: () {
          setState(() {
            _currentIndex = 1; // setting the index manually
          // setting the buttons bool values to appear as one 
         // button is pushed down at a time

            tapStatus[_currentIndex] = true; // the clicked button

            tapStatus[0] = false; 
            tapStatus[2] = false;
            _screenController.jumpToPage(_currentIndex);
          });
        },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I did not want to waste more time on making the &lt;code&gt;CustomBottomNavigationBar&lt;/code&gt; receives click event, I might apply changes some other time&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dartpad.dev/51438a3b24dd6a6c91fd76af5ed358ac"&gt;check out my custom bottom navigation bar&lt;/a&gt;&lt;/p&gt;

</description>
      <category>appwritehack</category>
      <category>flutter</category>
    </item>
    <item>
      <title>Day 2: crafting HAPOC UI</title>
      <dc:creator>fathidevs</dc:creator>
      <pubDate>Mon, 18 Apr 2022 20:52:27 +0000</pubDate>
      <link>https://forem.com/fathidevs/day-2-crafting-hapoc-ui-1p8p</link>
      <guid>https://forem.com/fathidevs/day-2-crafting-hapoc-ui-1p8p</guid>
      <description>&lt;p&gt;I thought I will finish the UI fast since it's not a very complicated interface, but I had to learn how to make custom 3D buttons in Flutter. I didn't think about how the button should look like when doing the UX, it was a design decision when I finished off the main screen.&lt;br&gt;
&lt;br&gt;&lt;br&gt;
it's a game right? it has to offer some interactive experience. so I looked up few tutorials and source codes on Github, here are the two Githubs that actually helped me:&lt;br&gt;
&lt;br&gt;&lt;br&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://github.com/raj457036/Flutter-Clicky-Button"&gt;Clicky button&lt;/a&gt;
very intense 3D shape and satisfying to click on and watch it bounce. &lt;a href="https://github.com/raj457036/Flutter-Clicky-Button/blob/master/images/demo.gif"&gt;Preview&lt;/a&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/nguyenvanduocit/button3d"&gt;Button3D&lt;/a&gt;
very simple and straightforward, unlike Clicky Button it has two shapes and gives the illusion of a 3D button viewed from angel between top and front. &lt;a href="https://camo.githubusercontent.com/a2558c859c1ac02b494972e6301a6fb3ac56651ff7df1f96682977b5554818f9/68747470733a2f2f63646e2d696d616765732d312e6d656469756d2e636f6d2f6d61782f313630302f312a636d37587a5133486333654e4a3845616537563462512e706e67"&gt;Preview&lt;/a&gt;

The button I created is inspired by both source codes above, it is like Clicky in animation and Button3D in design.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In Button3D the design is two widget above each other, the top is triggered when pressed and the bottom (I called it &lt;code&gt;_body()&lt;/code&gt;) is &lt;code&gt;static&lt;/code&gt;, both are wrapped in &lt;code&gt;Stack() =&amp;gt; GestureDetector()&lt;/code&gt; the &lt;code&gt;GestureDetector()&lt;/code&gt; job is to toggle between true and false when tap detected, and because the top widget returns &lt;code&gt;AnimatedPosition()&lt;/code&gt; I can play with the &lt;code&gt;Duration()&lt;/code&gt; to achieve smooth animation.&lt;br&gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;
here is the top widget, the one that detects taps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Widget _topFace() {
    return AnimatedPadding(
      duration: Duration(milliseconds:600),
      curve: Curves.ease,
      padding: EdgeInsets.only(bottom: isTapped ? 0.0 : 20.0),
      child: Container(
        decoration: BoxDecoration(
            color: Colors.red,
            borderRadius: BorderRadius.circular(5.0)),
        child: Padding(
          padding: EdgeInsets.symmetric(
              vertical: 18.0, horizontal: 18.0),
          child: LimitedBox(
            maxWidth: MediaQuery.maybeOf(context)!.size.width *.9,
            child: Text(
              "Click me",
              style: TextStyle(color: Colors.white),
            ),
          ),
        ),
      ),
    );
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important variable in above widget is &lt;code&gt;isTapped&lt;/code&gt; the key to the juicey movements lol, it is false by default and changes to &lt;code&gt;true&lt;/code&gt; only when &lt;code&gt;onTapDown // finger is not lifted or moved from its position&lt;/code&gt; in &lt;code&gt;GestureDetector()&lt;/code&gt; is triggered, then &lt;code&gt;setState(() =&amp;gt; istapped = false);&lt;/code&gt; when &lt;code&gt;onTapup // finger lifted from the screen&lt;/code&gt; and &lt;code&gt;onTapCanceled // finger slid from its position&lt;/code&gt;, also the VoidCallback &lt;code&gt;onPressed()&lt;/code&gt; is detected when &lt;code&gt;onTapUp&lt;/code&gt; is triggered, because user lift the finger after "press" action is done as a complete action and expect feedback.&lt;br&gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;
here is the methods for detecting gestures:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void _tapDown(TapDownDetails details) {
    setState(() {
      isTapped = true;
    });
  }

  void _tapCancel() {
    setState(() {
      isTapped = false;
    });
  }

  void _tapUp(TapUpDetails details) {
    setState(() {
      isTapped = false;
    });
    widget.onPressed();
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the static &lt;code&gt;Widget _body(){...}&lt;/code&gt; that doesn't animate or interact with click event, or any event:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Widget _body() {
    return Container(
      decoration: BoxDecoration(
        color: Colors.blue,
        borderRadius: BorderRadius.circular(5.0),
      ),
      child: Padding(
        padding: EdgeInsets.symmetric(
            vertical: 18.0, horizontal: 18.0 - .1),
        child: LimitedBox(
          maxWidth: MediaQuery.maybeOf(context)!.size.width * .9,
          child: Visibility(
            visible: false,
            maintainAnimation: true,
            maintainSize: true,
            maintainState: true,
            child: Text(
              "Click Me",
              style: TextStyle(color: Colors.blue),
            ),
          ),
        ),
      ),
    );
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you can see useless &lt;code&gt;Text()&lt;/code&gt; widget in the static &lt;code&gt;Widget _body(){...}&lt;/code&gt; with &lt;code&gt;visibility: false&lt;/code&gt;, it's because I set the &lt;code&gt;Widget _topFace(){...}&lt;/code&gt; to wrap the &lt;code&gt;Text()&lt;/code&gt; and I could not achieve that without setting copy of the &lt;code&gt;Text()&lt;/code&gt; in the &lt;code&gt;Widget _body(){...}&lt;/code&gt; otherwise it will wrap on itself and be smaller than &lt;code&gt;Widget _topFace(){...}&lt;/code&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://gist.github.com/fathidevs/28751f3529d497727946aaea820a9967"&gt;check the complete code&lt;/a&gt;&lt;/p&gt;

</description>
      <category>appwritehack</category>
    </item>
    <item>
      <title>Day 1: Setting up for participation in the Appwrite hackathon</title>
      <dc:creator>fathidevs</dc:creator>
      <pubDate>Sat, 16 Apr 2022 13:10:27 +0000</pubDate>
      <link>https://forem.com/fathidevs/day-1-setting-up-for-participation-in-the-appwrite-hackathon-29ac</link>
      <guid>https://forem.com/fathidevs/day-1-setting-up-for-participation-in-the-appwrite-hackathon-29ac</guid>
      <description>&lt;p&gt;I'm probably too late to the party lol.&lt;/p&gt;

&lt;p&gt;I just finished up UX design of the app, and might not do too much in UI design (maybe just colors) to save time. &lt;/p&gt;

&lt;p&gt;The app idea is a multiplayer game where players compete to form a name off a letter. I want to reveal the details about the game but I'm not sure if it's a good, please let me know if it's okay to reveal, I will do that on Day2 update.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is in Appwrite that I'm going to utilize?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Obviously &lt;strong&gt;Database&lt;/strong&gt; is the most important thing for the app to perform CRUD operation, there will be no "Read" operation though, because, coming from Firebase I think it is costly (this is my thought before reading the docs).&lt;/p&gt;

&lt;p&gt;The initial idea was to allow players to create "Room" then the created room will be available for every players in the app, but to cut down the cost I thought to allow players make "Private Room" then invite friends. I think there will be "Read" operation after all! cause "Friends List" lol :).&lt;/p&gt;

&lt;p&gt;other stuff to utilize is &lt;strong&gt;Authentication&lt;/strong&gt; at least for the sake of creating the "Rooms" under unique IDs (users Token, ID, etc...) and prevent crashes and awkward moments.&lt;/p&gt;

&lt;p&gt;probably &lt;strong&gt;Storage&lt;/strong&gt; to allow users upload their photo to replace an avatar. The game has flashing card with design, so I might utilize the storage even more by allowing users upload and use their custom design or a store for card design, it will be great if I'm able to do all that before the deadline, if not, maybe when I'm going to scale the app further.&lt;/p&gt;

&lt;p&gt;And &lt;strong&gt;other things that I'm going to find out that I need when I actually start to develop&lt;/strong&gt; will be included in the coming series&lt;/p&gt;

&lt;p&gt;Tomorrow is Sunday! so I will try to finish the UI in Flutter to be able to focus on the backend throughout the week while my 9 - 5 job.&lt;/p&gt;

&lt;p&gt;although I'm native Android dev, I chose to make it in Flutter because I'm fairly new to Flutter, and at the time of this post, I'm using Flutter for 2 months and 16 days, because my job requires it. Also it is a good opportunity to sharpen my newborn skill, and to explore other backend services (I'm familiar with Firebase and phpMyAdmin).&lt;/p&gt;

&lt;p&gt;26 days left, maybe I'm not too late to the party&lt;/p&gt;

</description>
      <category>appwritehack</category>
    </item>
  </channel>
</rss>
