@@ -233,8 +233,10 @@ class _GFSliderState extends State<GFSlider> with TickerProviderStateMixin {
233233
234234 int _current = 0 ;
235235
236+
236237 @override
237238 Widget build (BuildContext context) {
239+
238240 return Stack (
239241 children: < Widget > [
240242 getPageWrapper (PageView .builder (
@@ -258,7 +260,27 @@ class _GFSliderState extends State<GFSlider> with TickerProviderStateMixin {
258260
259261 return AnimatedBuilder (
260262 animation: widget.pageController,
261- child: widget.items[index],
263+ // child: widget.items[index],
264+ child: Container (
265+ width: double .infinity,
266+ height: this .size,
267+ child: Stack (
268+ children: [
269+ Positioned (
270+ left: 0 ,
271+ child: Row (
272+ children: widget.items.map ((child) {
273+ return Container (
274+ width: this .size,
275+ height: this .size,
276+ child: child,
277+ );
278+ }).toList (),
279+ ),
280+ ),
281+ ]
282+ ),
283+ ),
262284 builder: (BuildContext context, child) {
263285 // on the first render, the pageController.page is null,
264286 // this is a dirty hack
@@ -281,35 +303,17 @@ class _GFSliderState extends State<GFSlider> with TickerProviderStateMixin {
281303
282304 if (widget.scrollDirection == Axis .horizontal) {
283305 return Center (
284- // child: SizedBox(
285- // height: distortionValue * height, child: child),
286- child: Container (
287- width: double .infinity,
288- height: this .size,
289- child: Stack (
290- children: [
291- Positioned (
292- left: 0 ,
293- child: Row (
294- children: widget.items.map ((child) {
295- return Container (
296- width: this .size,
297- height: this .size,
298- child: child,
299- );
300- }).toList (),
301- ),
302- ),
303- ]
304- ),
305- ),
306+ child: SizedBox (
307+ height: distortionValue * height, child: child),
308+
306309 );
307310 } else {
308311 return Center (
309312 child: SizedBox (
310313 width: distortionValue *
311314 MediaQuery .of (context).size.width,
312- child: child));
315+ child: child),
316+ );
313317 }
314318 },
315319 );
0 commit comments