Browse Source

neon_news,neon_notes: Do not await wakelock operations

pull/475/head
jld3103 1 year ago
parent
commit
7ca345de69
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 6
      packages/neon/neon_news/lib/pages/article.dart
  2. 6
      packages/neon/neon_notes/lib/pages/note.dart

6
packages/neon/neon_news/lib/pages/article.dart

@ -33,9 +33,9 @@ class _NewsArticlePageState extends State<NewsArticlePage> {
NeonException.showSnackbar(context, error);
});
WidgetsBinding.instance.addPostFrameCallback((final _) async {
WidgetsBinding.instance.addPostFrameCallback((final _) {
if (Provider.of<NeonPlatform>(context, listen: false).canUseWakelock) {
await WakelockPlus.enable();
unawaited(WakelockPlus.enable());
}
});
@ -103,7 +103,7 @@ class _NewsArticlePageState extends State<NewsArticlePage> {
}
if (mounted && Provider.of<NeonPlatform>(context, listen: false).canUseWakelock) {
await WakelockPlus.disable();
unawaited(WakelockPlus.disable());
}
return false;
},

6
packages/neon/neon_notes/lib/pages/note.dart

@ -41,9 +41,9 @@ class _NotesNotePageState extends State<NotesNotePage> {
_contentController.addListener(() => _contentStreamController.add(_contentController.text));
_titleController.addListener(() => _titleStreamController.add(_titleController.text));
WidgetsBinding.instance.addPostFrameCallback((final _) async {
WidgetsBinding.instance.addPostFrameCallback((final _) {
if (Provider.of<NeonPlatform>(context, listen: false).canUseWakelock) {
await WakelockPlus.enable();
unawaited(WakelockPlus.enable());
}
if (widget.bloc.options.defaultNoteViewTypeOption.value == DefaultNoteViewType.edit ||
widget.bloc.initialContent.isEmpty) {
@ -66,7 +66,7 @@ class _NotesNotePageState extends State<NotesNotePage> {
Widget build(final BuildContext context) => BackButtonListener(
onBackButtonPressed: () async {
if (Provider.of<NeonPlatform>(context, listen: false).canUseWakelock) {
await WakelockPlus.disable();
unawaited(WakelockPlus.disable());
}
return false;
},

Loading…
Cancel
Save