玖叶教程网

前端编程开发入门

flutter appbar 沉浸式状态栏(flutter tabbar 悬浮)

class BaseViewBar extends PreferredSize {
  Widget childView;
  @override  final Size preferredSize; //Size.fromHeight(56.0)

  BaseViewBar({this.preferredSize, this.childView});

  @override  Widget build(BuildContext context) {
    Widget current = childView;
    if (childView == null) {
      current = LimitedBox(
        maxWidth: 0.0,
        maxHeight: 0.0,
        child: ConstrainedBox(constraints: const BoxConstraints.expand()),
      );
    }
    return current;
  }
}

下面是使用BaseViewBar

 @override
  Widget build(BuildContext context) {
    return Scaffold(
  backgroundColor: Colors.transparent,
  appBar: new BaseViewBar(
      childView: new CommonTitleBar( //自定义的标题栏类
        title: "Profile",
        color: Colors.white,
        rightClick: _onClickGold,
      ),
      preferredSize: Size.fromHeight(56.0)
    ),
  body: Text("hello")
    );
  }

发表评论:

控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言