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) { 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 // channels for analysis

View file

@ -90,7 +90,7 @@ class HomeWidgetProvider : AppWidgetProvider() {
val messenger = flutterEngine!!.dartExecutor val messenger = flutterEngine!!.dartExecutor
val channel = MethodChannel(messenger, WIDGET_DRAW_CHANNEL) val channel = MethodChannel(messenger, WIDGET_DRAW_CHANNEL)
try { try {
val bytes = suspendCoroutine { cont -> val bytes = suspendCoroutine<Any?> { cont ->
defaultScope.launch { defaultScope.launch {
FlutterUtils.runOnUiThread { FlutterUtils.runOnUiThread {
channel.invokeMethod("drawWidget", hashMapOf( channel.invokeMethod("drawWidget", hashMapOf(
@ -194,7 +194,10 @@ class HomeWidgetProvider : AppWidgetProvider() {
} }
private fun initChannels(context: Context) { 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 // dart -> platform -> dart
// - need Context // - 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 { val backgroundChannel = MethodChannel(messenger, BACKGROUND_CHANNEL).apply {
setMethodCallHandler { call, result -> setMethodCallHandler { call, result ->
when (call.method) { when (call.method) {

View file

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