Repository navigation
Replies: 9 comments 14 replies
|
You mean this: https://flet.dev/docs/controls/page#window_visible? |
1 reply
|
What OS are you running on? |
5 replies
|
Can you post complete both Flet and Flutter examples as text? |
0 replies
|
The following is the main code of the two examples flutterFuture setWindowPosition(double? top, double? left) async {
if (Platform.isMacOS) {
// debugPrint("setWindowPosition()");
// var currentPos = await windowManager.getPosition();
// if (kDebugMode) {
// print(currentPos);
// }
await windowManager.setPosition(
// Offset(left ?? currentPos.dx, top ?? currentPos.dy),
const Offset(1050.0, 100.0),
animate: defaultTargetPlatform != TargetPlatform.macOS);
}
}
void main() async {
if (Platform.isMacOS) {
// for macos app
WidgetsFlutterBinding.ensureInitialized();
// Must add this line.
await windowManager.ensureInitialized();
WindowOptions windowOptions = const WindowOptions(
size: Size(350, 680),
// center: true,
// backgroundColor: Colors.transparent,
skipTaskbar: false,
// titleBarStyle: TitleBarStyle.hidden,
title: '',
alwaysOnTop: true,
);
windowManager.waitUntilReadyToShow(windowOptions, () async {
await setWindowPosition(1000.0, 100.0);
await windowManager.show();
await windowManager.focus();
});
}
runApp(const MyApp());
}fletdef main(page: Page):
# page.title = "X-Shot"
# page.vertical_alignment = "center"
page.window_width = 300
page.window_top = 130
page.window_left = 1100
page.window_always_on_top = True
page.scroll = True
page.theme = theme.Theme(color_scheme_seed="green")
# page.theme.use_material3 = True
def copyit(e):
page.update()
def saveit(e):
page.update()
def test123(e):
print('afa')
page.add(
Row([
ElevatedButton(text="Copy to Board", on_click=copyit),
ElevatedButton(text="Save", on_click=saveit),
],
alignment="center",
)
)
# flet.app(target=main, view=flet.WEB_BROWSER)
flet.app(target=main) |
2 replies
|
Did it work? |
2 replies
|
Use |
2 replies
|
This workaround does not work on Flet >0.80 anymore. |
0 replies
|
Got it! page.window.visible = True
page.window.update()
...
ft.run(main, view=ft.AppView.FLET_APP_HIDDEN)
|
0 replies
|
OK, this works like a charm when using |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Kapture.2022-09-19.at.20.44.18.mp4
Always have a window flashing in the middle of the screen at startup
All reactions