Chuyển đến nội dung chính

Bài đăng

Hiển thị các bài đăng có nhãn Windows

Flutter trên desktop: cửa sổ giờ là một phần của ứng dụng bạn

Một ứng dụng Flutter chạy được trên desktop và một ứng dụng Flutter thuộc về desktop là hai phần mềm khác nhau. Cái thứ nhất là bố cục điện thoại kéo giãn ra 1920 pixel. Cái thứ hai biết cửa sổ của mình có thể bị co lại tới mức phi lý, biết người dùng mong Cmd+W đóng một tab, biết chuột phải phải bật menu ngữ cảnh, và biết cuộn bằng trackpad không phải cùng một cử chỉ với kéo bằng ngón tay. Chẳng có gì trong số này là khó. Nó chỉ là danh sách những thứ mà di động chưa bao giờ bắt bạn nghĩ tới. Cửa sổ có vòng đời do bạn điều khiển Future < void > main () async { WidgetsFlutterBinding . ensureInitialized (); await windowManager. ensureInitialized (); const options = WindowOptions ( size : Size ( 1200 , 800 ), minimumSize : Size ( 720 , 480 ), center : true , titleBarStyle : TitleBarStyle .normal, ); await windowManager. waitUntilReadyToShow (options, () async { await windowManager. show (); await windowManager. focus ()...

Flutter trên desktop: cửa sổ giờ là một phần của ứng dụng bạn

Một ứng dụng Flutter chạy được trên desktop và một ứng dụng Flutter thuộc về desktop là hai phần mềm khác nhau. Cái thứ nhất là bố cục điện thoại kéo giãn ra 1920 pixel. Cái thứ hai biết cửa sổ của mình có thể bị co lại tới mức phi lý, biết người dùng mong Cmd+W đóng một tab, biết chuột phải phải bật menu ngữ cảnh, và biết cuộn bằng trackpad không phải cùng một cử chỉ với kéo bằng ngón tay. Chẳng có gì trong số này là khó. Nó chỉ là danh sách những thứ mà di động chưa bao giờ bắt bạn nghĩ tới. Cửa sổ có vòng đời do bạn điều khiển Future < void > main () async { WidgetsFlutterBinding . ensureInitialized (); await windowManager. ensureInitialized (); const options = WindowOptions ( size : Size ( 1200 , 800 ), minimumSize : Size ( 720 , 480 ), center : true , titleBarStyle : TitleBarStyle .normal, ); await windowManager. waitUntilReadyToShow (options, () async { await windowManager. show (); await windowManager. focus ()...

Flutter on desktop: the window is part of your app now

A Flutter app that runs on desktop and a Flutter app that belongs on desktop are different pieces of software. The first is a phone layout stretched to 1920 pixels wide. The second knows its window can be resized to something absurd, that the user expects Cmd+W to close a tab, that a right-click should produce a context menu, and that scrolling with a trackpad is not the same gesture as dragging with a finger. None of this is hard. It is just a list of things mobile never made you think about. The window has a lifecycle you control Future < void > main () async { WidgetsFlutterBinding . ensureInitialized (); await windowManager. ensureInitialized (); const options = WindowOptions ( size : Size ( 1200 , 800 ), minimumSize : Size ( 720 , 480 ), center : true , titleBarStyle : TitleBarStyle .normal, ); await windowManager. waitUntilReadyToShow (options, () async { await windowManager. show (); await windowManager. focus ...

Flutter on desktop: the window is part of your app now

A Flutter app that runs on desktop and a Flutter app that belongs on desktop are different pieces of software. The first is a phone layout stretched to 1920 pixels wide. The second knows its window can be resized to something absurd, that the user expects Cmd+W to close a tab, that a right-click should produce a context menu, and that scrolling with a trackpad is not the same gesture as dragging with a finger. None of this is hard. It is just a list of things mobile never made you think about. The window has a lifecycle you control Future < void > main () async { WidgetsFlutterBinding . ensureInitialized (); await windowManager. ensureInitialized (); const options = WindowOptions ( size : Size ( 1200 , 800 ), minimumSize : Size ( 720 , 480 ), center : true , titleBarStyle : TitleBarStyle .normal, ); await windowManager. waitUntilReadyToShow (options, () async { await windowManager. show (); await windowManager. focus ...

Multi-window on Flutter desktop: what shipped in 3.47, and what to use today

Multi-window is the oldest item on the Flutter desktop wishlist. A desktop app that cannot open a second window is not really a desktop app — no detached inspector, no tear-off panel, no floating tool palette, no proper context menu that escapes the main window’s bounds. Flutter 3.41 shipped experimental multi-window APIs for desktop. Flutter 3.47 fills in a large amount of the plumbing underneath them. What it does not do is make them stable, and being clear about that distinction will save you a painful quarter. What actually landed in 3.47 The desktop work in this release is mostly engine-level, and it is substantial: Popup windows. Win32 and Linux both got popup window implementations. This is the foundation for menus, tooltips, and dropdowns that render outside the parent window’s bounds — a category of UI that Flutter desktop has faked with overlays until now. Sized-to-content windows. Regular and dialog windows can now size themselves to their content on Win32, and the de...