Replies: 6 comments 12 replies
-
You mean this: https://flet.dev/docs/controls/page#window_visible? |
Beta Was this translation helpful? Give feedback.
-
What OS are you running on? |
Beta Was this translation helpful? Give feedback.
-
Can you post complete both Flet and Flutter examples as text? |
Beta Was this translation helpful? Give feedback.
-
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)
|
Beta Was this translation helpful? Give feedback.
-
Did it work? |
Beta Was this translation helpful? Give feedback.
-
Use
|
Beta Was this translation helpful? Give feedback.
-
Kapture.2022-09-19.at.20.44.18.mp4
Always have a window flashing in the middle of the screen at startup
Beta Was this translation helpful? Give feedback.
All reactions