{"id":759,"date":"2020-05-04T20:59:50","date_gmt":"2020-05-04T11:59:50","guid":{"rendered":"https:\/\/www.typea.info\/blog\/?p=759"},"modified":"2020-10-31T00:07:59","modified_gmt":"2020-10-30T15:07:59","slug":"flutter-drawer-menu","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2020\/05\/04\/flutter-drawer-menu\/","title":{"rendered":"Flutter: Drawer\u30e1\u30cb\u30e5\u30fc\u306e\u30b5\u30f3\u30d7\u30eb"},"content":{"rendered":"<p><a href=\"https:\/\/www.amazon.co.jp\/Android-iOS%E3%82%AF%E3%83%AD%E3%82%B9%E9%96%8B%E7%99%BA%E3%83%95%E3%83%AC%E3%83%BC%E3%83%A0%E3%83%AF%E3%83%BC%E3%82%AF-Flutter%E5%85%A5%E9%96%80-%E6%8E%8C%E7%94%B0%E6%B4%A5%E8%80%B6%E4%B9%83-ebook\/dp\/B07Q19LVW2\/ref=as_li_ss_il?__mk_ja_JP=%E3%82%AB%E3%82%BF%E3%82%AB%E3%83%8A&amp;dchild=1&amp;keywords=flutter&amp;qid=1588593413&amp;sr=8-3&amp;linkCode=li2&amp;tag=typea09-22&amp;linkId=5c41c9b3b4acb6c04b74d9c8a93a7e84&amp;language=ja_JP\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"\/\/ws-fe.amazon-adsystem.com\/widgets\/q?_encoding=UTF8&amp;ASIN=B07Q19LVW2&amp;Format=_SL160_&amp;ID=AsinImage&amp;MarketPlace=JP&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=typea09-22&amp;language=ja_JP\" border=\"0\"><\/a><img loading=\"lazy\" decoding=\"async\" width=\"1\" height=\"1\" style=\"margin: 0px !important; border: currentcolor !important; border-image: none !important;\" alt=\"\" src=\"https:\/\/ir-jp.amazon-adsystem.com\/e\/ir?t=typea09-22&amp;language=ja_JP&amp;l=li2&amp;o=9&amp;a=B07Q19LVW2\" border=\"0\"><\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/index.php\/category\/flutter\/\">Flutter\u3067\u30a2\u30d7\u30ea\u958b\u767a\u306e\u305f\u3081\u306e\u90e8\u54c1\u3042\u3064\u3081<\/a>\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2020\/05\/03\/flutter-popupmenu_android_iphone\/\">\u30c8\u30c3\u30d7\u753b\u9762\u306e\u30e1\u30cb\u30e5\u30fc\u306b\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u30e1\u30cb\u30e5\u30fc\u3092\u8ffd\u52a0<\/a>\u3057\u305f\u304c\u3001\u30c9\u30ed\u30ef\u30fc\u30e1\u30cb\u30e5\u30fc\u306b\u5909\u3048\u308b\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/2020\/05\/flutter_drawer_menu.png\"><img loading=\"lazy\" decoding=\"async\" width=\"235\" height=\"414\" title=\"flutter_drawer_menu\" style=\"display: inline; background-image: none;\" alt=\"flutter_drawer_menu\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/2020\/05\/flutter_drawer_menu_thumb.png\" border=\"0\"><\/a><\/p>\n<pre class=\"prettyprint\">import 'dart:io';\nimport 'package:flutter\/cupertino.dart';\nimport 'package:flutter\/material.dart';\n\nimport '.\/google_sign_in.dart';\nimport '.\/firestore_cloud_vision.dart';\nimport '.\/firebase_auth.dart';\n\nvoid main() =&gt; runApp(MyApp());\n\nclass MyApp extends StatelessWidget {\n  final message = \"Initial Message.\";\n  @override\n  Widget build(BuildContext context) {\n    return new MaterialApp(\n      title: 'Flutter Sample',\n      home: MyHomePage(message:this.message),\n    );\n  }\n}\n\nenum Menu {\n  google_sign_in,\n  firestore_cloud_vision,\n  firebase_auth\n}\n\nclass MyHomePageState extends State&lt;MyHomePage&gt;{\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      appBar: AppBar(\n        title: Text(widget.message)\n      ),\n      drawer: Drawer(\n        child: ListView(\n          children: &lt;Widget&gt;[\n            DrawerHeader(\n              child: Text('Drawer Header'),\n              decoration: BoxDecoration(\n                color: Colors.blue,\n              ),\n            ),\n            ListTile( leading:Icon(Icons.account_box),\n                title:Text(\"Google Sign In\"),\n                onTap: () =&gt; drawerMenuSelected(Menu.google_sign_in)),\n            ListTile( leading:Icon(Icons.account_circle),\n                title:Text(\"Firebase Auth\"),\n                onTap: () =&gt; drawerMenuSelected(Menu.firebase_auth)),\n            ListTile( leading:Icon(Icons.crop_original),\n                title:Text(\"Firestore,CloudVision\"),\n                onTap: () =&gt; drawerMenuSelected(Menu.firestore_cloud_vision)),\n          ],\n        ),\n      ),\n    );\n  }\n\n  void drawerMenuSelected(Menu selectedMenu){\n    switch(selectedMenu) {\n      case Menu.google_sign_in:\n        _pushPage(context, GoogleSignInPage());\n        break;\n      case Menu.firebase_auth:\n        _pushPage(context, FirebaseAuthPage());\n        break;\n      case Menu.firestore_cloud_vision:\n        _pushPage(context, FirestoreCloudVisionPage());\n        break;\n      default:\n        break;\n    }\n  }\n\n  void _pushPage(BuildContext context, Widget page) {\n    Navigator.of(context).push(\n      MaterialPageRoute&lt;void&gt;(builder: (_) =&gt; page)\n    );\n  }\n}\n\nclass MyHomePage extends StatefulWidget {\n  final String message;\n  MyHomePage({this.message}):super() {}\n  @override\n  State&lt;StatefulWidget&gt; createState() =&gt; new MyHomePageState();\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Flutter\u3067\u30a2\u30d7\u30ea\u958b\u767a\u306e\u305f\u3081\u306e\u90e8\u54c1\u3042\u3064\u3081\u3002 \u30c8\u30c3\u30d7\u753b\u9762\u306e\u30e1\u30cb\u30e5\u30fc\u306b\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u30e1\u30cb\u30e5\u30fc\u3092\u8ffd\u52a0\u3057\u305f\u304c\u3001\u30c9\u30ed\u30ef\u30fc\u30e1\u30cb\u30e5\u30fc\u306b\u5909\u3048\u308b\u3002 import &#8216;dart:io&#8217;; import &#8216;package:flutter\/cu [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":919,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[111],"tags":[],"class_list":["post-759","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-flutter"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/759","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=759"}],"version-history":[{"count":4,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/759\/revisions"}],"predecessor-version":[{"id":928,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/759\/revisions\/928"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media\/919"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}