Files
lunasea/lib/core/ui/controllers/page_controller.dart
Jagandeep Brar a1d68cd234 [share_plus] iOS 12 and lower crashes at launch due to missing LinkPresentation.framework (#442)
* chore(packages): Added pedantic package to enforce linting and styling
* feat(lunasea): Enforce effective dart styling
* Comment and format colours class
* Localize additional classes in Dashboard, cleanup additional code
* chore(lunasea): Major refactor by running dartfmt on the entire codebase, added widget return for page routers
* Additional work on conforming to effective dart style
* fix(share_plus): Roll back share_plus package to 2.0.0 to support iOS 12 or lower
* chore(lunasea): Fix remaining enabled analysis warnings
2021-04-24 04:26:39 -05:00

25 lines
626 B
Dart

import 'package:flutter/material.dart';
/// Re-definition of [PageController] that adds a listener that will unfocus primary focus on a page change.
///
/// Needed for situations that a page has a keyboard prompt to unfocus the keyboard.
class LunaPageController extends PageController {
LunaPageController({
int initialPage,
}) : super(
initialPage: initialPage ?? 0,
) {
this?.addListener(_focusListener);
}
void _focusListener() {
FocusManager.instance.primaryFocus?.unfocus();
}
@override
void dispose() {
this?.removeListener(_focusListener);
super.dispose();
}
}