Merge pull request #5236 from pangeachat/5232-download-button-not-change-when-switch-between-csv-and-excel

chore: reset download state on switch download type
This commit is contained in:
ggurdin 2026-01-16 12:41:33 -05:00 committed by GitHub
commit da8685635a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -50,7 +50,13 @@ class AnalyticsDownloadDialogState extends State<AnalyticsDownloadDialog> {
}
void _setDownloadType(DownloadType type) {
if (mounted) setState(() => _downloadType = type);
if (mounted) {
setState(() {
_downloadType = type;
_downloaded = false;
_error = null;
});
}
}
Future<void> _downloadAnalytics() async {
@ -427,7 +433,8 @@ class AnalyticsDownloadDialogState extends State<AnalyticsDownloadDialog> {
padding: const EdgeInsets.all(8.0),
child: SegmentedButton<DownloadType>(
selected: {_downloadType},
onSelectionChanged: (c) => _setDownloadType(c.first),
onSelectionChanged:
_downloading ? null : (c) => _setDownloadType(c.first),
segments: [
ButtonSegment(
value: DownloadType.csv,