-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a "Flutter for Jetpack Compose developers" page #11232
base: main
Are you sure you want to change the base?
Conversation
added links from the legacy android page to compose version
Visit the preview URL for this PR (updated for commit c86364b): https://flutter-docs-prod--pr11232-for-compose-devs-gfdg478a.web.app |
I'm confused. How does this overlap with this: #11219 ? |
#11219 is a targeted flow for an add to app like thing for Flutter developers that need to add a Compose activity. This PR is speaking more to Compose developers who want to implement flutter and see how their knowledge transfers. There is minimal overlap. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jwill! Thanks for writing this! It's a great start.
My primary issue is the focus here should be on how to use Flutter, not how to program better in Compose. ;) I don't think we need so many Kotlin examples.
If you instead have experience building apps for Android with Views (XML), | ||
see [Flutter for Android developers][]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you instead have experience building apps for Android with Views (XML), | |
see [Flutter for Android developers][]. | |
If you have experience building Android apps with Views (XML), | |
check out [Flutter for Android developers][]. |
@@ -2378,7 +2384,7 @@ In Flutter, access this functionality using the | |||
For more information on using the Firebase Cloud Messaging API, | |||
see the [`firebase_messaging`][] plugin documentation. | |||
|
|||
|
|||
[Flutter for Jetpack Compose devs]: /flutter-for/compose-devs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, please update the src/_data/sidenav to include this file. Also, modify the title of the original page. Perhaps "Flutter for Android devs using View" ??? Then this page can be "Flutter for Android devs using Jetpack Compose".
@@ -11,6 +11,12 @@ If you understand the fundamentals of the Android framework then you | |||
can use this document as a jump start to Flutter development. | |||
|
|||
:::note | |||
Android has two native user interface systems, Views (XML based) and Jetpack Compose. | |||
Some fundamentals are shared so this document will provide value no matter what. | |||
Howeverm if you are coming from Jetpack Compose, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Howeverm if you are coming from Jetpack Compose, | |
However, if you are coming from Jetpack Compose, |
Android has two native user interface systems, Views (XML based) and Jetpack Compose. | ||
Some fundamentals are shared so this document will provide value no matter what. | ||
Howeverm if you are coming from Jetpack Compose, | ||
see [Flutter for Jetpack Compose devs][] for more information about Jetpack Compose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see [Flutter for Jetpack Compose devs][] for more information about Jetpack Compose | |
check out [Flutter for Jetpack Compose devs][] for detailed information about Jetpack Compose |
check out [Add Flutter to existing app][]. | ||
::: | ||
|
||
This document can be used as a cookbook by jumping around |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This document can be used as a cookbook by jumping around | |
This document can be used as a reference by jumping around |
A cookbook is typically sequential in nature.
### Styling text | ||
|
||
In **Compose**, you use the properties on `Text` for one or two | ||
attributes or construct `TextStyle` object to set many at once. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attributes or construct `TextStyle` object to set many at once. | |
attributes or construct a `TextStyle` object to set many at once. |
### Styling buttons | ||
|
||
In **Compose**, you modify the colors of a button using | ||
the `colors` property. If left unmodified, they will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the `colors` property. If left unmodified, they will | |
the `colors` property. If left unmodified, they |
You can then modify properties on composables that have related | ||
properties or accept a `TextStyle`. | ||
|
||
```kotlin | ||
// Font files bunded with app | ||
val firaSansFamily = FontFamily( | ||
Font(R.font.firasans_light, FontWeight.Light), | ||
Font(R.font.firasans_regular, FontWeight.Normal), | ||
Font(R.font.firasans_italic, FontWeight.Normal, FontStyle.Italic), | ||
Font(R.font.firasans_medium, FontWeight.Medium), | ||
Font(R.font.firasans_bold, FontWeight.Bold) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd delete this. Not a Compose tutorial.
) | ||
|
||
val bodyFontFamily = FontFamily( | ||
Font( | ||
googleFont = GoogleFont("Acme"), | ||
fontProvider = provider, | ||
) | ||
) | ||
|
||
val displayFontFamily = FontFamily( | ||
Font( | ||
googleFont = GoogleFont("Aboreto"), | ||
fontProvider = provider, | ||
) | ||
) | ||
|
||
// Usage | ||
Text(text = "text", fontFamily = firaSansFamily, fontWeight = FontWeight.Light) | ||
Text(text = "text", fontFamily = bodyFontFamily, fontWeight = FontWeight.Medium) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More delete-y.
``` | ||
|
||
:::note | ||
To download custom fonts to use in your apps, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean "custom" fonts? I think you mean "other Google fonts".
I actually cut down on the number of examples from the page I modeled it on, Flutter for SwiftUI devs (https://docs.flutter.dev/get-started/flutter-for/swiftui-devs). There are sections on animation and there concepts in that other page that didn't feel essential and were getting into the weeds. My goal here was targeting a developer who is conversant with Compose and wants to do Flutter. I think it's important to discuss the commonalities to allow them to hit the ground running with real apples to apples examples versus just a textual description. I can concede that maybe some things can be excerpted more aggressively and places where I listed the two common ways for "A" Compose concept that map to "B" Flutter implementation might be reduced to one. If you are proposing to cut out the Kotlin side of a section totally, it might be better to eliminate the section altogether. Eg The google fonts section could be excised totally with just a pointer to the recently updated typography page. |
Description of what this PR is changing or adding, and why:
Adds a page for Flutter for Jetpack Compose devs.
Issues fixed by this PR (if any):
Fixes #5611 and #9051
PRs or commits this PR depends on (if any):
Presubmit checklist