Skip to content

Commit

Permalink
fix: fix reported crash from percent indicator dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Moseco committed Nov 23, 2024
1 parent c43e891 commit 6bb3cbe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/ui/dialogs/percent_indicator_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class _PercentIndicatorDialogState extends State<PercentIndicatorDialog> {
initState() {
super.initState();

widget.request.data.listen((event) {
widget.request.data.listen((double event) {
double newStatus = (event * 100).floorToDouble() / 100;
if (newStatus != _downloadStatus) {
setState(() {
Expand Down
20 changes: 14 additions & 6 deletions lib/ui/views/settings/settings_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,20 @@ class SettingsViewModel extends BaseViewModel {
final downloadResult = downloadService.downloadProperNounDictionary();

// Show percent indicator dialog
_dialogService.showCustomDialog(
variant: DialogType.percentIndicator,
title: 'Downloading proper noun dictionary',
data: downloadService.progressStream,
barrierDismissible: false,
);
if (downloadService.progressStream != null) {
_dialogService.showCustomDialog(
variant: DialogType.percentIndicator,
title: 'Downloading proper noun dictionary',
data: downloadService.progressStream,
barrierDismissible: false,
);
} else {
_dialogService.showCustomDialog(
variant: DialogType.progressIndicator,
title: 'Downloading proper noun dictionary',
barrierDismissible: false,
);
}

if (!await downloadResult) {
_dialogService.completeDialog(DialogResponse());
Expand Down

0 comments on commit 6bb3cbe

Please sign in to comment.