{"id":32461,"date":"2024-11-01T09:09:09","date_gmt":"2024-11-01T09:09:09","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=32461"},"modified":"2024-11-01T11:55:12","modified_gmt":"2024-11-01T11:55:12","slug":"flutter-course-10-1-handling-main-buttons-in-flutter","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/32461\/","title":{"rendered":"Flutter Course: 10.1 Handling Main Buttons in Flutter"},"content":{"rendered":"<p><body><\/p>\n<p>Flutter is an open-source UI software development kit (SDK) for mobile application development, providing cross-platform capabilities. One of the reasons many developers choose Flutter is its excellent performance and flexibility. In this post, we will take a closer look at Flutter&#8217;s button widgets. Buttons are one of the most important UI elements for user interaction, and we will cover a wide range of topics from basic usage to advanced techniques.<\/p>\n<h2>1. Importance of Buttons<\/h2>\n<p>Buttons play a very important role in the UX\/UI of applications. Users interact with the application through buttons, and the feedback generated during this process greatly affects their experience. Therefore, when designing buttons, intuitiveness and user-friendliness should be considered.<\/p>\n<h2>2. Types of Buttons Available in Flutter<\/h2>\n<p>Flutter offers various types of buttons. Each button is optimized for specific situations and purposes.<\/p>\n<h3>2.1. RaisedButton<\/h3>\n<p><code>RaisedButton<\/code> is a button that gives a three-dimensional effect, providing a feel of being clickable to the user. It generally follows the principles of Material Design.<\/p>\n<pre><code>RaisedButton(\n        onPressed: () {\n            \/\/ Code to be executed when the button is clicked\n        },\n        child: Text(\"Click Here\"),\n    )<\/code><\/pre>\n<h3>2.2. FlatButton<\/h3>\n<p><code>FlatButton<\/code> is a flat button without a background, commonly used in various situations. It allows for more subtle interactions with the user.<\/p>\n<pre><code>FlatButton(\n        onPressed: () {\n            \/\/ Code to be executed when the button is clicked\n        },\n        child: Text(\"Button\"),\n    )<\/code><\/pre>\n<h3>2.3. IconButton<\/h3>\n<p><code>IconButton<\/code> is a button that uses only an icon. It provides simple functionality and is useful when emphasizing visual elements over text.<\/p>\n<pre><code>IconButton(\n        icon: Icon(Icons.add),\n        onPressed: () {\n            \/\/ Code on click\n        },\n    )<\/code><\/pre>\n<h3>2.4. FloatingActionButton<\/h3>\n<p><code>FloatingActionButton<\/code> is a circular button that floats over a specific position on the screen, typically representing the most important action. It helps users to take action easily.<\/p>\n<pre><code>FloatingActionButton(\n        onPressed: () {\n            \/\/ Code on click\n        },\n        child: Icon(Icons.add),\n    )<\/code><\/pre>\n<h2>3. Styling Buttons<\/h2>\n<p>Changing the style of buttons is very important for improving the user experience. In Flutter, you can apply various styles to buttons through the <code>buttonStyle<\/code> property.<\/p>\n<h3>3.1. Changing Colors<\/h3>\n<pre><code>RaisedButton(\n        color: Colors.blue,\n        textColor: Colors.white,\n        onPressed: () {\n            \/\/ Code on click\n        },\n        child: Text(\"Blue Button\"),\n    )<\/code><\/pre>\n<h3>3.2. Adding Borders and Shadows<\/h3>\n<pre><code>RaisedButton(\n        onPressed: () {},\n        child: Text(\"Add Border\"),\n        shape: RoundedRectangleBorder(\n            borderRadius: BorderRadius.circular(5),\n            side: BorderSide(color: Colors.black),\n        ),\n    )<\/code><\/pre>\n<h2>4. Animation Effects<\/h2>\n<p>Adding animation effects to buttons provides a better experience for users. Animations can be applied during state changes of the button (e.g., when clicked).<\/p>\n<h3>4.1. Using Hero Animation<\/h3>\n<p>Using Flutter&#8217;s Hero animation, you can add animation effects to buttons during page transitions.<\/p>\n<pre><code>Hero(\n        tag: 'my-button',\n        child: RaisedButton(\n            onPressed: () {},\n            child: Text(\"Hero Button\"),\n        ),\n    )<\/code><\/pre>\n<h2>5. Managing Button State<\/h2>\n<p>Managing the changes between the pressed state and the default state of a button is essential for enhancing user experience. You can manage the button&#8217;s state using <code>StatefulWidget<\/code>.<\/p>\n<pre><code>class MyButton extends StatefulWidget {\n        @override\n        _MyButtonState createState() =&gt; _MyButtonState();\n    }\n\n    class _MyButtonState extends State<MyButton> {\n        bool _isPressed = false;\n\n        @override\n        Widget build(BuildContext context) {\n            return RaisedButton(\n                onPressed: () {\n                    setState(() {\n                        _isPressed = !_isPressed;\n                    });\n                },\n                child: Text(_isPressed ? \"Pressed\" : \"Not Pressed\"),\n            );\n        }\n    }<\/code><\/pre>\n<h2>6. Optimizing Buttons for User Experience<\/h2>\n<p>The size, spacing, and labels of buttons all greatly affect user experience. The button size should be sufficiently large, considering the touchable area, allowing users to click easily. In Flutter, you can set the external margins of buttons using the <code>Padding<\/code> widget.<\/p>\n<pre><code>Padding(\n        padding: const EdgeInsets.all(8.0),\n        child: RaisedButton(\n            onPressed: () {},\n            child: Text(\"Button with Padding\"),\n        ),\n    )<\/code><\/pre>\n<h2>Conclusion<\/h2>\n<p>In this article, we explored the major types of buttons and their usage in Flutter. Since buttons play an important role in user interaction, they should be implemented with careful consideration of design and functionality. In future learning, practice optimizing user experience by using buttons in various situations.<\/p>\n<p>Buttons may be fundamental elements of an application, but they can greatly enhance user experience. Create an attractive interface through various types of buttons, styles, and animation effects. Don&#8217;t forget to keep learning and trying new features in the ever-evolving Flutter ecosystem!<\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Flutter is an open-source UI software development kit (SDK) for mobile application development, providing cross-platform capabilities. One of the reasons many developers choose Flutter is its excellent performance and flexibility. In this post, we will take a closer look at Flutter&#8217;s button widgets. Buttons are one of the most important UI elements for user interaction, &hellip; <a href=\"https:\/\/atmokpo.com\/w\/32461\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Flutter Course: 10.1 Handling Main Buttons in Flutter&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[151],"tags":[],"class_list":["post-32461","post","type-post","status-publish","format-standard","hentry","category-flutter-course"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Flutter Course: 10.1 Handling Main Buttons in Flutter - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/32461\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Flutter Course: 10.1 Handling Main Buttons in Flutter - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"Flutter is an open-source UI software development kit (SDK) for mobile application development, providing cross-platform capabilities. One of the reasons many developers choose Flutter is its excellent performance and flexibility. In this post, we will take a closer look at Flutter&#8217;s button widgets. Buttons are one of the most important UI elements for user interaction, &hellip; \ub354 \ubcf4\uae30 &quot;Flutter Course: 10.1 Handling Main Buttons in Flutter&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/32461\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:09:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:55:12+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"3\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/32461\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32461\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Flutter Course: 10.1 Handling Main Buttons in Flutter\",\"datePublished\":\"2024-11-01T09:09:09+00:00\",\"dateModified\":\"2024-11-01T11:55:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32461\/\"},\"wordCount\":486,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Flutter course\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/32461\/\",\"url\":\"https:\/\/atmokpo.com\/w\/32461\/\",\"name\":\"Flutter Course: 10.1 Handling Main Buttons in Flutter - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:09:09+00:00\",\"dateModified\":\"2024-11-01T11:55:12+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32461\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/32461\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/32461\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Flutter Course: 10.1 Handling Main Buttons in Flutter\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Flutter Course: 10.1 Handling Main Buttons in Flutter - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/atmokpo.com\/w\/32461\/","og_locale":"ko_KR","og_type":"article","og_title":"Flutter Course: 10.1 Handling Main Buttons in Flutter - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"Flutter is an open-source UI software development kit (SDK) for mobile application development, providing cross-platform capabilities. One of the reasons many developers choose Flutter is its excellent performance and flexibility. In this post, we will take a closer look at Flutter&#8217;s button widgets. Buttons are one of the most important UI elements for user interaction, &hellip; \ub354 \ubcf4\uae30 \"Flutter Course: 10.1 Handling Main Buttons in Flutter\"","og_url":"https:\/\/atmokpo.com\/w\/32461\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:09:09+00:00","article_modified_time":"2024-11-01T11:55:12+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"3\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/32461\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/32461\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Flutter Course: 10.1 Handling Main Buttons in Flutter","datePublished":"2024-11-01T09:09:09+00:00","dateModified":"2024-11-01T11:55:12+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/32461\/"},"wordCount":486,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Flutter course"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/32461\/","url":"https:\/\/atmokpo.com\/w\/32461\/","name":"Flutter Course: 10.1 Handling Main Buttons in Flutter - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:09:09+00:00","dateModified":"2024-11-01T11:55:12+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/32461\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/32461\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/32461\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Flutter Course: 10.1 Handling Main Buttons in Flutter"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32461","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=32461"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32461\/revisions"}],"predecessor-version":[{"id":32462,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32461\/revisions\/32462"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=32461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=32461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=32461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}