Widget _buildNotLoginInNavigationBar() { return(new Container( color: CColors.White, padding: EdgeInsets.only(16, CCommonUtils.getSafeAreaTopPadding(context: this.context), bottom: 16), child: new Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { _buildQrScanWidget(), new Text("欢迎来到", style: CTextStyle.H2), new Text("Unity Connect", style: CTextStyle.H2), new Container( margin: EdgeInsets.only(top: 16), child: new CustomButton( padding: EdgeInsets.zero, onPressed: () => this.widget.actionModel.mainRouterPushTo(obj: MainNavigatorRoutes.Login), child: new Container( padding: EdgeInsets.symmetric(horizontal: 24, vertical: 8), decoration: new BoxDecoration( border: Border.all(color: CColors.PrimaryBlue), borderRadius: BorderRadius.all(20) ), child: new Text( "登录/注册", style: CTextStyle.PLargeMediumBlue ) ) ) ) } ) )); }
public override Widget build(BuildContext context) { base.build(context: context); return(new Container( padding: EdgeInsets.only(top: CCommonUtils.getSafeAreaTopPadding(context: context)), color: CColors.White, child: new Column( children: new List <Widget> { new CustomNavigationBar( new Text("活动", style: CTextStyle.H2) ), new Expanded( child: new CustomSegmentedControl( new List <object> { "即将开始", "往期活动" }, new List <Widget> { new EventOngoingScreenConnector(), new EventCompletedScreenConnector() }, newValue => AnalyticsManager.ClickEventSegment("Event", 0 == newValue ? "ongoing" : "completed"), 1 ) ) } ) )); }
public override Widget build(BuildContext context) { base.build(context: context); var mode = this._selectValue == "all" ? "" : this._selectValue; return(new Container( padding: EdgeInsets.only(top: CCommonUtils.getSafeAreaTopPadding(context: context)), color: CColors.White, child: new Column( children: new List <Widget> { new CustomNavigationBar( new Text("活动", style: CTextStyle.H2) ), new Expanded( child: new CustomSegmentedControl( new List <object> { "即将开始", "往期活动" }, new List <Widget> { new EventOngoingScreenConnector(mode: mode), new EventCompletedScreenConnector(mode: mode) }, newValue => AnalyticsManager.ClickEventSegment("Event", 0 == newValue ? "ongoing" : "completed"), 1, trailing: new Container( padding: EdgeInsets.only(right: 12), child: new CustomDropdownButton <string>( value: this._selectValue, items: new List <CustomDropdownMenuItem <string> > { new CustomDropdownMenuItem <string>( value: "all", child: new Text("全部") ), new CustomDropdownMenuItem <string>( value: "online", child: new Text("线上") ), new CustomDropdownMenuItem <string>( value: "offline", child: new Text("线下") ) }, onChanged: newValue => { if (this._selectValue != newValue) { this.setState(() => this._selectValue = newValue); } }, headerWidget: new Container(height: 6, color: CColors.White), footerWidget: new Container(height: 6, color: CColors.White) ) ) ) ) } ) )); }
Widget _buildNotLoginInNavigationBar() { return(new Container( color: CColors.White, padding: EdgeInsets.only(top: CCommonUtils.getSafeAreaTopPadding(context: this.context)), margin: EdgeInsets.only(bottom: 16), child: new Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { this._buildQrScanWidget(false), new Container( padding: EdgeInsets.only(16, 8, 16, 24), child: new Row( children: new List <Widget> { new Column( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Text("欢迎来到", style: CTextStyle.H4.defaultHeight()), new Text("Unity Connect", style: CTextStyle.H2.defaultHeight()), new Container( margin: EdgeInsets.only(top: 24), child: new CustomButton( padding: EdgeInsets.zero, onPressed: () => this.widget.actionModel.mainRouterPushTo( obj: MainNavigatorRoutes.Login), child: new Container( height: 40, width: 120, alignment: Alignment.center, decoration: new BoxDecoration( color: CColors.PrimaryBlue, borderRadius: BorderRadius.all(20) ), child: new Text( "登录/注册", style: CTextStyle.PLargeMediumWhite.defaultHeight() ) ) ) ) } ), new Expanded( child: Image.asset( "image/mine_mascot_u" ) ) } ) ) } ) )); }
bool _onNotification(ScrollNotification notification) { var pixels = notification.metrics.pixels; var navBarBottomPosition = navBarHeight + CCommonUtils.getSafeAreaTopPadding(context: this.context); if (pixels >= navBarBottomPosition) { if (this._hideNavBar) { this.setState(() => this._hideNavBar = false); StatusBarManager.statusBarStyle(false); } } else { if (!this._hideNavBar) { this.setState(() => this._hideNavBar = true); StatusBarManager.statusBarStyle(true); } } if (pixels > imageBaseHeight - navBarHeight - 24) { if (!this._isHaveTitle) { this._controller.forward(); this.setState(() => this._isHaveTitle = true); } } else { if (this._isHaveTitle) { this._controller.reverse(); this.setState(() => this._isHaveTitle = false); } } if (pixels > imageBaseHeight - navBarHeight) { if (!this._isShowTop) { this.setState(() => this._isShowTop = true); } } else { if (this._isShowTop) { this.setState(() => this._isShowTop = false); } } return(true); }
bool _onNotification(BuildContext context, ScrollNotification notification) { var axisDirection = notification.metrics.axisDirection; if (axisDirection == AxisDirection.left || axisDirection == AxisDirection.right) { return(true); } var pixels = notification.metrics.pixels; var topPadding = 44 + CCommonUtils.getSafeAreaTopPadding(context: context); if (this._playButtonPosition == 0.0f) { var width = MediaQuery.of(context).size.width; var imageHeight = width / this._aspectRatio; this._playButtonPosition = imageHeight + gameBriefKey.currentContext.size.height - topPadding - 24 - 6; // topPadding 是顶部的高度, 24 是底部的 padding, 6 是按钮到左边图片到底部的距离 } if (pixels >= 44 + topPadding) { if (this._showNavBarShadow) { this.setState(() => { this._showNavBarShadow = false; }); StatusBarManager.statusBarStyle(false); } } else { if (!this._showNavBarShadow) { this.setState(() => { this._showNavBarShadow = true; }); StatusBarManager.statusBarStyle(true); } } if (pixels > this._playButtonPosition) { if (!this._isHaveTitle) { this._controller.forward(); this.setState(() => { this._isHaveTitle = true; }); } } else { if (this._isHaveTitle) { this._controller.reverse(); this.setState(() => { this._isHaveTitle = false; }); } } return(true); }
void _showBloggerDialog(Rect rect) { PreferencesManager.updateKingKongType(type: KingKongType.blogger); CustomDialogUtils.showCustomDialog( child: new Bubble( "这里可以发现很多大牛博主哦", rect.width - rect.width / 8.0f, rect.bottom - 16 - CCommonUtils.getSafeAreaTopPadding(context: this.context), contentRight: 16 ), barrierDismissible: true ); }
void _showTinyGameDialog(Rect rect) { PreferencesManager.updateKingKongType(type: KingKongType.tinyGame); CustomDialogUtils.showCustomDialog( child: new Bubble( "这里可以看 Tiny Projects 哦", rect.left + rect.width / 2.0f, rect.bottom + 8 - CCommonUtils.getSafeAreaTopPadding(context: this.context), contentRight: 16 ), barrierDismissible: true, onPop: () => {} ); }
public override Widget build(BuildContext context) { base.build(context: context); return(new Container( padding: EdgeInsets.only(top: CCommonUtils.getSafeAreaTopPadding(context: context)), color: CColors.White, child: new Column( children: new List <Widget> { this._buildSelectView(), this._buildContentView() } ) )); }
bool _onNotification(BuildContext context, ScrollNotification notification) { var pixels = notification.metrics.pixels; var topPadding = 44 + CCommonUtils.getSafeAreaTopPadding(context: context); if (this._titleHeight == 0.0f) { var width = MediaQuery.of(context).size.width; var imageHeight = width / this._aspectRatio; this._titleHeight = imageHeight + eventTitleKey.currentContext.size.height - topPadding + 16; // topPadding 是顶部的高度 16 是文字与图片的间隙 } if (pixels >= 44 + topPadding) { if (this._showNavBarShadow) { this.setState(() => { this._showNavBarShadow = false; }); StatusBarManager.statusBarStyle(false); } } else { if (!this._showNavBarShadow) { this.setState(() => { this._showNavBarShadow = true; }); StatusBarManager.statusBarStyle(true); } } if (pixels > this._titleHeight) { if (!this._isHaveTitle) { this._controller.forward(); this.setState(() => { this._isHaveTitle = true; }); } } else { if (this._isHaveTitle) { this._controller.reverse(); this.setState(() => { this._isHaveTitle = false; }); } } return(true); }
public override Widget build(BuildContext context) { base.build(context: context); return(new Container( padding: EdgeInsets.only(top: CCommonUtils.getSafeAreaTopPadding(context: context)), color: CColors.White, child: new NotificationListener <ScrollNotification>( onNotification: this._onNotification, child: new Column( children: new List <Widget> { this._buildNavigationBar(), this._buildContent() } ) ) )); }
public override Widget build(BuildContext context) { if (this.tipMenuItems == null || this.tipMenuItems.Count == 0) { return(this.child); } return(new GestureDetector( onLongPress: () => { var height = MediaQuery.of(context: context).size.height; var renderBox = (RenderBox)this._tipMenuKey.currentContext.findRenderObject(); var position = renderBox.localToGlobal(point: Offset.zero); ArrowDirection arrowDirection; if (position.dy > 44 + CCommonUtils.getSafeAreaTopPadding(context: context) + CustomTextSelectionControlsUtils._kToolbarTriangleSize.height + this._getTipMenuHeight(context: context)) { arrowDirection = ArrowDirection.down; } else if (position.dy + renderBox.size.height < height - 44) { position = new Offset(dx: position.dx, position.dy + renderBox.size.height); arrowDirection = ArrowDirection.up; } else { position = new Offset(dx: position.dx, height / 2.0f); arrowDirection = ArrowDirection.up; } // var position = renderBox.localToGlobal(new Offset(0, dy: renderBox.size.height)); this._createTipMenu( context: context, arrowDirection: arrowDirection, position: position, size: renderBox.size ); }, child: new Container( key: this._tipMenuKey, child: this.child ) )); }
Widget _buildTopView(BuildContext context) { return(new Flexible( child: new Stack( children: new List <Widget> { new Positioned( top: CCommonUtils.getSafeAreaTopPadding(context: context), left: 0, child: new CustomButton( padding: EdgeInsets.symmetric(10, 16), onPressed: () => this.widget.actionModel.mainRouterPop(), child: new Icon( icon: Icons.close, size: 24, color: CColors.White ) ) ), new Align( alignment: Alignment.center, child: new Container( height: 78, child: new Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new Container( width: 251, height: 53, child: Image.asset( "image/img-logo-unity-connect-white-with-shadow@4x", fit: BoxFit.cover ) ), new Text( "Unity 问 题 全 搞 定", maxLines: 1, style: CTextStyle.H5.copyWith(color: CColors.White, height: 1) ) } ) ) ) } ) )); }
void _showLeaderBoardDialog(Rect rect, List <KingKongType> kingKongTypes) { PreferencesManager.updateKingKongType(type: KingKongType.leaderBoard); CustomDialogUtils.showCustomDialog( child: new Bubble( "榜单上线,合辑、专栏、博主在这里哦", rect.width / 8.0f + rect.width / 4.0f, rect.bottom - 16 - CCommonUtils.getSafeAreaTopPadding(context: this.context), contentRight: 16 ), barrierDismissible: true, onPop: () => { if (!kingKongTypes.Contains(item: KingKongType.blogger)) { this._showBloggerDialog(rect: rect); } } ); }
void _showDailyCollectionDialog(Rect rect, List <KingKongType> kingKongTypes) { PreferencesManager.updateKingKongType(type: KingKongType.dailyCollection); CustomDialogUtils.showCustomDialog( child: new Bubble( "每日精选1篇文章,记得查看哦", rect.width / 8.0f, rect.bottom - 16 - CCommonUtils.getSafeAreaTopPadding(context: this.context), 16 ), barrierDismissible: true, onPop: () => { if (!kingKongTypes.Contains(item: KingKongType.leaderBoard)) { this._showLeaderBoardDialog(rect: rect, kingKongTypes: kingKongTypes); } } ); }
public override Widget build(BuildContext context) { Widget content; if (this.widget.viewModel.userLoading && this.widget.viewModel.user == null) { content = new GlobalLoading(); } else if (this.widget.viewModel.user == null || this.widget.viewModel.user.errorCode == "ResourceNotFound") { content = new BlankView( "用户不存在", "image/default-following" ); } else { content = this._buildUserContent(context: context); } return(new Container( color: CColors.White, child: new CustomSafeArea( top: false, bottom: false, child: new Stack( children: new List <Widget> { content, this._buildNavigationBar(context: context), new Positioned( left: 0, top: navBarHeight + CCommonUtils.getSafeAreaTopPadding(context: context), right: 0, child: new Offstage( offstage: !this._isShowTop, child: this._buildUserArticleTitle() ) ) } ) ) )); }
Widget _buildContent(BuildContext context) { return(new GestureDetector( onTap: () => { if (this._emailFocusNode.hasFocus) { this._emailFocusNode.unfocus(); } if (this._passwordFocusNode.hasFocus) { this._passwordFocusNode.unfocus(); } }, child: new Container( padding: EdgeInsets.only(top: CCommonUtils.getSafeAreaTopPadding(context: context)), decoration: new BoxDecoration( gradient: new LinearGradient( colors: new List <Color> { new Color(0xFFF7FBFF), new Color(0xFFEAF5FD) }, begin: Alignment.topLeft, end: Alignment.bottomRight ) ), child: new Column( children: new List <Widget> { this._buildTopView(), this._buildMiddleView(context: context), this._buildBottomView() } ) ) )); }
Widget _buildUserContent(BuildContext context) { var articleIds = this.widget.viewModel.user.articleIds; var favoriteIds = this.widget.viewModel.favoriteTagIdDict.ContainsKey(key: this.widget.viewModel.user.id) ? this.widget.viewModel.favoriteTagIdDict[key : this.widget.viewModel.user.id] : null; var articlesHasMore = this.widget.viewModel.user.articlesHasMore ?? false; var userFavoriteHasMore = this.widget.viewModel.userFavoriteHasMore; var userArticleLoading = this.widget.viewModel.userArticleLoading && articleIds == null; var userFavoriteLoading = this.widget.viewModel.userFavoriteLoading && favoriteIds == null; int itemCount; if (userArticleLoading && this._selectedIndex == 0) { itemCount = 3; } else if (userFavoriteLoading && this._selectedIndex == 1) { itemCount = 3; } else { if (articleIds == null && this._selectedIndex == 0) { itemCount = 3; } else if (favoriteIds == null && this._selectedIndex == 1) { itemCount = 3; } else { if (this._selectedIndex == 0) { var articleCount = articlesHasMore ? articleIds.Count : articleIds.Count + 1; itemCount = 2 + (articleIds.Count == 0 ? 1 : articleCount); } else { var favoriteCount = userFavoriteHasMore ? favoriteIds.Count : favoriteIds.Count + 1; itemCount = 2 + (favoriteIds.Count == 0 ? 1 : favoriteCount); } } } var headerHeight = imageBaseHeight + 44 + CCommonUtils.getSafeAreaTopPadding(context: context); return(new Container( color: CColors.Background, child: new CustomScrollbar( new SmartRefresher( controller: this._refreshController, enablePullDown: false, enablePullUp: this._selectedIndex == 0 ? articlesHasMore : userFavoriteHasMore, onRefresh: this._onRefresh, onNotification: this._onNotification, child: ListView.builder( physics: new AlwaysScrollableScrollPhysics(), itemCount: itemCount, itemBuilder: (cxt, index) => { if (index == 0) { return Transform.scale( scale: this._factor, child: this._buildUserInfo(context) ); } if (index == 1) { return this._buildUserArticleTitle(); } if (userArticleLoading && index == 2 && this._selectedIndex == 0) { var height = MediaQuery.of(context: context).size.height - headerHeight; return new Container( height: height, child: new GlobalLoading() ); } if (userFavoriteLoading && index == 2 && this._selectedIndex == 1) { var height = MediaQuery.of(context: context).size.height - headerHeight; return new Container( height: height, child: new GlobalLoading() ); } if ((articleIds == null || articleIds.Count == 0) && index == 2 && this._selectedIndex == 0) { var height = MediaQuery.of(context: context).size.height - headerHeight; return new Container( height: height, child: new BlankView( "哎呀,暂无已发布的文章", "image/default-article" ) ); } if ((favoriteIds == null || favoriteIds.Count == 0) && index == 2 && this._selectedIndex == 1) { var height = MediaQuery.of(context: context).size.height - headerHeight; return new Container( height: height, child: new BlankView( "哎呀,暂无已收藏的文章", "image/default-article" ) ); } if (index == itemCount - 1 && !articlesHasMore && this._selectedIndex == 0) { return new EndView(); } if (index == itemCount - 1 && !userFavoriteHasMore && this._selectedIndex == 1) { return new EndView(); } if (this._selectedIndex == 1) { var favoriteId = favoriteIds[index - 2]; return this._buildFavoriteCard(favoriteId: favoriteId); } var articleId = articleIds[index - 2]; if (!this.widget.viewModel.articleDict.ContainsKey(key: articleId)) { return new Container(); } var article = this.widget.viewModel.articleDict[key: articleId]; var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id); var fullName = ""; if (article.ownerType == OwnerType.user.ToString()) { if (this.widget.viewModel.userDict.ContainsKey(key: article.userId)) { fullName = this.widget.viewModel.userDict[key: article.userId].fullName ?? this.widget.viewModel.userDict[key: article.userId].name; } } if (article.ownerType == OwnerType.team.ToString()) { if (this.widget.viewModel.teamDict.ContainsKey(key: article.teamId)) { fullName = this.widget.viewModel.teamDict[key: article.teamId].name; } } return new ArticleCard( article: article, () => this.widget.actionModel.pushToArticleDetail(obj: article.id), () => ShareManager.showArticleShareView( this.widget.viewModel.currentUserId != article.userId, isLoggedIn: this.widget.viewModel.isLoggedIn, () => { Clipboard.setData(new ClipboardData(text: linkUrl)); CustomDialogUtils.showToast("复制链接成功", Icons.check_circle_outline); }, () => this.widget.actionModel.pushToLogin(), () => this.widget.actionModel.pushToBlock(article.id), () => this.widget.actionModel.pushToReport(article.id, ReportType.article), type => { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); string imageUrl = CImageUtils.SizeTo200ImageUrl(article.thumbnail.url); this.widget.actionModel.shareToWechat(arg1: type, arg2: article.title, arg3: article.subTitle, arg4: linkUrl, arg5: imageUrl) .Then(onResolved: CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); }, () => this.widget.actionModel.mainRouterPop() ), fullName, key: new ObjectKey(value: article.id) ); } ) ) ) )); }
Widget _buildTeamInfo(BuildContext context) { var team = this.widget.viewModel.team; return(new CoverImage( coverImage: team.coverImage, height: imageBaseHeight + CCommonUtils.getSafeAreaTopPadding(context: context), new Container( padding: EdgeInsets.only(16, 0, 16, 24), child: new Column( mainAxisAlignment: MainAxisAlignment.end, children: new List <Widget> { new Row( children: new List <Widget> { new Container( margin: EdgeInsets.only(right: 16), child: Avatar.Team( team: team, 80, true ) ), new Expanded( child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Row( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Flexible( child: new Text( data: team.name, style: CTextStyle.H4White.merge( new TextStyle(height: 1)), maxLines: 1, overflow: TextOverflow.ellipsis ) ), CImageUtils.GenBadgeImage( badges: team.badges, CCommonUtils.GetUserLicense( userId: team.id ), EdgeInsets.only(4, 6) ) } ) } ) ) } ), new Container( margin: EdgeInsets.only(top: 16), child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new Row( children: new List <Widget> { _buildFollowCount( "粉丝", $"{team.stats?.followCount ?? 0}", () => { if (this.widget.viewModel.isLoggedIn) { this.widget.actionModel.pushToTeamFollower( obj: this.widget.viewModel.team.id); } else { this.widget.actionModel.pushToLogin(); } } ), new SizedBox(width: 16), _buildFollowCount( "成员", $"{team.stats?.membersCount ?? 0}", () => this.widget.actionModel.pushToTeamMember( obj: this.widget.viewModel.team.id) ) } ), this._buildFollowButton() } ) ) } ) ) )); }
Widget _buildContent(BuildContext context) { var articleIds = this.widget.viewModel.team.articleIds; var articlesHasMore = this.widget.viewModel.team.articlesHasMore ?? false; var teamArticleLoading = this.widget.viewModel.teamArticleLoading && articleIds == null; int itemCount; if (teamArticleLoading) { itemCount = 3; } else { if (articleIds == null) { itemCount = 3; } else { var articleCount = articlesHasMore ? articleIds.Count : articleIds.Count + 1; itemCount = 2 + (articleIds.Count == 0 ? 1 : articleCount); } } var headerHeight = imageBaseHeight + 44 + CCommonUtils.getSafeAreaTopPadding(context: context); return(new Container( color: CColors.Background, child: new CustomScrollbar( new SmartRefresher( controller: this._refreshController, enablePullDown: false, enablePullUp: articlesHasMore, onRefresh: this._onRefresh, onNotification: this._onNotification, child: ListView.builder( physics: new AlwaysScrollableScrollPhysics(), itemCount: itemCount, itemBuilder: (cxt, index) => { if (index == 0) { return Transform.scale( scale: this._factor, child: this._buildTeamInfo(context: context) ); } if (index == 1) { return _buildTeamArticleTitle(); } if (teamArticleLoading && index == 2) { var height = MediaQuery.of(context: context).size.height - headerHeight; return new Container( height: height, child: new GlobalLoading() ); } if ((articleIds == null || articleIds.Count == 0) && index == 2) { var height = MediaQuery.of(context: context).size.height - headerHeight; return new Container( height: height, child: new BlankView( "哎呀,暂无已发布的文章", "image/default-article" ) ); } if (index == itemCount - 1 && !articlesHasMore) { return new EndView(); } var articleId = articleIds[index - 2]; if (!this.widget.viewModel.articleDict.ContainsKey(key: articleId)) { return new Container(); } var article = this.widget.viewModel.articleDict[key: articleId]; return new ArticleCard( article: article, () => this.widget.actionModel.pushToArticleDetail(obj: article.id), () => this._share(article: article), fullName: this.widget.viewModel.team.name, key: new ObjectKey(value: article.id) ); } ) ) ) )); }
Widget _buildHeadTop(RankData game, BuildContext context) { Widget titleWidget = new Container(); Widget playButton = new Container(); if (this._isHaveTitle) { titleWidget = new Text( game.resetTitle, style: CTextStyle.PXLargeMedium, maxLines: 1, overflow: TextOverflow.ellipsis, textAlign: TextAlign.left ); playButton = _buildPlayButton(game: game); } return(new AnimatedContainer( height: 44 + CCommonUtils.getSafeAreaTopPadding(context: context), duration: TimeSpan.Zero, padding: EdgeInsets.only(8, right: 8, top: CCommonUtils.getSafeAreaTopPadding(context: context)), decoration: new BoxDecoration( CColors.White, border: new Border( bottom: new BorderSide(this._isHaveTitle ? CColors.Separator2 : CColors.Transparent)), gradient: this._showNavBarShadow ? new LinearGradient( colors: new List <Color> { new Color(0x80000000), new Color(0x0) }, begin: Alignment.topCenter, end: Alignment.bottomCenter ) : null ), child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new CustomButton( onPressed: () => this.widget.actionModel.mainRouterPop(), child: new Icon( Icons.arrow_back, size: 24, color: this._showNavBarShadow ? CColors.White : CColors.Icon ) ), new Expanded( child: new Stack( fit: StackFit.expand, children: new List <Widget> { new PositionedTransition( rect: this._animation, child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { titleWidget, playButton } ) ) } ) ) } ) )); }
Widget _buildNavigationBar(BuildContext context) { Color navigationBarColor; Border border; Color backColor; if (this._isHaveTitle) { navigationBarColor = CColors.Transparent; border = null; backColor = CColors.White; } else { navigationBarColor = CColors.White; border = new Border(bottom: new BorderSide(color: CColors.Separator2)); backColor = CColors.TextTitle; } return(new Container( height: CustomAppBarUtil.appBarHeight + CCommonUtils.getSafeAreaTopPadding(context: context), padding: EdgeInsets.only(top: CCommonUtils.getSafeAreaTopPadding(context: context)), decoration: new BoxDecoration( color: navigationBarColor, border: border ), child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: new List <Widget> { new CustomButton( padding: EdgeInsets.only(16, 10, 16, 10), onPressed: () => this.widget.actionModel.mainRouterPop(), child: new Icon( icon: Icons.arrow_back, size: 24, color: backColor ) ), new Expanded( child: new Stack( fit: StackFit.expand, children: new List <Widget> { new AnimatedPositioned( left: 0, top: this._isHaveTitle ? 13 : -44, right: 0, duration: TimeSpan.FromMilliseconds(100), child: new Text( "优选榜单", textAlign: TextAlign.center, style: CTextStyle.PXLargeMediumWhite ) ), new AnimatedPositioned( left: 0, top: this._isHaveTitle ? 44 : 0, right: 0, duration: TimeSpan.FromMilliseconds(100), child: new Container( alignment: Alignment.center, child: this._buildTabBarHeader() ) ) } ) ), new Container(width: 56) } ) )); }
public override Widget build(BuildContext context) { base.build(context: context); Widget content; var notifications = this.widget.viewModel.notifications; if (!this._hasBeenLoadedData || this.widget.viewModel.notificationLoading && 0 == notifications.Count) { content = new Container( padding: EdgeInsets.only(bottom: CConstant.TabBarHeight + CCommonUtils.getSafeAreaBottomPadding(context: context)), child: new GlobalLoading() ); } else if (0 == notifications.Count) { content = new Container( padding: EdgeInsets.only(bottom: CConstant.TabBarHeight + CCommonUtils.getSafeAreaBottomPadding(context: context)), child: new BlankView( "好冷清,多和小伙伴们互动呀", "image/default-notification", true, () => { this.widget.actionModel.startFetchNotifications(); this.widget.actionModel.fetchNotifications(arg: firstPageNumber); } ) ); } else { var enablePullUp = this.widget.viewModel.page < this.widget.viewModel.pageTotal; content = new Container( color: CColors.Background, child: new CustomListView( controller: this._refreshController, enablePullDown: true, enablePullUp: enablePullUp, onRefresh: this._onRefresh, hasBottomMargin: true, itemCount: notifications.Count, itemBuilder: this._buildNotificationCard, footerWidget: enablePullUp ? null : new EndView(hasBottomMargin: true), hasScrollBar: false ) ); } return(new Container( padding: EdgeInsets.only(top: CCommonUtils.getSafeAreaTopPadding(context: context)), color: CColors.White, child: new Column( children: new List <Widget> { this._buildNavigationBar(), new CustomDivider( color: CColors.Separator2, height: 1 ), new Flexible( child: new NotificationListener <ScrollNotification>( onNotification: this._onNotification, child: new CustomScrollbar(child: content) ) ) } ) )); }
Widget _buildLoginInNavigationBar() { var user = this.widget.viewModel.userDict[key : this.widget.viewModel.user.userId]; Widget titleWidget; if (user.title != null && user.title.isNotEmpty()) { titleWidget = new Text( data: user.title, style: new TextStyle( fontSize: 14, fontFamily: "Roboto-Regular", color: CColors.BgGrey ), maxLines: 1, overflow: TextOverflow.ellipsis ); } else { titleWidget = new Container(); } var content = new Container( height: 184 + CCommonUtils.getSafeAreaTopPadding(context: this.context), padding: EdgeInsets.only(16, CCommonUtils.getSafeAreaTopPadding(context: this.context), bottom: 16), child: new Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { _buildQrScanWidget(), new Row( children: new List <Widget> { new Container( margin: EdgeInsets.only(right: 12), child: Avatar.User( user: user, 64, true ) ), new Expanded( child: new Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Row( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Flexible( child: new Text( user.fullName ?? user.name, style: CTextStyle.H4White.merge(new TextStyle(height: 1)), maxLines: 1, overflow: TextOverflow.ellipsis ) ), CImageUtils.GenBadgeImage( badges: user.badges, CCommonUtils.GetUserLicense( userId: user.id, userLicenseMap: this.widget.viewModel.userLicenseDict ), EdgeInsets.only(4, 6) ) } ), titleWidget } ) ), new Container( padding: EdgeInsets.only(12, right: 16), child: new Icon( icon: Icons.chevron_right, size: 24, color: CColors.LightBlueGrey ) ) } ) } ) ); return(new GestureDetector( onTap: () => this.widget.actionModel.pushToUserDetail(obj: user.id), child: new Stack( children: new List <Widget> { Positioned.fill(new Stack( children: new List <Widget> { new Stack( children: new List <Widget> { new Container(color: new Color(0xFF212121)), new Positioned( top: 30, right: 30, child: new Icon(Icons.UnityLogo, size: 210, color: new Color(0xFF2b2b2b))) }) })), content }) )); }
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); } } ) ) )); }
Widget _buildHeadTop(IEvent eventObj, BuildContext context) { Widget shareWidget = new CustomButton( onPressed: () => ActionSheetUtils.showModalActionSheet(new ShareView( projectType: ProjectType.iEvent, onPressed: type => { AnalyticsManager.ClickShare(type, "Event", "Event_" + eventObj.id, eventObj.title); var linkUrl = CStringUtils.JointEventShareLink(eventId: eventObj.id); if (type == ShareType.clipBoard) { this.widget.actionModel.copyText(linkUrl); CustomDialogUtils.showToast("复制链接成功", Icons.check_circle_outline); } else { var imageUrl = CImageUtils.SizeTo200ImageUrl(eventObj.avatar); CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); this.widget.actionModel.shareToWechat(type, eventObj.title, eventObj.shortDescription, linkUrl, imageUrl, null).Then(CustomDialogUtils.hiddenCustomDialog) .Catch(_ => CustomDialogUtils.hiddenCustomDialog()); } })), child: new Container( color: CColors.Transparent, child: new Icon(Icons.share, size: 24, color: this._showNavBarShadow ? CColors.White : CColors.Icon)) ); Widget titleWidget = new Container(); if (this._isHaveTitle) { titleWidget = new Text( eventObj.title, style: CTextStyle.PXLargeMedium, maxLines: 1, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center ); } return(new AnimatedContainer( height: 44 + CCommonUtils.getSafeAreaTopPadding(context: context), duration: TimeSpan.Zero, padding: EdgeInsets.only(8, right: 8, top: CCommonUtils.getSafeAreaTopPadding(context: context)), decoration: new BoxDecoration( CColors.White, border: new Border( bottom: new BorderSide(this._isHaveTitle ? CColors.Separator2 : CColors.Transparent)), gradient: this._showNavBarShadow ? new LinearGradient( colors: new List <Color> { new Color(0x80000000), new Color(0x0) }, begin: Alignment.topCenter, end: Alignment.bottomCenter ) : null ), child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new CustomButton( onPressed: () => this.widget.actionModel.mainRouterPop(), child: new Icon( Icons.arrow_back, size: 24, color: this._showNavBarShadow ? CColors.White : CColors.Icon ) ), new Expanded( child: new Stack( fit: StackFit.expand, children: new List <Widget> { new PositionedTransition( rect: this._animation, child: titleWidget ) } ) ), shareWidget } ) )); }
Widget _buildUserInfo(BuildContext context) { var user = this.widget.viewModel.user ?? new User(); Widget titleWidget; if (user.title != null && user.title.isNotEmpty()) { titleWidget = new Text( data: user.title, style: new TextStyle( fontSize: 14, fontFamily: "Roboto-Regular", color: CColors.BgGrey ), maxLines: 1, overflow: TextOverflow.ellipsis ); } else { titleWidget = new Container(); } return(new CoverImage( coverImage: user.coverImage, imageBaseHeight + CCommonUtils.getSafeAreaTopPadding(context: context), new Container( padding: EdgeInsets.only(16, 0, 16, 24), child: new Column( mainAxisAlignment: MainAxisAlignment.end, children: new List <Widget> { new Row( children: new List <Widget> { new Container( margin: EdgeInsets.only(right: 16), child: Avatar.User( user: user, 80, true ) ), new Expanded( child: new Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Row( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Flexible( child: new Text( user.fullName ?? user.name, style: CTextStyle.H4White.merge( new TextStyle(height: 1)), maxLines: 1, overflow: TextOverflow.ellipsis ) ), CImageUtils.GenBadgeImage( badges: user.badges, CCommonUtils.GetUserLicense( userId: user.id, userLicenseMap: this.widget.viewModel.userLicenseDict ), EdgeInsets.only(4, 6) ) } ), titleWidget } ) ) } ), new Container( margin: EdgeInsets.only(top: 16), child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new Row( children: new List <Widget> { _buildFollowCount( "关注", $"{(user.followingUsersCount ?? 0) + (user.followingTeamsCount ?? 0)}", () => this.widget.actionModel.pushToUserFollowing( arg1: this.widget.viewModel.user.id, 0) ), new SizedBox(width: 16), _buildFollowCount( "粉丝", $"{user.followCount ?? 0}", () => this.widget.actionModel.pushToUserFollower( obj: this.widget.viewModel.user.id) ) } ), this._buildFollowButton() } ) ) } ) ) )); }
Widget _buildNavigationBar(BuildContext context) { Widget titleWidget = new Container(); if (this._isHaveTitle) { var team = this.widget.viewModel.team ?? new Team(); titleWidget = new Row( children: new List <Widget> { new Expanded( child: new Text( data: team.name, style: CTextStyle.PXLargeMedium, maxLines: 1, overflow: TextOverflow.ellipsis ) ), new SizedBox(width: 8), this._buildFollowButton(true), new SizedBox(width: 16) } ); } var hasTeam = !(this.widget.viewModel.team == null || this.widget.viewModel.team.errorCode == "ResourceNotFound"); return(new Positioned( left: 0, top: 0, right: 0, height: navBarHeight + CCommonUtils.getSafeAreaTopPadding(context: context), child: new Container( padding: EdgeInsets.only(top: CCommonUtils.getSafeAreaTopPadding(context: context)), decoration: new BoxDecoration( this._hideNavBar ? CColors.Transparent : CColors.White, border: new Border( bottom: new BorderSide(this._isHaveTitle ? CColors.Separator2 : CColors.Transparent)) ), child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new GestureDetector( onTap: () => this.widget.actionModel.mainRouterPop(), child: new Container( padding: EdgeInsets.only(16, 8, 8, 8), color: CColors.Transparent, child: new Icon( icon: Icons.arrow_back, size: 24, color: hasTeam ? this._hideNavBar ? CColors.White : CColors.Icon : CColors.Icon ) ) ), new Expanded( child: new Stack( fit: StackFit.expand, children: new List <Widget> { new PositionedTransition( rect: this._animation, child: titleWidget ) } ) ) } ) ) )); }
Widget _buildLoginInNavigationBar() { var user = this.widget.viewModel.userDict[key : this.widget.viewModel.user.userId]; Widget titleWidget; if (user.title != null && user.title.isNotEmpty()) { titleWidget = new Container( padding: EdgeInsets.only(top: 4), child: new Text( data: user.title, style: new TextStyle( fontSize: 14, fontFamily: "Roboto-Regular", color: CColors.Grey80 ), maxLines: 1, overflow: TextOverflow.ellipsis ) ); } else { titleWidget = new Container(); } return(new Stack( children: new List <Widget> { new Container( color: CColors.BgGrey, padding: EdgeInsets.only(bottom: 56), child: new GestureDetector( onTap: () => this.widget.actionModel.pushToUserDetail(obj: user.id), child: new Container( padding: EdgeInsets.only( top: CCommonUtils.getSafeAreaTopPadding(context: this.context)), decoration: new BoxDecoration( color: CColors.Black, new DecorationImage( new AssetImage("image/default-background-cover"), fit: BoxFit.cover ) ), child: new Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { this._buildQrScanWidget(true), new Container( padding: EdgeInsets.only(16, 16, 16, 64), child: new Row( children: new List <Widget> { new Container( margin: EdgeInsets.only(right: 12), child: Avatar.User( user: user, 64, true ) ), new Expanded( child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Row( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Flexible( child: new Text( user.fullName ?? user.name, style: CTextStyle.H4White .defaultHeight(), maxLines: 1, overflow: TextOverflow.ellipsis ) ), CImageUtils.GenBadgeImage( badges: user.badges, CCommonUtils.GetUserLicense( userId: user.id, userLicenseMap: this.widget.viewModel .userLicenseDict ), EdgeInsets.only(4, 6) ) } ), titleWidget } ) ), new Padding( padding: EdgeInsets.symmetric(horizontal: 4), child: new Text( "个人主页", style: new TextStyle( fontSize: 14, fontFamily: "Roboto-Regular", color: CColors.Grey80 ) ) ), new Icon( icon: Icons.baseline_forward_arrow, size: 16, color: CColors.LightBlueGrey ) } ) ) } ) ) ) ), new Align( alignment: Alignment.bottomCenter, child: new Container( margin: EdgeInsets.only(16, 0, 16, 16), height: 80, decoration: new BoxDecoration( color: CColors.White, borderRadius: BorderRadius.all(8), boxShadow: new List <BoxShadow> { new BoxShadow( CColors.Black.withOpacity(0.2f), blurRadius: 8 ) } ), child: new Row( children: new List <Widget> { new Expanded( child: new CustomButton( onPressed: () => { if (this.widget.viewModel.isLoggedIn && user.id.isNotEmpty()) { this.widget.actionModel.pushToUserFollowing(arg1: user.id, 0); } }, child: new Column( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { new Text( CStringUtils.CountToString((user.followingUsersCount ?? 0) + (user.followingTeamsCount ?? 0), "0"), style: CTextStyle.Bold20 ), new Container(height: 4), new Text( "关注", style: CTextStyle.PSmallBody3.defaultHeight() ) } ) ) ), new Container(height: 32, width: 1, color: CColors.Separator.withOpacity(0.5f)), new Expanded( child: new CustomButton( onPressed: () => { if (this.widget.viewModel.isLoggedIn && user.id.isNotEmpty()) { this.widget.actionModel.pushToUserFollower(obj: user.id); } }, child: new Column( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { new Text( CStringUtils.CountToString(user.followCount ?? 0, "0"), style: CTextStyle.Bold20 ), new Container(height: 4), new Text( "粉丝", style: CTextStyle.PSmallBody3.defaultHeight() ) } ) ) ), new Container(height: 32, width: 1, color: CColors.Separator.withOpacity(0.5f)), new Expanded( child: new CustomButton( onPressed: () => { // if (this.widget.viewModel.isLoggedIn && user.id.isNotEmpty()) { // this.widget.actionModel.pushToUserLike(obj: user.id); // } }, child: new Column( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { new Text( CStringUtils.CountToString(user.appArticleLikedCount ?? 0, "0"), style: CTextStyle.Bold20 ), new Container(height: 4), new Text( "赞", style: CTextStyle.PSmallBody3.defaultHeight() ) } ) ) ) } ) ) ) } )); }