public override Widget build(BuildContext context) { Orientation _orientation = MediaQuery.of(context).orientation; bool _isPortrait = _orientation == Orientation.portrait; Widget _colorList() { var list = new List <Widget>(); if (_isPortrait) { list.Add(new Padding(padding: EdgeInsets.only(top: 7f))); } else { list.Add(new Padding(padding: EdgeInsets.only(left: 7f))); } foreach (var _colors in _colorTypes) { Color _colorType = _colors[0]; list.Add( new GestureDetector( onTap: () => { setState(() => { _currentColor = _colors; }); }, child: new Container( color: new Color(0), padding: (_isPortrait ? EdgeInsets.fromLTRB(0f, 7f, 0f, 7f) : EdgeInsets.fromLTRB(7f, 0f, 7f, 0f)), child: new Align( child: new AnimatedContainer( duration: new TimeSpan(0, 0, 0, 300), width: 25f, height: 25f, decoration: new BoxDecoration( color: _colorType, borderRadius: BorderRadius.circular(60f), //boxShadow: new List<BoxShadow>{ // (_currentColor != _colors ? null : // (_colorType == Theme.of(context).cardColor // ? new BoxShadow(color: Colors.grey[300], blurRadius: 5f) // : new BoxShadow(color: _colorType, blurRadius: 5f) // ) // ) //}, border: (_colorType == Theme.of(context).cardColor ? Border.all(color: Colors.grey[300], width: 1f) : null ) ) //BoxDecoration ) //AnimatedContainer ) //Align ) //Container ) //GestureDetector ); } if (_isPortrait) { list.Add(new Padding(padding: EdgeInsets.only(top: 5f))); } else { list.Add(new Padding(padding: EdgeInsets.only(left: 5f))); } return(new Container( width: (_isPortrait ? (float?)60f : null), height: (_isPortrait ? null : (float?)60f), decoration: new BoxDecoration( border: _isPortrait ? new Border(right: new BorderSide(color: Colors.grey[300], width: 1f)) : new Border(top: new BorderSide(color: Colors.grey[300], width: 1f)) ),//BoxDecoration child: new ListView( scrollDirection: _isPortrait ? Axis.vertical : Axis.horizontal, children: list ) //ListView )); //container }//function _colorList Widget _shadingList() { var list = new List <Widget>(); if (_isPortrait) { list.Add(new Padding(padding: EdgeInsets.only(top: 15f))); } else { list.Add(new Padding(padding: EdgeInsets.only(left: 15f))); } foreach (Color _color in _shadingTypes(_currentColor)) { list.Add( new GestureDetector( onTap: () => { setState(() => { _currentShading = _color; }); widget.onColorChanged(_currentShading); }, child: new Container( color: new Color(0), padding: (_isPortrait ? EdgeInsets.fromLTRB(0f, 7f, 0f, 7f) : EdgeInsets.fromLTRB(7f, 0f, 7f, 0) ), child: new Align( child: new AnimatedContainer( duration: new TimeSpan(0, 0, 0, 300), width: _isPortrait ? 250f : 50f, height: _isPortrait ? 50f : 220f, decoration: new BoxDecoration( color: _color, //boxShadow: new List<BoxShadow>{ // (_currentShading != _color ? null : // (_color == Theme.of(context).cardColor // ? new BoxShadow(color: Colors.grey[300], blurRadius: 5f) // : new BoxShadow(color: _currentShading, blurRadius: 5f) // ) // ) //},//List<BoxShadow> border: (_color == Theme.of(context).cardColor ? Border.all(color: Colors.grey[300], width: 1f) : Border.all(color: Colors.grey[300], width: 1f) ) ),//BoxDecoration child: (_isPortrait && widget.enableLabel ? new Container( color: _color, child: new Align( alignment: Alignment.centerRight, child: new Text( "#" + _color.ToString().Replace("Color(0xFF", "").Replace(")", ""), style: new TextStyle( color: Utils.useWhiteForeground(_color) ? Colors.white : Colors.black, fontWeight: FontWeight.w100 ) //TextStyle ) //Text ) //Align ) : new Container(color: _color) as Widget ) //child ) //AnimatedContainer ) //Align ) //Container ) //GestureDetector ); }//end foreach return(new ListView( scrollDirection: _isPortrait?Axis.vertical: Axis.horizontal, children: list ));//ListView }//_shadingList switch (_orientation) { case Orientation.portrait: return(new SizedBox( height: 500f, width: 300f, child: new Row( children: new List <Widget> { _colorList(), new Expanded( child: new Padding( padding: EdgeInsets.symmetric(horizontal: 12f), child: _shadingList() ) ) } ) )); case Orientation.landscape: return(new SizedBox( width: 500f, height: 300f, child: new Column( children: new List <Widget> { new Expanded( child: new Padding( padding: EdgeInsets.symmetric(vertical: 12f), child: _shadingList() ) //Padding ), //Expanded _colorList() } ) //Column )); //SizedBox default: return(new Container()); } }//build
Widget _buildNavigationBar() { 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) } ); } return(new Positioned( left: 0, top: 0, right: 0, height: 44 + this._topPadding, child: new Container( padding: EdgeInsets.only(top: this._topPadding), 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: this._hideNavBar ? CColors.White : CColors.Icon ) ) ), new Expanded( child: new Stack( fit: StackFit.expand, children: new List <Widget> { new PositionedTransition( rect: this._animation, child: titleWidget ) } ) ) } ) ) )); }
Widget _buildSubmitButton() { Widget right; if (this.widget.viewModel.loading) { right = new CustomActivityIndicator( loadingColor: LoadingColor.white, size: LoadingSize.small ); } else { right = new Container(); } return(new Container( padding: EdgeInsets.symmetric(horizontal: 16), margin: EdgeInsets.only(top: 32), child: new CustomButton( onPressed: () => { if (this.widget.viewModel.loading || !this._isCompleted) { return; } this.widget.actionModel.startFeedback(); this.widget.actionModel.sendFeedbak(this._contentController.text, this._nameController.text, this._contactController.text ); }, padding: EdgeInsets.zero, child: new Container( height: 40, decoration: new BoxDecoration( this._isCompleted ? this.widget.viewModel.loading ? CColors.ButtonActive : CColors.PrimaryBlue : CColors.Disable, borderRadius: BorderRadius.all(4) ), child: new Stack( children: new List <Widget> { new Align( alignment: Alignment.center, child: new Text( "提交", style: CTextStyle.PLargeMediumWhite ) ), new Positioned( right: 24, height: 40, child: right ) } ) ) ) )); }
public override Widget build(BuildContext context) { if (this.game == null) { return(new Container()); } return(new GestureDetector( onTap: () => this.onTap?.Invoke(), child: new Container( padding: EdgeInsets.symmetric(12, 16), color: CColors.White, child: new Row( children: new List <Widget> { new Container( margin: EdgeInsets.only(right: 16), child: new PlaceholderImage( imageUrl: this.game.image, 48, 48, 8, fit: BoxFit.cover, true ) ), new Expanded( child: new Container( height: 48, child: new Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Text( data: this.game.resetTitle, style: CTextStyle.PLargeBody, maxLines: 1, overflow: TextOverflow.ellipsis ), new Text( this.game.resetSubLabel ?? "Unity Tiny官方示例项目", style: CTextStyle.PSmallBody4, maxLines: 1, overflow: TextOverflow.ellipsis ) } ) ) ), new Container( margin: EdgeInsets.only(16), child: new CustomButton( padding: EdgeInsets.zero, child: new Container( width: 60, height: 28, decoration: new BoxDecoration( borderRadius: BorderRadius.all(14), border: Border.all(color: CColors.PrimaryBlue) ), alignment: Alignment.center, child: new Text( "开始", style: new TextStyle( fontSize: 14, fontFamily: "Roboto-Medium", color: CColors.PrimaryBlue ) ) ), onPressed: this.onPlay ) ) } ) ) )); }
public override Widget build(BuildContext context) { if (this.article == null) { return(new Container()); } var time = this.article.lastPublishedTime == null ? this.article.publishedTime : this.article.lastPublishedTime; var imageUrl = this.article.thumbnail.url.EndsWith(".gif") ? this.article.thumbnail.url : $"{this.article.thumbnail.url}.300x0x1.jpg"; var card = new Container( color: CColors.White, child: new Padding( padding: EdgeInsets.all(16), child: new Container( child: new Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Container( child: new Text(this.article.title, style: CTextStyle.H5, maxLines: 2, textAlign: TextAlign.left, overflow: TextOverflow.ellipsis ) ), new Container( margin: EdgeInsets.only(top: 8, bottom: 8), child: new Row( children: new List <Widget> { new Expanded( child: new Text(this.article.subTitle, style: CTextStyle.PRegularBody, maxLines: 3, overflow: TextOverflow.ellipsis ) ), new Container( margin: EdgeInsets.only(8.0f), width: 100, height: 66, child: new PlaceholderImage( imageUrl, 100, 66, 4, BoxFit.cover ) ) } ) ), new Container( child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new Expanded( child: new Text( $"{this.fullName} · {DateConvert.DateStringFromNow(time)} · 阅读 {this.article.viewCount}", style: CTextStyle.PSmallBody3 ) ), new CustomButton( child: new Container( height: 28, child: new Icon( Icons.ellipsis, size: 20, color: CColors.BrownGrey ) ), onPressed: this.moreCallBack ) } ) ) } ) ) ) ); return(new GestureDetector( child: card, onTap: this.onTap )); }
public override Widget build(BuildContext context) { string text; if (this.channel.lastMessage != null) { if (this.channel.lastMessage.deleted) { text = "[此消息已被删除]"; } else if (this.channel.lastMessage.type == ChannelMessageType.image) { text = "[图片]"; } else if (this.channel.lastMessage.type == ChannelMessageType.file) { text = "[文件]"; } else { text = this.channel.lastMessage.content ?? ""; } } else { text = ""; } var contentTextSpans = new List <TextSpan>(); if (this.channel.lastMessage.author?.fullName.isNotEmpty() ?? text.isNotEmpty() && this.channel.lastMessage.author.id != this.myUserId) { contentTextSpans.Add(new TextSpan( $"{this.channel.lastMessage.author?.fullName}: ", style: CTextStyle.PRegularBody4 )); } contentTextSpans.AddRange(MessageUtils.messageWithMarkdownToTextSpans( content: text, mentions: this.channel.lastMessage?.mentions, this.channel.lastMessage?.mentionEveryone ?? false, null, bodyStyle: CTextStyle.PRegularBody4, linkStyle: CTextStyle.PRegularBody4 )); Widget message = new RichText( text: new TextSpan( (this.channel.atMe || this.channel.atAll) && this.channel.unread > 0 ? "[有人@我] " : "", style: CTextStyle.PRegularError, children: contentTextSpans ), overflow: TextOverflow.ellipsis, maxLines: 1 ); // Don't show the time if nonce is 0, i.e. the time is not loaded yet. // Otherwise, the time would be like 0001/01/01 8:00 string timeString = this.channel.lastMessage?.nonce != 0 ? this.channel.lastMessage?.time.DateTimeString() ?? "" : ""; Widget titleLine = new Container( padding: EdgeInsets.only(16), child: new Row( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Expanded( child: new Text( data: this.channel.name, style: CTextStyle.PLargeMedium, maxLines: 1, overflow: TextOverflow.ellipsis ) ), new Container(width: 16), new Text( data: timeString, style: CTextStyle.PSmallBody4 ) } ) ); return(new GestureDetector( onTap: this.onTap, child: new Container( color: this.channel.isTop ? CColors.PrimaryBlue.withOpacity(0.04f) : CColors.White, height: 72, padding: EdgeInsets.symmetric(12, 16), child: new Row( children: new List <Widget> { new PlaceholderImage( this.channel?.thumbnail ?? "", 48, 48, 4, fit: BoxFit.cover, true, CColorUtils.GetSpecificDarkColorFromId(id: this.channel?.id) ), new Expanded( child: new Column( children: new List <Widget> { titleLine, new Row( children: new List <Widget> { new Container(width: 16), new Expanded( child: message ), new NotificationDot( this.channel.unread > 0 ? this.channel.mentioned > 0 ? $"{this.channel.mentioned}" : "" : null, margin: EdgeInsets.only(16) ) } ) } ) ) } ) ) )); }
Widget _buildBottom() { int articleLikeCount = this.article.appLikeCount > 0 ? this.article.appLikeCount : 0; return(new Container( height: 56, child: new Stack( alignment: Alignment.center, children: new List <Widget> { new Positioned( left: 0, child: new GestureDetector( onTap: () => this.likeCallBack(), child: new Container( color: CColors.Transparent, height: 56, padding: EdgeInsets.only(16, right: 20), child: new IgnorePointer( child: new Row( children: new List <Widget> { new Container( padding: EdgeInsets.only(bottom: 4), child: new Icon( this.isLike ? Icons.thumb_bold : Icons.thumb_line, size: 24, color: this.isLike ? CColors.Thumb : CColors.Icon ) ), new Container( margin: EdgeInsets.only(6), child: new Text( CStringUtils.CountToString(count: articleLikeCount, "点赞"), style: CTextStyle.PRegularBody5.merge(new TextStyle(height: 1)) ) ) } ) ) ) ) ), new Positioned( left: 96, child: new Container( child: new GestureDetector( onTap: this.commentCallBack, child: new Container( color: CColors.Transparent, height: 56, padding: EdgeInsets.only(right: 20), child: new Row( children: new List <Widget> { new Icon(icon: Icons.comment, size: 24, color: CColors.Icon), new Container( margin: EdgeInsets.only(6), child: new Text( CStringUtils.CountToString(count: this.article.commentCount, "评论"), style: CTextStyle.PRegularBody5.merge(new TextStyle(height: 1)) ) ) } ) ) ) ) ), new Align( alignment: Alignment.centerRight, child: new GestureDetector( child: new Container( color: CColors.Transparent, height: 56, padding: EdgeInsets.symmetric(horizontal: 16), child: new Icon( icon: Icons.ellipsis, size: 20, color: CColors.BrownGrey ) ), onTap: this.moreCallBack ) ) } ) )); }
Widget _buildHeader(BuildContext context) { var container = new Container( padding: EdgeInsets.only(left: 16.0, right: 8.0), height: headerHeight, color: CLColors.header, child: new Row( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { new Container( child: new Text( "All Assets", style: new TextStyle( fontSize: 16, color: Color.fromARGB(100, 255, 255, 0) ) ) ), new CustomButton( padding: EdgeInsets.only(0.0, 0.0, 16.0, 0.0), child: new Icon( Icons.keyboard_arrow_down, size: 18.0, color: CLColors.icon2 ) ), new Container( decoration: new BoxDecoration( color: CLColors.white, borderRadius: BorderRadius.all(3) ), width: 320, height: 36, padding: EdgeInsets.all(10.0), margin: EdgeInsets.only(right: 4), child: new EditableText( maxLines: 1, selectionControls: MaterialUtils.materialTextSelectionControls, controller: new TextEditingController("Type here to search assets"), focusNode: new FocusNode(), style: new TextStyle( fontSize: 16 ), selectionColor: Color.fromARGB(255, 255, 0, 0), cursorColor: Color.fromARGB(255, 0, 0, 0) ) ), new Container( decoration: new BoxDecoration( color: CLColors.background4, borderRadius: BorderRadius.all(2) ), width: 36, height: 36, child: new Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: new List <Widget> { new CustomButton( padding: EdgeInsets.only(8.0, 0.0, 8.0, 0.0), child: new Icon( Icons.search, size: 18.0, color: CLColors.white ) ) } ) ), new Container( margin: EdgeInsets.only(left: 16, right: 16), child: new Text( "Learn Game Development", style: new TextStyle( fontSize: 12, color: CLColors.white ) ) ), new Container( decoration: new BoxDecoration( border: Border.all( color: CLColors.white ) ), margin: EdgeInsets.only(right: 16), padding: EdgeInsets.all(4), child: new Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: new List <Widget> { new Text( "Plus/Pro", style: new TextStyle( fontSize: 11, color: CLColors.white ) ) } ) ), new Container( margin: EdgeInsets.only(right: 16), child: new Text( "Impressive New Assets", style: new TextStyle( fontSize: 12, color: CLColors.white ) ) ), new Container( child: new Text( "Shop On Old Store", style: new TextStyle( fontSize: 12, color: CLColors.white ) ) ), } ) ); return(container); }
public override Widget build(BuildContext context) { var card = new Container( margin: EdgeInsets.only(right: 45), child: new Container( child: new Column( children: new List <Widget> { new Container( decoration: new BoxDecoration( color: CLColors.white, borderRadius: BorderRadius.only(topLeft: 3, topRight: 3) ), width: 200, height: 124, child: Image.network( this.imageSrc, fit: BoxFit.fill ) ), new Container( color: CLColors.white, width: 200, height: 86, padding: EdgeInsets.fromLTRB(14, 12, 14, 8), child: new Column( crossAxisAlignment: CrossAxisAlignment.baseline, children: new List <Widget> { new Container( height: 18, padding: EdgeInsets.only(top: 3), child: new Text(this.category, style: new TextStyle( fontSize: 11, color: CLColors.text5 ) ) ), new Container( height: 20, padding: EdgeInsets.only(top: 2), child: new Text(this.name, style: new TextStyle( fontSize: 14, color: CLColors.text6 ) ) ), new Container( height: 22, padding: EdgeInsets.only(top: 4), child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new Container( child: new Row( children: new List <Widget> { new Container( margin: EdgeInsets.only(right: 10), child: new Text( "$" + this.price, style: new TextStyle( fontSize: 14, color: CLColors.text7, decoration: TextDecoration.lineThrough ) ) ), new Container( child: new Text( "$" + this.priceDiscount, style: new TextStyle( fontSize: 14, color: CLColors.text8 ) ) ) }) ), this.showBadge ? new Container( width: 80, height: 18, color: CLColors.black, child: new Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: new List <Widget> { new Text( "Plus/Pro", style: new TextStyle( fontSize: 11, color: CLColors.white ) ) } ) ) : new Container() } ) ) } ) ) } ) ) ); return(card); }
public override Widget build(BuildContext buildContext) { if (_loading) { return(new Container( child: new Center( child: new Loading( size: 48f ) ) )); } var markdownBuildCtx = new BuilderContext(_imageMetas, buildContext); _spanRecognizers?.ForEach(recognizer => recognizer.dispose()); var widgets = new List <Widget>(); widgets.AddRange(_tokens .Where(token => Mappings.ContainsKey(token.type)) .Select(token => Mappings[token.type].Invoke(token, markdownBuildCtx)) .Where(w => !(w is null)) .Select(w => new RepaintBoundary(child: w))); _spanRecognizers = markdownBuildCtx.SpanRecognizers; widgets.Insert(0, new Container( height: 64f, padding: EdgeInsets.only(bottom: 8f), decoration: new BoxDecoration( border: new Border( bottom: new BorderSide( color: new Color(0xffd8d8d8), width: 1f ) ) ), child: new Align( alignment: Alignment.bottomLeft, child: new Breadcrumbs( _breadcrumbs, normalBreadcrumbStyle: new TextStyle( fontSize: 16f, color: new Color(0xff979797) ), hoverBreadCrumbStyle: new TextStyle( fontSize: 16f, color: new Color(0xff979797), decoration: TextDecoration.underline ), splitterStyle: new TextStyle( fontSize: 16f, color: new Color(0xff979797) ) ) ) ) ); var linkButtons = new List <Widget>(); if (_prevLink != null) { linkButtons.Add( new Expanded( child: new Container( margin: EdgeInsets.only(right: 20), child: new Button( text: _prevLink.content ?? "", onTap: () => { if (!string.IsNullOrEmpty(_prevLink?.link)) { LocationUtil.Go( $"/Manual/{_prevLink?.link}"); } }, prefix: Icons.MaterialArrowBack ) ) ) ); } else { linkButtons.Add( new Expanded( flex: 1, child: new Container() ) ); // placeholder to use spaceBetween } if (_nextLink != null) { linkButtons.Add( new Expanded( child: new Container( margin: EdgeInsets.only(left: 20), child: new Button( text: _nextLink.content ?? "", onTap: () => { if (!string.IsNullOrEmpty(_nextLink.link)) { LocationUtil.Go( $"/Manual/{_nextLink.link}"); } }, suffix: Icons.MaterialArrowForward ) ) ) ); } else { linkButtons.Add( new Expanded( flex: 1, child: new Container() ) ); // placeholder to use spaceBetween } widgets.Add( new Container( margin: EdgeInsets.only(top: 32, bottom: 64), child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: linkButtons ) ) ); var version = DocApp.of(buildContext).version; return(new Row( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Expanded( child: new Stack( children: new List <Widget> { new Scroller( child: new SingleChildScrollView( controller: _scrollController, child: new ScrollableOverlay( child: new Column( children: new List <Widget> { new Container( constraints: new BoxConstraints( minHeight: MediaQuery.of(buildContext).size.height - Header.Height - SearchBar.Height - Footer.Height ), child: new Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: widgets) ), new Footer(style: Footer.Light, showSocials: false) } ) ) ) ), new ToTop(_scrollController, displayThreshold: 128f) } ) ), new MetaFields( markdownBuildCtx.PositionRecords, _scrollController, $"https://github.com/UnityTech/documentation-cn/blob/{version.unity_version}/Manual/md/{widget._title}.md" ) } )); }
public override Widget build(BuildContext context) { var reply = new Container(); if (!this.widget.replyUserName.isEmpty()) { reply = new Container( height: 40, width: MediaQuery.of(context).size.width, padding: EdgeInsets.only(16, right: 16), alignment: Alignment.centerLeft, decoration: new BoxDecoration( CColors.White, border: new Border( bottom: new BorderSide(CColors.Separator) ) ), child: new RichText( text: new TextSpan( "回复 ", CTextStyle.PRegularBody3, new List <TextSpan> { new TextSpan(this.widget.replyUserName, CTextStyle.PMediumBody3 ) } ) ) ); } return(new Container( child: new Column( mainAxisAlignment: MainAxisAlignment.end, children: new List <Widget> { new Container( color: Color.fromRGBO(0, 0, 0, 0.4f), child: new Container( color: CColors.White, child: new Column( children: new List <Widget> { reply, new Row( children: new List <Widget> { new Expanded( child: new Container( margin: EdgeInsets.only(10, 6.5f, 8, 6.5f), decoration: new BoxDecoration( CColors.Separator2, borderRadius: BorderRadius.circular( (this._inputFieldHeight + 13) / 2) ), child: new Container( padding: this._inputFieldPadding, child: new InputField(this._inputFieldKey, height: this._inputFieldHeight, controller: this._controller, style: this._inputFieldStyle, maxLines: 2, autofocus: true, hintText: "友好的评论是交流的起点…", hintStyle: CTextStyle.PLargeBody4, cursorColor: CColors.PrimaryBlue, textInputAction: TextInputAction.send, onChanged: text => { var isTextEmpty = text.Length > 0; if (this._isPublish != isTextEmpty) { this.setState(() => { this._isPublish = isTextEmpty; }); } this._inputText = text; }, onSubmitted: this._onSubmitted ) ) ) ), new CustomButton( onPressed: () => { if (!this._isPublish) { return; } this._onSubmitted(this._inputText); }, child: new Text( "发布", style: this._isPublish ? CTextStyle.PLargeBlue : CTextStyle.PLargeDisabled ) ), new Container(width: 8) } ) } ), margin: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom) ) ) } ) )); }
public override Widget build(BuildContext context) { var children = new List <Widget> { new Container( width: 1080, height: 800, color: Colors.red ), new Container( width: 1080, height: 800, color: Colors.green ), new Container( width: 1080, height: 800, color: Colors.blueAccent ), new Container( width: 1080, height: 800, color: Colors.grey ) }; return(new Scaffold( appBar: new AppBar( title: new Text(widget.title) ), body: new Column( children: new List <Widget> { new Row( children: new List <Widget> { new Checkbox( value: loop, onChanged: (va) => { setState(() => { if (va == true) { //controller = new TransformerPageController(itemCount:4,loop:true); } else { //controller = new PageController(initialPage:0); } loop = (bool)va; }); } ), new Text("loop") } ), new RadioGroup( titles: new List <string> { "COLOR", "DROP", "NONE", "SCALE", "SLIDE", "WARM" }, onIndexChanged: (index) => { setState(() => { _index = index; layout = layouts[index]; }); } ), new Container( width: 1080, height: 800, child: new Stack( children: new List <Widget> { TransformerPageView.children(index: 0, children: children, pageController: controller ), new Align( alignment: Alignment.bottomCenter, child: new Padding( padding: EdgeInsets.only(bottom: 20), child: getItem() ) ) } ) ) } ) )); }
Widget title() { return(new Container(child: new Text(this.widget.title ?? "", textAlign: TextAlign.center, style: new TextStyle(fontSize: 24, fontWeight: FontWeight.w700)), margin: EdgeInsets.only(bottom: 20))); }
public override Widget build(BuildContext context) { return(new Container( color: CColors.Transparent, child: new Unity.UIWidgets.widgets.Stack( children: new List <Widget> { new Align( alignment: Alignment.bottomCenter, child: new GestureDetector( onPanEnd: detail => { if (detail.velocity.pixelsPerSecond.dx > 0 && camera_pic) { setState(() => { camera_pic = false; }); } if (detail.velocity.pixelsPerSecond.dx < 0 && !camera_pic) { setState(() => { camera_pic = true; }); } }, child: new Container( width: 600, color: CColors.Transparent, child: new Column( verticalDirection: VerticalDirection.up, children: new List <Widget> { new Padding(padding: EdgeInsets.only(bottom: 23)), new SizedBox( height: 35, child: new OutlineButton( disabledBorderColor: CColors.White, borderSide: new BorderSide(color: CColors.White, width: 5), child: new Text(data: "评论", style: new TextStyle(color: CColors.White, fontSize: 14)) ) ), new Padding(padding: EdgeInsets.only(bottom: 18)), new Listener( onPointerDown: detail => { }, child: new SizedBox( width: 60, height: 60, child: new RaisedButton( shape: new CircleBorder(new BorderSide(color: CColors.White, width: 5)), disabledColor: CColors.Transparent, elevation: 0, disabledElevation: 0, color: CColors.Transparent, child: !camera_pic ? new Icon( color: CColors.FlatGreen, size: 24, icon: MyIcons.camera_button_mine ) : null ) ) ), new Padding(padding: EdgeInsets.only(top: 9)), new AnimatedPadding( padding: camera_pic ? EdgeInsets.fromLTRB(21.5f, 0, -21.5f, 0) : EdgeInsets.fromLTRB(-21.5f, 0, 21.5f, 0), duration: new System.TimeSpan(0, 0, 0, 0, 100), curve: Curves.easeInOut, child: new Container( width: 111, padding: EdgeInsets.only(left: 15, right: 15), child: new Container( height: 21, width: 71, child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new Listener( onPointerDown: detail => { if (!camera_pic) { setState(() => { camera_pic = true; }); } }, child: new Text(data: "照片", style: camera_pic?CTextStyle.strength: CTextStyle.normal)), new Listener( onPointerDown: detail => { if (camera_pic) { setState(() => { camera_pic = false; }); } }, child: new Text(data: "视频", style: !camera_pic ? CTextStyle.strength: CTextStyle.normal)), }) ) ) ), }) ) ) ), new Align( alignment: Alignment.topLeft, child: new IconButton( color: CColors.Transparent, iconSize: 24, onPressed: () => { BuildContext lastContext = Globals.instance.contextStack.Pop(); Navigator.pop(lastContext); }, icon: new Icon( icon: MyIcons.back_mine, color: CColors.Black ) ) ), new Align( alignment: new Alignment(0.95f, -0.98f), child: new OutlineButton( onPressed: () => { Globals.instance.contextStack.Push(context); //Globals.instance.arEffect.SetActive(true); Globals.instance.arBase.SetAREffectState(true); Globals.instance.arBase.EditMap(); //Globals.instance.arEffect.GetComponent<AREffect.AREffectManager>().EditMap(); Navigator.push(context, new MaterialPageRoute(builder: (_) => { return new StoreProvider <AppState>( store: StoreProvider.store, new MaterialApp( home: new SettingScreenConnector() ) ); })); }, disabledBorderColor: CColors.White, borderSide: new BorderSide(color: CColors.White, width: 5), //color: CColors.Transparent, child: new Text(data: "二次创作", style: new TextStyle(color: CColors.White, fontSize: 16))) ), } ) )); }
public override Widget build(BuildContext buildContext) { var size = MediaQuery.of(context).size; var children = new List <Widget>(); var emptyKeyword = string.IsNullOrEmpty(_keyword); var mainAxisAlignment = _searching || emptyKeyword ? MainAxisAlignment.center : MainAxisAlignment.start; var crossAxisAlignment = emptyKeyword ? CrossAxisAlignment.center : CrossAxisAlignment.start; if (emptyKeyword) { children.Add( new Column( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Container( width: 253, height: 334, margin: EdgeInsets.only(bottom: 24f), decoration: new BoxDecoration( image: new DecorationImage( image: new AssetImage( "Images/search@3x" ), fit: BoxFit.cover ) ) ), new Text( "请输入关键词搜索", style: new TextStyle( fontSize: 24f, fontWeight: FontWeight.w500, color: new Color(0xff979797), height: 1.33333333f.LineHeight() ) ) } ) ); } else if (_searching) { children.Add( new Container( child: new Center( child: new Loading( size: 48f ) ) ) ); } else { if (_results != null) { children.Add( new Container( height: 24f, child: new Align( alignment: Alignment.centerLeft, child: new Text( _results.total == 0 ? $"您搜索的 “{_keyword}” 暂无匹配的结果" : $"您搜索的“{_keyword}”共有{_results.total}个匹配的结果", style: new TextStyle( fontSize: 16f, fontWeight: FontWeight.w500 ) ) ), margin: EdgeInsets.only(bottom: 16f) ) ); if (_results.items != null) { children.AddRange(_results.items .Select(searchResultItem => new SearchResultCard(searchResultItem)) .Cast <Widget>()); } if (_results.pages != null) { children.Add( new Container( margin: EdgeInsets.only(top: 16f), child: new Pager( pages: _results.pages, currentPage: _results.currentPage, totalPages: _results.totalPages, onPageChanged: page => LocationUtil.Go( $"/Search/{_filterType}/{HttpUtility.UrlEncode(_keyword)}/{page}") ) ) ); } } } var pageHeight = MediaQuery.of(context).size.height; const float minHeight = Header.Height + SearchBar.Height + Footer.Height; return(new Container( constraints: new BoxConstraints( minHeight: size.height ), width: size.width, child: new SingleChildScrollView( child: new ScrollableOverlay( child: new Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: new List <Widget> { new Header(), new SearchBar(), new Container( constraints: new BoxConstraints( minHeight: minHeight < pageHeight ? pageHeight - minHeight : 0 ), padding: EdgeInsets.only(top: 16f, right: 48f, bottom: 48f, left: 48f), color: new Color(0xfff2f1f2), child: new Column( crossAxisAlignment: crossAxisAlignment, mainAxisAlignment: mainAxisAlignment, children: children ) ), new Footer(), } ) ) ) )); }
public override Widget build(BuildContext context) { List <Widget> stacked = new List <Widget> { }; MediaQueryData existingMediaQuery = MediaQuery.of(context); MediaQueryData newMediaQuery = MediaQuery.of(context); Widget content = new _TabSwitchingView( currentTabIndex: _controller.index, tabNumber: widget.tabBar.items.Count, tabBuilder: widget.tabBuilder ); EdgeInsets contentPadding = EdgeInsets.zero; if (widget.resizeToAvoidBottomInset) { newMediaQuery = newMediaQuery.removeViewInsets(removeBottom: true); contentPadding = EdgeInsets.only(bottom: existingMediaQuery.viewInsets.bottom); } if (widget.tabBar != null && (!widget.resizeToAvoidBottomInset || widget.tabBar.preferredSize.height > existingMediaQuery.viewInsets.bottom)) { float bottomPadding = widget.tabBar.preferredSize.height + existingMediaQuery.padding.bottom; if (widget.tabBar.opaque(context)) { contentPadding = EdgeInsets.only(bottom: bottomPadding); newMediaQuery = newMediaQuery.removePadding(removeBottom: true); } else { newMediaQuery = newMediaQuery.copyWith( padding: newMediaQuery.padding.copyWith( bottom: bottomPadding ) ); } } content = new MediaQuery( data: newMediaQuery, child: new Padding( padding: contentPadding, child: content ) ); stacked.Add(content); stacked.Add( new MediaQuery( data: existingMediaQuery.copyWith(textScaleFactor: 1), child: new Align( alignment: Alignment.bottomCenter, child: widget.tabBar.copyWith( currentIndex: _controller.index, onTap: (int newIndex) => { _controller.index = newIndex; if (widget.tabBar.onTap != null) { widget.tabBar.onTap(newIndex); } } ) ) ) ); return(new DecoratedBox( decoration: new BoxDecoration( color: CupertinoDynamicColor.resolve(widget.backgroundColor, context) ?? CupertinoTheme.of(context).scaffoldBackgroundColor ), child: new Stack( children: stacked ) )); }
static Widget _Atomic(BuildContext context, string type, string contentType, string title, _OriginalImage originalImage, string url, string downloadUrl, Action <string> openUrl, Action <string> playVideo) { if (type == "ATTACHMENT" && contentType != "video/mp4") { return(new Container()); } var playButton = Positioned.fill( new Container() ); if (type == "VIDEO" || type == "ATTACHMENT") { playButton = Positioned.fill( new Center( child: new CustomButton( onPressed: () => { if (type == "ATTACHMENT") { playVideo($"{downloadUrl}?noLoginRequired=true"); } else { if (url == null || url.Length <= 0) { return; } openUrl(url); } }, child: new Container( width: 60, height: 60, decoration: new BoxDecoration( CColors.H5White, borderRadius: BorderRadius.all(30) ), child: new Icon( Icons.play_arrow, size: 45, color: CColors.Icon ) ) ) ) ); } var attachWidth = MediaQuery.of(context).size.width - 32; var attachHeight = attachWidth * 9 / 16; if (type == "ATTACHMENT") { return(new Container( color: CColors.White, padding: EdgeInsets.only(bottom: 32), alignment: Alignment.center, child: new Container( padding: EdgeInsets.only(16, right: 16), child: new Column( children: new List <Widget> { new Stack( children: new List <Widget> { new Container( width: attachWidth, height: attachHeight, color: CColors.Black ), playButton } ) } ) ) )); } var width = originalImage.width < MediaQuery.of(context).size.width - 32 ? originalImage.width : MediaQuery.of(context).size.width - 32; var height = width * originalImage.height / originalImage.width; var imageUrl = originalImage.url; if (imageUrl.isNotEmpty()) { imageUrl = imageUrl.EndsWith(".gif") ? imageUrl : $"{originalImage.url}.600x0x1.jpg"; } var nodes = new List <Widget> { new Stack( children: new List <Widget> { new PlaceholderImage( imageUrl, width, height, fit: BoxFit.cover ), playButton } ) }; if (title != null) { var imageTitle = new Container( decoration: new BoxDecoration( border: new Border( bottom: new BorderSide( CColors.Separator, 2 ) ) ), child: new Container( margin: EdgeInsets.only(4, 8, 4, 4), child: new Text( title, style: CTextStyle.PRegularBody4 ) ) ); nodes.Add(imageTitle); } return(new Container( color: CColors.White, padding: EdgeInsets.only(bottom: 32), alignment: Alignment.center, child: new Container( padding: EdgeInsets.only(16, right: 16), child: new Column( children: nodes ) ) )); }
static Widget _Atomic(BuildContext context, string type, string contentType, string title, string dataUrl, _OriginalImage originalImage, string videoStatus, string videoPoster, string url, string downloadUrl, string attachmentId, Action <string> openUrl, Action <string, bool, int> playVideo, Action loginAction, bool needUpdate, int limitSeconds, Action <string> browserImage = null) { if (type == "ATTACHMENT" && contentType != "video/mp4") { return(new Container()); } var playButton = Positioned.fill( new Container() ); if (type == "VIDEO" || type == "ATTACHMENT") { playButton = Positioned.fill( new Center( child: videoStatus == "completed" ? UserInfoManager.isLogin() ? new CustomButton( onPressed: () => { if (type == "ATTACHMENT") { if (url.isEmpty()) { playVideo(downloadUrl, false, 0); } else { playVideo($"{Config.apiAddress_cn}/playlist/{attachmentId}", needUpdate, limitSeconds); } } else { if (url == null || url.Length <= 0) { return; } openUrl(url); } }, child: new Container( width: 60, height: 60, decoration: new BoxDecoration( CColors.H5White, borderRadius: BorderRadius.all(30) ), child: new Icon( Icons.play_arrow, size: 45, color: CColors.Icon ) ) ) : (Widget) new GestureDetector( onTap: () => { loginAction(); }, child: new Container( color: CColors.Black.withOpacity(0.5f), alignment: Alignment.center, child: new Text("Login to view this video", style: CTextStyle.PXLargeWhite.merge( new TextStyle(decoration: TextDecoration.underline))) )) : new Container( color: CColors.Black.withOpacity(0.5f), alignment: Alignment.center, child: new Text("Video is processing, try it later", style: CTextStyle.PXLargeWhite) ) ) ); } var attachWidth = MediaQuery.of(context).size.width - 32; var attachHeight = attachWidth * 9 / 16; if (type == "ATTACHMENT") { return(new Container( color: CColors.White, padding: EdgeInsets.only(bottom: 32), alignment: Alignment.center, child: new Container( padding: EdgeInsets.only(16, right: 16), child: new Column( children: new List <Widget> { new Stack( children: new List <Widget> { new Container( width: attachWidth, height: attachHeight, color: CColors.Black, child: Image.network( videoPoster, fit: BoxFit.cover ) ), playButton } ) } ) ) )); } var width = originalImage.width < MediaQuery.of(context).size.width - 32 ? originalImage.width : MediaQuery.of(context).size.width - 32; var height = width * originalImage.height / originalImage.width; var imageUrl = originalImage.url; if (imageUrl.isNotEmpty()) { imageUrl = imageUrl.EndsWith(".gif") || imageUrl.EndsWith(".png") ? imageUrl : CImageUtils.SuitableSizeImageUrl(MediaQuery.of(context).size.width, imageUrl); imageUrls.Add(imageUrl); } var nodes = new List <Widget> { new Stack( children: new List <Widget> { new GestureDetector( child: new Hero( tag: imageUrl, child: new PlaceholderImage( imageUrl: imageUrl, width: width, height: height, fit: BoxFit.cover, useCachedNetworkImage: true ) ), onTap: () => { if (dataUrl.isNotEmpty()) { openUrl(obj: dataUrl); } else { browserImage?.Invoke(imageUrl); } } ), playButton } ) }; if (title != null) { var imageTitle = new Container( decoration: new BoxDecoration( border: new Border( bottom: new BorderSide( CColors.Separator, 2 ) ) ), child: new Container( margin: EdgeInsets.only(4, 8, 4, 4), child: new Text( title, style: CTextStyle.PRegularBody4 ) ) ); nodes.Add(imageTitle); } return(new Container( color: CColors.White, padding: EdgeInsets.only(bottom: 32), alignment: Alignment.center, child: new Container( padding: EdgeInsets.only(16, right: 16), child: new Column( children: nodes ) ) )); }
Widget _buildAvatar() { Widget rightWidget; if (this.userType == UserType.me || this.userType == UserType.follow) { var time = this.article.publishedTime; rightWidget = new Text( $"{DateConvert.DateStringFromNow(dt: time)}", style: CTextStyle.PSmallBody5 ); } else { rightWidget = new FollowButton( userType: this.userType, onFollow: this.followCallBack ); } var avatar = this.type == OwnerType.user ? Avatar.User( user: this.user, 38 ) : Avatar.Team( team: this.team, 38 ); var badge = this.type == OwnerType.user ? CImageUtils.GenBadgeImage( badges: this.user.badges, license: this.license, EdgeInsets.only(4) ) : CImageUtils.GenBadgeImage( badges: this.team.badges, null, EdgeInsets.only(4) ); Widget titleWidget = new Container(); if (this.user.title != null && this.user.title.isNotEmpty() && this.type == OwnerType.user) { titleWidget = new Text( data: this.user.title, style: CTextStyle.PSmallBody4, maxLines: 1, overflow: TextOverflow.ellipsis ); } return(new Container( padding: EdgeInsets.only(16, 16, 16), child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new GestureDetector( child: avatar, onTap: this.avatarCallBack ), new Expanded( child: new GestureDetector( onTap: this.avatarCallBack, child: new Container( color: CColors.Transparent, margin: EdgeInsets.only(8, right: 16), child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Row( children: new List <Widget> { new Flexible( child: new Text( this.type == OwnerType.user ? this.user.fullName ?? this.user.name ?? "佚名" : this.team.name, style: CTextStyle.PLargeBody.merge( new TextStyle(height: 1)), maxLines: 1, overflow: TextOverflow.ellipsis ) ), badge } ), titleWidget } ) ) ) ), rightWidget } ) )); }
public override Widget build(BuildContext context) { if (this.user == null) { return(new Container()); } return(new GestureDetector( onTap: this.onTap, child: new Container( padding: EdgeInsets.symmetric(horizontal: 16), color: CColors.White, height: 72, child: new Row( children: new List <Widget> { new Expanded( child: new Row( children: new List <Widget> { Avatar.User(user: this.user, 48), new Expanded( child: new Container( padding: EdgeInsets.only(12, right: 16), child: new Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Row( children: new List <Widget> { new Flexible( child: new Text( data: this.user.fullName, style: new TextStyle( fontSize: this.isSearchCard ? 16 : 14, height: 1, fontFamily: "Roboto-Medium", color: CColors.TextBody ), maxLines: 1, overflow: TextOverflow.ellipsis ) ), CImageUtils.GenBadgeImage( badges: this.user.badges, license: this.license, EdgeInsets.only(4) ) } ), this._buildUserTitle() } ) ) ) } ) ), new FollowButton( userType: this.userType, onFollow: this.onFollow ) } ) ) )); }
public override Widget build(BuildContext context) { var children = new List <Widget> { new Clickable( onTap: () => LocationUtil.Go($"/{_item.type.FirstCharToUpper()}/{_item.name}"), child: new Container( margin: EdgeInsets.only(top: 24f, left: 24f, right: 24f, bottom: 8f), child: new Text( _item.name, style: TitleTextStyle ) ) ) }; if (_highlight != null) { children.Add( new Clickable( onTap: () => LocationUtil.Go($"/{_item.type.FirstCharToUpper()}/{_item.name}"), child: new Container( child: new RichText( text: new TextSpan( children: _highlight ) ), margin: EdgeInsets.only(bottom: 24f, left: 24f, right: 24f) ) ) ); } if (_item.breadcrumbs != null && _item.breadcrumbs.Count != 0) { children.Add(Splitter); children.Add( new Container( height: 44f, padding: EdgeInsets.symmetric(horizontal: 24f), child: new Align( alignment: Alignment.centerLeft, child: new Breadcrumbs( _item.breadcrumbs, splitterStyle: BreadcrumbSplitterStyle, normalBreadcrumbStyle: BreadcrumbStyle, hoverBreadCrumbStyle: BreadcrumbHoverStyle ) ) ) ); } else { children.Add( new Container( height: 24f ) ); } return(new Container( decoration: ContainerDecoration, margin: EdgeInsets.only(bottom: 12f), child: new Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: children ) )); }
Widget _buildSelectItem(string title, int index) { Color textColor; float titleFontSize; float lineHeight = this._navBarHeight <= _minNavBarHeight ? 2 : 4; float radius = this._navBarHeight <= _minNavBarHeight ? 0 : 2; Widget lineView; if (index == this._selectedIndex) { textColor = this._navBarHeight <= _minNavBarHeight ? CColors.PrimaryBlue : CColors.TextTitle; titleFontSize = this._titleFontSize; lineView = new Align( alignment: Alignment.bottomCenter, child: new Container( width: 40, height: lineHeight, decoration: new BoxDecoration( color: CColors.PrimaryBlue, borderRadius: BorderRadius.circular(radius: radius) ) ) ); } else { textColor = CColors.TextTitle; titleFontSize = _minTitleFontSize; lineView = new Align( alignment: Alignment.bottomCenter, child: new Container( width: 40, height: lineHeight ) ); } Widget redDot; if (index == 0 && this.widget.viewModel.isLoggedIn && this.widget.viewModel.feedHasNew) { redDot = new Positioned( top: 0, right: 0, child: new Container( width: 8, height: 8, decoration: new BoxDecoration( color: CColors.Error, borderRadius: BorderRadius.circular(4) ) ) ); } else { redDot = new Container(); } return(new CustomButton( onPressed: () => { if (this._selectedIndex != index) { if (index == 0) { if (!this.widget.viewModel.isLoggedIn) { this.widget.actionModel.pushToLogin(); return; } } this.setState(() => this._selectedIndex = index); this._pageController.animateToPage( page: index, TimeSpan.FromMilliseconds(250), curve: Curves.ease ); } }, padding: EdgeInsets.zero, child: new Container( height: this._navBarHeight, child: new Stack( alignment: Alignment.bottomCenter, children: new List <Widget> { new Stack( children: new List <Widget> { new Container( padding: EdgeInsets.only(8, 4, 8, 10), color: CColors.Transparent, child: new Text( data: title, style: new TextStyle( fontSize: titleFontSize, fontFamily: "Roboto-Bold", color: textColor ) ) ), redDot } ), lineView } ) ) )); }
public override Widget build(BuildContext context) { var mediaQueryData = MediaQuery.of(context: context); return(new Column( mainAxisAlignment: MainAxisAlignment.end, children: new List <Widget> { new Container( color: CColors.White, width: mediaQueryData.size.width, height: this.projectType == ProjectType.article && this.showReportAndBlock ? 319 + mediaQueryData.padding.bottom : 211 + mediaQueryData.padding.bottom, child: new Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Container( height: 54, padding: EdgeInsets.only(top: 16, left: 16), child: new Text("分享至", style: CTextStyle.PRegularBody4) ), new Container( height: 108, padding: EdgeInsets.only(top: 16), decoration: new BoxDecoration( border: new Border( new BorderSide(color: CColors.Separator2), bottom: new BorderSide(color: CColors.Separator2) ) ), child: new Row( mainAxisAlignment: MainAxisAlignment.start, children: this._buildShareItems() ) ), this.projectType == ProjectType.article && this.showReportAndBlock ? new Container( height: 108, padding: EdgeInsets.only(top: 16), decoration: new BoxDecoration( border: new Border( bottom: new BorderSide(color: CColors.Separator2) ) ), child: new Row( mainAxisAlignment: MainAxisAlignment.start, children: this._buildOtherItems() ) ) : new Container(), new GestureDetector( onTap: () => { if (Router.navigator.canPop()) { Router.navigator.pop(); } }, child: new Container( height: 49, color: CColors.Transparent, alignment: Alignment.center, child: new Text("取消", style: CTextStyle.PLargeBody.copyWith(CColors.Cancel)) ) ), new Container( height: mediaQueryData.padding.bottom ) } ) ) } )); }
Widget _buildEventBottom(IEvent eventObj, EventType eventType, EventStatus eventStatus, bool isLoggedIn) { if (!WechatPlugin.instance().isInstalled() || eventType == EventType.offline) { return(new Container()); } return(new Container( height: 56 + this._bottomPadding, padding: EdgeInsets.only(16, 8, 16, 8 + this._bottomPadding), decoration: new BoxDecoration( color: CColors.White, border: new Border(new BorderSide(color: CColors.Separator)) ), child: new CustomButton( onPressed: () => { CustomDialogUtils.showCustomDialog( barrierColor: Color.fromRGBO(0, 0, 0, 0.5f), child: new CustomAlertDialog( "即将前往微信小程序\n开始观看", null, new List <Widget> { new CustomButton( child: new Text( "稍后再说", style: new TextStyle( height: 1.33f, fontSize: 16, fontFamily: "Roboto-Regular", color: new Color(0xFF959595) ), textAlign: TextAlign.center ), onPressed: CustomDialogUtils.hiddenCustomDialog ), new CustomButton( child: new Text( "立即前往", style: CTextStyle.PLargeBlue, textAlign: TextAlign.center ), onPressed: () => { CustomDialogUtils.hiddenCustomDialog(); WechatPlugin.instance().context = this.context; WechatPlugin.instance().currentEventId = eventObj.id; var path = CStringUtils.CreateMiniPath(id: eventObj.id, title: eventObj.title); if (path.isNotEmpty()) { WechatPlugin.instance().toOpenMiNi(path); } } ) } ) ); }, padding: EdgeInsets.zero, child: new Container( decoration: new BoxDecoration( color: CColors.PrimaryBlue, borderRadius: BorderRadius.all(4) ), child: new Row( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { new Text( "进入微信小程序", style: CTextStyle.PLargeMediumWhite.merge(new TextStyle(height: 1)) ) } ) ) ) )); }
protected override Widget build(BuildContext context) { int seconds = this.animation.value; int minutes = seconds / 60; int minutesOne = 0; if (minutes >= 10) { minutesOne = minutes / 10; } int minutesTwo = minutes - minutesOne * 10; int lastSeconds = seconds - minutes * 60; int lastSecondsOne = 0; if (lastSeconds >= 10) { lastSecondsOne = lastSeconds / 10; } int lastSecondsTwo = lastSeconds - lastSecondsOne * 10; return(Positioned.fill( new Container( alignment: Alignment.center, color: Color.fromRGBO(0, 0, 0, 0.4f), child: new Row( mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: new List <Widget> { new Column( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { new Row( children: new List <Widget> { new Container( margin: EdgeInsets.only(right: 4), child: _buildCountView($"{minutesOne}") ), _buildCountView($"{minutesTwo}") } ), new Container( margin: EdgeInsets.only(top: 8), child: new Text( "分钟", style: CTextStyle.CaptionWhite ) ) } ), new Container( margin: EdgeInsets.symmetric(horizontal: 4), height: 50, child: new Text( ":", style: new TextStyle( color: CColors.White, fontFamily: "Roboto-Bold", fontSize: 20 ) ) ), new Column( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { new Row( children: new List <Widget> { new Container( margin: EdgeInsets.only(right: 4), child: _buildCountView($"{lastSecondsOne}") ), _buildCountView($"{lastSecondsTwo}") } ), new Container( margin: EdgeInsets.only(top: 8), child: new Text( "秒", style: CTextStyle.CaptionWhite ) ) } ) } ) ) )); }
Widget _buildChatBar(bool showChatWindow) { IconData iconData; Widget bottomWidget; if (showChatWindow) { iconData = Icons.expand_more; bottomWidget = new Container(); } else { iconData = Icons.expand_less; bottomWidget = new Text( "轻点展开聊天", style: CTextStyle.PSmallBody4 ); } return(new GestureDetector( onTap: () => { this._focusNode.unfocus(); if (!showChatWindow) { this._controller.forward(); } else { this._controller.reverse(); } this.widget.actionModel.showChatWindow(!this.widget.viewModel.showChatWindow); }, child: new Container( padding: EdgeInsets.symmetric(horizontal: 16), color: CColors.White, height: showChatWindow ? 44 : 64, child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Row( children: new List <Widget> { new Container( margin: EdgeInsets.only(right: 6), width: 6, height: 6, decoration: new BoxDecoration( CColors.SecondaryPink, borderRadius: BorderRadius.circular(3) ) ), new Text( "直播聊天", style: new TextStyle( height: 1.09f, fontSize: 16, fontFamily: "Roboto-Medium", color: CColors.TextBody ) ) } ), bottomWidget } ), new Icon( iconData, color: CColors.BrownGrey, size: 28 ) } ) ) )); }
Widget _buildTeamInfo() { var team = this.widget.viewModel.team; return(new CoverImage( coverImage: team.coverImage, height: headerHeight, 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 Text( data: team.name, style: CTextStyle.H4White, maxLines: 1, overflow: TextOverflow.ellipsis ) } ) ) } ), 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.teamId); } else { this.widget.actionModel.pushToLogin(); } } ), new SizedBox(width: 16), _buildFollowCount( "成员", $"{team.stats?.membersCount ?? 0}", () => this.widget.actionModel.pushToTeamMember(obj: this.widget.viewModel.teamId) ) } ), this._buildFollowButton() } ) ) } ) ) )); }
Widget _buildChatList() { Widget child = new Container(); if (this.widget.viewModel.messageLoading) { child = new GlobalLoading(); } else { if (this.widget.viewModel.messageList.Count <= 0) { child = new BlankView("暂无聊天内容", null); } else { child = new SmartRefresher( controller: this._refreshController, enablePullDown: this.widget.viewModel.hasMore, enablePullUp: false, onRefresh: this._onRefresh, child: ListView.builder( padding: EdgeInsets.only(16, right: 16, bottom: 10), physics: new AlwaysScrollableScrollPhysics(), itemCount: this.widget.viewModel.messageList.Count, itemBuilder: (cxt, index) => { var messageId = this.widget.viewModel.messageList[ this.widget.viewModel.messageList.Count - index - 1]; var messageDict = new Dictionary <string, Message>(); if (this.widget.viewModel.channelMessageDict.ContainsKey( this.widget.viewModel.channelId)) { messageDict = this.widget.viewModel.channelMessageDict[this.widget.viewModel.channelId]; } var message = new Message(); if (messageDict.ContainsKey(messageId)) { message = messageDict[messageId]; } return(new ChatMessage( message )); } ) ); } } return(new Flexible( child: new GestureDetector( onTap: () => this._focusNode.unfocus(), child: new Container( color: CColors.White, child: child ) ) )); }
public override Widget build(BuildContext context) { var children = new List <Widget>(); if (this.title.isNotEmpty()) { children.Add( new Container( padding: EdgeInsets.only(16, 24, 16, this.message == null ? 24 : 8), alignment: Alignment.center, child: new Text( data: this.title, style: CTextStyle.PLargeMedium, textAlign: TextAlign.center ) )); } if (this.message.isNotEmpty()) { var mediaQuery = MediaQuery.of(context); var horizontalPadding = mediaQuery.viewInsets.left + mediaQuery.viewInsets.right + 40 + 40; var width = mediaQuery.size.width - horizontalPadding - 32; var maxHeight = this._calculateTextHeight(this.message, width, 7); var totalHeight = this._calculateTextHeight(this.message, width); if (maxHeight < totalHeight) { maxHeight += 16; } else { maxHeight += 32; } children.Add(new Container( height: maxHeight, alignment: Alignment.center, child: new CustomScrollbar( new SingleChildScrollView( child: new Padding( padding: EdgeInsets.only(16, 8, 16, 16), child: new Text(this.message, style: this._messageStyle ) ) ) ) )); } if (this.actions != null) { children.Add(new CustomDivider( height: 1 )); var _children = new List <Widget>(); foreach (var _child in this.actions) { _children.Add(new Expanded( child: new Stack( fit: StackFit.expand, children: new List <Widget> { _child } ) )); var index = this.actions.IndexOf(_child); if (index < this.actions.Count - 1) { _children.Add(new Container( width: 1, color: CColors.Separator )); } } Widget child = new Container( height: 48, child: new Row( mainAxisAlignment: MainAxisAlignment.start, children: _children ) ); children.Add(child); } Widget dialogChild = new IntrinsicWidth( child: new Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: children ) ); return(new CustomDialog( backgroundColor: CColors.White, radius: 5, child: dialogChild )); }
public override Widget build(BuildContext context) { List <Widget> items = new List <Widget>(); Widget onePhysicalPixelVerticalDivider = new SizedBox(width: 1.0f / MediaQuery.of(context).devicePixelRatio); if (this.handleCut != null) { items.Add(_buildToolbarButton("剪切", this.handleCut)); } if (this.handleCopy != null) { if (items.isNotEmpty()) { items.Add(onePhysicalPixelVerticalDivider); } items.Add(_buildToolbarButton("拷贝", this.handleCopy)); } if (this.handlePaste != null) { if (items.isNotEmpty()) { items.Add(onePhysicalPixelVerticalDivider); } items.Add(_buildToolbarButton("粘贴", this.handlePaste)); } if (this.handleSelectAll != null) { if (items.isNotEmpty()) { items.Add(onePhysicalPixelVerticalDivider); } items.Add(_buildToolbarButton("全选", this.handleSelectAll)); } Widget padding = new Padding(padding: EdgeInsets.only(bottom: 10.0f)); Widget triangle = SizedBox.fromSize( size: CustomTextSelectionControlsUtils._kToolbarTriangleSize, child: new CustomPaint( painter: new _TextSelectionToolbarNotchPainter((_ArrowDirection)this.arrowDirection) ) ); Widget toolbar = new ClipRRect( borderRadius: CustomTextSelectionControlsUtils._kToolbarBorderRadius, child: new DecoratedBox( decoration: new BoxDecoration( color: CustomTextSelectionControlsUtils._kToolbarDividerColor, borderRadius: CustomTextSelectionControlsUtils._kToolbarBorderRadius, border: Border.all(color: CustomTextSelectionControlsUtils._kToolbarBackgroundColor, 0) ), child: new Row(mainAxisSize: MainAxisSize.min, children: items) ) ); List <Widget> menus = this.arrowDirection == _ArrowDirection.down ? new List <Widget> { toolbar, triangle, padding } : new List <Widget> { padding, triangle, toolbar }; return(new Column( mainAxisSize: MainAxisSize.min, children: menus )); }