for now i`m passing my dummy data to carousel items.
showing two items at the same time in slider is what i aiming for...
but as you know map method traverse one item for the list at a time...
for now i divided carousel item by 2 with Row Widget...
is there any other way to accomplish?
something like increment to be increases 2 at a time for loop...
import 'package:flutter/material.dart';
import 'package:carousel_slider/carousel_slider.dart';
var reports = [
{
'title': '1',
'content': '1'
},
{
'title': '2',
'content': '2'
},
{
'title': '3',
'content': '3'
},
{
'title': '4',
'content': '4'
},
];
Widget buildReport() {
return CarouselSlider(
options: CarouselOptions(
height: 250.0,
),
items: reports
.asMap()
.map(
(i, report) {
return MapEntry(
i,
Builder(
builder: (BuildContext context) {
return Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Card(
child: Container(
child: Column(
children: [
Text(
'${report['title']}',
),
Text(
'${report['content']}',
),
],
),
),
),//i wish these two cards have different data.
Card(
child: Container(
child: Column(
children: [
Text(
'${report['title']}',
),
Text(
'${report['content']}',
),
],
),
),
),
],
),
);
},
),
);
},
)
.values
.toList(),
);
}
and i thought about (for loop) but i don`t know how to do that in this code...