zenled / calendar_views

Collection of customisable calendar related widgets for Flutter.
https://pub.dartlang.org/packages/calendar_views
MIT License
102 stars 49 forks source link

How to get index of list in days_page_view. #12

Closed AnuragVadd closed 4 years ago

AnuragVadd commented 5 years ago

I want to customize and display specific widgets in certain pages. I want to use the index of the list final List<DateTime> days;. I tried to convert it to a Map in the following code :

`
@override Widget build(BuildContext context) { SystemChrome.setEnabledSystemUIOverlays([]);

super.build(context);
return new Row(
  children: widget.days.asMap().map((index, day) => MapEntry(index, Container(
      constraints: new BoxConstraints(
        maxHeight: MediaQuery.of(context).size.height * 1.00,
        maxWidth: MediaQuery.of(context).size.width * 1.00

      ),
          child:  ListTile(subtitle: Starting_screen(_makeTextString(day)),  //this screen just displays different widgets
            title:Text((index.toString())),)
        ),
  )
  ).values.toList()
);

}`

When i tried this method, the index of the map seems to be mapping to all the pages and hence stays the same. Could i get some suggestion on how to properly access the index of this list? also a side question: in the below code, is day the index of the list days? (this is the original code which i modified to display a different screen)

` @override Widget build(BuildContext context) { SystemChrome.setEnabledSystemUIOverlays([]);

super.build(context);
return new Row(
  children: widget.days.map((day) => Container(
      constraints: new BoxConstraints(
        maxHeight: MediaQuery.of(context).size.height * 1.00,
        maxWidth: MediaQuery.of(context).size.width * 1.00

      ),
          child: Starting_screen(_makeTextString(day)),  //this screen just displays different widgets
        ),
  ).toList()
);

}