Comments (3)
i might have a solution for the FlutterOverlayWindow package since im using the same one too
First
add the dependency 'flutter_overlay_window: ^0.4.4' to your pubspec.yaml
Second
import the package 'import 'package:flutter_overlay_window/flutter_overlay_window.dart';'
Third
this is my function of the overlay window
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ home_page.dart
OverlayPosition? storedPosition;
Future _launchOverlayWindow(String? isDarkModeString,
String? selectedAddress, String? selectedFlavors) async {
if (!_permissionGranted!) {
_permissionGranted =
await FlutterOverlayWindow.requestPermission() ?? false;
}
if (_permissionGranted!) {
FlutterOverlayWindow.closeOverlay();
storedPosition = await FlutterOverlayWindow.getOverlayPosition();
sendData(isDarkModeString, selectedAddress, selectedFlavors);
await FlutterOverlayWindow.showOverlay(
visibility: NotificationVisibility.visibilityPublic,
flag: OverlayFlag.defaultFlag,
width: _screenWidthInt!,
height: _screenHeightInt!,
enableDrag: true,
positionGravity: PositionGravity.none,
startPosition: storedPosition ?? OverlayPosition(0, 0),
);
}
}
\\\\\\\\\\\\\\\\\\\\\\\\\\\\true_caller.dart
void sendData(String? isDarkModeString, String? address, String? flavors) {
final data =
'{"isDarkModeString": "$isDarkModeString", "address": "$address", "flavors": "$flavors"}';
FlutterOverlayWindow.shareData(data);
}
@OverRide
void initState() {
super.initState();
FlutterOverlayWindow.overlayListener.listen((event) {
final parsedData = parseEvent(event);
setState(() {
isDarkModeString = parsedData['isDarkModeString'] ?? '';
address = parsedData['address'] ?? '';
flavors = parsedData['flavors'] ?? '';
isDarkModeBool = isDarkModeString.toLowerCase() == 'true';
});
});
}
Map<String, dynamic> parseEvent(String event) {
try {
final Map<String, dynamic> data = jsonDecode(event);
return {
'isDarkModeString': data['isDarkModeString'] as String,
'address': data['address'] as String,
'flavors': data['flavors'] as String,
};
} catch (e) {
log("Error parsing event data: $e");
return {};
}
}
hope you might find this helpful
from flutter_overlay_window.
Same here not able to send the data to the overlay window
from flutter_overlay_window.
same issue :( Have you found the solution yet?
from flutter_overlay_window.
Related Issues (20)
- Does it use Google Play services? HOT 1
- You can use the resize overlay and pass the enableDrag params HOT 2
- Could not run the example
- FlutterOverlayWindow.showOverlay(height: WindowSize.fullcover) wont work
- Listview scroll event conflicts with FlutterOverlayWindow drag, HOT 1
- Save overlay position
- Open the main app from floating window? HOT 5
- MissingPluginException HOT 1
- Open Overlay from background when app is kill state HOT 3
- Android 14 requirese foregroundServiceType HOT 1
- Crash in production HOT 4
- Does not display all objects
- warning red
- Back button not working! HOT 1
- Height doesn't account for status bar
- Use of `FlutterEngineGroup` instead of simply using `FlutterEngine` HOT 1
- Overlay stops sending messages to UI when it's turned on after previously being closed after app termination
- Unable to create multiple overlay window. HOT 4
- Please add more flags to show when phone is looked HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_overlay_window.