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

kelvin.atomblender at riseup.net kelvin.atomblender at riseup.net
Sun Jun 18 21:39:36 UTC 2017


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kirigami-proposal.zip
Type: application/zip
Size: 51381 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20170618/b70a5380/attachment-0001.zip>


More information about the Plasma-devel mailing list