fabulous-dev / Fabulous

Declarative UI framework for cross-platform mobile & desktop apps, using MVU and F# functional programming
https://fabulous.dev
Apache License 2.0
1.13k stars 122 forks source link

Add support for MAUI #919

Closed TimLariviere closed 1 year ago

TimLariviere commented 2 years ago

Now that MAUI Release Candidate 1 is released, I'm taking a stab at supporting it.

IDE support on macOS is completely absent but running via command line works.

// iOS
dotnet build -t:Run -f net6.0-ios -p:_DeviceName=:v2:udid=59F2133A-63ED-4791-A795-8F23C61E678B

// Android
dotnet build -t:Run -f net6.0-android

// Mac Catalyst
dotnet build -t:Run -f net6.0-maccatalyst
TimLariviere commented 2 years ago

@edgarfgp If you want to play with it, this branch is ready for experimentations You'll have to open Fabulous-Maui.sln. The main sln doesn't seem Maui friendly

edgarfgp commented 2 years ago

Thanks so much . I will play a long and see if we can make some progress . :)

TimLariviere commented 2 years ago

Managed to get the label displayed

TimLariviere commented 1 year ago

Trying to make some progress on the Maui support. Getting closer to get a running sample, but still quite far from having anything usable.

Current state: I can display a Label and a Button inside a Window. The button sends the events correctly but Maui isn't updating the UI despite calling handler.UpdateValue("Text"). Also, VStack/HStack are not displaying anything.

TimLariviere commented 1 year ago

... and the IDEs crashing when I'm debugging aren't making anything easier.

TimLariviere commented 1 year ago

Was missing the synchronization with the main thread. Now it's working 🎉

edgarfgp commented 1 year ago

Nice . Let me know if there is any thing I can help ?

edgarfgp commented 1 year ago

While adding support for Maui . Could we review the Light and Dark support for text images , maybe also the styling ?

TimLariviere commented 1 year ago

Nice . Let me know if there is any thing I can help ?

Thanks for asking :) Right now, I'm still struggling to understand how controls work in Maui. If you feel like it, I can use another brain to reverse-engineer Maui to get the Hello World sample running 😄

This commented code is the sample I want to get working: https://github.com/fsprojects/Fabulous/pull/919/files#diff-d7b680c6fd70cff6508141ef3a2b3414f496d8f4ef5101b06910b120fb585c47R62-R91

While adding support for Maui . Could we review the Light and Dark support for text images , maybe also the styling ?

Sure. Do you have an idea how you would do it differently?

TimLariviere commented 1 year ago

Small update: got StackLayout to work 🎉

TimLariviere commented 1 year ago
image
TimLariviere commented 1 year ago

https://github.com/dotnet/maui/issues/5835

TimLariviere commented 1 year ago

Still have some layout issues, but I made some progress

TimLariviere commented 1 year ago

I ported the TicTacToe sample. It's not exactly the same than the XF one because Maui.Core lacks some features: OnSizeAllocated and RequestedThemeChanged.

TimLariviere commented 1 year ago

The direct support for Maui (without Maui.Controls & XAML) has been moved to https://github.com/fsharp-mobile/Fabulous.Maui