<?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: Elvis</title>
    <description>The latest articles on DEV Community by Elvis (@elvis_igiebor).</description>
    <link>https://dev.to/elvis_igiebor</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%2F902567%2F454bf2f0-d81a-4945-8219-40f592a95c42.jpeg</url>
      <title>DEV Community: Elvis</title>
      <link>https://dev.to/elvis_igiebor</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/elvis_igiebor"/>
    <language>en</language>
    <item>
      <title>Apartment listing Detail UI for Beginners with flutter</title>
      <dc:creator>Elvis</dc:creator>
      <pubDate>Thu, 15 Sep 2022 14:27:46 +0000</pubDate>
      <link>https://dev.to/elvis_igiebor/apartment-listing-detail-ui-for-beginners-with-flutter-98h</link>
      <guid>https://dev.to/elvis_igiebor/apartment-listing-detail-ui-for-beginners-with-flutter-98h</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--095LcR6I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/glcfl88q1jgz5wtf5gwo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--095LcR6I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/glcfl88q1jgz5wtf5gwo.png" alt="Image description" width="880" height="1564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Good to have you here again&lt;br&gt;
In this episode we shall go through the UI above together. I encourage you to check other episodes, for simpler ui designs.&lt;/p&gt;

&lt;p&gt;Everything is on &lt;a href="https://github.com/Elvis-1/apartment_listing_ui"&gt;github&lt;/a&gt;, so you can download and check the code. Only portrait mode was considered but Its completely responsive on different screens.&lt;/p&gt;

&lt;p&gt;Before we do a quick analysis of the architecture of the screen, lets look at the folder structure. We have three folders which are: Assets folder (located in the root folder), screens folder (inside lib folder) and widgets folder (also inside lib folder). Then we have the main.dart, where the app is run. The screen we are considering here is the details' screen. We are running this screen from main.dart.&lt;/p&gt;

&lt;p&gt;Lets consider the design and how it was achieved.&lt;/p&gt;

&lt;p&gt;Lets start with the app bar. For this app, we did not use the app bar widget, we created our custom app bar. If you notice, the screen has gradient and a background image. For flexibility, we did not use app bar widget&lt;/p&gt;

&lt;p&gt;We went straight to the body and wrapped the body with a padding.&lt;/p&gt;

&lt;p&gt;From the screen, you will notice two type of stack,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The widgets are vertically aligned on each other making it a column&lt;/li&gt;
&lt;li&gt;Widgets also overlay on each other making it a Stack&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So we started with a column as a direct child of the padding (remember we said the padding wraps the whole body?).&lt;br&gt;
We calculated the screen height and width with media query. This makes it responsive on any screen.&lt;/p&gt;

&lt;p&gt;Let consider the first component of the app&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5hz691ST--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gxz07l34iw4gq6noacjf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5hz691ST--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gxz07l34iw4gq6noacjf.png" alt="First component" width="538" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this first component, we have the background image, the overlay for gradient, the app bar, the lease button, the apartment name and address, and the icon and text container.&lt;/p&gt;

&lt;p&gt;First we used the stack widget. Like we explained above, the stack widget, takes children widgets that overlay on themselves.&lt;/p&gt;

&lt;p&gt;The first child of the stack widget is the background image container, followed by the linear gradient container,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;           // background image
              Container(
                height: height / 2,
                width: double.infinity,
                decoration: const BoxDecoration(
                    image: DecorationImage(
                        fit: BoxFit.cover,
                        image: AssetImage(
                          'assets/images/details_img.png',
                        ))),
              ),

              // linear gradient
              Container(
                height: height * .6,
                width: double.infinity,
                decoration: const BoxDecoration(
                  gradient: LinearGradient(
                      colors: [Colors.black45, Colors.transparent],
                      begin: Alignment.bottomCenter,
                      end: Alignment.topCenter),
                ),
              ),

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, we have the app bar which we called the header. To position it at the top of the screen, we used positioned widget (stack widgets takes position widget, this is why we had to use stack widget).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;           // header
              Positioned(
                left: 0,
                right: 0,
                top: height * 0.06,
                child: Padding(
                  padding: EdgeInsets.all(10),
                  child: Row(
                    mainAxisAlignment: 
              MainAxisAlignment.spaceBetween,
                    children: [
                      CircleIconButton(
                        height: height * 0.05,
                        icon: Icons.arrow_back_ios_new_rounded,
                      ),
                      Row(
                        children: [
                          CircleIconButton(
                            icon: Icons.favorite_border,
                            height: height * 0.05,
                          ),
                          SizedBox(
                            width: width * 0.07,
                          ),
                          CircleIconButton(
                              icon: Icons.bookmark_border,
                              height: height * 0.05)
                        ],
                      ),
                    ],
                  ),
                ),
              ),


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Positioned next to the header is the lease button and the apartment name and address&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;              Positioned(
                bottom: height * 0.22,
                left: 0,
                right: 0,
                child: Center(
                  child: ClipRRect(
                    // Clip it cleanly.
                    borderRadius: BorderRadius.circular(20),

                    child: BackdropFilter(
                      blendMode: BlendMode.src,
                      filter: ImageFilter.blur(sigmaX: 2, sigmaY: 2),
                      child: Container(
                        padding: const EdgeInsets.all(8),
                        height: MediaQuery.of(context).size.height * 0.08,
                        width: MediaQuery.of(context).size.width * 0.5,
                        decoration: BoxDecoration(
                          color: Colors.grey.withOpacity(0.3),
                        ),
                        alignment: Alignment.center,
                        child: Column(
                          mainAxisAlignment: MainAxisAlignment.center,
                          children: const [
                            Text(
                              'Lease',
                              style: TextStyle(
                                  color: Colors.white,
                                  fontWeight: FontWeight.w900,
                                  fontSize: 16),
                            ),
                            Text(
                              "\$175,000.00",
                              style: TextStyle(
                                  letterSpacing: 1.5,
                                  color: Colors.white,
                                  fontWeight: FontWeight.w900,
                                  fontSize: 16),
                            )
                          ],
                        ),
                      ),
                    ),
                  ),
                ),
              ),

              // apartment address
              Positioned(
                  bottom: height * 0.15,
                  left: 0,
                  right: 0,
                  child: Column(
                    children: const [
                      Text(
                        'WestVille Apartments',
                        style: TextStyle(
                            fontSize: 20,
                            letterSpacing: 2.0,
                            fontWeight: FontWeight.bold,
                            color: Colors.white),
                      ),
                      Text(
                        '3544 NW 24th Street Road',
                        style: TextStyle(
                            fontSize: 14,
                            letterSpacing: 2.0,
                            //fontWeight: FontWeight.bold,
                            color: Colors.white54),
                      ),
                    ],
                  )),

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly on the stack is the icontext container. You will notice from the screen that the icontext is in a row. check below;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ozlsfwqs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/85h78gwpuqiqdiywux1t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ozlsfwqs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/85h78gwpuqiqdiywux1t.png" alt="IconTextContainer" width="591" height="130"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We created the icon text container as a reusable widget since it repeats three time on the screen. Check the code below;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';
import 'dart:math' as math;

class IconTextContainer extends StatelessWidget {
  IconTextContainer({Key? key, required this.icon, required this.text})
      : super(key: key);
  IconData icon;
  String text;
  @override
  Widget build(BuildContext context) {
    return Transform(
      //alignment: Alignment.topRight,
      transform: Matrix4.skewY(0.4)..rotateZ(-math.pi / 12),
      child: Container(
        alignment: Alignment.center,
        height: MediaQuery.of(context).size.height * 0.09,
        width: MediaQuery.of(context).size.height * 0.09,
        decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(3),
            color: Colors.black87,
            border: Border.all(color: Colors.grey)),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Icon(
              icon,
              color: Colors.white,
            ),
            Container(
              // padding: const EdgeInsets.all(8.0),
              child: Text(
                text,
                style: const TextStyle(
                  color: Colors.white,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Again we used position widget to position it on the stack, then, use Row widget to horizontally align it. A Row widget takes children widget and align them horizontally.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   // icon and text containers
              Positioned(
                bottom: height * 0.05,
                left: 0,
                right: 0,
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceAround,
                  children: [
                    IconTextContainer(text: '3', icon: Icons.hotel_sharp),
                    IconTextContainer(
                        text: '4', icon: Icons.shopping_cart_sharp),
                    IconTextContainer(text: '2500', icon: Icons.window),
                  ],
                ),
              )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember we are still in a Column widget? The Stack widget above is the first child.&lt;/p&gt;

&lt;p&gt;Let see the other children of the column&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5k4dwbuR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x4k80xd3c2q82yhp8b9w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5k4dwbuR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x4k80xd3c2q82yhp8b9w.png" alt="Image description" width="547" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the first container, we have the agent image, details and icon.&lt;br&gt;
The container wraps a row widget. The row widget carries another row widget and an Icon widget as children&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; // agent image, details and icon 
          Container(
            // padding: EdgeInsets.all(10),
            height: height * 0.09,
            width: double.infinity,
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(10),
              color: const Color(0xFF2B2B2B),
            ),
            child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  // image and text row widget
                  Row(
                    children: [
                      // image
                      Image.asset('assets/images/shelly_img.png'),
                      // column of text widget
                      Padding(
                        padding: const EdgeInsets.all(4),
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          mainAxisAlignment: MainAxisAlignment.center,
                          children: const [
                            Text(
                              'Shelly Butcher',
                              style: TextStyle(color: Colors.white),
                            ),
                            Text(
                              'Agent',
                              style: TextStyle(color: Colors.grey),
                            ),
                          ],
                        ),
                      )
                    ],
                  ),
                  // icon
                  const Icon(
                    Icons.arrow_forward_ios_outlined,
                    color: Colors.grey,
                  ),
                ]),
          ),

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we have another column for description and details.&lt;br&gt;
These are text widgets&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dUP7tD5j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qy47y8wn549qqe8tkrn8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dUP7tD5j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qy47y8wn549qqe8tkrn8.png" alt="Image description" width="537" height="183"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  // description and details
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Padding(
                padding: EdgeInsets.symmetric(
                    vertical: MediaQuery.of(context).size.height * 0.01),
                child: Text(
                  'Description',
                  style: TextStyle(color: Colors.white, fontSize: 18),
                ),
              ),
              const Text(
                'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Egestas ut consectetur integer aliquam integer scelerisque. Nibh malesuada lectus mattis aliquet eget elementum dictum non. Eu, viverra gravida leo vitae non eu laoreet. Egestas lorem amet, diam diam neque vestibulum semper. Dictum fusce tellus eu et viverra ac augue aliquam fusce. Pharetra laoreet arcu vitae interdum id',
                style: TextStyle(color: Colors.white70),
              ),
            ],
          ),

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly is the apply button. This button is a container with a text widget as child.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;           Container(
            alignment: Alignment.center,
            width: double.infinity,
            height: MediaQuery.of(context).size.height * 0.06,
            margin:
                EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.01),
            // padding: EdgeInsets.only(top: 10),
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(10),
                gradient: LinearGradient(
                    begin: Alignment.topLeft,
                    end: Alignment.topRight,
                    stops: const [1, 1],
                    colors: [Colors.red.shade700, Colors.transparent])),
            child: const Text(
              'Apply',
              style: TextStyle(
                  color: Colors.white,
                  fontWeight: FontWeight.bold,
                  fontSize: 18),
            ),
          ),

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I know everything may not be clear, I understand. You can always drop your questions. Its my pleasure to help. Go through the code from the link below for more clarity.&lt;/p&gt;

&lt;p&gt;Github &lt;a href="https://github.com/Elvis-1/apartment_listing_ui"&gt;link&lt;/a&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>ios</category>
      <category>android</category>
    </item>
    <item>
      <title>How to build complex UIs with Flutter for beginners — Track Order Screen</title>
      <dc:creator>Elvis</dc:creator>
      <pubDate>Thu, 25 Aug 2022 10:19:00 +0000</pubDate>
      <link>https://dev.to/elvis_igiebor/how-to-build-complex-uis-with-flutter-for-beginners-track-order-screen-5h7l</link>
      <guid>https://dev.to/elvis_igiebor/how-to-build-complex-uis-with-flutter-for-beginners-track-order-screen-5h7l</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wfSVtofn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kepduiu22btd6zcrf4lu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wfSVtofn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kepduiu22btd6zcrf4lu.png" alt="Image description" width="880" height="1564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this episode we shall be coding another simple UI. Our aim is to help every beginner understand how to analyze and code any UI, both simple and complex.&lt;br&gt;
This is the second screen in this series. You can check the &lt;a href="https://dev.to/elvis_igiebor/how-to-build-complex-uis-with-flutter-for-beginners-cart-screen-aa5"&gt;first&lt;/a&gt; episode if you want to. Everything is on &lt;a href="https://github.com/Elvis-1/mobile_ui_screen_series"&gt;github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The project has two folders and two separate files. The folders are screens (contains all the screens or pages) and widget (contains reusable widgets), colors file and main file. All the colors used across the app are in the colors file, the app is ran in the main file&lt;/p&gt;

&lt;p&gt;Lets analyze the screen&lt;br&gt;
We have the first row which is the app bar&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JKpvi1m---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9rp4bgnnsrjudsknpa3a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JKpvi1m---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9rp4bgnnsrjudsknpa3a.png" alt="Image description" width="478" height="76"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The app bar has a leading icon and a centered text widget&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;      AppBar(
        backgroundColor: AppColors.backgroundColor,
        centerTitle: true,
        leading: const Icon(
          Icons.arrow_back_ios_new,
          color: AppColors.lightBlue,
        ),
        foregroundColor: AppColors.darkText,
        elevation: 0,
        title: const Text(
          'Track Order',
          style: TextStyle(color: AppColors.darkText),
        ),
        // leading: Icon(),
      ),
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We wrapped the body with a container in order to apply padding to the whole screen.&lt;/p&gt;

&lt;p&gt;If you check the content of the screen properly, you will notice that the widgets are vertically aligned. This makes the general content a column widget. Like we defined, Column widgets has children that are vertically aligned.&lt;/p&gt;

&lt;p&gt;Lets quickly analyze the content of the body before we look at the code&lt;/p&gt;

&lt;p&gt;The first child widget of the column widget is a column. This column has two child text widgets that are aligned to the center.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2okRbGos--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mwf78n9qbf0ulkaqlppb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2okRbGos--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mwf78n9qbf0ulkaqlppb.png" alt="Image description" width="429" height="127"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We created a container widget with a text widget as a child. We created a container so that we can give it full width and align the text to the left. Diagram is below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RxXAmOpQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3fpuy0pfe0xv34bn1wgb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RxXAmOpQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3fpuy0pfe0xv34bn1wgb.png" alt="Image description" width="442" height="64"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next to that is a Row widget of two text widgets. We used main axis alignment to horizontally separate them. Diagram below &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YyNZuqlI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ftpg99u4xxya7u0q87j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YyNZuqlI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ftpg99u4xxya7u0q87j.png" alt="Image description" width="427" height="52"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then we have an image with a text at the bottom. For this we created a reusable widget. Diagram below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3QSPXHw_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jr7xvx9vgtx2pzga2iqi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3QSPXHw_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jr7xvx9vgtx2pzga2iqi.png" alt="Image description" width="430" height="136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lastly is the button. For this, we created a container with a Row of text and icon widgets as children.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FsfDOQud--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8f8uftfhxj48isl3sv8p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FsfDOQud--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8f8uftfhxj48isl3sv8p.png" alt="Image description" width="435" height="85"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is the general structure of the app. The code is below;&lt;/p&gt;

&lt;p&gt;First is the code for the colors file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;import 'package:flutter/material.dart';

class AppColors {
  static const Color backgroundColor = Color(0xFFFFFFFF);
  static const Color lightBlue = Color(0xFF4C9EEB);
  static const Color darkText = Color(0xFF14171F);
  static const Color myCartBackgroundColor = Color(0xFfE5E5E5);
  static const Color inProgressColor = Color(0xFFEBB300);
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then the code for the button&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';
import 'package:mobile_ui_screen_series/colors.dart';

class ImageAndText extends StatelessWidget {
  ImageAndText({Key? key, required this.image, required this.text})
      : super(key: key);
  String image;
  String text;

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Container(
            width: 110,
            height: 90,
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(10.0),
                image: DecorationImage(
                    fit: BoxFit.cover, image: AssetImage(image)))),
        const SizedBox(
          height: 10,
        ),
        Text(
          text,
          style: const TextStyle(color: AppColors.lightBlue),
        )
      ],
    );
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We also have the track order screen&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';
import 'package:mobile_ui_screen_series/colors.dart';
import 'package:mobile_ui_screen_series/widgets/image_and_text_container.dart';

class TrackOrderScreen extends StatelessWidget {
  const TrackOrderScreen({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppColors.backgroundColor,
      appBar: AppBar(
        backgroundColor: AppColors.backgroundColor,
        centerTitle: true,
        leading: const Icon(
          Icons.arrow_back_ios_new,
          color: AppColors.lightBlue,
        ),
        foregroundColor: AppColors.darkText,
        elevation: 0,
        title: const Text(
          'Track Order',
          style: TextStyle(color: AppColors.darkText),
        ),
        // leading: Icon(),
      ),
      body: Container(
        padding: EdgeInsets.all(20),
        width: double.maxFinite,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
// column of text and images
            Column(
              children: [
                // Column of text
               const  SizedBox(
                  height: 40,
                ),
                Column(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: const [
                    Text(
                      'Your Order is on its way',
                      style: TextStyle(
                          color: AppColors.darkText,
                          fontWeight: FontWeight.bold,
                          fontSize: 25),
                    ),
                    SizedBox(
                      height: 20,
                    ),
                    Text('Order will arrive in 3 days',
                        style: TextStyle(
                          fontSize: 16,
                        )),
                  ],
                ),
               const SizedBox(
                  height: 30,
                ),
                // Container Text
                Container(
                  width: double.infinity,
                  child: const Text(
                    'Products',
                    textAlign: TextAlign.left,
                    style: TextStyle(
                        fontSize: 16,
                        color: AppColors.darkText,
                        fontWeight: FontWeight.w500),
                  ),
                ),
                const SizedBox(
                  height: 30,
                ),

                // Row of text
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: const [
                    Text(
                      '#90876532',
                      style: TextStyle(
                          // fontSize: 16,
                          color: AppColors.darkText,
                          fontWeight: FontWeight.w500),
                    ),
                    Text(
                      'In progress',
                      style: TextStyle(color: AppColors.inProgressColor),
                    ),
                  ],
                ),
                const SizedBox(
                  height: 30,
                ),
                // Row
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceAround,
                  children: [
                    // column of image and text
                    ImageAndText(
                        image: 'assets/images/snicker.png',
                        text: 'Nike Sneaker'),
                    ImageAndText(
                        image: 'assets/images/apple.png', text: 'Apple Laptop'),
                    ImageAndText(
                        image: 'assets/images/lady.png', text: 'Lady Shoe')
                  ],
                ),
              ],
            ),

            // container button
            Container(
              width: double.infinity,
              padding: EdgeInsets.symmetric(horizontal: 10, vertical: 15),
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(20),
                  color: AppColors.lightBlue),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: const [
                  Text(
                    'Container',
                    textAlign: TextAlign.center,
                    style: TextStyle(
                        color: AppColors.backgroundColor, fontSize: 20),
                  ),
                  SizedBox(
                    width: 10,
                  ),
                  Icon(
                    Icons.arrow_forward,
                    color: AppColors.backgroundColor,
                  )
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly is the main file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';
import 'package:mobile_ui_screen_series/screens/track_order_screen.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'Flutter Demo',
        home: TrackOrderScreen());
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thanks for reading. Its my pleasure to make sure you understand. You can drop your questions, and if you have any difficult UI mockup, I can guide you on how to go about it.&lt;/p&gt;

&lt;p&gt;Github link &lt;a href="https://github.com/Elvis-1/mobile_ui_screen_series"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>mobile</category>
      <category>firebase</category>
    </item>
    <item>
      <title>How to build complex UIs with Flutter for beginners — Cart Screen</title>
      <dc:creator>Elvis</dc:creator>
      <pubDate>Mon, 22 Aug 2022 08:38:00 +0000</pubDate>
      <link>https://dev.to/elvis_igiebor/how-to-build-complex-uis-with-flutter-for-beginners-cart-screen-aa5</link>
      <guid>https://dev.to/elvis_igiebor/how-to-build-complex-uis-with-flutter-for-beginners-cart-screen-aa5</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqnu237pbl6xdno6u7ob2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqnu237pbl6xdno6u7ob2.png" alt="cart screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can check the introduction to this series &lt;a href="https://dev.to/elvis_igiebor/how-to-build-complex-uis-with-flutter-for-beginners-3co8"&gt;here&lt;/a&gt;. Our aim is to understand how to analyze any mobile app mock up and build it responsively, from beginner’s to advance’ level.&lt;/p&gt;

&lt;p&gt;We are starting with a relatively simple screen, the cart screen.&lt;/p&gt;

&lt;p&gt;Mobile app mockups like we have above usually consists Rows and Columns, understanding how to identify them is the foundation for building any mock up. In flutter we describe them as widgets. Lets first understand what Row and Column widget is.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In simple terms, a Row is a widget that takes other widgets as children and align them horizontally. Column widget also accept other widgets as children but align them vertically.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Lets divide my cart page into Rows and Widget&lt;/p&gt;

&lt;p&gt;Let take the first Row&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc5limwzlai1c1pmscuah.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc5limwzlai1c1pmscuah.png" alt="first row on the cart screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This first Row has two widgets as children, Text(‘My Cart’) widget and an Icon() widget.&lt;/p&gt;

&lt;p&gt;Lets see the second row&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frikqf33cyxl3wm7q0nkk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frikqf33cyxl3wm7q0nkk.png" alt="second row on the cart screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The second Row too has children widgets which are a Row and a Container widget.&lt;/p&gt;

&lt;p&gt;If you notice, in My Cart screen, all the Row widgets are aligned vertically, or siting vertically on each other, this makes the general structure a Column widget.&lt;/p&gt;

&lt;p&gt;For better understanding, lets analyze the second Row above. It has two children widgets which are a Row and a Container.&lt;/p&gt;

&lt;p&gt;The Row widget has two children, Image and a Column widget&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvd3cnhvja9ibj8ul0pw2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvd3cnhvja9ibj8ul0pw2.png" alt="image and column"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Container widget takes a Row widget, this Row widget has three children, Icon, Text and Icon widget.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fueckf9h0j0ov49bcqxb6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fueckf9h0j0ov49bcqxb6.png" alt="Container with a child row widget"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lets analyze the last Row in My Cart Screen&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7vvepv5fr2prnc3ry9px.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7vvepv5fr2prnc3ry9px.png" alt="last row on the cart screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This Row also has two children, a Column and a Container widget. The Column widget has two Text widgets. The Container widget has a Text widget as a child.&lt;/p&gt;

&lt;p&gt;I will drop the github link for the complete code. Everything on the Cart screen was created from scratch, including buttons. The colors used are hex colors. There are two folders, screens and widgets ( re-usable widgets are written here), were the colors file and then the main file where the project is ran.&lt;/p&gt;

&lt;p&gt;Here is the cart screen page&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';
import 'package:mobile_ui_screen_series/colors.dart';
import 'package:mobile_ui_screen_series/widgets/my_cart_items_constainer.dart';

class MyCartScreen extends StatelessWidget {
  const MyCartScreen({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        height: MediaQuery.of(context).size.height,
        width: double.maxFinite,
        color: AppColors.myCartBackgroundColor,
        child: Center(
          child: Container(
            decoration: BoxDecoration(
                color: AppColors.backgroundColor,
                borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(25),
                    topRight: Radius.circular(25))),
            padding: EdgeInsets.all(10),
            width: 400,
            height: 450,
            child: Column(
              children: [
                const SizedBox(
                  height: 30,
                ),
                // row of text and icon
                Row(
                  children: const [
                    Expanded(
                      child: Center(
                        child: Text(
                          'My Cart',
                          style: TextStyle(
                              color: AppColors.darkText,
                              fontSize: 20,
                              fontWeight: FontWeight.bold),
                        ),
                      ),
                    ),
                    Icon(
                      Icons.close,
                      color: AppColors.lightBlue,
                      size: 30,
                    ),
                  ],
                ),

                // column of image, text and button
                SizedBox(
                  height: 20,
                ),
                Column(
                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                  children: [
                    MyCartItemsContainer(
                        image: 'assets/images/snicker.png',
                        itemName: 'Nike Sneaker',
                        itemPrice: 'NGN250,000',
                        itemQuantity: '2'),
                    MyCartItemsContainer(
                        image: 'assets/images/apple.png',
                        itemName: 'Apple Laptop',
                        itemPrice: 'NGN350,000',
                        itemQuantity: '1'),
                    MyCartItemsContainer(
                        image: 'assets/images/lady.png',
                        itemName: 'Nike Sneaker',
                        itemPrice: 'NGN50,000',
                        itemQuantity: '1')
                  ],
                ),
                SizedBox(
                  height: 50,
                ),
                // row of text and button
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    // column of text
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Text(
                          'Total',
                          style: TextStyle(
                              fontSize: 16, color: AppColors.lightBlue),
                        ),
                        Text(
                          'NGN750,000',
                          style: TextStyle(
                              color: AppColors.darkText,
                              fontSize: 20,
                              fontWeight: FontWeight.bold),
                        )
                      ],
                    ),
                    // button
                    Container(
                      padding: EdgeInsets.all(15),
                      width: 150,
                      height: 50,
                      decoration: BoxDecoration(
                          color: AppColors.lightBlue,
                          borderRadius: BorderRadius.circular(25)),
                      child: Text(
                        'Checkout',
                        style: TextStyle(
                            color: AppColors.backgroundColor,
                            fontWeight: FontWeight.bold),
                        textAlign: TextAlign.center,
                      ),
                    )
                  ],
                )
              ],
            ),
          ),
        ),
      ),
    );
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will notice that the second Row ( the image is above) is repeated three times. So we created a widget in the widgets folder and added it to the cart screen page as a reusable widget.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';
import 'package:mobile_ui_screen_series/colors.dart';

class MyCartItemsContainer extends StatelessWidget {
  MyCartItemsContainer(
      {Key? key,
      required this.image,
      required this.itemName,
      required this.itemPrice,
      required this.itemQuantity})
      : super(key: key);
  String image;
  String itemName;
  String itemPrice;
  String itemQuantity;
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(bottom: 20),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          //a  row of image and text
          Row(
            children: [
              Image(fit: BoxFit.cover, image: AssetImage(image)),
              SizedBox(
                width: 15,
              ),
              Column(
                children: [
                  Text(
                    itemName,
                    style: TextStyle(
                        color: AppColors.lightBlue,
                        fontSize: 16,
                        fontWeight: FontWeight.bold),
                  ),
                  SizedBox(
                    height: 5,
                  ),
                  Text(
                    itemPrice,
                    style: TextStyle(
                      color: AppColors.darkText,
                      fontSize: 16,
                      //fontWeight: FontWeight.bold
                    ),
                  )
                ],
              ),
            ],
          ),
          // button
          Container(
            padding: EdgeInsets.all(8),
            width: 100,
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(20),
                border: Border.all(color: AppColors.lightBlue)),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: [
                Icon(
                  Icons.remove,
                  size: 15,
                  color: AppColors.lightBlue,
                ),
                Text(
                  itemQuantity,
                  style: TextStyle(
                    fontSize: 20,
                    color: AppColors.lightBlue,
                  ),
                ),
                Icon(
                  Icons.add,
                  size: 15,
                  color: AppColors.lightBlue,
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly, we have the colors file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';

class AppColors {
  static const Color backgroundColor = Color(0xFFFFFFFF);
  static const Color lightBlue = Color(0xFF4C9EEB);
  static const Color darkText = Color(0xFF14171F);
  static const Color myCartBackgroundColor = Color(0xFfE5E5E5);
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We shall be drawing other screens. Our focus in this first episode is not responsiveness but how to identify Column and Row widgets.&lt;/p&gt;

&lt;p&gt;Its our pleasure to teach, so you can drop any question and If you need any personal assistance, you can request for our mail.&lt;/p&gt;

&lt;p&gt;Download the code : &lt;a href="https://github.com/Elvis-1/mobile_ui_screen_series" rel="noopener noreferrer"&gt;Github link&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Pls follow for more episodes.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>android</category>
      <category>ios</category>
      <category>mobile</category>
    </item>
    <item>
      <title>How to build complex UIs with Flutter for beginners</title>
      <dc:creator>Elvis</dc:creator>
      <pubDate>Thu, 18 Aug 2022 03:52:34 +0000</pubDate>
      <link>https://dev.to/elvis_igiebor/how-to-build-complex-uis-with-flutter-for-beginners-3co8</link>
      <guid>https://dev.to/elvis_igiebor/how-to-build-complex-uis-with-flutter-for-beginners-3co8</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HzAMHpYT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aeu1fw9fxk236iql7piq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HzAMHpYT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aeu1fw9fxk236iql7piq.png" alt="Image description" width="414" height="896"&gt;&lt;/a&gt;&lt;br&gt;
Understanding how to build UIs in flutter can be very confusing for beginners.&lt;/p&gt;

&lt;p&gt;In my opinion, Flutter is the easiest framework for building UIs, though there are no drags and drops, every component is coded. I think this is where most beginners find it difficult.&lt;/p&gt;

&lt;p&gt;We will be explaining how every single component is built, how to understand UI structures and draw them. We will also make sure they are responsive, that is they can fit to different mobile screens.&lt;/p&gt;

&lt;p&gt;We will not be drawing for the web in this series. We will also do a YouTube series on it. I encourage you to stay with us on this series, at the end you will be able to comfortably draw complex UIs on your own.&lt;/p&gt;

&lt;p&gt;As we begin the series, you can ask your questions, github link will be made available for download. We will start with a simple screen to complex ones.&lt;/p&gt;

&lt;p&gt;Thanks for reading, we will start in the next article.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>mobile</category>
      <category>android</category>
      <category>dart</category>
    </item>
    <item>
      <title>SOLID: Fundamental Principles of Software Development using PHP (2)</title>
      <dc:creator>Elvis</dc:creator>
      <pubDate>Thu, 11 Aug 2022 10:28:00 +0000</pubDate>
      <link>https://dev.to/elvis_igiebor/solid-fundamental-principles-of-software-development-using-php-2-188l</link>
      <guid>https://dev.to/elvis_igiebor/solid-fundamental-principles-of-software-development-using-php-2-188l</guid>
      <description>&lt;p&gt;This is a continuation of our implementation of SOLID principles using PHP. I encourage you to go through the first part where we implemented the first principle, &lt;a href="https://dev.to/elvis_igiebor/solid-fundamental-principles-of-software-development-using-php-1-26mo"&gt;Single-Responsibility Principle&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In this episode we shall implement the second principle, Open and Closed Principle. At the end of the whole series, we shall be writing real application with clean. Please read it to the end, drop your questions incase if there is any part that needs clarity. Also don’t forget to share. Thank you.&lt;/p&gt;

&lt;p&gt;SOLID stands for:&lt;/p&gt;

&lt;p&gt;S — Single-Responsibility Principle&lt;/p&gt;

&lt;p&gt;O — Open-Closed Principle&lt;/p&gt;

&lt;p&gt;L — Liskov Substitution Principle&lt;/p&gt;

&lt;p&gt;I — Interface Segregation Principle&lt;/p&gt;

&lt;p&gt;D — Dependency Inversion Principle&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;The Open-Closed principle states that Objects or entities should be open for extension but closed for modification.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the first part, we created an app that collects shapes, calculate their areas and returns their sum. Assuming, we have other shapes, we will have to modify the areasumcalculator class, which is against the principle.&lt;/p&gt;

&lt;p&gt;Our aim here is to ensure that a class or an entity can extended but not modified.&lt;/p&gt;

&lt;p&gt;To achieve this, we create an interface that all shapes must follow.&lt;/p&gt;

&lt;p&gt;` interface ShapeArea{&lt;br&gt;
  public function area();&lt;/p&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;p&gt;` // exception, incase a shape that does not implements our interface is provided.&lt;br&gt;
 class InvalideShapeException extends Exception&lt;br&gt;
 {&lt;br&gt;
  public $message;&lt;/p&gt;

&lt;p&gt;function __construct($mess = 'Invalid shape')&lt;br&gt;
  {&lt;br&gt;
$this-&amp;gt;message = $mess;&lt;br&gt;
//return 'This shape is invalid';&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;public function getMyMessage()&lt;br&gt;
  {&lt;br&gt;
    return $this-&amp;gt;message;&lt;br&gt;
  }&lt;br&gt;
 }`&lt;/p&gt;

&lt;p&gt;We will create shape classes that will implement the interface&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Square implements ShapeArea
{
    public $length;

     function __construct($length)
    {
      $this-&amp;gt;length = $length;
    }

    public function area()
    {
      $area = $this-&amp;gt;length * $this-&amp;gt;length;
      return $area;
    }

}

class Circle implements ShapeArea{
    public $radius;

     function __construct($radius)
    {
        $this-&amp;gt;radius = $radius;
    }
    public function area()
    {
      $area = pi() * ($this-&amp;gt;radius * $this-&amp;gt;radius);
       return $area;
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To test our exception, lets create another shape that doesn't implement shapesurface&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Triangle{
  public $breadth;
  public $height;

  function __construct($breadth,$height)
  {
$this-&amp;gt;breadth = $breadth;
$this-&amp;gt;height = $height;
  }
   public function myArea()
   {
      $area = 1/2 * ($this-&amp;gt;breadth * $this-&amp;gt;height);

      return $area;
   }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now lets go back to our areasumcalculator class&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class AreaSumCalculator{
    protected $shapes;

     public function __construct($shapes = [])
     {

       $this-&amp;gt;shapes = $shapes;
     } 

    public function sum()
    {
        $area = [];
      foreach($this-&amp;gt;shapes as $shape)
      {
        if(is_a($shape, 'ShapeArea'))
        {
          $area[] = $shape-&amp;gt;area();  
        }
        else{
          throw new InvalideShapeException;
        }



      }
      return array_sum($area);
    }

}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then the class to class to output the calculated sum&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class AreaSumCalculatorOutput{
    public $areasumcalculator;

   public function __construct(AreaSumCalculator $areasumcalculator)
    {
        $this-&amp;gt;areasumcalculator = $areasumcalculator;
    }

    public function jsonOutput()
    {
      $data = [
        'sum' =&amp;gt; $this-&amp;gt;areasumcalculator-&amp;gt;sum(),
      ];

      return json_encode($data);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lets create shapes or objects (instance of classes)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$circle = new Circle(10);
$square = new Square(5);

$triangle1 = new Triangle(10,23);
$triangle = new Triangle(1,23);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a shape variable to accept an array of the area of shapes (object created)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$shapes1 = [$circle, $square];&lt;br&gt;
$shapes2 = [$triangle1, $triangle];&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Lets test our first shapes (circle and square), it implements the interface.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/ calculate the sum of the areas of the shapes

try{

  $area_sum_calculator = new AreaSumCalculator($shapes1); 

  // answer :
/* {
  "sum": 339.1592653589793
}
*/


  // output the sum
$area_sum_output = new AreaSumCalculatorOutput($area_sum_calculator);

// call the output

$json_output = $area_sum_output-&amp;gt;jsonOutput();

echo $json_output .'&amp;lt;br&amp;gt;'; 

}catch(InvalideShapeException $e)
{
  echo "Caught my exception: \n ";
  echo $e-&amp;gt;getMyMessage();

}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Test the second shape&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try{

  $area_sum_calculator = new AreaSumCalculator($shapes2); 

  // answer :
// Caught my exception Invalid shape


  // output the sum
$area_sum_output = new AreaSumCalculatorOutput($area_sum_calculator);

// call the output

$json_output = $area_sum_output-&amp;gt;jsonOutput();

//echo $json_output;

}catch(InvalideShapeException $e)
{
  echo "Caught my exception\n";
  echo $e-&amp;gt;getMyMessage();

}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thanks for reading. You can drop your comments, questions or suggestions.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>SOLID: Fundamental Principles of Software Development using PHP (1)</title>
      <dc:creator>Elvis</dc:creator>
      <pubDate>Wed, 03 Aug 2022 07:40:00 +0000</pubDate>
      <link>https://dev.to/elvis_igiebor/solid-fundamental-principles-of-software-development-using-php-1-26mo</link>
      <guid>https://dev.to/elvis_igiebor/solid-fundamental-principles-of-software-development-using-php-1-26mo</guid>
      <description>&lt;p&gt;Software development principles are a must-know for all software engineers that aim to achieve clean codes. Software evolves with time as new features are required, so it is necessary to build a maintainable, reliable and sustainable code.&lt;/p&gt;

&lt;p&gt;SOLID principles are five basic principles for object-oriented programming design. They are set of rules to follow when designing a class structured software. These principles puts maintainability and extensibility into consideration as software evolves.&lt;/p&gt;

&lt;p&gt;SOLID STANDS FOR :&lt;/p&gt;

&lt;p&gt;S — SINGLE-RESPONSILITY PRINCIPLE&lt;/p&gt;

&lt;p&gt;O — OPEN-CLOSED PRINCIPLE&lt;/p&gt;

&lt;p&gt;L — LISKOV SUBSTITUTION PRINCIPLE&lt;/p&gt;

&lt;p&gt;I — INTERFACE SEGREGATION PRINCIPLE&lt;/p&gt;

&lt;p&gt;D — DEPENCY INVERSION PRINCIPLE&lt;/p&gt;

&lt;p&gt;The SOLID principles were first introduced by the famous Computer Scientist Robert J. Martin (a.k.a Uncle Bob) in his 2000 paper.&lt;/p&gt;

&lt;p&gt;Uncle Bob also authors best selling books Clean Code and Architectures, and he is one of the participant of the Agile Alliance.&lt;/p&gt;

&lt;p&gt;The concepts of clean concept of clean coding, object-oriented architecture and design patterns are somehow related and complementary.&lt;/p&gt;

&lt;p&gt;The purpose of these concepts is “To create understandable, readable and testable code that many developers can collaboratively work on”.&lt;/p&gt;

&lt;p&gt;We all explain the five principles one after the other with examples. In this series, we shall explain the first principle :&lt;/p&gt;

&lt;p&gt;SINGLE-RESPONSIBILITY PRINCIPLE (SRP)&lt;/p&gt;

&lt;p&gt;It states that a class should have one and only one reason to change, meaning a class should have only job.&lt;/p&gt;

&lt;p&gt;This means a class should do only one thing. For example, if a data container like Vehicle class or Book class containing fields regarding the entity should change, it should change only because of the data model.&lt;/p&gt;

&lt;p&gt;Consider the example below:&lt;/p&gt;

&lt;p&gt;Let’s create a app that takes a collection of shapes, calculates and sums up the areas.&lt;/p&gt;

&lt;p&gt;Let create two classes, Square and Circle, with their required parameters&lt;/p&gt;

&lt;p&gt;class Square&lt;/p&gt;

&lt;p&gt;{&lt;/p&gt;

&lt;p&gt;public $length;&lt;/p&gt;

&lt;p&gt;function __construct($length)&lt;/p&gt;

&lt;p&gt;{&lt;/p&gt;

&lt;p&gt;$this-&amp;gt;length = $length;&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;class Circle&lt;/p&gt;

&lt;p&gt;{&lt;/p&gt;

&lt;p&gt;public $radius;&lt;/p&gt;

&lt;p&gt;function __construct($radius)&lt;/p&gt;

&lt;p&gt;{&lt;/p&gt;

&lt;p&gt;$this-&amp;gt;radius = $radius;&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;Let’s create another class to calculate the area&lt;/p&gt;

&lt;p&gt;class AreaSumCalculator {&lt;/p&gt;

&lt;p&gt;protected $shapes;&lt;/p&gt;

&lt;p&gt;public function __construct($shapes = [])&lt;/p&gt;

&lt;p&gt;{&lt;/p&gt;

&lt;p&gt;$this-&amp;gt;shapes = $shapes;&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;public function sum()&lt;br&gt;
{&lt;br&gt;
foreach ($this-&amp;gt;shapes as $shape) {&lt;br&gt;
if (is_a($shape, 'Square')) {&lt;br&gt;
$area[] = pow($shape-&amp;gt;length, 2);&lt;br&gt;
} elseif (is_a($shape, 'Circle')) {&lt;br&gt;
$area[] = pi() * pow($shape-&amp;gt;radius, 2);&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
return array_sum($area);&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;public function jsonOutput()&lt;/p&gt;

&lt;p&gt;{&lt;/p&gt;

&lt;p&gt;$data = [&lt;/p&gt;

&lt;p&gt;‘sum’ =&amp;gt; $this-&amp;gt;areasumcalculator-&amp;gt;sum(),&lt;/p&gt;

&lt;p&gt;];&lt;/p&gt;

&lt;p&gt;return json_encode($data);&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;// create objects (instance of classes)&lt;/p&gt;

&lt;p&gt;$circle = new Circle(10);&lt;/p&gt;

&lt;p&gt;$square = new Square(5);&lt;/p&gt;

&lt;p&gt;// create a shape variable to accept an array of shapes (object created)&lt;/p&gt;

&lt;p&gt;$shapes = [$circle,$square];&lt;/p&gt;

&lt;p&gt;$areas = new AreaCalculator($shapes);&lt;/p&gt;

&lt;p&gt;echo $areas-&amp;gt;jsonOutput($areas);&lt;br&gt;
The issue with this code is that the AreaCalculator handles, the business logic with the output or presentation logic.&lt;/p&gt;

&lt;p&gt;If we need to make any change or add a feature like outputting our answer in another form, we will have to alter the AreaCalculator class.&lt;/p&gt;

&lt;p&gt;To solve this, you need to create a class to handle the output or presentation and another to handle the summation.&lt;/p&gt;

&lt;p&gt;class AreaSumCalculator{&lt;/p&gt;

&lt;p&gt;protected $shapes;&lt;/p&gt;

&lt;p&gt;public function __construct($shapes = [])&lt;/p&gt;

&lt;p&gt;{&lt;/p&gt;

&lt;p&gt;print_r($this-&amp;gt;shapes);&lt;/p&gt;

&lt;p&gt;$this-&amp;gt;shapes = $shapes;&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;public function sum()&lt;/p&gt;

&lt;p&gt;{&lt;/p&gt;

&lt;p&gt;$area = [];&lt;/p&gt;

&lt;p&gt;foreach($this-&amp;gt;shapes as $shape)&lt;/p&gt;

&lt;p&gt;{&lt;/p&gt;

&lt;p&gt;if(is_a($shape, ‘Square’))&lt;/p&gt;

&lt;p&gt;{&lt;/p&gt;

&lt;p&gt;$area[] = $shape-&amp;gt;length * $shape-&amp;gt;length;&lt;/p&gt;

&lt;p&gt;}elseif(is_a($shape, ‘Circle’))&lt;/p&gt;

&lt;p&gt;{&lt;/p&gt;

&lt;p&gt;$area[] = pi() * ($shape-&amp;gt;radius * $shape-&amp;gt;radius);&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;// return array_sum($area);&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;return array_sum($area);&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;class AreaSumCalculatorOutput{&lt;/p&gt;

&lt;p&gt;public $areasumcalculator;&lt;/p&gt;

&lt;p&gt;public function __construct(AreaSumCalculator $areasumcalculator)&lt;/p&gt;

&lt;p&gt;{&lt;/p&gt;

&lt;p&gt;$this-&amp;gt;areasumcalculator = $areasumcalculator;&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;public function jsonOutput()&lt;/p&gt;

&lt;p&gt;{&lt;/p&gt;

&lt;p&gt;$data = [&lt;/p&gt;

&lt;p&gt;‘sum’ =&amp;gt; $this-&amp;gt;areasumcalculator-&amp;gt;sum(),&lt;/p&gt;

&lt;p&gt;];&lt;/p&gt;

&lt;p&gt;return json_encode($data);&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;// create objects (instance of classes)&lt;/p&gt;

&lt;p&gt;$circle = new Circle(10);&lt;/p&gt;

&lt;p&gt;$square = new Square(5);&lt;/p&gt;

&lt;p&gt;// create a shape variable to accept an array of shapes (object created)&lt;/p&gt;

&lt;p&gt;$shapes = [$circle,$square];&lt;/p&gt;

&lt;p&gt;// calculate the sum of the areas of the shapes&lt;/p&gt;

&lt;p&gt;$area_sum_calculator = new AreaSumCalculator($shapes);&lt;/p&gt;

&lt;p&gt;// output the sum&lt;/p&gt;

&lt;p&gt;$area_sum_output = new AreaSumCalculatorOutput($area_sum_calculator);&lt;/p&gt;

&lt;p&gt;// call the output&lt;/p&gt;

&lt;p&gt;$json_output = $area_sum_output-&amp;gt;jsonOutput();&lt;/p&gt;

&lt;p&gt;//echo $json_output;&lt;/p&gt;

&lt;p&gt;With this, you have applied the single-responsibility principle of software design. Thanks for following this first part of the series. You can send me a mail at &lt;a href="mailto:igieborelvis@gmail.com"&gt;igieborelvis@gmail.com&lt;/a&gt; or drop comments.&lt;/p&gt;

</description>
      <category>php</category>
      <category>android</category>
      <category>api</category>
      <category>laravel</category>
    </item>
  </channel>
</rss>
