1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: MIT
3
4import { TaskListView, TaskListAdapter } from "./views/task_list_view.slint";
5export { TaskListAdapter }
6
7import { CreateTaskView, CreateTaskAdapter } from "./views/create_task_view.slint";
8export { CreateTaskAdapter }
9
10import { AnimationSettings } from "./widgets/styling.slint";
11
12export global NavigationAdapter {
13 out property <int> current-page;
14
15 public function next-page() {
16 root.current-page += 1;
17 }
18
19 public function previous-page() {
20 root.current-page = max(0, root.current-page - 1);
21 }
22}
23
24export component MainWindow inherits Window {
25 preferred-width: 400px;
26 preferred-height: 600px;
27 title: "Slint todo mvc example";
28
29 Rectangle {
30 x: -(NavigationAdapter.current-page * root.width);
31 width: 2 * root.width;
32
33 if self.x > -root.width : TaskListView {
34 x: 0;
35 width: root.width;
36 height: root.height;
37 }
38
39 if self.x < 0 : CreateTaskView {
40 x: root.width;
41 width: root.width;
42 height: root.height;
43 }
44
45 animate x {
46 duration: AnimationSettings.move-duration;
47 easing: AnimationSettings.move-easing;
48 }
49 }
50}
51