[Kirigami] Support for stacked page rows (a proposal)

Aleix Pol aleixpol at kde.org
Tue Jun 20 13:03:10 UTC 2017


On Sun, Jun 18, 2017 at 11:39 PM,  <kelvin.atomblender at riseup.net> wrote:
> Hi,
> I'm developing my application using Kirigami 2 and I really like the
> PageRow component which allows simple navigation between pages and makes
> it easy to target phones and tablets with one code base. However I find
> it rather limiting to have only one page row per application available.
>
> For example if I have a few pages currently shown in the page row and I
> want to show a page from completely different context e.g. settings I
> have only two choices:
> 1. show the page next to other pages - I think this is not a good idea
> because the page belongs to entirely different context so I would like
> it separated from other pages. Also I might not want to allow
> interacting with other pages while I'm browsing a settings page
> 2. clean up the page row and show settings page - if I'm not mistaken
> this is how Discover works. However when I clean the page row I throw
> away its current state e.g. current page info, scroll level in each page
> and any per page data e.g. selected items.
>
> So I was experimenting a bit with Kirigami code to try to overcome this
> limitation. With really small code modifications I've designed this:
> 1. I introduced the concept of Activity, which is a basic visual
> container. It can contain one page row or many swappable page rows.
> 2. I introduced ActivityStack which stacks the activites in the QQC2
> StackView. ApplicationWindow.activityStack property replaced
> ApplicationWindow.pageStack property as a main visual container.
> 3. I patched a few components (Headers, Drawers, Pages) to reference
> ApplicationWindow.activityStack.currentActivity.pageRow instead of
> ApplicationWindow.pageStack
>
> ...and it mostly works:)
>
> I got the idea of Activity from Android:
> https://developer.android.com/guide/components/activities/intro-activities.html
> https://developer.android.com/guide/components/activities/activity-lifecycle.html
> https://developer.android.com/guide/components/fragments.html
>
> You can see the effects in the attached archive which contains 3
> folders:
> 1. kirigami-new: source of 3 new and ~10 patched components of Kirigami
> 2. kirigami-simplest: example showing how simple it is to use
> kirigami-new with one activity and one page row
> 3. kirigami-rssfeeds: example with two activites: the default
> BrowserActivity shows fake rss feeds. When the user wants to see
> settings the SettingsActivity is pushed on the ActivityStack and it
> covers BrowserActivity. Both activities have their own page rows and
> they set their preferred application header style. When the user exits
> settings the control goes back to BrowserActivity and its state is of
> course the same as when the user left the activity (well, almost: for
> unknown reason scroll positions slightly differs).
>
> I hope this idea will somehow be introduced into Kirigami, if not the
> way I proposed (activities) then some other. It doesn't change
> Kirigami's design principles but rather extends it and makes it more
> flexible.
>
> Regards,
> K.

Sounds interesting! I would indeed appreciate some flexibility there.

As marco pointed out, having good API for this is really important.
Maybe it's something we can discuss over phabricator?

Aleix


More information about the Plasma-devel mailing list