小编pow*_*941的帖子

如何在 App Bar Flutter 中创建线性渐变?

我正在尝试在应用程序栏中添加线性渐变,但到目前为止我还没有设法做到这一点。有谁知道如何将其添加到我的应用程序栏中?谢谢

decoration: BoxDecoration(
                gradient: LinearGradient(
                    colors: [const Color(0xFFF06292), const Color(0xff2A75BC)]),
Run Code Online (Sandbox Code Playgroud)

我的代码看起来像这样

class RegisterAgree extends StatefulWidget {
  @override
  _RegisterAgreeState createState() => _RegisterAgreeState();
}

class _RegisterAgreeState extends State<RegisterAgree> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.pink,
        title: Row(
          children: <Widget>[
            Image.asset(
              'assets/images/logox.png',
              fit: BoxFit.cover,
              height: 45.0,
            )
          ],
        ),
      ),
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

gradient dart android-appbarlayout flutter flutter-appbar

5
推荐指数
2
解决办法
2248
查看次数