Here is my code.
@override
Widget build(BuildContext context) {
return Container(
color: Colors.red,
padding: EdgeInsets.all(7),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('지금 뜨는 콘서트'),
Material(
color: Colors.lightGreen,
child: CarouselSlider(
items: makeBoxImages(context, concerts),
options: CarouselOptions(
viewportFraction: 0.3,
enableInfiniteScroll: false,
initialPage: 1,
),
),
),
],
),
);
}
List<Widget> makeBoxImages(BuildContext context, List<Concert> concerts) {
List<Widget> results = [];
for (var i = 0; i < concerts.length; i++) {
results.add(
Material(
color: Colors.yellow,
child: Column(
children: [
Container(
color: Colors.blue,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
'assets/images/' + concerts[i].poster,
width: MediaQuery.of(context).size.width * 0.25,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(
kIconMap[concerts[i].kinds],
size: 15,
),
Text(concerts[i].kinds),
],
),
],
),
),
],
),
),
);
}
return results;
}
and then, screen showed like this.
when i scroll left to right screen showed like this.
After that the screen fixed.
At this point, I have a two question.
When slider's first element in a screen is leftmost, I want to fix it (when user scroll left to right)
like the 1st image not 2nd image.
Thank you for reading my question.