{"id":10789,"date":"2021-10-22T10:00:00","date_gmt":"2021-10-22T01:00:00","guid":{"rendered":"https:\/\/www.gigas-jp.com\/appnews\/?p=10789"},"modified":"2021-10-21T19:30:31","modified_gmt":"2021-10-21T10:30:31","slug":"lets-learn-flutter-ui-with-me","status":"publish","type":"post","link":"https:\/\/www.gigas-jp.com\/appnews\/archives\/10789","title":{"rendered":"Let&#8217;s learn flutter UI with me"},"content":{"rendered":"\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/10\/Screenshot_1634800770.jpg\" alt=\"\" class=\"wp-image-10790\" width=\"195\" height=\"413\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>For this week, I will create only user interface design for android app using flutter. In this article I will explain deeply the usage of widget and we can learn a lot of flutter widget and how to clearly create folder structures etc.<\/p>\n\n\n\n<p>Firstly I create images asset folders from the app directory named with <strong>assets<\/strong>. Like this :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>project_name\/assets\/images\/your_image.jpg<\/code><\/pre>\n\n\n\n<p>After inserting images in assets folder, we will need to apply this image to our app. So  we have to put images assets in <strong>pubspec.yaml<\/strong> file. <\/p>\n\n\n\n<p>Let&#8217;s starting coding in main.dart file. In our widget, we call Profile page named with<strong> profile_page.dart<\/strong>. You can also use other file name. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  Widget build(BuildContext context) {\n    return MaterialApp(\n        title: 'Flutter Demo',\n        debugShowCheckedModeBanner: false,\n        theme: ThemeData(\n            primarySwatch: Colors.blue,\n\n        ),\n        home: ProfilePage()\n    );\n  }<\/code><\/pre>\n\n\n\n<p>In our <strong>ProfilePage<\/strong> for appbar, inside the <strong>scaffold<\/strong> widget I create <strong>Row<\/strong> widget with leading and trailing, leading is that will display back button and trailing is that will display SELECT text in right side of the screen of the one row.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>        child: Row(\n          children: &lt;Widget&gt;&#091;\n            leading : GestureDetector(\n          onTap: () {\n            Navigator.of(context).pop();\n          },\n          child: Icon(Icons.arrow_back),\n        ),\n            Spacer(),\n            trailing : Text(\n          \"SELECT\",\n          style: actionMenuStyle,\n        ),\n          ],\n        ),<\/code><\/pre>\n\n\n\n<p>And for display <strong>Super Liked Me<\/strong> text and other design, I create one <strong>Column<\/strong> widget inside the <strong>body<\/strong>. For display <strong>Super Liked Me<\/strong> text, We can use <strong>Text<\/strong> Widget inside a <strong>Padding<\/strong> widget. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>         Padding(\n            padding: const EdgeInsets.all(16),\n            child: Text(\n              \"Super Liked Me\",\n              style: headingTextStyle.copyWith(color: Colors.black),\n            ),\n          )<\/code><\/pre>\n\n\n\n<p>The next design for beautiful <strong>Search<\/strong> box, we can use <strong>TextField<\/strong> widget inside a <strong>Card<\/strong> Widget. If you do rounded search bar, we can use inside <strong>RoundedRectangleBorder<\/strong> widget with properties <strong>BorerRadius.circular(30)<\/strong> widget.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>          Card(\n            elevation: 4,\n            shape: RoundedRectangleBorder(\n              borderRadius: BorderRadius.circular(16),\n            ),\n            margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),\n            child: Padding(\n              padding: const EdgeInsets.symmetric(horizontal: 8),\n              child: TextField(\n                decoration: InputDecoration(\n                    border: InputBorder.none,\n                    prefixIcon: Icon(Icons.search),\n                    hintText: \"Search\",\n                    hintStyle: whiteSubHeadingTextStyle.copyWith(color: hintTextColor)),\n              ),\n            ),\n          )<\/code><\/pre>\n\n\n\n<p>And another design from the left side of Super Likes Text , the center of 5 text and the last text of 1h, to display this we can use <strong>Row<\/strong> widget again. Inside the Row widget , we can use <strong>three<\/strong> <strong>Text<\/strong> Widgets. Like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> Row(\n   children: &lt;Widget&gt;&#091;\n     Text(\"Super likes\",...),          \n        Text(\"5\",..),      \n        Spacer(),\n         Text(\"1h\",..),\n     ],\n    )<\/code><\/pre>\n\n\n\n<p>The last thing to display a list design , we can use <strong>ListView.builder<\/strong> widget. If you want to scrolling the listview, we can use <strong>Expanded<\/strong> , that will wrap <strong>ListView.builder<\/strong> widget. For display the item look like a card, we can use <strong>Card<\/strong> Widget inside <strong>ListView.builder widget.<\/strong>Inside a <strong>Card<\/strong> widget to display subtitle, we can use <strong>ListTitle<\/strong> widget with <strong>subtitle<\/strong> property. Inside the card the first thing wanted to display item is used <strong>leading<\/strong> property and for the last item <strong>trailing<\/strong> property. And we need to add <strong>itemCount: 10<\/strong> property for how many list item will display. This example is item count for 10 times.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> Expanded(\n   child: ListView.builder(\n      itemBuilder: (context, index) {\n         return Card(\n           child: ListTile(\n             title: Text(.....),\n               subtitle: Row(...),\n               leading: ClipOval(...),\n               trailing: SizedBox(...),\n                ),\n               );\n             },\n      itemCount: 10,\n            ),\n          ),<\/code><\/pre>\n\n\n\n<p>Hope you enjoyed this article.<\/p>\n\n\n\n<p>By Ami<\/p>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/10789\" ><\/g:plusone><\/div>\n            <div class=\"wsbl_hatena_button\"><a href=\"\/\/b.hatena.ne.jp\/entry\/https:\/\/www.gigas-jp.com\/appnews\/archives\/10789\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"Let&#8217;s learn flutter UI with me\" data-hatena-bookmark-layout=\"standard\" title=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\"> <img src=\"\/\/b.hatena.ne.jp\/images\/entry-button\/button-only@2x.png\" alt=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\" width=\"20\" height=\"20\" style=\"border: none;\" \/><\/a><script type=\"text\/javascript\" src=\"\/\/b.hatena.ne.jp\/js\/bookmark_button.js\" charset=\"utf-8\" async=\"async\"><\/script><\/div>\n            <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/10789\" data-text=\"Let&#8217;s learn flutter UI with me\" data-via=\"GIGASJAPAN_APPS\" data-lang=\"ja\">Tweet<\/a><\/div>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/10789\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_facebook_send\"><div id=\"fb-root\"><\/div><fb:send href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/10789\" colorscheme=\"light\" ><\/fb:send><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>For this week, I will create only user interface design for android app using flutter. In this article I will  [&hellip;]<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[100],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/10789"}],"collection":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/comments?post=10789"}],"version-history":[{"count":11,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/10789\/revisions"}],"predecessor-version":[{"id":10809,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/10789\/revisions\/10809"}],"wp:attachment":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/media?parent=10789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/categories?post=10789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/tags?post=10789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}