前提
TabbarのunselectedLabelColorを使って、非選択時の色を変えたいのですが、変わりません。
調べたのですが原因がわからないため、こちらで質問させていただきます。どうすればunselectedLabelColorを使って非選択時の色を変えるのでしょうか?
該当のソースコード
Dart
1import 'package:flutter/material.dart'; 2 3class Like extends StatefulWidget { 4 const Like({Key? key}); 5 6 State<Like> createState() => _Like(); 7} 8 9class _Like extends State<Like> with SingleTickerProviderStateMixin { 10 11 Widget build(BuildContext context) { 12 return DefaultTabController( 13 initialIndex: 0, 14 length: 2, 15 child: Scaffold( 16 appBar: AppBar( 17 backgroundColor: Color.fromARGB(255, 255, 255, 255), 18 toolbarHeight: deviceHeight * 0.04, 19 elevation: 0.0, 20 bottom: TabBar( 21 indicatorColor: Colors.black, 22 labelColor: Colors.black, 23 unselectedLabelColor: Colors.grey, 24 tabs: <Widget>[ 25 Tab( 26 child: Text( 27 '1' 28 ), 29 ), 30 Tab( 31 child: Text( 32 '2', 33 ), 34 ), 35 ], 36 ), 37 ), 38 body: const TabBarView( 39 children: <Widget>[ 40 Center(), 41 Center(), 42 ], 43 ), 44 ), 45 ); 46 } 47}
補足情報(FW/ツールのバージョンなど)
[✓] Flutter (Channel stable, 3.7.0, on macOS 13.1 22C65 darwin-arm64, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.73.0)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

回答1件
あなたの回答
tips
プレビュー