I'm trying to run a simple test, where I show an overlay with the entry-point. But the window doesn't start/create, instead null is returned. The followings are the logs -
Logs
```
Launching lib\main.dart on Android SDK built for x86 in debug mode...
lib\main.dart:1
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:61440/5XyFBiJrhLk=/ws
D/FloatwingPlugin( 9392): [plugin] pixel radio already exits
D/FloatwingPlugin( 9392): [plugin] system config already exits: {"pixelRadio":2,"screen":{"width":1080,"height":2208}}
[log] [plugin] initialize result: {permission_grated: true, pixel_radio_updated: false, system_config_updated: false, service_running: false, windows: null}
[log] [plugin] there are 0 windows already started
D/FloatwingService( 9392): [service] wait for service created
I/FloatwingService( 9392): [service] create a window: default {entry=myOverlayMain}
D/FloatwingService( 9392): [service] wait for service created
I/flutter ( 9392): [ DEBUG ]: window null
```
I also noticed that awaiting the openPermissionSetting() doesn't actually wait for permission from the user/settings.
await FloatwingPlugin().openPermissionSetting();
Steps to reproduce:
Run the following code -
main.dart
```dart
import 'package:flutter/material.dart';
import 'package:flutter_floatwing/flutter_floatwing.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
FloatwingPlugin().initialize();
runApp(const RootApp());
}
@pragma("vm:entry-point")
void myOverlayMain() {
WidgetsFlutterBinding.ensureInitialized();
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home: Material(
color: Colors.transparent,
elevation: 0.0,
child: Container(
width: 100,
height: 100,
color: Colors.black,
),
),
),
);
}
class RootApp extends StatelessWidget {
const RootApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: const Text("Floatwing Test"),
),
body: Center(
child: TextButton(
onPressed: _startWindow,
child: const Text("Start"),
),
),
),
);
}
void _startWindow() async {
// check permission and service status
final bool hasPermission = await FloatwingPlugin().checkPermission();
final bool serviceStarted = await FloatwingPlugin().isServiceRunning();
if (!hasPermission) {
await FloatwingPlugin().openPermissionSetting();
// ☝️ it doesn't wait for the value returned by permissions
}
if (!serviceStarted) {
await FloatwingPlugin().startService();
}
// start overlay window
final Window? window = await WindowConfig(
entry: "myOverlayMain",
).to().create(start: true);
debugPrint("[ DEBUG ]: window $window");
}
}
```
Thanks for the great package!
Specs:
Flutter: 3.3.10 (stable) Android SDK: 31.0.0-rc4 flutter_floatwing: ^0.2.1
Issue:
I'm trying to run a simple test, where I show an overlay with the
entry-point
. But the window doesn't start/create, insteadnull
is returned. The followings are the logs -Logs
``` Launching lib\main.dart on Android SDK built for x86 in debug mode... lib\main.dart:1 √ Built build\app\outputs\flutter-apk\app-debug.apk. Connecting to VM Service at ws://127.0.0.1:61440/5XyFBiJrhLk=/ws D/FloatwingPlugin( 9392): [plugin] pixel radio already exits D/FloatwingPlugin( 9392): [plugin] system config already exits: {"pixelRadio":2,"screen":{"width":1080,"height":2208}} [log] [plugin] initialize result: {permission_grated: true, pixel_radio_updated: false, system_config_updated: false, service_running: false, windows: null} [log] [plugin] there are 0 windows already started D/FloatwingService( 9392): [service] wait for service created I/FloatwingService( 9392): [service] create a window: default {entry=myOverlayMain} D/FloatwingService( 9392): [service] wait for service created I/flutter ( 9392): [ DEBUG ]: window null ```I also noticed that awaiting the
openPermissionSetting()
doesn't actually wait for permission from the user/settings.Steps to reproduce:
Run the following code -
main.dart
```dart import 'package:flutter/material.dart'; import 'package:flutter_floatwing/flutter_floatwing.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); FloatwingPlugin().initialize(); runApp(const RootApp()); } @pragma("vm:entry-point") void myOverlayMain() { WidgetsFlutterBinding.ensureInitialized(); runApp( MaterialApp( debugShowCheckedModeBanner: false, home: Material( color: Colors.transparent, elevation: 0.0, child: Container( width: 100, height: 100, color: Colors.black, ), ), ), ); } class RootApp extends StatelessWidget { const RootApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: Scaffold( appBar: AppBar( title: const Text("Floatwing Test"), ), body: Center( child: TextButton( onPressed: _startWindow, child: const Text("Start"), ), ), ), ); } void _startWindow() async { // check permission and service status final bool hasPermission = await FloatwingPlugin().checkPermission(); final bool serviceStarted = await FloatwingPlugin().isServiceRunning(); if (!hasPermission) { await FloatwingPlugin().openPermissionSetting(); // ☝️ it doesn't wait for the value returned by permissions } if (!serviceStarted) { await FloatwingPlugin().startService(); } // start overlay window final Window? window = await WindowConfig( entry: "myOverlayMain", ).to().create(start: true); debugPrint("[ DEBUG ]: window $window"); } } ```