Flutter Desktop change title, position and size of main window

Asked

Viewed 274 times

2

Currently when running a desktop application the window size and title come predefined, how to change this information?

inserir a descrição da imagem aqui

As an example, we used the standard test project provided in git:

flutter channel master
flutter upgrade
flutter config --enable-windows-desktop
git clone https://github.com/google/flutter-desktop-embedding.git

1 answer

2


Using the version 1.15.3-pre.37 Edit the file: window_configuration.h in the briefcase windows and change as per the example:

const wchar_t *kFlutterWindowTitle = L"Titulo Minha Aplicacao";
const unsigned int kFlutterWindowOriginX = 0; //posição margem esquerda
const unsigned int kFlutterWindowOriginY = 0; //posição top
const unsigned int kFlutterWindowWidth = 1200; //Largura
const unsigned int kFlutterWindowHeight = 768; //Altura

-------EDIT---------

Using the version 1.19.0-2.0.pre.73 it is already possible to define within the application:

import 'package:window_size/window_size.dart';`


WidgetsFlutterBinding.ensureInitialized();
setWindowTitle('Meu app');
const frame = Rect.fromLTWH(0, 0, 1200, 768);
setWindowFrame(frame);
runApp(MyApp());
  • I can access these constants in Runtime? Or will the application obey only what was set in that file? ~~ I want to use the desktop, but it seems to me very unstable yet and without many functions

  • 1

    @Matheusribeiro I believe not, I have not yet had this need to modify at runtime, as you said is still very unstable but I can already use enough thing, mobx, get_it, etc..

Browser other questions tagged

You are not signed in. Login or sign up in order to post.