Add font: own web file chooser, so a picked font is never dropped silently
file_picker's web picker treated the window regaining focus as a cancel when the files arrived more than 500 ms later, so a real dialog could return an empty pick and Add font did nothing. The web now uses its own file input that completes only on change or cancel; mobile browsers get no accept filter. Picker, check and save failures are shown in a dialog, and the row is busy only after files were chosen.
This commit is contained in:
@@ -76,9 +76,15 @@ class _SettingsFontSectionState extends State<SettingsFontSection> {
|
||||
}
|
||||
|
||||
Future<void> _add() async {
|
||||
setState(() => _adding = true);
|
||||
try {
|
||||
await addCustomFont(context, widget.controller, widget.pickFiles);
|
||||
await addCustomFont(
|
||||
context,
|
||||
widget.controller,
|
||||
widget.pickFiles,
|
||||
onPicked: () {
|
||||
if (mounted) setState(() => _adding = true);
|
||||
},
|
||||
);
|
||||
} finally {
|
||||
if (mounted) setState(() => _adding = false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user