Flutter按钮添加背景图片及文字【转】


Flutter按钮添加背景图片及文字的一种方法,记录下,上代码

Widget picAndTextButton(String imgpath,String text) {
  return Container(
    width: 200,
    height: 60,
    decoration: BoxDecoration(
      color: Colors.white,
      image: DecorationImage(
        image: AssetImage(path),
        fit: BoxFit.fill
      ),
    ),
    alignment: Alignment.center,
    child: FlatButton(
      onPressed: _theDayBefor,
      child: Text(text),
      color: Colors.transparent,
      ),
  );
}

来源:Flutter按钮添加背景图片及文字


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM