LiquidSwipe.builder constructor Null safety
- {Key? key,
- required IndexedWidgetBuilder itemBuilder,
- required int itemCount,
- double fullTransitionValue = FULL_TRANSITION_PX,
- int initialPage = 0,
- Widget? slideIconWidget,
- double positionSlideIcon = 0.8,
- bool enableLoop = true,
- LiquidController? liquidController,
- WaveType waveType = WaveType.liquidReveal,
- OnPageChangeCallback? onPageChangeCallback,
- CurrentUpdateTypeCallback? currentUpdateTypeCallback,
- SlidePercentCallback? slidePercentCallback,
- bool ignoreUserGestureWhileAnimating = false,
- bool disableUserGesture = false,
- bool enableSideReveal = false}
A builder constructor with same fields but with itemBuilder
Sample itembuilder :
itemCount: data.length,
itemBuilder: (context, index){
return Container(
color: data[index].color,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Image.asset(
data[index].image,
fit: BoxFit.cover,
),
Padding(
padding: EdgeInsets.all(20.0),
),
Column(
children: <Widget>[
Text(
data[index].text1,
style: WithPages.style,
),
Text(
data[index].text2,
style: WithPages.style,
),
Text(
data[index].text3,
style: WithPages.style,
),
],
),
],
),
);
},
See Example for complete reference.
Implementation
LiquidSwipe.builder({
Key? key,
required IndexedWidgetBuilder itemBuilder,
required int itemCount,
this.fullTransitionValue = FULL_TRANSITION_PX,
this.initialPage = 0,
this.slideIconWidget,
this.positionSlideIcon = 0.8,
this.enableLoop = true,
this.liquidController,
this.waveType = WaveType.liquidReveal,
this.onPageChangeCallback,
this.currentUpdateTypeCallback,
this.slidePercentCallback,
this.ignoreUserGestureWhileAnimating = false,
this.disableUserGesture = false,
this.enableSideReveal = false,
}) : assert(itemCount > 0),
assert(initialPage >= 0 && initialPage < itemCount),
assert(positionSlideIcon >= 0 && positionSlideIcon <= 1),
liquidSwipeChildDelegate =
LiquidSwipeBuilderChildDelegate(itemBuilder, itemCount),
super(key: key);