如果你有趣味 你能够关注一下公众号 biglead 来获取最新的学习材料。

  • Flutter 从入门 到精通系列文章在这里
  • 当然也必须是要有源码的 在这里了
  • github 有点慢 无妨来看看码云的源码吧
  • 系列学习教程在这里

本文实现的成果:

在 Flutter 中,是通过 CupertinoSlidingSegmentedControl 来实现

  //以后选中的索引  int _currentIndex = 0;    buildSlidSegment() {    return Container(      margin: EdgeInsets.only(top: 80),      width: 300,      child: CupertinoSlidingSegmentedControl(        //子标签        children: <int, Widget>{          0: Text("全副"),          1: Text("支出"),          2: Text("收入 "),        },        //以后选中的索引        groupValue: _currentIndex,        //点击回调        onValueChanged: (int index) {          print("以后选中 $index");          setState(() {            _currentIndex = index;          });        },      ),    );  }