{"id":10457,"date":"2021-09-10T10:00:00","date_gmt":"2021-09-10T01:00:00","guid":{"rendered":"https:\/\/www.gigas-jp.com\/appnews\/?p=10457"},"modified":"2021-09-09T19:02:55","modified_gmt":"2021-09-09T10:02:55","slug":"flutter-clipboard","status":"publish","type":"post","link":"https:\/\/www.gigas-jp.com\/appnews\/archives\/10457","title":{"rendered":"Flutter &#8211; Clipboard"},"content":{"rendered":"\n<p>This week also let&#8217;s learn flutter new things. I will show you how to copy and paste a text with flutter. Let&#8217;s start coding.<\/p>\n\n\n\n<div class=\"wp-block-columns are-vertically-aligned-center\">\n<div class=\"wp-block-column is-vertically-aligned-center\" style=\"flex-basis:100%\">\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\" style=\"flex-basis:100%\">\n<figure class=\"wp-block-gallery columns-2 is-cropped\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"485\" height=\"1024\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/09\/Screenshot_1631174575-1-485x1024.png\" alt=\"\" data-id=\"10467\" class=\"wp-image-10467\" srcset=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/09\/Screenshot_1631174575-1-485x1024.png 485w, https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/09\/Screenshot_1631174575-1.png 1080w\" sizes=\"(max-width: 485px) 100vw, 485px\" \/><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" width=\"485\" height=\"1024\" src=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/09\/Screenshot_1631174074-3-485x1024.png\" alt=\"\" data-id=\"10468\" data-full-url=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/09\/Screenshot_1631174074-3.png\" data-link=\"https:\/\/www.gigas-jp.com\/appnews\/?attachment_id=10468\" class=\"wp-image-10468\" srcset=\"https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/09\/Screenshot_1631174074-3-485x1024.png 485w, https:\/\/www.gigas-jp.com\/appnews\/wp-content\/uploads\/sites\/4\/2021\/09\/Screenshot_1631174074-3.png 1080w\" sizes=\"(max-width: 485px) 100vw, 485px\" \/><\/figure><\/li><\/ul><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<p>First thing we need to do is add this <strong>clipboard<\/strong> package in <strong>pubspec.yaml<\/strong> file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>flutter pub add clipboard<\/code><\/pre>\n\n\n\n<h4>Copy to clipboard <a href=\"https:\/\/pub.dev\/packages\/clipboard#copy-to-clipboard-from-your-app\"><\/a><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>FlutterClipboard.copy(field.text).then(( value ) =&gt; print('copied'));<\/code><\/pre>\n\n\n\n<h4>Paste from clipboard <\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>FlutterClipboard.paste().then((value) {\n    \/\/ Do what ever you want with the value.\n    setState(() {\n      field.text = value;\n      pasteValue = value;\n    });\n  });<\/code><\/pre>\n\n\n\n<h4>For text editing field : <\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>TextEditingController field = TextEditingController();\nTextFormField(\n                controller: field,\n                decoration: const InputDecoration(\n                    hintText: 'Enter text'\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\/10457\" ><\/g:plusone><\/div>\n            <div class=\"wsbl_hatena_button\"><a href=\"\/\/b.hatena.ne.jp\/entry\/https:\/\/www.gigas-jp.com\/appnews\/archives\/10457\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"Flutter &#8211; Clipboard\" 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\/10457\" data-text=\"Flutter &#8211; Clipboard\" 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\/10457\" 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\/10457\" colorscheme=\"light\" ><\/fb:send><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>This week also let&#8217;s learn flutter new things. I will show you how to copy and paste a text with flutter [&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\/10457"}],"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=10457"}],"version-history":[{"count":5,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/10457\/revisions"}],"predecessor-version":[{"id":10476,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/10457\/revisions\/10476"}],"wp:attachment":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/media?parent=10457"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/categories?post=10457"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/tags?post=10457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}