Widget _buildMoreBlogger(List <string> bloggerIds) { return(new GestureDetector( onTap: () => this.onPressMore?.Invoke(), child: new Container( width: 160, margin: EdgeInsets.only(right: 16), decoration: new BoxDecoration( color: CColors.White, borderRadius: BorderRadius.all(6) ), child: new ClipRRect( borderRadius: BorderRadius.all(6), child: new Stack( fit: StackFit.expand, children: new List <Widget> { Image.asset( "image/blogger-more-pattern", fit: BoxFit.fill ), Positioned.fill( new Column( mainAxisAlignment: MainAxisAlignment.center, children: this._buildAvatars(bloggerIds) ) ) } ) ) ) )); }
Widget _buildFileIcon() { var attachment = this.message.attachments.first(); string imageName; if (attachment.filename.EndsWith(".pdf")) { imageName = "image/pdf-file-icon"; } else if (attachment.filename.EndsWith(".mp4")) { imageName = "image/video-file-icon"; } else { imageName = "image/file-general-icon"; } return(Image.asset( name: imageName, width: 42, height: 48, fit: BoxFit.fill )); }
public override Widget build(BuildContext context) { onTap = this.widget.onTap; selectedColor = this.widget.selectedColor; title = this.widget.title; selected = this.widget.selected; index = this.widget.index; currentIndex = this.widget.currentIndex; selected = currentIndex == index; float width = Screen.width * 0.8f - 60; return(new GestureDetector( child: new Container( width: width, color: selected ? selectedColor : null, child: new Card( child: new ListTile( title: Image.asset("LiftModel/" + title), subtitle: new Text(title, textAlign: TextAlign.center) ) ) ), onTap: () => OnTap() ) ); }
Widget _buildCoverButtonItem(int index, float buttonSize) { var imageName = CImageUtils.FavoriteCoverImages[index : index]; var isSelected = this._favoriteImageName == imageName; return(new CustomButton( width: buttonSize, height: buttonSize, decoration: new BoxDecoration( color: CColors.BlackHaze, borderRadius: BorderRadius.circular(4), border: Border.all( isSelected ? CColors.TextBody : CColors.BlackHaze, 1.5f ) ), child: Image.asset( $"{CImageUtils.FavoriteCoverImagePath}/{imageName}" ), onPressed: () => { this.PackUpKeyboard(); this._setEnableSubmit(); if (this._favoriteImageName != imageName) { this.setState(() => this._favoriteImageName = imageName); } } )); }
Widget _buildFileIcon() { var attachment = this.message.attachments.first(); string imageName; if (attachment.contentType == "application/pdf") { imageName = "image/pdf-file-icon"; } else if (attachment.contentType == "video/mp4") { imageName = "image/video-file-icon"; } else { imageName = "image/file-general-icon"; } return(Image.asset( name: imageName, width: 42, height: 48, fit: BoxFit.fill )); }
Widget _buildContent(BuildContext context) { return(new Container( color: CColors.White, child: new Stack( children: new List <Widget> { new Container( width: MediaQuery.of(context: context).size.width, height: MediaQuery.of(context: context).size.height, child: Image.asset( "image/img-bg-login@4x", fit: BoxFit.cover ) ), new Positioned( new Column( children: new List <Widget> { this._buildTopView(context: context), this._buildBottomView(context: context) } ) ) } ) )); }
Widget _buildPopupLikeButton( string content, bool selected, bool leftMost, bool rightMost, GestureTapCallback onTap) { return(new GestureDetector( onTap: onTap, child: new Container( padding: EdgeInsets.only(left: leftMost ? 0 : 2, right: rightMost ? 0 : 2), child: new Container( width: 44, height: 44, decoration: new BoxDecoration( borderRadius: BorderRadius.all(12), color: selected ? CColors.Separator2 : CColors.Transparent), child: new Center( child: Image.asset( content, width: this._buttonSizeValue, height: this._buttonSizeValue) ) ) ) )); }
public override Widget build(BuildContext context) { if (Application.platform == RuntimePlatform.Android) { return(new Container( color: CColors.White)); } return(new Container( color: CColors.White, child: new Center( child: new Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: new List <Widget> { new Container( width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height, margin: EdgeInsets.only(bottom: 0, top: 0), child: Image.asset("image/iOS/AppIcon.imageset/AppIcon", fit: BoxFit.cover) ), new Text( "By @jdnichollsc", textAlign: TextAlign.center, style: CTextStyle.H2 ) }) ))); }
public override Widget build(BuildContext context) { return(new ShrinePage( scaffoldKey: this.scaffoldKey, products: this.widget.products, shoppingCart: this.widget.shoppingCart, floatingActionButton: new FloatingActionButton( onPressed: () => { this.updateOrder(inCart: true); int n = this.currentOrder.quantity; string item = this.currentOrder.product.name; string message = n == 1 ? $"is one {item} item" : $"are {n} {item} items"; this.showSnackBarMessage( $"There {message} in the shopping cart." ); }, backgroundColor: new Color(0xFF16F0F0), tooltip: "Add to cart", child: new Icon( Icons.add_shopping_cart, color: Colors.black ) ), body: new CustomScrollView( slivers: new List <Widget> { new SliverToBoxAdapter( child: new _HeadingShrineOrder( product: this.widget.order.product, quantity: this.currentOrder.quantity, quantityChanged: (int value) => { this.updateOrder(quantity: value); } ) ), new SliverSafeArea( top: false, minimum: EdgeInsets.fromLTRB(8.0f, 32.0f, 8.0f, 8.0f), sliver: new SliverGrid( gridDelegate: new SliverGridDelegateWithMaxCrossAxisExtent( maxCrossAxisExtent: 248.0f, mainAxisSpacing: 8.0f, crossAxisSpacing: 8.0f ), layoutDelegate: new SliverChildListDelegate( this.widget.products .FindAll((Product product) => product != this.widget.order.product) .Select <Product, Widget>((Product product) => { return new Card( elevation: 1.0f, child: Image.asset( product.imageAsset, fit: BoxFit.contain ) ); }).ToList() ) ) ) } ) )); }
Widget loadAsset() { var image = Image.asset(this.localImagePath, filterMode: FilterMode.Bilinear ); return(image); }
// _buildImage, buildcheckbox, build bullet, buildTablecell Widget _buildImage(string src) { var parts = src.Split('#'); if (parts.isEmpty()) { return(new SizedBox()); } var path = parts.first(); float width = 0, height = 0; if (parts.Length == 2) { var dimensions = parts.last().Split('x'); if (dimensions.Length == 2) { width = float.Parse(dimensions[0]); height = float.Parse(dimensions[1]); } } var uri = new Uri(path); Widget child; if (uri.Scheme == "http" || uri.Scheme == "https") { child = Image.network(uri.ToString(), null, 1); } else if (uri.Scheme == "data") { // todo child = this._handleDataSchemeUri(uri, width, height); } else if (uri.Scheme == "resource") { //TODO: child = Image.asset(path.Substring(9), null, null, width, height); } else { string filePath = this.imageDirectory == null ? uri.ToString() : Path.Combine(this.imageDirectory, uri.ToString()); child = Image.file(filePath, null, 1, width, height); } if (this._linkHandlers.isNotEmpty()) { TapGestureRecognizer recognizer = this._linkHandlers.last() as TapGestureRecognizer; return(new GestureDetector(null, child, null, null, recognizer.onTap)); } else { return(child); } }
public override Widget build(BuildContext context) { return(new Padding( padding: this.padding, child: new Row( children: new List <Widget> { Image.asset( name: this.imageName, width: 24, height: 24 ), new Padding( padding: EdgeInsets.only(4), child: new Text( data: this.title, style: new TextStyle( fontSize: 16, fontFamily: "Roboto-Medium", color: CColors.TextBody ) ) ), new Flexible(child: new Container()), new GestureDetector( onTap: this.onPress, child: new Container( color: CColors.Transparent, child: new Row( children: new List <Widget> { new Padding( padding: EdgeInsets.only(16), child: new Text( "查看更多", style: new TextStyle( fontSize: 14, fontFamily: "Roboto-Regular", color: CColors.TextBody4 ) ) ), new Padding( padding: EdgeInsets.only(right: 8), child: new Icon( icon: Icons.chevron_right, size: 20, color: Color.fromRGBO(199, 203, 207, 1) ) ) } ) ) ) } ) )); }
public override Widget build(BuildContext context) { List <Color> colors; if (this._selectedIndex == 2) { colors = new List <Color> { new Color(0xFFFFB84F), new Color(0xFFFF8024) }; } else { colors = new List <Color> { new Color(0xFF6EC6FF), CColors.PrimaryBlue, CColors.MessageReactionCount }; } return(new Container( color: CColors.White, child: new CustomSafeArea( top: false, bottom: false, child: new Container( decoration: new BoxDecoration( gradient: new LinearGradient( colors: colors, begin: Alignment.topLeft, end: Alignment.bottomRight ) ), child: new Stack( alignment: Alignment.topLeft, fit: StackFit.expand, children: new List <Widget> { Image.asset("image/leaderboard-pattern-curves", fit: BoxFit.fill), Positioned.fill( new Column( children: new List <Widget> { this._buildNavigationBar(context: context), new Flexible(child: this._buildContent()) } ) ) } ) ) ) )); }
Widget _buildNavigationBar() { return(new Container( color: CColors.White, height: this._navBarHeight, child: new Row( children: new List <Widget> { new SizedBox(width: 16), new Expanded( child: new GestureDetector( onTap: () => this.widget.actionModel.pushToSearch(), child: new Container( height: 32, decoration: new BoxDecoration( color: CColors.EmojiBottomBar, borderRadius: BorderRadius.all(16) ), child: new Row( children: new List <Widget> { new Padding( padding: EdgeInsets.only(16, right: 8), child: new Icon( icon: Icons.outline_search, size: 16, color: CColors.Icon ) ), new Text( this.widget.viewModel.searchSuggest.isNotEmpty() ? this.widget.viewModel.searchSuggest : "搜索", style: new TextStyle( fontSize: 14, fontFamily: "Roboto-Regular", color: CColors.TextBody5 ) ) } ) ) ) ), new CustomButton( padding: EdgeInsets.only(16, 8, 16, 8), onPressed: () => this.widget.actionModel.pushToGame(), child: Image.asset("image/egg-gamepad") ) } ) )); }
public override Widget build(BuildContext context) { return(new Theme( data: new ThemeData( appBarTheme: new AppBarTheme( color: Colors.purple ), bottomAppBarTheme: new BottomAppBarTheme( color: Colors.blue ), cardTheme: new CardTheme( color: Colors.red, elevation: 2.0f ) ), child: new Scaffold( appBar: new AppBar(title: new Text("Test App Bar Theme")), body: new Center( child: new Card( shape: new RoundedRectangleBorder( borderRadius: BorderRadius.all(5.0f) ), child: new Container( height: 250, child: new Column( children: new List <Widget> { Image.asset( "products/backpack", fit: BoxFit.cover, width: 200, height: 200 ), new Text("Card Theme") } ) ) ) ), bottomNavigationBar: new BottomAppBar( child: new Row( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new IconButton(icon: new Icon(Unity.UIWidgets.material.Icons.menu), onPressed: () => { }), new IconButton(icon: new Icon(Unity.UIWidgets.material.Icons.account_balance), onPressed: () => { }) }) ) ) )); }
public override Widget build(BuildContext context) { Size screenSize = MediaQuery.of(context).size; return(new SizedBox( height: (screenSize.height - Constants.kToolbarHeight) * 1.35f, child: new Material( type: MaterialType.card, elevation: 0.0f, child: new Padding( padding: EdgeInsets.only(left: 16.0f, top: 18.0f, right: 16.0f, bottom: 24.0f), child: new CustomMultiChildLayout( layoutDelegate: new _HeadingLayoutShrineOrder(), children: new List <Widget> { new LayoutId( id: _HeadingLayoutShrineOrder.image, child: new Hero( tag: this.product.tag, child: Image.asset(this.product.imageAsset, fit: BoxFit.contain, alignment: Alignment.center ) ) ), new LayoutId( id: _HeadingLayoutShrineOrder.icon, child: new Icon( Icons.info_outline, size: 24.0f, color: new Color(0xFFFFE0E0) ) ), new LayoutId( id: _HeadingLayoutShrineOrder.product, child: new _ProductItemShrineOrder( product: this.product, quantity: this.quantity, onChanged: this.quantityChanged ) ), new LayoutId( id: _HeadingLayoutShrineOrder.vendor, child: new _VendorItemShrineOrder(vendor: this.product.vendor) ) } ) ) ) )); }
Widget _buildLeaderBoardItem(BuildContext context, int index) { var collectionId = this.data[index : index]; var rankData = this.rankDict.ContainsKey(key: collectionId) ? this.rankDict[key : collectionId] : new RankData(); var favoriteTag = this.favoriteTagDict.ContainsKey(key: rankData.itemId) ? this.favoriteTagDict[key : rankData.itemId] : new FavoriteTag(); return(new GestureDetector( onTap: () => this.onPressItem?.Invoke(text: rankData.id), child: new Container( width: 160, height: 80, margin: EdgeInsets.only(index == 0 ? 16 : 0, right: 16), decoration: new BoxDecoration( borderRadius: BorderRadius.all(4) ), child: new ClipRRect( borderRadius: BorderRadius.all(4), child: new Stack( children: new List <Widget> { Positioned.fill( new Container(color: CColorUtils.GetCardColorFromId(id: collectionId)) ), Image.asset( CImageUtils.GetSpecificPatternImageNameFromId(id: collectionId), width: 160, height: 80, fit: BoxFit.fill ), Positioned.fill( new Padding( padding: EdgeInsets.all(16), child: new Text( rankData.resetTitle.isNotEmpty() ? rankData.resetTitle : favoriteTag.name, maxLines: 2, overflow: TextOverflow.ellipsis, style: CTextStyle.PLargeMediumWhite ) ) ) } ) ) ) )); }
Widget _buildTopView(BuildContext context) { return(new Flexible( child: new Stack( children: new List <Widget> { new Positioned( top: CCommonUtils.getSafeAreaTopPadding(context: context), left: 0, child: new CustomButton( padding: EdgeInsets.symmetric(10, 16), onPressed: () => this.widget.actionModel.mainRouterPop(), child: new Icon( icon: Icons.close, size: 24, color: CColors.White ) ) ), new Align( alignment: Alignment.center, child: new Container( height: 78, child: new Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: new List <Widget> { new Container( width: 251, height: 53, child: Image.asset( "image/img-logo-unity-connect-white-with-shadow@4x", fit: BoxFit.cover ) ), new Text( "Unity 问 题 全 搞 定", maxLines: 1, style: CTextStyle.H5.copyWith(color: CColors.White, height: 1) ) } ) ) ) } ) )); }
public override Widget build(BuildContext context) { Size screenSize = MediaQuery.of(context).size; ShrineTheme theme = ShrineTheme.of(context); return(new SizedBox( height: screenSize.width > screenSize.height ? (screenSize.height - Constants.kToolbarHeight) * 0.85f : (screenSize.height - Constants.kToolbarHeight) * 0.70f, child: new Container( decoration: new BoxDecoration( color: theme.cardBackgroundColor, border: new Border(bottom: new BorderSide(color: theme.dividerColor)) ), child: new CustomMultiChildLayout( layoutDelegate: new _HeadingLayout(), children: new List <Widget> { new LayoutId( id: _HeadingLayout.price, child: new _FeaturePriceItem(product: this.product) ), new LayoutId( id: _HeadingLayout.image, child: Image.asset( this.product.imageAsset, fit: BoxFit.cover ) ), new LayoutId( id: _HeadingLayout.title, child: new Text(this.product.featureTitle, style: theme.featureTitleStyle) ), new LayoutId( id: _HeadingLayout.description, child: new Text(this.product.featureDescription, style: theme.featureStyle) ), new LayoutId( id: _HeadingLayout.vendor, child: new _VendorItem(vendor: this.product.vendor) ) } ) ) )); }
public override Widget build(BuildContext context) { return(new ClipRRect( borderRadius: BorderRadius.all(radius: this.borderRadius), child: new Container( width: this.size, height: this.size, margin: this.margin, padding: this.padding, decoration: new BoxDecoration( color: this.coverColor, borderRadius: BorderRadius.all(radius: this.borderRadius) ), child: Image.asset( name: this.coverImage ) ) )); }
public override Widget build(BuildContext context) { return(new DecoratedBox( decoration: new BoxDecoration( gradient: new LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, colors: new List <Color> { this.section.leftColor, this.section.rightColor } ) ), child: Image.asset(this.section.backgroundAsset, color: Color.fromRGBO(255, 255, 255, 0.075f), colorBlendMode: BlendMode.modulate, fit: BoxFit.cover ) )); }
public override Widget build(BuildContext context) { Widget coverImageWidget; Color coverImageColor; var coverImageWidth = MediaQuery.of(context).size.width; if (this.coverImage.isNotEmpty()) { coverImageWidget = new PlaceholderImage( imageUrl: this.coverImage, height: this.height, width: coverImageWidth, fit: BoxFit.cover ); coverImageColor = Color.fromRGBO(0, 0, 0, 0.4f); } else { coverImageWidget = new Container( color: CColors.Black, child: Image.asset( "image/default-background-cover", height: this.height, width: coverImageWidth, fit: BoxFit.cover ) ); coverImageColor = CColors.Transparent; } return(new Stack( children: new List <Widget> { coverImageWidget, Positioned.fill( new Container( color: coverImageColor, child: this.child ) ) } )); }
public override Widget build(BuildContext context) { ThemeData theme = Theme.of(context); return(new ListView( key: new PageStorageKey <Category>(this.category), padding: EdgeInsets.symmetric( vertical: 16.0f, horizontal: 64.0f ), children: this.category.assets.Select <string, Widget>((string asset) => { return new Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: new List <Widget> { new Card( child: new Container( width: 144.0f, alignment: Alignment.center, child: new Column( children: new List <Widget> { Image.asset( asset, fit: BoxFit.contain ), new Container( padding: EdgeInsets.only(bottom: 16.0f), alignment: Alignment.center, child: new Text( asset, style: theme.textTheme.caption ) ), } ) ) ), new SizedBox(height: 24.0f) } ); }).ToList() )); }
Widget _buildOther() { CrossFadeState?crossFadeState = null; string refreshText = ""; if (this.mode == 0 || this.mode == 1) { refreshText = "探索新鲜内容"; crossFadeState = CrossFadeState.showFirst; } if (this.mode == 2) { crossFadeState = CrossFadeState.showSecond; } if (this.mode == 3) { refreshText = "刷新成功"; crossFadeState = CrossFadeState.showFirst; } if (this.mode == 4) { refreshText = "刷新失败"; crossFadeState = CrossFadeState.showFirst; } Widget child = new AnimatedCrossFade( firstChild: _buildText(text: refreshText), secondChild: Image.asset( "image/loading.gif", width: 235, height: 40 ), duration: TimeSpan.FromMilliseconds(500), crossFadeState: crossFadeState, alignment: Alignment.center ); return(new Container( height: 56.0f, alignment: Alignment.center, child: child )); }
private Widget renderNoBuildLogo() { var logo = Image.asset("html5-logo", fit: BoxFit.cover, width: 24, height: 34); var label = new Text(data: "Webgl", style: new TextStyle(fontSize: 15f, color: new Color(0xFF424242), fontWeight: FontWeight.w700)); var text = new Container( child: new Row( children: new List <Widget>() { new Container(padding: EdgeInsets.only(top: 8), child: label) }, mainAxisAlignment: MainAxisAlignment.center ) ); return(new Unity.UIWidgets.material.Material( elevation: 3f, shadowColor: Color.fromRGBO(0, 0, 0, 0.1f), shape: new CircleBorder( side: new BorderSide( width: 2.0f, style: BorderStyle.none ) ), child: new Container( child: new Column( children: new List <Widget>() { logo, text }, mainAxisAlignment: MainAxisAlignment.center ), height: 110, width: 110, decoration: new BoxDecoration(color: new Color(0xFFFFFFFF), shape: BoxShape.circle) ) )); }
public override Widget build(BuildContext context) { return(new Card( child: new Stack( children: new List <Widget> { new Column( children: new List <Widget> { new Align( alignment: Alignment.centerRight, child: new _ProductPriceItem(product: this.product) ), new Container( width: 144.0f, height: 144.0f, padding: EdgeInsets.symmetric(horizontal: 8.0f), child: new Hero( tag: this.product.tag, child: Image.asset(this.product.imageAsset, fit: BoxFit.contain ) ) ), new Padding( padding: EdgeInsets.symmetric(horizontal: 8.0f), child: new _VendorItem(vendor: this.product.vendor) ) } ), new Material( type: MaterialType.transparency, child: new InkWell(onTap: this.onPressed == null ? (GestureTapCallback)null : () => { this.onPressed(); }) ) } ) )); }
public override Widget build(BuildContext context) { var imageName = HttpManager.isNetWorkError() ? "image/default-network" : this.imageName; var message = HttpManager.isNetWorkError() ? "数据不见了,快检查下网络吧" : $"{this.title}"; return(new Container( color: CColors.White, width: MediaQuery.of(context).size.width, child: new Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: new List <Widget> { imageName != null ? new Container( margin: EdgeInsets.only(bottom: 24), child: Image.asset( name: imageName, width: 128, height: 128 ) ) : new Container(), new Container( margin: EdgeInsets.only(bottom: 24), child: new Text( data: message, style: new TextStyle( fontSize: 16, fontFamily: "Roboto-Regular", color: new Color(0xFF959595) ) ) ), this._buildRefreshButton() } ) )); }
public override Widget build(BuildContext context) { return(new SizedBox( height: 24.0f, child: new Row( children: new List <Widget> { new SizedBox( width: 24.0f, child: new ClipRRect( borderRadius: BorderRadius.circular(12.0f), child: Image.asset( this.vendor.avatarAsset, fit: BoxFit.cover ) ) ), new SizedBox(width: 8.0f), new Expanded( child: new Text(this.vendor.name, style: ShrineTheme.of(context).vendorItemStyle) ) } ) )); }
Widget _buildTrailing() { return(new Opacity( (CustomAppBarUtil.appBarHeight - this._navBarHeight) / CustomAppBarUtil.appBarHeight, child: new Row( children: new List <Widget> { new CustomButton( padding: EdgeInsets.only(16, 8, 8, 8), onPressed: () => this.widget.actionModel.pushToSearch(), child: new Icon( icon: Icons.outline_search, size: 28, color: CColors.Icon ) ), new CustomButton( padding: EdgeInsets.only(8, 8, 16, 8), onPressed: () => this.widget.actionModel.pushToGame(), child: Image.asset("image/egg-gamepad") ) } ) )); }
Widget _buildAvatar(User user, string imageName, float avatarSize = 64, bool isFirst = false) { return(new GestureDetector( onTap: () => this.onPress?.Invoke(text: user.id), child: new Container( color: CColors.Transparent, child: new Column( children: new List <Widget> { new Stack( children: new List <Widget> { Avatar.User(user: user, size: avatarSize, true), new Positioned( right: 0, bottom: 0, child: Image.asset( name: imageName, width: isFirst ? 22 : 18, height: isFirst ? 27 : 22 ) ) } ), new Padding( padding: EdgeInsets.only(8, 10, 8), child: new Text( data: user.fullName, maxLines: 1, overflow: TextOverflow.ellipsis, style: CTextStyle.PMediumWhite ) ) } ) ) )); }