title: How to use PageView builder to view items based on my List?
body: <p>I am using PageView builder in my flutter app to display scrollable cards. For that I have first created a widget <code>_buildCarousel</code> and widget <code>_buildCarouselItem</code> to display it using my defined by defined widget for card. I have also defined a List of Maps (<strong>eventsData</strong>) for the events' data.</p>
  <pre><code>  Widget _buildCarousel(BuildContext context) {
      List&lt;Map&gt; EventsData = [
        {
          &quot;title&quot;: &quot;Event ABC&quot;,
          &quot;subTitle&quot;: &quot;Organised by XYZ&quot;,
          &quot;desc&quot;: &quot;Event description.&quot;,
          &quot;date&quot;: &quot;13th Jan, 2022&quot;,
          &quot;time&quot;: &quot;4:00 pm&quot;,
          &quot;lastDate&quot;: &quot;11th Jan, 2022&quot;
        },
        {
          &quot;title&quot;: &quot;Event MNT&quot;,
          &quot;subTitle&quot;: &quot;Organised by XYZ&quot;,
          &quot;desc&quot;: &quot;Event description.&quot;,
          &quot;date&quot;: &quot;13th Jan, 2022&quot;,
          &quot;time&quot;: &quot;4:00 pm&quot;,
          &quot;lastDate&quot;: &quot;11th Jan, 2022&quot;
        },
        {
          &quot;title&quot;: &quot;Event WOQ&quot;,
          &quot;subTitle&quot;: &quot;Organised by STU&quot;,
          &quot;desc&quot;: &quot;Event description.&quot; ,
          &quot;date&quot;: &quot;13th Jan, 2022&quot;,
          &quot;time&quot;: &quot;4:00 pm&quot;,
          &quot;lastDate&quot;: &quot;11th Jan, 2022&quot;
        }
      ];
      return SizedBox(
        height: 500.0,
        child: PageView.builder(
          itemCount: EventsData.length,
          controller: PageController(viewportFraction: 1),
          itemBuilder: (BuildContext context, int itemIndex) {
            return _buildCarouselItem(context);
          },
        ),
      );
    }
  
    Widget _buildCarouselItem(BuildContext context) {
      return Padding(
          padding: EdgeInsets.symmetric(horizontal: 4.0), child: EventCard());
    }
  </code></pre>
  <p>Here EventCard is my defined widget for a Card. Code for EventCard widget is:</p>
  <pre><code>class EventCard extends StatelessWidget {
    EventCard({Key? key}) : super(key: key);
  
    @override
    Widget build(BuildContext context) {
  
      return Card(
        elevation: 10,
        shadowColor: Colors.black,
        margin: EdgeInsets.all(25.0),
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(16.0),
        ),
        color: const Color(0xffB7AC44),
        child: SizedBox(
          width: MediaQuery.of(context).size.width,
          height: MediaQuery.of(context).size.height,
          child: Padding(
            padding: const EdgeInsets.all(16.0),
            child: Column(
              children: [
                SizedBox(
                  height: 10,
                ),
                Text(
                  'Title',
                  style: TextStyle(
                      fontSize: 22,
                      color: Colors.white,
                      fontWeight: FontWeight.w900,
                      fontFamily: 'Montserrat'),
                ),
                SizedBox(
                  height: 10,
                ),
                Text(
                  'Sub Title',
                  style: TextStyle(
                      fontSize: 16,
                      color: Colors.black,
                      fontWeight: FontWeight.w700,
                      fontFamily: 'Montserrat'),
                ),
                SizedBox(
                  height: 10,
                ),
                SizedBox(
                  height: 100,
                  child: Text(
                    'Description',
                    maxLines: 6,
                    overflow: TextOverflow.ellipsis,
                    style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400),
                  ),
                ),
                SizedBox(
                  height: 20,
                ),
                Spacer(),
                Column(
                  children: [
                    Align(
                      alignment: Alignment.bottomLeft,
                      child: Text(
                        'Date: 12 May, 2022',
                        style: TextStyle(
                            fontSize: 14,
                            color: Colors.black,
                            fontWeight: FontWeight.w700,
                            fontFamily: 'Montserrat'),
                      ),
                    ),
                    Align(
                      alignment: Alignment.bottomLeft,
                      child: Text(
                        'Time: 5:00 pm',
                        style: TextStyle(
                            fontSize: 14,
                            color: Colors.black,
                            fontWeight: FontWeight.w700,
                            fontFamily: 'Montserrat'),
                      ),
                    ),
                    Align(
                      alignment: Alignment.bottomLeft,
                      child: Text(
                        'Last date to register: 31 May, 2022',
                        style: TextStyle(
                            fontSize: 14,
                            color: Colors.black,
                            fontWeight: FontWeight.w700,
                            fontFamily: 'Montserrat'),
                      ),
                    ),
                  ],
                ),
                SizedBox(
                  height: 20,
                ),
              ],
            ),
          ),
        ),
      );
    }
  }
  </code></pre>
  <p>Here's the output:</p>
  <p><a href="https://i.stack.imgur.com/ISXZk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ISXZk.png" alt="enter image description here" /></a></p>
  <p>As you can see, here the values for the different text widgets in Card are static. But I want these values to be based on the items of the List <strong>EventsData</strong> that I have defined earlier in <code>_buidCarousel</code>. I am unable to figure out how should I do that. Where should exactly I define this <code>eventsData</code> list and how can I take these values for my card widget.</p>