fixes
This commit is contained in:
parent
b9f5f774e2
commit
ece002f25b
@ -4,6 +4,7 @@ import 'package:collection/collection.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:repertory/constants.dart' as constants;
|
||||||
import 'package:repertory/helpers.dart';
|
import 'package:repertory/helpers.dart';
|
||||||
import 'package:repertory/models/mount.dart';
|
import 'package:repertory/models/mount.dart';
|
||||||
|
|
||||||
@ -140,9 +141,15 @@ class _MountWidgetState extends State<MountWidget> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
setState(() {
|
||||||
|
_enabled = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
if (!context.mounted) {
|
if (!context.mounted) {
|
||||||
return;
|
return cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
@ -153,34 +160,37 @@ class _MountWidgetState extends State<MountWidget> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return;
|
|
||||||
|
return cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
mount
|
final success = await mount.mount(
|
||||||
.mount(isActive, location: location)
|
isActive,
|
||||||
.then((success) {
|
location: location,
|
||||||
setState(() {
|
);
|
||||||
_enabled = true;
|
debugPrint(
|
||||||
});
|
'success: $success, active: $isActive, mounted: ${context.mounted}',
|
||||||
|
);
|
||||||
|
|
||||||
if (success || isActive || !context.mounted) {
|
if (success ||
|
||||||
return;
|
isActive ||
|
||||||
}
|
constants.navigatorKey.currentContext == null ||
|
||||||
|
!constants.navigatorKey.currentContext!.mounted) {
|
||||||
|
return cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(
|
||||||
SnackBar(
|
constants.navigatorKey.currentContext!,
|
||||||
content: const Text(
|
).showSnackBar(
|
||||||
"Mount location not found",
|
SnackBar(
|
||||||
textAlign: TextAlign.center,
|
content: const Text(
|
||||||
),
|
"Mount location not found",
|
||||||
),
|
textAlign: TextAlign.center,
|
||||||
);
|
),
|
||||||
})
|
),
|
||||||
.catchError((_) {
|
);
|
||||||
setState(() {
|
|
||||||
_enabled = true;
|
return cleanup();
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user