Skip to content
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

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

jwill
Copy link
Contributor

@jwill jwill commented Oct 5, 2024

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

  • This PR is marked as draft with an explanation if not meant to land until a future stable release.
  • This PR doesn’t contain automatically generated corrections (Grammarly or similar).
  • This PR follows the Google Developer Documentation Style Guidelines — for example, it doesn’t use i.e. or e.g., and it avoids I and we (first person).
  • This PR uses semantic line breaks of 80 characters or fewer.

added links from the legacy android page to compose version
@flutter-website-bot
Copy link
Collaborator

flutter-website-bot commented Oct 5, 2024

Visit the preview URL for this PR (updated for commit 9ab28d9):

https://flutter-docs-prod--pr11232-for-compose-devs-5p2wixgb.web.app

@sfshaza2
Copy link
Contributor

sfshaza2 commented Oct 9, 2024

I'm confused. How does this overlap with this: #11219 ?

@jwill
Copy link
Contributor Author

jwill commented Oct 9, 2024

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.

Copy link
Contributor

@sfshaza2 sfshaza2 left a 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.

src/content/get-started/flutter-for/compose-devs.md Outdated Show resolved Hide resolved
@@ -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
Copy link
Contributor

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".

src/content/get-started/flutter-for/android-devs.md Outdated Show resolved Hide resolved
src/content/get-started/flutter-for/android-devs.md Outdated Show resolved Hide resolved
src/content/get-started/flutter-for/compose-devs.md Outdated Show resolved Hide resolved
src/content/get-started/flutter-for/compose-devs.md Outdated Show resolved Hide resolved
src/content/get-started/flutter-for/compose-devs.md Outdated Show resolved Hide resolved
Comment on lines +756 to +767
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)
)
Copy link
Contributor

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.

Comment on lines +774 to +792
)

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)
Copy link
Contributor

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,
Copy link
Contributor

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".

@jwill
Copy link
Contributor Author

jwill commented Oct 11, 2024

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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide Kotlin code on 'Flutter for Android developers' page
3 participants