chore: reset download state on switch download type

This commit is contained in:
ggurdin 2026-01-16 12:41:06 -05:00
parent 4c74f45346
commit bc66198bf4
No known key found for this signature in database
GPG key ID: A01CB41737CBB478

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,