GithubHelp home page GithubHelp logo

Comments (4)

ducviet321 avatar ducviet321 commented on June 22, 2024 1

@jijormathew Could you put it in a code block?

By the way, is there any example of using & communicating between multiple of windows?

from flutter_overlay_window.

saurabhkumar8112 avatar saurabhkumar8112 commented on June 22, 2024

Please try to add minimal example of the code that you're using. As it says in the docs and sample example creating a new overlay should be as simple as simply calling showOverlay

from flutter_overlay_window.

jijormathew avatar jijormathew commented on June 22, 2024

import 'dart:async';
import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:flutter_overlay_window/flutter_overlay_window.dart';

import 'news_data.dart';

class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@OverRide
State createState() => _MyHomePageState();
}

class _MyHomePageState extends State {

@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Top Stories'),
centerTitle: false,
titleTextStyle: const TextStyle(
fontSize: 30,
color: Colors.black)),
body: ListView.separated(
shrinkWrap: true,
separatorBuilder: (context, idx) {
return const Divider();
},
itemCount: getNewsStories().length,
itemBuilder: (context, idx) {
final article = getNewsStories()[idx];
return ListTile(
onLongPress: (){
_closeOverlayWindow();
},
key: Key('$idx ${article.hashCode}'),
title: Text(article.title),
subtitle: Text(article.description),
onTap: () {
_showOverlayWindow();
},
);
},
));

}
_showOverlayWindow() async {
bool status = await FlutterOverlayWindow.isPermissionGranted();
if(!status){
status = await FlutterOverlayWindow.requestPermission() ?? false;
setState(() {
});
}else{
await FlutterOverlayWindow.showOverlay(alignment: OverlayAlignment.centerLeft,height: 200,width: 300,enableDrag: true,flag: OverlayFlag.defaultFlag,positionGravity: PositionGravity.auto);
}
}
_closeOverlayWindow() async {
await FlutterOverlayWindow.closeOverlay();
}
} This is the example code that I'm attempting to run. I want to launch an overlay window as I press each article, not replace the one that's already open.

from flutter_overlay_window.

X-SLAYER avatar X-SLAYER commented on June 22, 2024

For the moment this package works only on displaying single overlay

from flutter_overlay_window.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.