Hello I need to call the index to recuperate user information into an AlertDialog The build Method should have index but I dont know how to add. this is the variable need to call:
final Message chat = chats[index];
and I need index into build method:
class InfluencerDescription extends StatefulWidget {
final User user;
InfluencerDescription({this.user});
@override
_InfluencerDescriptionState createState() => _InfluencerDescriptionState();
}
class _InfluencerDescriptionState extends State<InfluencerDescription> {
@override
Widget build(BuildContext context ) {
return AlertDialog(
elevation: 20,
content: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(
child: SizedBox(
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
RaisedButton(
elevation: 10,
color: Colors.green,
child: Container(
width: 100,
height: 60,
child: Center(
child: Text(
'AVVIA UNA \n CHAT CON ME',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white,fontSize: 13),
),
),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => ChatScreen(user: HERE NEED TO CALL CHAT.SENDER VAR,),),);
}
),