当前位置:   article > 正文

Flutter中AppBar自定义顶部导航按钮图标、颜色及TabBar定义顶部Tab切换_flutter appbar图标颜色

flutter appbar图标颜色

AppBarDemo.dart

  1. import 'package:flutter/material.dart';
  2. class AppBarPage extends StatelessWidget {
  3. @override
  4. Widget build(BuildContext context) {
  5. return Scaffold(
  6. appBar: AppBar(
  7. //标题居中
  8. centerTitle: true,
  9. title: Text("AppBarDemo"),
  10. //背景颜色
  11. backgroundColor: Colors.red,
  12. //设置前面显示图片
  13. leading: IconButton(
  14. icon: Icon(Icons.menu),
  15. onPressed: () {},
  16. ),
  17. //后面放置图标
  18. actions: <Widget>[
  19. IconButton(
  20. icon: Icon(Icons.help),
  21. onPressed: () {},
  22. ),
  23. IconButton(
  24. icon: Icon(Icons.settings),
  25. onPressed: () {},
  26. ),
  27. ],
  28. ),
  29. body: Text("AppBarDemo页面内容区域"),
  30. );
  31. }
  32. }

 

显示效果:

 

AppBarDemo.dart

  1. import 'package:flutter/material.dart';
  2. class AppBarPage extends StatelessWidget {
  3. @override
  4. Widget build(BuildContext context) {
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/431769
推荐阅读
相关标签
  

闽ICP备14008679号