a beginner in a field, I have this code that works, but there is an error in the case of clicking When I click on any card, all cards also open. I want to open a card that I just click on
import 'dart:io';
import 'package:english_club/data/im.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
class Novals extends StatefulWidget {
@override
_NovalsState createState()
{
return _NovalsState();
}
}
class _NovalsState extends State<Novals> {
bool _expanded = false;
var _test = "Full Screen";
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
body: ListView.builder(
itemCount: storys.length,
itemBuilder: (context, index){
return SingleChildScrollView(
child: Column(
children: [
Center(
child: Container(
margin: EdgeInsets.all(10),
color: Colors.green,
child: ExpansionPanelList(
animationDuration: Duration(milliseconds: 2000),
children: [
ExpansionPanel(
headerBuilder: (context, isExpanded) {
return ListTile(
title: Text(storys[index]["name"], style: TextStyle(color: Colors.black),),
);
},
body:ListTile(
title: Text(storys[index]["lines"],style: TextStyle(color: Colors.black)),
),
isExpanded: _expanded,
canTapOnHeader: true,
),
],
dividerColor: Colors.grey,
expansionCallback: (panelIndex, isExpanded) {
_expanded = !_expanded;
setState(() {
});
},
),
),
),
]
),
);
}
),
);
}
}
I tried to solve it, but I could not aim for the code to display the name of the story, and when the user clicks on it, the whole story appears