desktop full screen remember

This commit is contained in:
niuhuan 2021-12-04 12:20:51 +08:00
parent 6328e7d83b
commit 795929186a
2 changed files with 10 additions and 2 deletions

View File

@ -37,9 +37,12 @@ func main() {
}
var runOptions []flutter.Option
runOptions = append(runOptions, flutter.WindowInitialDimensions(width, height))
runOptions = append(runOptions, options...)
fullScreen, _ := properties.LoadBoolProperty("full_screen", false)
if fullScreen {
runOptions = append(runOptions, flutter.WindowMode(flutter.WindowModeMaximize))
}
// ------
err := flutter.Run(append(runOptions, mainOptions...)...)
err := flutter.Run(append(append(runOptions, options...), mainOptions...)...)
if err != nil {
fmt.Println(err)
os.Exit(1)

View File

@ -79,5 +79,10 @@ func (p *PikapikaPlugin) InitPluginGLFW(window *glfw.Window) error {
properties.SaveProperty("window_height", strconv.Itoa(height))
}()
})
window.SetMaximizeCallback(func(w *glfw.Window, iconified bool) {
go func() {
properties.SaveProperty("full_screen", strconv.FormatBool(iconified))
}()
})
return nil
}