ninghao / ninghao_flutter

宁皓网 《Flutter 移动应用》开发课程源代码
https://ninghao.net/package/flutter
412 stars 186 forks source link

buttonColor: Theme.of(context).accentColor 设置无效 #2

Open LLemonGreen opened 5 years ago

LLemonGreen commented 5 years ago

分支:material-components

button_demo.dart

line30 buttonColor: Theme.of(context).accentColor 设置无效

buttonColor放在 buttonTheme: ButtonThemeData( 下设置生效

Theme(
                  data: Theme.of(context).copyWith(
                    // buttonColor: Theme.of(context).accentColor,
                    buttonTheme: ButtonThemeData(
                      buttonColor: Theme.of(context).accentColor,
                      textTheme: ButtonTextTheme.primary,
                      // shape: BeveledRectangleBorder(
                      //   borderRadius: BorderRadius.circular(5.0),
                      // )
                      shape:StadiumBorder(),
                    ),
                  ),
                  child: RaisedButton(
                  child: Text('Button'),
                  onPressed: () {},
                  splashColor: Colors.grey,
                  elevation: 0.0,
                  // color: Theme.of(context).accentColor,
                  // textColor: Colors.white,
                  // textTheme: ButtonTextTheme.primary,
                ),
                ),

当前flutter版本:Flutter (Channel beta, v1.5.4-hotfix.2, on Mac OS X 10.14.4 18E226, locale zh-Hans-CN)