小编DOG*_*hal的帖子

如何设置 CupertinoSegmentedControl 高度?

我正在尝试使用CupertinoSegmentedControl来自 flutter Cupertino 库AppBarusing the bottom 属性来实现以下设计(高度 = 32)

库比蒂诺分段控制

所以我尝试了以下方法:

@override
    Widget build(BuildContext context) {
        return Scaffold(
                appBar: AppBar(
                    elevation: 2,
                    backgroundColor: Colors.white,
                    centerTitle: true,
                    title: Text(this.widget.title, style: TextStyle(color: Colors.black)),
                    bottom: PreferredSize(
        child: Padding(
          padding: const  EdgeInsets.only(top: 8, bottom: 12),
          child: Row(
            children: <Widget>[
              SizedBox(width: 24),
              Expanded(
                child: CupertinoSegmentedControl(
                  children: this.widget.tabs,
                  groupValue: this._selectedTab,
                  onValueChanged: (value) {
                    this.setState(() => this._selectedTab = value);
                    this._tabController.animateTo(value);
                  }
                ),
              ),
              SizedBox(width: 24)
            ],
          ),
        ),
        preferredSize: Size(double.infinity, 48)
      )
                ), …
Run Code Online (Sandbox Code Playgroud)

dart segmentedcontrol flutter

4
推荐指数
2
解决办法
6047
查看次数

标签 统计

dart ×1

flutter ×1

segmentedcontrol ×1