Widget _buildContentView() { ScrollPhysics physics; if (this.widget.viewModel.isLoggedIn) { physics = new BouncingScrollPhysics(); } else { physics = new NeverScrollableScrollPhysics(); } return(new Flexible( child: new Container( child: new NotificationListener <ScrollNotification>( onNotification: this._onNotification, child: new PageView( physics: physics, controller: this._pageController, onPageChanged: index => { this.setState(() => this._selectedIndex = index); if (index == 0) { AnalyticsManager.AnalyticsClickHomeFocus(); } }, children: new List <Widget> { new FollowArticleScreenConnector(), new RecommendArticleScreenConnector() } ) ) ) )); }
Widget _buildContent() { ScrollPhysics physics; if (this.widget.viewModel.isLoggedIn) { physics = new BouncingScrollPhysics(); } else { physics = new NeverScrollableScrollPhysics(); } return(new Expanded( child: new CustomSegmentedControl( new List <object> { this._buildSelectItem("关注", 0), this._buildSelectItem("推荐", 1) }, new List <Widget> { new FollowArticleScreenConnector(selectedIndex: this._selectedIndex), new RecommendArticleScreenConnector(selectedIndex: this._selectedIndex) }, newValue => { this.setState(() => this._selectedIndex = newValue); if (newValue == 0) { AnalyticsManager.AnalyticsClickHomeFocus(); this._changeTabBarItemStatus(pixels: this._followArticlePixels, status: TabBarItemStatus.normal); } if (newValue == 1) { this._changeTabBarItemStatus(pixels: this._recommendArticlePixels, status: TabBarItemStatus.normal); } }, 1, trailing: this._buildTrailing(), headerDecoration: new BoxDecoration( color: CColors.White, border: new Border(bottom: new BorderSide(this._navBarHeight <= 0 ? CColors.Separator2 : CColors.Transparent)) ), indicator: new CustomGradientsTabIndicator( insets: EdgeInsets.symmetric(horizontal: 8), height: 8, gradient: new LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, new List <Color> { new Color(0xFFB1E0FF), new Color(0xFF6EC6FF) } ) ), headerPadding: EdgeInsets.only(8, bottom: 8), labelPadding: EdgeInsets.zero, selectedColor: CColors.TextTitle, unselectedColor: CColors.TextBody4, unselectedTextStyle: new TextStyle( fontSize: 18, fontFamily: "Roboto-Medium" ), selectedTextStyle: new TextStyle( fontSize: 18, fontFamily: "Roboto-Medium" ), controller: this._tabController, physics: physics, onTap: index => { if (this._selectedIndex != index) { if (index == 0) { if (!this.widget.viewModel.isLoggedIn) { this.widget.actionModel.pushToLogin(); return; } } this.setState(() => this._selectedIndex = index); this._tabController.animateTo(value: index); } } ) )); }
public override Widget build(BuildContext context) { base.build(context: context); ScrollPhysics physics; if (this.widget.viewModel.isLoggedIn) { physics = new BouncingScrollPhysics(); } else { physics = new NeverScrollableScrollPhysics(); } return(new Container( padding: EdgeInsets.only(top: CCommonUtils.getSafeAreaTopPadding(context: context)), color: CColors.White, child: new NotificationListener <ScrollNotification>( onNotification: this._onNotification, child: new CustomSegmentedControl( new List <object> { this._buildSelectItem("关注", 0), this._buildSelectItem("推荐", 1) }, new List <Widget> { new FollowArticleScreenConnector(), new RecommendArticleScreenConnector() }, newValue => { this.setState(() => this._selectedIndex = newValue); if (newValue == 0) { AnalyticsManager.AnalyticsClickHomeFocus(); } }, 1, headerHeight: this._navBarHeight, this._buildTrailing(), new BoxDecoration( color: CColors.White, border: new Border(bottom: new BorderSide(this._navBarHeight < _maxNavBarHeight ? CColors.Separator2 : CColors.Transparent)) ), new CustomUnderlineTabIndicator( borderSide: new BorderSide( width: this._navBarHeight <= _minNavBarHeight ? 2 : 4, color: CColors.PrimaryBlue ) ), EdgeInsets.only(8), labelPadding: EdgeInsets.zero, 40, selectedColor: this._navBarHeight <= _minNavBarHeight ? CColors.PrimaryBlue : CColors.TextTitle, unselectedColor: CColors.TextTitle, unselectedTextStyle: new TextStyle( fontSize: _minTitleFontSize, fontFamily: "Roboto-Bold" ), selectedTextStyle: new TextStyle( fontSize: this._titleFontSize, fontFamily: "Roboto-Bold" ), controller: this._tabController, physics: physics, onTap: index => { if (this._selectedIndex != index) { if (index == 0) { if (!this.widget.viewModel.isLoggedIn) { this.widget.actionModel.pushToLogin(); return; } } this.setState(() => this._selectedIndex = index); this._tabController.animateTo(value: index); } } ) ) )); }