【Flutter】ボタンのprimaryColorを変える
Flutter2からボタンの色は、MaterialApp
のTheme.primarySwatch
に引っ張られるようになった。
デザインの統一性を持たせるためには便利になったが、ボタン単体で色(primaryColor)を変えるには、以下のようにする。
TextButton( onPressed: (){}, child: Text('Text Button'), style: TextButton.styleFrom( primary: Colors.green, ), ),
See the Pen flutter_text_button by popy1017 (@popy1017) on CodePen.