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

YaruMasterDetailPage: add tile builder #252

Merged
merged 1 commit into from
Oct 10, 2022
Merged

YaruMasterDetailPage: add tile builder #252

merged 1 commit into from
Oct 10, 2022

Conversation

jpnurmi
Copy link
Member

@jpnurmi jpnurmi commented Oct 7, 2022

This gives full control over master-detail tiles. Notice that YaruMasterTile can be wrapped with any other widget such as Tooltip or Semantics.

Before

YaruMasterDetailPage(
  iconBuilder: (context, index, selected) => const Icon(Icons.foo),
  titleBuilder: (context, index, selected) => const Text('Title'),
)

After

YaruMasterDetailPage(
  tileBuilder: (context, index, selected) => YaruMasterTile(
    leading: const Icon(Icons.foo),
    title: const Text('Custom'),
    subtitle: const Text('Lorem ipsum...'),
    trailing: const Chip(label: Text('123'),
    onTap: () {},
  ),
)

image

Ref: #255

@jpnurmi jpnurmi marked this pull request as draft October 8, 2022 08:12
@jpnurmi jpnurmi changed the title POC: master-detail tile builder YaruMasterDetailPage: add tile builder Oct 9, 2022
@jpnurmi jpnurmi marked this pull request as ready for review October 9, 2022 18:53
Copy link
Member

@Jupi007 Jupi007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly this is really nice.
And the compact mode switcher still work :D

Tested and approved for me :)
Thanks!

pageItems[index].iconBuilder(context, selected),
tileBuilder: (context, index, selected) => YaruMasterTile(
leading: pageItems[index].iconBuilder(context, selected),
title: pageItems[index].titleBuilder(context),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked out and tested locally everything works!
If one might be super picky maybe this would also be named titleBuilder instead? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

title, subtitle, leading, etc. are ordinary Widget properties of YaruMasterTile, similarly to the respective properties of ListTile :)

@jpnurmi
Copy link
Member Author

jpnurmi commented Oct 10, 2022

Thank you! 🎉 We'll continue with the app bars next, and explore similar possibilities for the compact layout, too! 😉

@Feichtmeier Feichtmeier merged commit 2632767 into ubuntu:main Oct 10, 2022
@jpnurmi jpnurmi deleted the md-tile-builder branch October 10, 2022 06:15
@Feichtmeier Feichtmeier mentioned this pull request Nov 6, 2022
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.

None yet

3 participants