Skip to content
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

Lost connection to device. (on ubuntu 22.04 LTS) #264

Open
hosseinvejdani opened this issue Dec 20, 2022 · 3 comments
Open

Lost connection to device. (on ubuntu 22.04 LTS) #264

hosseinvejdani opened this issue Dec 20, 2022 · 3 comments

Comments

@hosseinvejdani
Copy link

hosseinvejdani commented Dec 20, 2022

when i want to use window_manager package in my flutter app in ubuntu 22.04 os, i got this message:
Lost connection to device.
and suddenly the opened app windows close!

my code is here:

import 'package:get/get.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:window_manager/window_manager.dart';
import 'src/core/core.dart';
import 'src/view/view.dart';


void main() async {
  // ====================== new ========================
  WidgetsFlutterBinding.ensureInitialized();
  await windowManager.ensureInitialized();

  WindowOptions windowOptions = WindowOptions(
    size: Size(800, 600),
    center: true,
    backgroundColor: Colors.transparent,
    skipTaskbar: false,
    titleBarStyle: TitleBarStyle.hidden,
  );

  windowManager.waitUntilReadyToShow(windowOptions, () async {
    await windowManager.show();
    await windowManager.focus();
  });

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    //Set the fit size (Find your UI design, look at the dimensions of the device screen and fill it in,unit in dp)
    return ScreenUtilInit(
      designSize: designSize,
      minTextAdapt: true,
      splitScreenMode: true,
      builder: (context, _) {
        return GetMaterialApp(
          debugShowCheckedModeBanner: false,
          initialRoute: RoutesName.portConfigScreen,
          getPages: AppPages.pages,
        );
      },
    );
  }
}

but if i comment this part, the app run healthy without setting my size properly:

 windowManager.waitUntilReadyToShow(windowOptions, () async {
    await windowManager.show();
    await windowManager.focus();
  })

and finally this is my flutter doctor result:

user@I1081:~/dev/work/with-ssh/panel$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.9, on Ubuntu 22.04.1 LTS 5.15.0-56-generic, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.3)
[✓] VS Code
[✓] Connected device (2 available)
HTTP Host availability check is taking a long time...[✓] HTTP Host Availability

• No issues found!
@hosseinvejdani hosseinvejdani changed the title Lost connection to device. Lost connection to device. (on ubuntu 22.04 LTS) Dec 20, 2022
@sgehrman
Copy link

sgehrman commented Jan 5, 2023

try
window_manager: 0.2.8

0.2.9 is crashy

@damywise
Copy link
Contributor

damywise commented Jan 6, 2023

0.2.9 wasn't released 2 weeks ago

@WxqKb
Copy link

WxqKb commented Jun 1, 2023

I also encountered this problem
Mainly because of the center property

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants