{"id":1338,"date":"2021-03-10T12:58:09","date_gmt":"2021-03-10T03:58:09","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/?p=1338"},"modified":"2021-03-10T13:06:28","modified_gmt":"2021-03-10T04:06:28","slug":"flutter-bottom-navigator-color","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2021\/03\/10\/flutter-bottom-navigator-color\/","title":{"rendered":"[Flutter] \u30dc\u30c8\u30e0\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u306b\u3001\u30ab\u30e9\u30d5\u30eb\u306a\u30a2\u30a4\u30b3\u30f3\u753b\u50cf\u3092”\u305d\u306e\u307e\u307e”\u8868\u793a\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"
\u672c\u8a18\u4e8b\u306f\u3001Flutter\u958b\u767a\u306b\u304a\u3051\u308b\u5c0f\u6280\u306e\u7d39\u4ecb\u3067\u3059\u3002<\/p>\n
\u5bfe\u8c61\u8aad\u8005\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n
\u4ee5\u4e0b\u306e2\u3064\u306e\u753b\u50cf\u3092\u30a2\u30a4\u30b3\u30f3\u3068\u3057\u3066\u8868\u793a\u3055\u305b\u308b\u3053\u3068\u3092\u8003\u3048\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n
<\/p>\n
\u901a\u5e38\u306e\u5b9f\u88c5\u3060\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u306b\u306a\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n
class BottomNavigatorColor extends StatelessWidget {\n @override\n Widget build(BuildContext context) {\n return Scaffold(\n body: Container(\n child: Center(child: Text('\u30dc\u30c8\u30e0\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u30a2\u30a4\u30b3\u30f3\u8868\u793a\u30c6\u30b9\u30c8')),\n ),\n bottomNavigationBar: BottomNavigationBar(\n selectedItemColor: Colors.black,\n items: [\n BottomNavigationBarItem(\n icon: ImageIcon(AssetImage('images\/blue.png'), size: 32),\n label: 'blue',\n ),\n BottomNavigationBarItem(\n icon: ImageIcon(AssetImage('images\/red.png'), size: 32),\n label: 'red',\n ),\n ],\n ),\n );\n }\n}<\/code><\/pre>\n\u8868\u793a\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n
<\/p>\n
\u753b\u50cf\u304c\u30b0\u30ec\u30fc\u3067\u8868\u793a\u3055\u308c\u3066\u3057\u307e\u3063\u3066\u3044\u307e\u3059\u306d\u3002<\/p>\n
\u539f\u56e0\u306f\u3001ImageIcon\u30a6\u30a7\u30b8\u30a7\u30c3\u30c8\u304c\u753b\u50cf\u3092\u8868\u793a\u3059\u308b\u969b\u306b\u3001\u5fc5\u305acolor\u5c5e\u6027\u3092\u6307\u5b9a\u3057\u3066\u3057\u307e\u3063\u3066\u3044\u308b<\/strong>\u3068\u3053\u308d\u306b\u3042\u308a\u307e\u3059\u3002
\n\u4ee5\u4e0b\u306f\u3001ImageIcon\u30a6\u30a7\u30b8\u30a7\u30c3\u30c8\u5185\u306e\u30b3\u30fc\u30c9\u306e\u4e00\u90e8\u629c\u7c8b\u3067\u3059(\u30b3\u30e1\u30f3\u30c8\u3067\u88dc\u8db3\u60c5\u5831\u3092\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059)\u3002<\/p>\n @override\n Widget build(BuildContext context) {\n ... (\u7565)\n\n \/\/ \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u8a2d\u5b9a\u3055\u308c\u308bcolor\u5c5e\u6027\u306e\u5024 \u307e\u305f\u306f Theme\u8a2d\u5b9a\u306e\u5024\u304b\u3089\u8272\u3092\u53d6\u5f97\n Color iconColor = color ?? iconTheme.color;\n\n \/\/ \u900f\u660e\u5ea6\u3092\u8a2d\u5b9a\n if (iconOpacity != null && iconOpacity != 1.0)\n iconColor = iconColor.withOpacity(iconColor.opacity * iconOpacity);\n\n return Semantics(\n label: semanticLabel,\n child: Image(\n image: image,\n width: iconSize,\n height: iconSize,\n \/\/ \u753b\u50cf\u306e\u8272\u3092\u8a2d\u5b9a\n color: iconColor,\n fit: BoxFit.scaleDown,\n alignment: Alignment.center,\n excludeFromSemantics: true,\n ),\n );<\/code><\/pre>\n\u30b3\u30fc\u30c9\u5185\u306e\u30b3\u30e1\u30f3\u30c8\u306b\u3082\u8a18\u8ff0\u3057\u3066\u3044\u307e\u3059\u304c\u3001Image\u30a6\u30a7\u30b8\u30a7\u30c3\u30c8\u306ecolor\u5c5e\u6027\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u306d\u3002\u30ab\u30e9\u30d5\u30eb\u306b\u753b\u50cf\u3092\u8868\u793a\u3055\u305b\u305f\u3044\u5834\u5408\u306f\u3001\u8a2d\u5b9a\u3057\u306a\u3044\u3088\u3046\u306b\u3057\u305f\u3044\u306e\u3067\u3059\u304c\u3001ImageIcon\u30a6\u30a7\u30b8\u30a7\u30c3\u30c8\u306b\u6e21\u3059\u5f15\u6570\u306e\u8abf\u6574\u3067\u306f\u3001\u89e3\u6c7a\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n
\u305d\u306e\u305f\u3081\u3001\u8003\u3048\u3089\u308c\u308b\u89e3\u6c7a\u65b9\u6cd5\u3068\u3057\u3066\u3001<\/p>\n
ImageIcon\u30a6\u30a7\u30b8\u30a7\u30c3\u30c8\u3092\u7d99\u627f\u3057\u3001\u753b\u50cf\u306e\u8272\u3092\u8a2d\u5b9a\u3057\u306a\u3044\u65b0\u3057\u3044\u30a6\u30a7\u30b8\u30a7\u30c3\u30c8\u3092\u5b9a\u7fa9\u3059\u308b<\/strong> \u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n\u65b0\u3057\u3044\u30a6\u30a7\u30b8\u30a7\u30c3\u30c8\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9a\u7fa9\u3057\u307e\u3059\u3002<\/p>\n
class MyImageIcon extends ImageIcon {\n const MyImageIcon(\n ImageProvider image, {\n Key key,\n double size,\n Color color,\n String semanticLabel,\n }) : super(image,\n key: key, size: size, color: color, semanticLabel: semanticLabel);\n\n @override\n Widget build(BuildContext context) {\n return Semantics(\n label: semanticLabel,\n child: Image(\n image: image,\n width: size,\n height: size,\n fit: BoxFit.scaleDown,\n alignment: Alignment.center,\n excludeFromSemantics: true,\n \/\/ color\u5c5e\u6027\u306f\u8a2d\u5b9a\u3057\u306a\u3044\n ),\n );\n }\n}\n<\/code><\/pre>\nImageIcon\u304b\u3089MyImageIcon\u306b\u7f6e\u304d\u63db\u3048\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8868\u793a\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n
<\/p>\n
\u753b\u50cf\u306e\u8272\u304c\u305d\u306e\u307e\u307e\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u306d\u3002<\/p>\n
\u30dc\u30c8\u30e0\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u3067\u3001\u30ab\u30e9\u30d5\u30eb\u306a\u30a2\u30a4\u30b3\u30f3\u3092\u8868\u793a\u3059\u308b\u969b\u306e\u52a9\u3051\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u672c\u8a18\u4e8b\u306f\u3001Flutter\u958b\u767a\u306b\u304a\u3051\u308b\u5c0f\u6280\u306e\u7d39\u4ecb\u3067\u3059\u3002 \u5bfe\u8c61\u8aad\u8005\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002 Flutter\u3067\u30a2\u30d7\u30ea\u3092\u958b\u767a\u3057\u3066\u3044\u308b \u30dc\u30c8\u30e0\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u306e\u30dc\u30bf\u30f3\u306e\u8272\u3092\u30ab\u30e9\u30d5\u30eb\u306b\u8868\u793a\u3057\u305f\u3044 \u4ee5\u4e0b\u306e2\u3064\u306e\u753b\u50cf\u3092\u30a2\u30a4\u30b3\u30f3\u3068\u3057\u3066\u8868\u793a\u3055\u305b\u308b\u3053\u3068\u3092\u8003\u3048\u3066\u3044\u304d\u307e\u3059\u3002 \u901a\u5e38\u306e\u5b9f\u88c5\u3060\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u306b\u306a\u308b\u3068\u601d\u3044\u307e\u3059\u3002 class BottomNavigatorColor extends StatelessWidget […]<\/p>\n","protected":false},"author":5,"featured_media":1344,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/1338"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=1338"}],"version-history":[{"count":4,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/1338\/revisions"}],"predecessor-version":[{"id":1348,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/1338\/revisions\/1348"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media\/1344"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=1338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=1338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=1338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}