Widget _buildOuterPagination( SwiperPagination pagination, Widget swiper, SwiperPluginConfig config) { List <Widget> list = new List <Widget> { }; if (this.widget.containerHeight != null || this.widget.containerWidth != null) { list.Add(swiper); } else { list.Add(new Expanded(child: swiper)); } list.Add(new Align( alignment: Alignment.center, child: pagination.build(this.context, config) )); return(new Column( children: list, crossAxisAlignment: CrossAxisAlignment.stretch, mainAxisSize: MainAxisSize.min )); }
public SwiperPluginView( SwiperPlugin plugin, SwiperPluginConfig config, Key key = null ) : base(key: key) { this.plugin = plugin; this.config = config; }
public override Widget build(BuildContext context, SwiperPluginConfig config) { Color activeColor = this.activeColor ?? CColors.PrimaryBlue; Color color = this.color ?? CColors.White; List <Widget> list = new List <Widget> (); D.assert(() => { if (config.itemCount > 20) { Debug.LogWarning( "The itemCount is too big, we suggest use FractionPaginationBuilder instead of DotSwiperPaginationBuilder in this sitituation"); } return(true); }); int itemCount = config.itemCount; int activeIndex = config.activeIndex.Value; for (int i = 0; i < itemCount; ++i) { bool active = i == activeIndex; Size size = active ? this.activeSize : this.size; list.Add(new SizedBox( width: size.width, height: size.height, child: new Container( color: active ? activeColor : color, key: Key.key($"pagination_{i}"), margin: EdgeInsets.all(value: this.space) ) )); } if (config.scrollDirection == Axis.vertical) { return(new Column( key: this.key, mainAxisSize: MainAxisSize.min, children: list )); } return(new Row( key: this.key, mainAxisSize: MainAxisSize.min, children: list )); }
public override Widget build(BuildContext context) { Widget swiper = this._buildSwiper(); List <Widget> listForStack = null; SwiperPluginConfig config = null; if (this.widget.control != null) { config = this._ensureConfig(config); listForStack = this._ensureListForStack( swiper, listForStack, this.widget.control.build(context, config)); } // if (this.widget.plugins != null) { // config = this._ensureConfig(config); // foreach (SwiperPlugin plugin in this.widget.plugins) { // listForStack = this._ensureListForStack( // swiper, listForStack, plugin.build(context, config)); // } // } if (this.widget.pagination != null) { config = this._ensureConfig(config); if (this.widget.outer == true) { return(this._buildOuterPagination((SwiperPagination)this.widget.pagination, listForStack == null ? swiper : new Stack(children: listForStack), config)); } else { listForStack = this._ensureListForStack( swiper, listForStack, this.widget.pagination.build(context, config)); } } if (listForStack != null) { return(new Stack( children: listForStack )); } return(swiper); }
SwiperPluginConfig _ensureConfig(SwiperPluginConfig config) { if (config == null) { config = new SwiperPluginConfig( outer: this.widget.outer, itemCount: this.widget.itemCount, layout: this.widget.layout, indicatorLayout: this.widget.indicatorLayout, pageController: this._pageController, activeIndex: this._activeIndex, scrollDirection: this.widget.scrollDirection, controller: this._controller, loop: this.widget.loop); } return(config); }
public override Widget build(BuildContext context, SwiperPluginConfig config) { Color activeColor = this.activeColor ?? CColors.PrimaryBlue; Color color = this.color ?? CColors.White; if (Axis.vertical == config.scrollDirection) { return(new Column( key: this.key, mainAxisSize: MainAxisSize.min, children: new List <Widget> { new Text( $"{config.activeIndex + 1}", style: new TextStyle(color: activeColor, fontSize: this.activeFontSize) ), new Text( "/", style: new TextStyle(color: color, fontSize: this.fontSize) ), new Text( $"{config.itemCount}", style: new TextStyle(color: color, fontSize: this.fontSize) ) } )); } return(new Row( key: this.key, mainAxisSize: MainAxisSize.min, children: new List <Widget> { new Text( $"{config.activeIndex + 1}", style: new TextStyle(color: activeColor, fontSize: this.activeFontSize) ), new Text( $" / {config.itemCount}", style: new TextStyle(color: color, fontSize: this.fontSize) ) } )); }
public override Widget build(BuildContext context, SwiperPluginConfig config) { Alignment alignment = this.alignment ?? (config.scrollDirection == Axis.horizontal ? Alignment.bottomCenter : Alignment.centerRight); Widget child = new Container( margin: this.margin, child: this.builder.build(context: context, config: config) ); if (config.outer != true) { child = new Align( key: this.key, alignment: alignment, child: child ); } return(child); }
public override Widget build(BuildContext context, SwiperPluginConfig config) { return(this.builder(context: context, config: config)); }
public override Widget build(BuildContext context, SwiperPluginConfig config) { D.assert(() => { if (config.itemCount > 20) { Debug.LogWarning( "The itemCount is too big, we suggest use FractionPaginationBuilder instead of DotSwiperPaginationBuilder in this sitituation"); } return(true); }); Color activeColor = this.activeColor ?? CColors.PrimaryBlue; Color color = this.color ?? CColors.White; if (config.indicatorLayout != PageIndicatorLayout.none && config.layout == SwiperLayout.normal) { return(new PageIndicator( count: config.itemCount, controller: config.pageController, layout: config.indicatorLayout ?? PageIndicatorLayout.slide, size: this.size, activeColor: activeColor, color: color, space: this.space )); } List <Widget> list = new List <Widget> (); int itemCount = config.itemCount; int activeIndex = config.activeIndex.Value; for (int i = 0; i < itemCount; ++i) { bool active = i == activeIndex; float size = active ? this.activeSize : this.size; list.Add(new Container( Key.key($"pagination_{i}"), margin: EdgeInsets.all(value: this.space), child: new Container( width: size, height: size, decoration: new BoxDecoration( active ? activeColor : color, borderRadius: BorderRadius.all(size / 2.0f) ) ) )); } if (config.scrollDirection == Axis.vertical) { return(new Column( key: this.key, mainAxisSize: MainAxisSize.min, children: list )); } return(new Row( key: this.key, mainAxisSize: MainAxisSize.min, children: list )); }
public abstract Widget build(BuildContext context, SwiperPluginConfig config);