public override Widget build(BuildContext context) { Widget child = new Container( decoration: new BoxDecoration( boxShadow: new List <BoxShadow> { new BoxShadow( color: new Color(0x66000000), offset: new Offset(0, 2f), blurRadius: 4f ) }, borderRadius: BorderRadius.all(32), color: new Color(0xff000000) ), height: 64, width: 64, child: new Center( child: Transform.rotate( degree: Mathf.PI, alignment: Alignment.center, child: new Icon( Icons.MaterialExpandMore, color: new Color(0xffffffff), size: 32f ) ) ) ); if (widget._displayThreshold != null) { if (Math.Abs(_animation.value) < 1e-2) { child = null; } else { child = new Opacity( opacity: _animation.value, child: child ); } } return(new Positioned( bottom: 140, right: 48, child: new Clickable( onTap: () => widget._scrollController.animateTo( 0, SuitableAnimationTimeSpan, Curves.easeIn), child: child ) )); }
public override Widget build(int i, float animationValue, Widget widget) { float v = CustomLayoutUtils._getValue(values: this.values, animationValue: animationValue, index: i); return(Transform.rotate( degree: v, child: widget )); }
public override Widget build(BuildContext context) { return(Transform.rotate( degree: _animation.value, alignment: Alignment.center, child: new Icon( Icons.IconFontLoading, size: widget._size, color: IconColor ) )); }
public override Widget build(BuildContext context) { return(Transform.rotate( degree: m_Animation.value, alignment: Alignment.center, child: new Container( width: widget.size, height: widget.size, child: Image.asset( widget.isWhite ? "Images/white-loading" : "Images/black-loading" ) ) )); }
public override Widget build(BuildContext context) { return(SizedBox.fromSize(size: AppConstants.DIRECTION_BUTTON_SIZE * 2.8f, child: Transform.rotate( origin: new Offset(90, 90), degree: Mathf.PI / 4, child: new Column( mainAxisSize: MainAxisSize.min, children: new List <Widget>() { new SizedBox(height: AppConstants.DIRECTION_BUTTON_SPACE), new Row( children: new List <Widget>() { new SizedBox(width: AppConstants.DIRECTION_BUTTON_SPACE), new GBButton( size: AppConstants.DIRECTION_BUTTON_SIZE, () => { Game.of(context).Drop(); } ), new SizedBox(width: AppConstants.DIRECTION_BUTTON_SPACE), new GBButton( size: AppConstants.DIRECTION_BUTTON_SIZE, () => { Game.of(context).Right(); } ) } ), new SizedBox(height: AppConstants.DIRECTION_BUTTON_SPACE), new Row( children: new List <Widget>() { new SizedBox(width: AppConstants.DIRECTION_BUTTON_SPACE), new GBButton( size: AppConstants.DIRECTION_BUTTON_SIZE, () => { Game.of(context).Left(); } ), new SizedBox(width: AppConstants.DIRECTION_BUTTON_SPACE), new GBButton( size: AppConstants.DIRECTION_BUTTON_SIZE, () => { Game.of(context).Down(); } ) } ), new SizedBox(height: AppConstants.DIRECTION_BUTTON_SPACE) } ) ) )); }
public override Widget build(BuildContext context) { var screenWidth = MediaQuery.of(context).size.width; var windowChildren = new List <Widget> { new Scroller( child: ListView.builder( controller: m_ScrollController, reverse: true, itemCount: m_HasMoreOld ? widget.messages[widget.channel.id].Count + 1 : widget.messages[widget.channel.id].Count, itemBuilder: (ctx, index) => { if (!m_Initialized) { return(new Container()); } if (index == widget.messages[widget.channel.id].Count) { return(new LoadTrigger( () => { var lastMessageId = widget.messages[widget.channel.id].last().id; Get( $"/api/connectapp/v1/channels/{widget.channel.id}/messages?before={lastMessageId}", (GetMessagesResponse getMessagesResponse) => { if (mounted) { using (WindowProvider.of(context) .getScope()) { setState(() => { widget.messages[widget.channel.id] .AddRange( getMessagesResponse.items .Where( item => item.id != lastMessageId ) ); m_MsgsUnreads = 0; m_HasMoreUnreads = true; if (m_PreviousLastMsgId == null) { m_HasMoreUnreads = false; } else { foreach (var m in widget.messages[widget.channel.id]) { if (string.Compare(m.id, m_PreviousLastMsgId) > 0) { ++m_MsgsUnreads; } else { m_HasMoreUnreads = false; break; } } } m_HasMoreOld = getMessagesResponse.hasMore; }); } } }); } )); } var currentMessage = widget.messages[widget.channel.id][index]; var msgTime = ExtractTimeFromSnowflakeId(currentMessage.id.IsNullOrEmpty() ? currentMessage.nonce : currentMessage.id); bool showTime; var isNew = false; if (index == widget.messages[widget.channel.id].Count - 1) { showTime = true; } else { var nextMessage = widget.messages[widget.channel.id][index + 1]; showTime = msgTime - ExtractTimeFromSnowflakeId( nextMessage.id.IsNullOrEmpty() ? nextMessage.nonce : nextMessage.id) > TimeSpan.FromMinutes(5); if (nextMessage.id != null && nextMessage.id == m_PreviousLastMsgId) { isNew = true; } } Action onBuild = null; if (currentMessage.id == m_PreviousLastMsgId) { onBuild = () => { SchedulerBinding.instance.addPostFrameCallback(value => { setState(() => { m_MsgsUnreads = 0; m_HasMoreUnreads = false; }); }); }; } return(new Message( widget.messages[widget.channel.id][index], widget.users, showTime, m_PreviousLastMsgId != widget.channel.lastMessage.id && isNew, msgTime, onBuild )); } ) ), }; if (Window.reconnecting) { windowChildren.Add( new Positioned( left: 0, top: 0, right: 0, child: new Container( color: new Color(0xfffde1df), height: 48, alignment: Alignment.center, child: new Text( "网络未连接,正在连接中", style: new TextStyle( fontSize: 16, color: new Color(0xfff44336), fontFamily: "PingFang" ) ) ) ) ); } var newMsgsCount = Window.NewMessages.Count(msg => msg.author.id != Window.currentUserId); if (newMsgsCount != 0) { windowChildren.Add( new Positioned( bottom: 24, child: new GestureDetector( onTap: () => { Window.NewMessages.ForEach(msg => { Window.Messages[msg.channelId].Insert(0, msg); }); Window.NewMessages.Clear(); setState(); m_ScrollController.animateTo( 0, new TimeSpan(0, 0, 0, 0, 480), Curves.easeInOut ); }, child: new Container( height: 40, padding: EdgeInsets.symmetric(horizontal: 16), decoration: new BoxDecoration( borderRadius: BorderRadius.all(20), boxShadow: new List <BoxShadow> { new BoxShadow( offset: new Offset(0, 1), blurRadius: 6, color: new Color(0x19000000) ), }, color: new Color(0xffffffff) ), child: new Row( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { new Text( $"{newMsgsCount}条新消息未读", style: new TextStyle( color: new Color(0xff2196f3), fontSize: 14, fontFamily: "PingFang" ) ), } ) ) ) ) ); } if (m_MsgsUnreads > 0) { var text = $"{m_MsgsUnreads}"; if (m_HasMoreUnreads) { text += "+"; } text += "条新消息"; windowChildren.Add( new Positioned( top: 24, child: new GestureDetector( onTap: () => { var totalHeight = 0.0f; for (var index = 0; index < widget.messages[widget.channel.id].Count; ++index) { var message = widget.messages[widget.channel.id][index]; if (string.Compare(message.id, m_PreviousLastMsgId) > 0) { var showTime = true; var msgTime = ExtractTimeFromSnowflakeId(message.id.IsNullOrEmpty() ? message.nonce : message.id); if (index != widget.messages[widget.channel.id].Count - 1) { var nextMessage = widget.messages[widget.channel.id][index + 1]; showTime = msgTime - ExtractTimeFromSnowflakeId( nextMessage.id.IsNullOrEmpty() ? nextMessage.nonce : nextMessage.id) > TimeSpan.FromMinutes(5); } var layoutWidth = screenWidth * 0.7f; if (screenWidth >= 750) { layoutWidth -= 286.5f; } else { layoutWidth -= 24f; } totalHeight += CalculateMessageHeight( message, showTime, layoutWidth ); } else { break; } } if (m_HasMoreUnreads) { totalHeight += 40; } else { totalHeight += 36; } m_ScrollController.animateTo( totalHeight - MediaQuery.of(context).size.height + 184, new TimeSpan(0, 0, 0, 0, 480), Curves.easeInOut ); if (!m_HasMoreUnreads) { setState(() => { m_MsgsUnreads = 0; m_HasMoreUnreads = false; }); } }, child: new Container( height: 40, padding: EdgeInsets.symmetric(horizontal: 16), decoration: new BoxDecoration( borderRadius: BorderRadius.all(20), boxShadow: new List <BoxShadow> { new BoxShadow( offset: new Offset(0, 1), blurRadius: 6, color: new Color(0x19000000) ), }, color: new Color(0xffffffff) ), child: new Row( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { new Text( text, style: new TextStyle( color: new Color(0xff2196f3), fontSize: 14, fontFamily: "PingFang" ) ), new Container( margin: EdgeInsets.only(left: 4), child: Transform.rotate( child: new Icon( IconFont.IconFontArrowUp, size: 24, color: new Color(0xff2196f3) ) ) ) } ) ) ) ) ); } var rootState = HomePage.of(context); var children = new List <Widget> { new Container( color: new Color(0xffffffff), child: new Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: new List <Widget> { new ChattingWindowHeader( widget.channel, () => { if (screenWidth < 750) { m_AnimationController.reverse(); } else { HomePage.of(context).Select(string.Empty); } }), new Expanded( child: new Stack( alignment: Alignment.center, children: windowChildren ) ), new Sender( m_SenderFocusNode, widget.users), } ) ), }; if (!m_Initialized) { children.Add( new Container( alignment: Alignment.center, child: new Loading(size: 56) ) ); } Widget all = new GestureDetector( onTap: () => { FocusScope.of(context).requestFocus(m_EmptyFocusNode); }, child: new Stack( children: children ) ); if (screenWidth < 750) { all = Transform.translate( offset: new Offset((1 - m_AnimationController.value) * screenWidth, 0), child: all ); } return(all); }
public override Widget build(BuildContext context) { D.assert(WidgetsD.debugCheckHasDirectionality(context)); D.assert(material_.debugCheckHasMaterialLocalizations(context)); D.assert(material_.debugCheckHasMaterialLocalizations(context)); ThemeData theme = Theme.of(context); List <Widget> children = new List <Widget> { }; if (widget.accountName != null) { Widget accountNameLine = new LayoutId( id: _AccountDetailsLayout.accountName, child: new Padding( padding: EdgeInsets.symmetric(vertical: 2.0f), child: new DefaultTextStyle( style: theme.primaryTextTheme.bodyText1, overflow: TextOverflow.ellipsis, child: widget.accountName ) ) ); children.Add(accountNameLine); } if (widget.accountEmail != null) { Widget accountEmailLine = new LayoutId( id: _AccountDetailsLayout.accountEmail, child: new Padding( padding: EdgeInsets.symmetric(vertical: 2.0f), child: new DefaultTextStyle( style: theme.primaryTextTheme.bodyText2, overflow: TextOverflow.ellipsis, child: widget.accountEmail ) ) ); children.Add(accountEmailLine); } if (widget.onTap != null) { Widget dropDownIcon = new LayoutId( id: _AccountDetailsLayout.dropdownIcon, child: new SizedBox( height: UserAccountsDrawerHeaderUtils._kAccountDetailsHeight, width: UserAccountsDrawerHeaderUtils._kAccountDetailsHeight, child: new Center( child: Transform.rotate( angle: _animation.value * Mathf.PI, child: new Icon( Icons.arrow_drop_down, color: widget.arrowColor ) ) ) ) ); children.Add(dropDownIcon); } Widget accountDetails = new CustomMultiChildLayout( layoutDelegate: new _AccountDetailsLayout( Directionality.of(context)), children: children ); if (widget.onTap != null) { accountDetails = new InkWell( onTap: widget.onTap == null ? (GestureTapCallback)null : () => { widget.onTap(); }, child: accountDetails ); } return(new SizedBox( height: UserAccountsDrawerHeaderUtils._kAccountDetailsHeight, child: accountDetails )); }