--- /dev/null
+// SPDX-FileCopyrightText: 2024 Chris Duncan <chris@zoso.dev>
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+import { EventData, View, NavigatedData, Page } from '@nativescript/core'
+import { Item } from '../shared/item'
+
+export function onNavigatingTo (args: NavigatedData) {
+ const page = args.object as Page
+ const item = args.context as Item
+ page.bindingContext = item
+}
+
+export function onBackButtonTap (args: EventData) {
+ const view = args.object as View
+ const page = view.page as Page
+
+ page.frame.goBack()
+}
xmlns="http://schemas.nativescript.org/tns.xsd"
>
<ActionBar>
- <Label text="Settings" />
- </ActionBar>
- <GridLayout class="page__content">
- <Label
- class="page__content-icon fas"
- text="⚙"
+ <NavigationButton
+ tap="onBackButtonTap"
+ android.systemIcon="ic_menu_back"
/>
+ <Label text="{{ name }}" />
+ </ActionBar>
+ <GridLayout>
<Label
- class="page__content-placeholder"
- text="-- Settings go here --"
+ class="m-10 h3"
+ text="{{ description }}"
+ verticalAlignment="top"
/>
</GridLayout>
</Page>
--- /dev/null
+// SPDX-FileCopyrightText: 2024 Chris Duncan <chris@zoso.dev>
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+import { View, ItemEventData, NavigatedData, Page } from '@nativescript/core'
+
+import { SettingsViewModel } from './settings-view-model'
+import { Item } from './shared/item'
+
+export function onNavigatingTo (args: NavigatedData) {
+ const page = <Page>args.object
+ page.bindingContext = new SettingsViewModel()
+}
+
+export function onItemTap (args: ItemEventData) {
+ const view = <View>args.view
+ const page = <Page>view.page
+ const tappedItem = <Item>view.bindingContext
+
+ page.frame.navigate({
+ moduleName: 'settings/settings-item-detail/settings-item-detail-page',
+ context: tappedItem,
+ animated: true,
+ transition: {
+ name: 'slide',
+ duration: 200,
+ curve: 'ease',
+ },
+ })
+}
--- /dev/null
+<!--
+SPDX-FileCopyrightText: 2024 Chris Duncan <chris@zoso.dev>
+SPDX-License-Identifier: GPL-3.0-or-later
+-->
+
+<Page
+ navigatingTo="onNavigatingTo"
+ xmlns="http://schemas.nativescript.org/tns.xsd"
+ >
+ <ActionBar>
+ <Label text="Settings" />
+ </ActionBar>
+ <ListView
+ items="{{ items }}"
+ itemTap="onItemTap"
+ >
+ <ListView.itemTemplate>
+ <StackLayout orientation="horizontal">
+ <Label
+ text="{{ name }}"
+ textWrap="true"
+ />
+ </StackLayout>
+ </ListView.itemTemplate>
+ </ListView>
+</Page>
+++ /dev/null
-// SPDX-FileCopyrightText: 2024 Chris Duncan <chris@zoso.dev>
-// SPDX-License-Identifier: GPL-3.0-or-later
-
-import { NavigatedData, Page } from '@nativescript/core'
-import { SettingsViewModel } from './settings-view-model'
-
-export function onNavigatingTo (args: NavigatedData) {
- const page = <Page>args.object
- page.bindingContext = new SettingsViewModel()
-}
// SPDX-License-Identifier: GPL-3.0-or-later
import { Observable } from '@nativescript/core'
+import { Item } from './shared/item'
export class SettingsViewModel extends Observable {
+ items: Array<Item>
+
constructor () {
super()
+
+ this.items = new Array<Item>(
+ {
+ name: 'Item 1',
+ description: 'Description for Item 1',
+ },
+ {
+ name: 'Item 2',
+ description: 'Description for Item 2',
+ },
+ {
+ name: 'Item 3',
+ description: 'Description for Item 3',
+ },
+ {
+ name: 'Item 4',
+ description: 'Description for Item 4',
+ },
+ {
+ name: 'Item 5',
+ description: 'Description for Item 5',
+ },
+ {
+ name: 'Item 6',
+ description: 'Description for Item 6',
+ },
+ {
+ name: 'Item 7',
+ description: 'Description for Item 7',
+ },
+ {
+ name: 'Item 8',
+ description: 'Description for Item 8',
+ },
+ {
+ name: 'Item 9',
+ description: 'Description for Item 9',
+ },
+ {
+ name: 'Item 10',
+ description: 'Description for Item 10',
+ },
+ {
+ name: 'Item 11',
+ description: 'Description for Item 11',
+ },
+ {
+ name: 'Item 12',
+ description: 'Description for Item 12',
+ },
+ {
+ name: 'Item 13',
+ description: 'Description for Item 13',
+ },
+ {
+ name: 'Item 14',
+ description: 'Description for Item 14',
+ },
+ {
+ name: 'Item 15',
+ description: 'Description for Item 15',
+ },
+ {
+ name: 'Item 16',
+ description: 'Description for Item 16',
+ }
+ )
}
}
--- /dev/null
+// SPDX-FileCopyrightText: 2024 Chris Duncan <chris@zoso.dev>
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+export interface Item {
+ name: string
+ description: string
+}