Skip to content

Commit

Permalink
use singlechildscrollview instead of listview
Browse files Browse the repository at this point in the history
  • Loading branch information
esskar committed Sep 12, 2020
1 parent 8f016ea commit 2f6e569
Showing 1 changed file with 54 additions and 51 deletions.
105 changes: 54 additions & 51 deletions lib/intro_slider.dart
Expand Up @@ -984,58 +984,61 @@ class IntroSliderState extends State<IntroSlider>
this.verticalScrollbarBehavior == scrollbarBehavior.SHOW_ALWAYS
? ScrollController(initialScrollOffset: 0.01)
: null;
final listView = ListView(
final scrollableChild = SingleChildScrollView(
controller: scrollController,
children: <Widget>[
Container(
// Title
child: widgetTitle ??
Text(
title ?? "",
style: styleTitle ??
TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 30.0,
),
maxLines: maxLineTitle != null ? maxLineTitle : 1,
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
),
margin: marginTitle ??
EdgeInsets.only(top: 70.0, bottom: 50.0, left: 20.0, right: 20.0),
),
child: Column(
children: <Widget>[
Container(
// Title
child: widgetTitle ??
Text(
title ?? "",
style: styleTitle ??
TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 30.0,
),
maxLines: maxLineTitle != null ? maxLineTitle : 1,
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
),
margin: marginTitle ??
EdgeInsets.only(
top: 70.0, bottom: 50.0, left: 20.0, right: 20.0),
),

// Image or Center widget
GestureDetector(
child: pathImage != null
? Image.asset(
pathImage,
width: widthImage ?? 200.0,
height: heightImage ?? 200.0,
fit: foregroundImageFit ?? BoxFit.contain,
)
: Center(child: centerWidget ?? Container()),
onTap: onCenterItemPress,
),
// Image or Center widget
GestureDetector(
child: pathImage != null
? Image.asset(
pathImage,
width: widthImage ?? 200.0,
height: heightImage ?? 200.0,
fit: foregroundImageFit ?? BoxFit.contain,
)
: Center(child: centerWidget ?? Container()),
onTap: onCenterItemPress,
),

// Description
Container(
child: widgetDescription ??
Text(
description ?? "",
style: styleDescription ??
TextStyle(color: Colors.white, fontSize: 18.0),
textAlign: TextAlign.center,
maxLines: maxLineTextDescription != null
? maxLineTextDescription
: 100,
overflow: TextOverflow.ellipsis,
),
margin:
marginDescription ?? EdgeInsets.fromLTRB(20.0, 50.0, 20.0, 50.0),
),
],
// Description
Container(
child: widgetDescription ??
Text(
description ?? "",
style: styleDescription ??
TextStyle(color: Colors.white, fontSize: 18.0),
textAlign: TextAlign.center,
maxLines: maxLineTextDescription != null
? maxLineTextDescription
: 100,
overflow: TextOverflow.ellipsis,
),
margin: marginDescription ??
EdgeInsets.fromLTRB(20.0, 50.0, 20.0, 50.0),
),
],
),
);
return Container(
width: double.infinity,
Expand Down Expand Up @@ -1070,11 +1073,11 @@ class IntroSliderState extends State<IntroSlider>
margin: EdgeInsets.only(bottom: 60.0),
child: this.verticalScrollbarBehavior != scrollbarBehavior.HIDE
? Scrollbar(
child: listView,
child: scrollableChild,
controller: scrollController,
isAlwaysShown: scrollController != null,
)
: listView,
: scrollableChild,
),
);
}
Expand Down

0 comments on commit 2f6e569

Please sign in to comment.