-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I can't display my data on the overlay window. #115
Comments
Same here not able to send the data to the overlay window |
same issue :( Have you found the solution yet? |
i might have a solution for the FlutterOverlayWindow package since im using the same one too First Second Third Future _launchOverlayWindow(String? isDarkModeString,
} @OverRide Map<String, dynamic> parseEvent(String event) { |
I have wrote homepage.dart,there's a button,I add a function in onPress event.
trailing: IconButton(
icon: const Icon(Icons.map),
onPressed: () async {
_launchMapsLauncher(
_selectedNavOp, address, latitude, longitude);
_openFloatingWindow(context);
///////////////////////////////////////////////////////////////////////////////////
void _openFloatingWindow (BuildContext context) async{
if (await FlutterOverlayWindow.isActive()) return;
await FlutterOverlayWindow.showOverlay(
enableDrag: true,
overlayTitle: _selectedAddress!,
overlayContent: 'Overlay Enabled',
flag: OverlayFlag.defaultFlag,
visibility: NotificationVisibility.visibilityPublic,
positionGravity: PositionGravity.auto,
height: (MediaQuery.of(context).size.height * 0.6).toInt(),
width: WindowSize.matchParent,
startPosition: const OverlayPosition(0, -259),
);
}
the Overlaywindow shows context of true_caller_overlay not the context i except to
true_caller_overlay.dart
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter_overlay_window/flutter_overlay_window.dart';
import '../home_page.dart';
class TrueCallerOverlay extends StatefulWidget {
final String title;
const TrueCallerOverlay({Key? key, required this.title}) : super(key: key);
@OverRide
State createState() => _TrueCallerOverlayState();
}
class _TrueCallerOverlayState extends State {
@OverRide
void initState() {
super.initState();
}
@OverRide
Widget build(BuildContext context) {
return Material(
color: Colors.transparent,
child: Center(
child: Container(
padding: const EdgeInsets.symmetric(vertical: 5.0),
width: double.infinity,
decoration: BoxDecoration(
color: Colors.black, // 將背景顏色設置為黑色
borderRadius: BorderRadius.circular(12.0),
),
child: GestureDetector(
onTap: () {
FlutterOverlayWindow.getOverlayPosition().then((value) {
log("Overlay Position: $value");
});
},
child: Stack(
children: [
Column(
children: [
ListTile(
leading: Container(
height: 80.0,
width: 80.0,
),
title: const Text(
"aaaaaa",
style: TextStyle(
fontSize: 20.0, fontWeight: FontWeight.bold , color: Colors.white),
),
),
],
),
Positioned(
top: 0,
right: 0,
child: IconButton(
onPressed: () async {
await FlutterOverlayWindow.closeOverlay();
},
icon: const Icon(
Icons.close,
color: Colors.white,
),
),
),
],
),
),
),
),
);
}
}
and my main.dart
import 'dart:async';
import 'package:v2_0/auth/login_screen.dart';
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
import '../overlays/true_caller_overlay.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(const MyApp());
}
@pragma("vm:entry-point")
void overlayMain() {
WidgetsFlutterBinding.ensureInitialized();
runApp(
const MaterialApp(
debugShowCheckedModeBanner: false,
home: TrueCallerOverlay(title: '123',),
),
);
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@OverRide
Widget build(BuildContext context) {
return const MaterialApp(
debugShowCheckedModeBanner: false, home: LoginScreen());
}
}
The text was updated successfully, but these errors were encountered: