-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Description
Hello, I might have found a bug/error in the framework. I describe how the actual results differ from the ones I expected.
(copied from where I posted this first https://stackoverflow.com/questions/65743515/flutter-expansionpanellist-radio-callback-returns-wrong-value)
The line I marked with the comment (in CAPS) doesn't do what it's expected to do.
console output when I toggle a certain ExpansionPanelRadio()
(of language english
for example):
- I open the
ExpansionPanelRadio()
: flutter: english false (<-- should be true, right?) - I close the
ExpansionPanelRadio()
: flutter: english true (<-- should be false, right?)
console output when language english
is selected, and I click another one (for example mandarin
):
- flutter: mandarin false (<--this one went from close to open, shouldn't it return
true
??) - flutter: english false (<--this one went from open to close)
Why do they both say false
, when obviously one opened and the other one closed? Both panels were in different states before, and also after the change.
With this information^^, HOW am I supposed to know WHICH ExpansionPanelRadio()
just got tapped?
List<String> languages = Languages.languageToImagePath.keys.toList();
return SingleChildScrollView(
child: ExpansionPanelList.radio(
initialOpenPanelValue: targetLanguage, //see value in ExpansionPanelRadio
expansionCallback: (int panelIndex, bool isExpanded) {
print('${languages[panelIndex]} $isExpanded'); //<-- HEEEEEEERRREEEEE
},
children: languages.map<ExpansionPanel>((language) {
return ExpansionPanelRadio(
value: language,
headerBuilder: (context, bool isExpanded) { //and what's this bool for?
return Text(language);
},
body: Text('Choose writing system(s) todo...'),
);
}).toList(),
),
);
I think these might be errors/bugs in the framework, but I wanted to ask here on stackoverflow before reporting it.
Maybe I just don't understand how these Widgets are supposed to be used.
Any help is appreciated.
I first thought ExpansionPanelList.radio might be the perfect Widget for what I intend to do, but it looks like I just have to make my own custom Widget