public override Widget build(BuildContext context) { var mediaQueryData = MediaQuery.of(context: context); return(new Column( mainAxisAlignment: MainAxisAlignment.end, children: new List <Widget> { new Container( decoration: new BoxDecoration( color: CColors.White, borderRadius: BorderRadius.only(12, 12) ), width: mediaQueryData.size.width, height: 384 + mediaQueryData.padding.bottom, child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { this._buildFavoriteTitle(), this._buildCreateFavoriteTag(), new Expanded( child: this._buildFavoriteTags() ), new Container( height: mediaQueryData.padding.bottom ) } ) ) } )); }
Widget _buildCart(BuildContext context, Widget child) { AppStateModel model = ScopedModel <AppStateModel> .of(context); int numProducts = model.productsInCart.Keys.Count; int totalCartQuantity = model.totalCartQuantity; Size screenSize = MediaQuery.of(context).size; float screenWidth = screenSize.width; float screenHeight = screenSize.height; _width = _widthFor(numProducts); _widthAnimation = _getWidthAnimation(screenWidth); _heightAnimation = _getHeightAnimation(screenHeight); _shapeAnimation = _getShapeAnimation(); _thumbnailOpacityAnimation = _getThumbnailOpacityAnimation(); _cartOpacityAnimation = _getCartOpacityAnimation(); return(new Container( width: _widthAnimation.value, height: _heightAnimation.value, child: new Material( animationDuration: TimeSpan.FromMilliseconds(0), shape: new BeveledRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular(_shapeAnimation.value) ) ), elevation: 4.0f, color: shrineColorsUtils.kShrinePink50, child: _cartIsVisible ? _buildShoppingCartPage() : _buildThumbnails(numProducts) ) )); }
public override Widget build(BuildContext context) { return(new Material( elevation: 16.0f, shape: new BeveledRectangleBorder( borderRadius: BorderRadius.only(topLeft: Radius.circular(46.0f)) ), child: new Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: new List <Widget> { new GestureDetector( behavior: HitTestBehavior.opaque, onTap: () => { onTap?.Invoke(); }, child: new Container( height: 40.0f, alignment: AlignmentDirectional.centerStart ) ), new Expanded( child: child ), } ) )); }
BorderRadius _getEdgeBorderRadius( int index, int length, TextDirection textDirection, ToggleButtonsThemeData toggleButtonsTheme ) { BorderRadius resultingBorderRadius = borderRadius ?? toggleButtonsTheme.borderRadius ?? BorderRadius.zero; if (_isFirstIndex(index, length, textDirection)) { return(BorderRadius.only( topLeft: resultingBorderRadius.topLeft, bottomLeft: resultingBorderRadius.bottomLeft )); } else if (_isLastIndex(index, length, textDirection)) { return(BorderRadius.only( topRight: resultingBorderRadius.topRight, bottomRight: resultingBorderRadius.bottomRight )); } return(BorderRadius.zero); }
BorderRadius _getClipBorderRadius( int index, int length, TextDirection textDirection, ToggleButtonsThemeData toggleButtonsTheme ) { BorderRadius resultingBorderRadius = borderRadius ?? toggleButtonsTheme.borderRadius ?? BorderRadius.zero; float resultingBorderWidth = borderWidth ?? toggleButtonsTheme.borderWidth ?? _defaultBorderWidth; if (_isFirstIndex(index, length, textDirection)) { return(BorderRadius.only( topLeft: resultingBorderRadius.topLeft - Radius.circular(resultingBorderWidth / 2.0f), bottomLeft: resultingBorderRadius.bottomLeft - Radius.circular(resultingBorderWidth / 2.0f) )); } else if (_isLastIndex(index, length, textDirection)) { return(BorderRadius.only( topRight: resultingBorderRadius.topRight - Radius.circular(resultingBorderWidth / 2.0f), bottomRight: resultingBorderRadius.bottomRight - Radius.circular(resultingBorderWidth / 2.0f) )); } return(BorderRadius.zero); }
public UnderlineInputBorder( BorderSide borderSide = null, BorderRadius borderRadius = null ) : base(borderSide: borderSide ?? new BorderSide()) { this.borderRadius = borderRadius ?? BorderRadius.only( topLeft: Radius.circular(4.0f), topRight: Radius.circular(4.0f) ); }
public override Widget build(BuildContext context) { return(new Container( height: 54, alignment: Alignment.center, decoration: new BoxDecoration( color: CColors.White, borderRadius: BorderRadius.only(12, 12) ), child: new Text("每周三更新", style: CTextStyle.PRegularBody4) )); }
public override Widget build(BuildContext context) { return(new Scaffold( appBar: new AppBar( title: new Text("Travel stream"), actions: new List <Widget> { new MaterialDemoDocumentationButton(CardsDemo.routeName), new IconButton( icon: new Icon( Icons.sentiment_very_satisfied ), onPressed: () => { this.setState(() => { this._shape = this._shape != null ? null : new RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular(16.0f), topRight: Radius.circular(16.0f), bottomLeft: Radius.circular(2.0f), bottomRight: Radius.circular(2.0f) ) ); }); } ) } ), body: new ListView( itemExtent: TravelDestinationItem.height, padding: EdgeInsets.only(top: 8.0f, left: 8.0f, right: 8.0f), children: CardsDemoConstants.destinations.Select <TravelDestination, Widget>( (TravelDestination destination) => { return new Container( margin: EdgeInsets.only(bottom: 8.0f), child: new TravelDestinationItem( destination: destination, shape: this._shape ) ); }).ToList() ) )); }
public override Widget build(BuildContext context) { ThemeData theme = Theme.of(context); return(new Material( elevation: 2.0f, borderRadius: BorderRadius.only( topLeft: Radius.circular(16.0f), topRight: Radius.circular(16.0f) ), child: new Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: new List <Widget> { new GestureDetector( behavior: HitTestBehavior.opaque, onVerticalDragUpdate: this.onVerticalDragUpdate, onVerticalDragEnd: this.onVerticalDragEnd, onTap: () => { this.onTap?.Invoke(); }, child: new Container( height: 48.0f, padding: EdgeInsetsDirectional.only(start: 16.0f), alignment: AlignmentDirectional.centerStart, child: new DefaultTextStyle( style: theme.textTheme.subtitle1, child: new Tooltip( message: "Tap to dismiss", child: this.title ) ) ) ), new Divider(height: 1.0f), new Expanded(child: this.child) } ) )); }
public override Widget build(BuildContext context) { return(new AnimatedPadding( padding: MediaQuery.of(context).viewInsets + EdgeInsets.symmetric(horizontal: 40.0f, vertical: 24.0f), duration: this.insetAnimationDuration, curve: this.insetAnimationCurve, child: MediaQuery.removeViewInsets( removeLeft: true, removeTop: true, removeRight: true, removeBottom: true, context: context, child: new Center( child: new ConstrainedBox( constraints: new BoxConstraints(280.0f), child: new Column( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { this.header ?? new Container(), new Container( decoration: new BoxDecoration( color: this.backgroundColor, borderRadius: this.header == null ? BorderRadius.all(Radius.circular((float)this.radius)) : BorderRadius.only( bottomRight: Radius.circular((float)this.radius), bottomLeft: Radius.circular((float)this.radius) ) ), child: this.child ) } ) ) ) ) )); }
public override BorderRadius resolve(TextDirection?direction) { switch (direction) { case TextDirection.rtl: return(BorderRadius.only( topLeft: _topLeft + _topEnd, topRight: _topRight + _topStart, bottomLeft: _bottomLeft + _bottomEnd, bottomRight: _bottomRight + _bottomStart )); case TextDirection.ltr: return(BorderRadius.only( topLeft: _topLeft + _topStart, topRight: _topRight + _topEnd, bottomLeft: _bottomLeft + _bottomStart, bottomRight: _bottomRight + _bottomEnd )); } return(null); }
public override Widget build(BuildContext context) { return(new Theme( data: lightTheme?ThemeData.light() : ThemeData.dark(), child: new DefaultTabController( length: 3, child: new Scaffold( appBar: new AppBar( title: new GestureDetector( child: new Text("Color Picker Example"), onDoubleTap: (DoubleTapDetails details) => setState(() => lightTheme = !lightTheme) ),//GestureDetector bottom: new TabBar( tabs: new List <Widget> { new Tab(text: "HSV"), new Tab(text: "Material"), new Tab(text: "Block") } ) //TabBar ), //AppBar body: new TabBarView( physics: new NeverScrollableScrollPhysics(), children: new List <Widget> { new Column( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { new RaisedButton( elevation: 3f, onPressed: () => { DialogUtils.showDialog( context: context, builder: (BuildContext _) => { return new AlertDialog( titlePadding: EdgeInsets.all(0f), contentPadding: EdgeInsets.all(0f), content: new SingleChildScrollView( child: new ColorPicker( pickerColor: currentColor, onColorChanged: changeColor, colorPickerWidth: 300f, pickerAreaHeightPercent: 0.7f, enableAlpha: true, displayThumbColor: true, showLabel: true, paletteType: PaletteType.hsv, pickerAreaBorderRadius: BorderRadius.only( topLeft: Radius.circular(2f), topRight: Radius.circular(2f) ) //BorderRadius ) //ColorPicker ) //SingleChildScrollView ); //AlertDialog } ); }, child: new Text("Change me"), color: currentColor, textColor: Utils.useWhiteForeground(currentColor) ? new Color(0xffffffff) : new Color(0xff000000) ), //RaisedButton new RaisedButton( elevation: 3f, onPressed: () => { DialogUtils.showDialog( context: context, builder: (BuildContext _) => { return new AlertDialog( titlePadding: EdgeInsets.all(0), contentPadding: EdgeInsets.all(0f), shape: new RoundedRectangleBorder( borderRadius: BorderRadius.circular(25) ), //RoundedRectangleBorder content: new SingleChildScrollView( child: new SlidePicker( pickerColor: currentColor, onColorChanged: changeColor, paletteType: PaletteType.rgb, enableAlpha: false, displayThumbColor: true, showLabel: false, showIndicator: true, indicatorBorderRadius: BorderRadius.vertical(top: Radius.circular(25)) ) //SlidePicker ) //SingleChildScrollView ); //AlertDialog } ); }, child: new Text("Change me again"), color: currentColor, textColor: Utils.useWhiteForeground(currentColor) ? new Color(0xffffffff) : new Color(0xff000000) ) } ), //Column new Center( child: new RaisedButton( elevation: 3f, onPressed: () => { DialogUtils.showDialog( context: context, builder: (BuildContext _) => { return new AlertDialog( titlePadding: EdgeInsets.all(0f), contentPadding: EdgeInsets.all(0f), content: new SingleChildScrollView( child: new MaterialPicker( pickerColor: currentColor, onColorChanged: changeColor, enableLabel: true ) //MaterialPicker ) //SingleChildScrollView ); //AlertDialog } ); //showDialog }, //onPresed child: new Text("Change me"), color: currentColor, textColor: Utils.useWhiteForeground(currentColor) ? new Color(0xffffffff) : new Color(0xff000000) ) //RaisedButton ), //Center new Center( child: new Column( mainAxisAlignment: MainAxisAlignment.center, children: new List <Widget> { new RaisedButton( elevation: 3f, onPressed: () => { DialogUtils.showDialog( context: context, builder: (BuildContext _) => { return new AlertDialog( title: new Text("Select color"), content: new SingleChildScrollView( child: new BlockPicker( pickerColor: currentColor, onColorChanged: changeColor ) //BlockPicker ) //SingleChildScrollView ); //AlertDialog } ); //showDialog }, //onPressed child: new Text("Change me again"), color: currentColor, textColor: Utils.useWhiteForeground(currentColor) ? new Color(0xffffffff) : new Color(0xff000000) ) //RaisedButton } ) //Column ) //center } ) //TabBarView ) //Scaffold ) //DefaultTabController )); //Theme }//function build
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 static Widget SettingHSVColorPicker( BuildContext context, string title, ValueChanged <Color> onColorChanged, Color color = null, string buttonName = "", bool enableAlpha = false, bool showPreviousColor = false ) { if (color == null) { color = Colors.blueAccent; } if (buttonName == "") { buttonName = color.ToHexString(enableAlpha); } return(new Container( padding: EdgeInsets.symmetric(horizontal: 6f), child: new Row( children: new List <Widget> { new Container(child: new Text(title)), new Expanded( child: new Container( padding: EdgeInsets.all(6), alignment: Alignment.bottomRight, child: new RaisedButton( color: color, child: new Text( buttonName, style: new TextStyle( color: Utils.useWhiteForeground(color) ? Colors.white : Colors.black ) //TextStyle ), //Text onPressed: () => { DialogUtils.showDialog( context: context, builder: (BuildContext _) => { if (showPreviousColor) { return new AlertDialog( titlePadding: EdgeInsets.all(0), contentPadding: EdgeInsets.all(0f), shape: new RoundedRectangleBorder( borderRadius: BorderRadius.circular(25) ), //RoundedRectangleBorder content: new SingleChildScrollView( child: new SlidePicker( pickerColor: color, onColorChanged: onColorChanged, paletteType: PaletteType.hsv, enableAlpha: enableAlpha, displayThumbColor: true, showLabel: false, showIndicator: true, indicatorBorderRadius: BorderRadius.vertical(top: Radius.circular(25)) ) //SlidePicker ) //SingleChildScrollView ); //AlertDialog } else { return new AlertDialog( titlePadding: EdgeInsets.all(0f), contentPadding: EdgeInsets.all(0f), content: new SingleChildScrollView( child: new ColorPicker( pickerColor: color, onColorChanged: onColorChanged, colorPickerWidth: 300f, pickerAreaHeightPercent: 0.7f, enableAlpha: enableAlpha, displayThumbColor: true, showLabel: true, paletteType: PaletteType.hsv, pickerAreaBorderRadius: BorderRadius.only( topLeft: Radius.circular(2f), topRight: Radius.circular(2f) ) //BorderRadius ) //ColorPicker ) //SingleChildScrollView ); //AlertDialog } } ); } ) ) //container ), //expanded } //list ) //row )); }
public override Widget build(BuildContext context) { var bloggerIds = this.widget.viewModel.bloggerIds; Widget content; if (this.widget.viewModel.bloggerLoading && bloggerIds.isEmpty()) { content = new GlobalLoading( color: CColors.Transparent, loadingColor: LoadingColor.white ); } else if (bloggerIds.Count <= 0) { content = new CustomScrollbar( new CustomScrollView( new PageStorageKey <string>("博主"), physics: new AlwaysScrollableScrollPhysics(), slivers: new List <Widget> { new SliverToBoxAdapter( child: new Container(height: 16) ), new SliverFillRemaining( child: new BlankView( "暂无博主", "image/default-following", true, () => { this.widget.actionModel.startFetchBlogger(); this.widget.actionModel.fetchBlogger(arg: firstPageNumber); }, new BoxDecoration( color: CColors.White, borderRadius: BorderRadius.only(12, 12) ) ) ) } ) ); } else { var enablePullUp = this.widget.viewModel.bloggerHasMore; Widget endView; if (!enablePullUp) { endView = new EndView(); } else { endView = new Visibility( visible: this._isLoading, child: new Container( color: CColors.Background, padding: EdgeInsets.symmetric(16), child: new CustomActivityIndicator( loadingColor: LoadingColor.black, animating: this._isLoading ? AnimatingType.repeat : AnimatingType.reset ) ) ); } content = new NotificationListener <ScrollNotification>( onNotification: this._onNotification, child: new CustomScrollbar( new CustomScrollView( new PageStorageKey <string>("博主"), physics: new AlwaysScrollableScrollPhysics(), slivers: new List <Widget> { new SliverToBoxAdapter( child: new Container( child: new Column( children: new List <Widget> { new LeaderBoardBloggerHeader( bloggerIds: bloggerIds, userDict: this.widget.viewModel.userDict, userId => this.widget.actionModel.pushToUserDetail(obj: userId) ), new LeaderBoardUpdateTip(), new CustomDivider(height: 1, color: CColors.Separator2) } ) ) ), new SliverList( del: new SliverChildBuilderDelegate( builder: this._buildBloggerCard, childCount: bloggerIds.Count ) ), new SliverToBoxAdapter( child: endView ) } ) ) ); } return(new Container( child: content )); }
Widget _buildKingKongItem(string title, string imageName, GestureTapCallback onPressItem) { Widget newDot; if (title == "榜单" && this.widget.leaderBoardUpdatedTime.HasValue && LocalDataManager.needNoticeNewLeaderBoard(dateTime: this.widget.leaderBoardUpdatedTime.Value)) { newDot = new Positioned( top: 0, right: 0, child: new Container( width: 18, height: 18, decoration: new BoxDecoration( color: CColors.Error, borderRadius: BorderRadius.only(9, 9, 9) ), alignment: Alignment.center, child: new Text( "新", style: new TextStyle( fontSize: 10, fontFamily: "Roboto-Bold", color: CColors.White ) ) ) ); } else { newDot = Positioned.fill(new Container()); } return(new Expanded( child: new GestureDetector( onTap: onPressItem, child: new Container( color: CColors.Transparent, padding: EdgeInsets.only(top: 16, bottom: 16), child: new Column( children: new List <Widget> { new Container( margin: EdgeInsets.only(bottom: 8), child: new Stack( children: new List <Widget> { new Padding( padding: EdgeInsets.symmetric(horizontal: 9), child: Image.asset( "image/kingkong-bg", width: 48, height: 48 ) ), newDot, Positioned.fill( new Container( padding: EdgeInsets.all(6), child: Image.asset($"image/{imageName}") ) ) } ) ), new Text(data: title, style: CTextStyle.PSmallBody4) } ) ) ) )); }
private List <Widget> BuildChildList(BuildContext context, bool isLoggedInUser) { Profile senderProfile = App.ProfilesModel.GetProfile(sender); Radius corners = Radius.circular(10.0f); /// color differentiation between users in the chat Color bg = isLoggedInUser ? Colors.blue.shade100 : Colors.white; /// this makes the chat bubble point left or right, depending on user BorderRadius radius = isLoggedInUser ? BorderRadius.only( topLeft: corners, topRight: corners, bottomLeft: corners ) : BorderRadius.only( topLeft: corners, topRight: corners, bottomRight: corners ); return(new List <Widget> { /// the image of the sender for this message, which opens the ProfileScreen when tapped new AvatarButton(onTap: () => { Navigator.of(context).push(new MaterialPageRoute((buildContext) => new ProfileScreen(profile: senderProfile))); }, senderProfile.PhotoURL), new Column( children: new List <Widget> { /// the chat bubble container, using border radius and box shadow to create the bubble effect new Container( margin: EdgeInsets.all(3.0f), padding: EdgeInsets.all(8.0f), decoration: new BoxDecoration( boxShadow: new List <BoxShadow> { new BoxShadow( blurRadius: 0.6f, spreadRadius: 1.0f, color: Colors.black.withOpacity(0.16f) ) }, color: bg, borderRadius: radius ), /// display the actual message inside the bubble child: new Text(message) ), // we tack on the date underneath the bubble container new Padding(padding: isLoggedInUser ? EdgeInsets.only(right: 5f) : EdgeInsets.only(left: 5f), child: new Text(time, style: new TextStyle( color: Colors.black38, fontSize: 10.0f ) ) ) } ) }); }
public override Widget build(BuildContext context) { if (this.model == null) { return(new Container()); } const float imageWidth = 114; const float imageHeight = 76; const float borderRadius = 4; var gap = this.topPadding ? 16 : 0; var time = Convert.ToDateTime(this.model.begin.startTime); var hour = $"{time.Hour.ToString().PadLeft(2, '0')}"; var minute = $"{time.Minute.ToString().PadLeft(2, '0')}"; var hourMinute = $"{hour}:{minute}"; var address = this.place ?? ""; var imageUrl = this.model.avatar ?? this.model.background; var card = new Container( height: 108 + gap, padding: EdgeInsets.only(16, 16 + gap, 16, 16), color: CColors.White, child: new Row( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Container( width: 32, margin: EdgeInsets.only(right: 10), child: new Column( crossAxisAlignment: CrossAxisAlignment.center, children: new List <Widget> { new Text( time.Day.ToString(), style: new TextStyle( height: 1.33f, fontSize: 24, fontFamily: "Roboto-Bold", color: CColors.SecondaryPink ) ), new Text( $"{time.Month.ToString()}月", style: CTextStyle.CaptionBody ) } ) ), new Expanded( child: new Container( margin: EdgeInsets.only(right: 8), child: new Column( crossAxisAlignment: CrossAxisAlignment.start, children: new List <Widget> { new Container( margin: EdgeInsets.only(bottom: 8), child: new Text(this.model.title, style: CTextStyle.PLargeMedium, maxLines: 2, overflow: TextOverflow.ellipsis ) ), new Text(this.model.mode == "online" ? $"{hourMinute} · {this.model.participantsCount}人已预订" : $"{hourMinute} · {address}", style: CTextStyle.PSmallBody3 ) } ) ) ), new Container( child: new Stack( children: new List <Widget> { new PlaceholderImage( imageUrl.EndsWith(".gif") ? imageUrl : CImageUtils.SuitableSizeImageUrl(imageWidth, imageUrl), imageWidth, imageHeight, borderRadius, BoxFit.cover ), new Positioned( bottom: 0, right: 0, child: new ClipRRect( borderRadius: BorderRadius.only(bottomRight: 4), child: new Container( width: 41, height: 24, color: this.model.mode == "online" ? CColors.SecondaryPink : CColors.PrimaryBlue, alignment: Alignment.center, child: new Text(this.model.mode == "online" ? "线上" : "线下", style: CTextStyle.CaptionWhite, textAlign: TextAlign.center ) ) ) ) } ) ) } ) ); return(new GestureDetector( child: card, onTap: this.onTap )); }
public override Widget build(BuildContext context) { var mediaQueryData = MediaQuery.of(context: context); return(new Column( mainAxisAlignment: MainAxisAlignment.end, children: new List <Widget> { new Container( decoration: new BoxDecoration( color: CColors.White, borderRadius: BorderRadius.only(12, 12) ), 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(color: CColors.Cancel)) ) ), new Container( height: mediaQueryData.padding.bottom ) } ) ) } )); }
Widget _buildAlbumCard(BuildContext context, int index) { if (index == 0) { if (this.widget.viewModel.loading) { return(new Container( height: MediaQuery.of(context).size.height - 202 - MediaQuery.of(context).padding.top, child: new Center( child: new GlobalLoading(color: CColors.White) ) )); } if (this.widget.viewModel.articleList.isEmpty()) { return(new Container( height: MediaQuery.of(context).size.height - 202 - MediaQuery.of(context).padding.top, child: new BlankView( "暂无文章", "image/default-article", true, () => { this.widget.actionModel.startFetchDetailList(); this.widget.actionModel.fetchDetailList(this._pageNumber); }, new BoxDecoration( color: CColors.White, borderRadius: BorderRadius.only(12, 12) )) )); } return(new Container( height: 16, decoration: new BoxDecoration(color: CColors.White, borderRadius: BorderRadius.only(12, 12)) )); } var article = this.widget.viewModel.articleDict[this.widget.viewModel.articleList[index - 1]]; if (!this.widget.viewModel.articleDict.ContainsKey(key: article.id)) { return(new Container()); } var fullName = ""; var userId = ""; if (article.ownerType == OwnerType.user.ToString()) { userId = article.userId; 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()) { userId = article.teamId; if (this.widget.viewModel.teamDict.ContainsKey(key: article.teamId)) { fullName = this.widget.viewModel.teamDict[key : article.teamId].name; } } var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id); return(new ArticleCard( article: article, () => { this.widget.actionModel.pushToArticleDetail(obj: article.id); AnalyticsManager.ClickEnterArticleDetail("Home_Article", articleId: article.id, articleTitle: article.title); }, () => ShareManager.showArticleShareView( false, isLoggedIn: this.widget.viewModel.isLoggedIn, () => { Clipboard.setData(new ClipboardData(text: linkUrl)); CustomDialogUtils.showToast("复制链接成功", iconData: Icons.check_circle_outline); }, () => this.widget.actionModel.pushToLogin(), () => this.widget.actionModel.pushToBlock(obj: article.id), () => this.widget.actionModel.pushToReport(arg1: article.id, arg2: ReportType.article), type => { CustomDialogUtils.showCustomDialog( child: new CustomLoadingDialog() ); string imageUrl = CImageUtils.SizeTo200ImageUrl(imageUrl: 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()); } ), fullName: fullName, new ObjectKey(value: article.id) )); }
public override Widget build(BuildContext context) { var collectionIds = this.widget.viewModel.collectionIds; Widget content; if (this.widget.viewModel.collectionLoading && collectionIds.isEmpty()) { content = new GlobalLoading( color: CColors.Transparent, loadingColor: LoadingColor.white ); } else if (collectionIds.Count <= 0) { content = new CustomScrollbar( new CustomScrollView( new PageStorageKey <string>("合辑"), slivers: new List <Widget> { new SliverToBoxAdapter( child: new Container(height: 16) ), new SliverFillRemaining( child: new BlankView( "暂无合辑", "image/default-article", true, () => { this.widget.actionModel.startFetchCollection(); this.widget.actionModel.fetchCollection(arg: firstPageNumber); }, new BoxDecoration( color: CColors.White, borderRadius: BorderRadius.only(12, 12) ) ) ) } ) ); } else { var enablePullUp = this.widget.viewModel.collectionHasMore; Widget endView; if (!enablePullUp) { endView = new EndView(); } else { endView = new Visibility( visible: this._isLoading, child: new Container( padding: EdgeInsets.symmetric(16), child: new CustomActivityIndicator( loadingColor: LoadingColor.white, animating: this._isLoading ? AnimatingType.repeat : AnimatingType.reset ) ) ); } content = new NotificationListener <ScrollNotification>( onNotification: this._onNotification, child: new CustomScrollbar( new CustomScrollView( new PageStorageKey <string>("合辑"), physics: new AlwaysScrollableScrollPhysics(), slivers: new List <Widget> { new SliverToBoxAdapter( child: new Container( child: new Column( children: new List <Widget> { new SizedBox(height: 16), new LeaderBoardUpdateTip(), new CustomDivider(height: 1, color: CColors.Separator2) } ) ) ), new SliverFixedExtentList( del: new SliverChildBuilderDelegate( builder: this._buildCollectionCard, childCount: collectionIds.Count ), itemExtent: 112 ), new SliverToBoxAdapter( child: endView ) } ) ) ); } return(new Container( child: content )); }
public override Widget build(BuildContext context) { return(new Scaffold( appBar: new AppBar( title: new Text("Cards"), actions: new List <Widget> { new MaterialDemoDocumentationButton(CardsDemo.routeName), new IconButton( icon: new Icon( Icons.sentiment_very_satisfied ), onPressed: () => { this.setState(() => { this._shape = this._shape != null ? null : new RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular(16.0f), topRight: Radius.circular(16.0f), bottomLeft: Radius.circular(2.0f), bottomRight: Radius.circular(2.0f) ) ); }); } ) } ), body: new Scrollbar( child: new ListView( padding: EdgeInsets.only(top: 8.0f, left: 8.0f, right: 8.0f), children: TravelDestination.destinations.Select <TravelDestination, Widget>( (TravelDestination destination) => { Widget child = null; switch (destination.type) { case CardDemoType.standard: child = new TravelDestinationItem(destination: destination, shape: this._shape); break; case CardDemoType.tappable: child = new TappableTravelDestinationItem(destination: destination, shape: this._shape); break; case CardDemoType.selectable: child = new SelectableTravelDestinationItem(destination: destination, shape: this._shape); break; } return new Container( margin: EdgeInsets.only(bottom: 8.0f), child: child ); }).ToList() ) ) )); }