Quantcast
Channel: Flutter - undefined name of class parameter - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Flutter - undefined name of class parameter

$
0
0

I'm having difficulties in this part of my code. It looks preety simple, however there is one thing I just don't understand.This is my class, it looks rather basic:

class _ChangePageItem extends StatelessWidget {  final String label;  final bool isActive;  final int pageIndex;  final Function handlePagination;  _ChangePageItem(this.label, this.isActive, this.pageIndex, this.handlePagination);  @override  Widget build(BuildContext context) {    return Container(      width: 35.0,      height: 35.0,      margin: EdgeInsets.only(right: 10.0),      decoration: BoxDecoration(        border: Border.all(          width: 1.0,          color: Colors.grey,          style: BorderStyle.solid,        ),      ),      child: RaisedButton(        color: Colors.white,        child: Text('$label'),        onPressed:            isActive ? () => handlePagination(int.parse('${label}')) : null,      ),    );  }}

then I'm using this class in the same file:

return Row(  mainAxisAlignment: MainAxisAlignment.end,  children: [    _ChangePageItem(label, isActive, pageIndex, handlePagination),    paginationsItems(), _PaginationItem(label: '>')],);

This is the error that I'm getting:enter image description here

Adding value doesn't help:enter image description here


Viewing all articles
Browse latest Browse all 2

Trending Articles