This commit is contained in:
Thibault Deckers 2023-02-05 18:07:41 +01:00
parent f07244c144
commit f62c31a46b
4 changed files with 18 additions and 7 deletions

View file

@ -79,7 +79,10 @@ class AnalysisService : Service() {
}
private fun initChannels(context: Context) {
val messenger = flutterEngine!!.dartExecutor
val engine = flutterEngine
engine ?: throw Exception("Flutter engine is not initialized")
val messenger = engine.dartExecutor
// channels for analysis

View file

@ -90,7 +90,7 @@ class HomeWidgetProvider : AppWidgetProvider() {
val messenger = flutterEngine!!.dartExecutor
val channel = MethodChannel(messenger, WIDGET_DRAW_CHANNEL)
try {
val bytes = suspendCoroutine { cont ->
val bytes = suspendCoroutine<Any?> { cont ->
defaultScope.launch {
FlutterUtils.runOnUiThread {
channel.invokeMethod("drawWidget", hashMapOf(
@ -194,7 +194,10 @@ class HomeWidgetProvider : AppWidgetProvider() {
}
private fun initChannels(context: Context) {
val messenger = flutterEngine!!.dartExecutor
val engine = flutterEngine
engine ?: throw Exception("Flutter engine is not initialized")
val messenger = engine.dartExecutor
// dart -> platform -> dart
// - need Context

View file

@ -72,7 +72,10 @@ class SearchSuggestionsProvider : ContentProvider() {
}
}
val messenger = flutterEngine!!.dartExecutor
val engine = flutterEngine
engine ?: throw Exception("Flutter engine is not initialized")
val messenger = engine.dartExecutor
val backgroundChannel = MethodChannel(messenger, BACKGROUND_CHANNEL).apply {
setMethodCallHandler { call, result ->
when (call.method) {

View file

@ -235,9 +235,11 @@ class _BasicSectionState extends State<BasicSection> {
void _onScrollingChanged() {
if (!widget.isScrollingNotifier.value) {
// using `autofocus` while scrolling seems to fail for widget built offscreen
// so we give focus to this page when the screen is no longer scrolling
_chipFocusNode.children.firstOrNull?.requestFocus();
if (settings.useTvLayout) {
// using `autofocus` while scrolling seems to fail for widget built offscreen
// so we give focus to this page when the screen is no longer scrolling
_chipFocusNode.children.firstOrNull?.requestFocus();
}
}
}
}