Skip to content

Commit d490bd4

Browse files
ikoevskarigor789
authored andcommitted
Styled completed tasks (#141)
* Styled completed tasks * Removed advanced tasks * Removed duplicate text & code
1 parent a65a999 commit d490bd4

File tree

3 files changed

+48
-7
lines changed

3 files changed

+48
-7
lines changed

content/docs/en/getting-started/2-playground-tutorial.md

+48-7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ You can work in the Playground for as long as you like. You can use it to just g
2323
* [Advanced design: Styled input field and button](#advanced-design-styled-input-field-and-button)
2424
* [Advanced design: Styled tab navigation](#advanced-design-styled-tab-navigation)
2525
* [Advanced design: Styled active tasks](#advanced-design-styled-active-tasks)
26+
* [Advanced design: Styled completed tasks](#advanced-design-styled-completed-tasks)
2627

2728

2829
# Part 1: Getting familiar with the Playground
@@ -96,16 +97,11 @@ If you want to explore the [NativeScript Playground](https://play.nativescript.o
9697
* View tasks: Newly added tasks are listed as active and can be tapped
9798
* Complete tasks: Tapping an active task shows an action dialog with options
9899
* Delete tasks: Tapping an active or completed task shows an action dialog with options
99-
* (In progress) Advanced design
100+
* Advanced design
100101
* Input and button for adding tasks are styled
101102
* Tabs are styled
102103
* Active tasks are styled
103-
* (Coming soon) Completed tasks are styled
104-
* (Coming soon) Advanced functionality
105-
* (Coming soon) Store timestamp data for each task
106-
* (Coming soon) View task history
107-
* (Coming soon) Manage tasks in bulk
108-
* (Coming soon) Schedule tasks: Users can set deadlines for tasks by picking a date from a calendar widget
104+
* Completed tasks are styled
109105

110106
> **TIP:** All sections of this tutorial contain a *Some NativeScript basics* and *Requirement implementation* sub-sections. You can skip the basics sub-section and jump straight to the implementation for a more hands-on approach.
111107
@@ -661,3 +657,48 @@ To implement a style particularly for the text of active tasks, you can set an `
661657
padding-bottom: 10;
662658
}
663659
```
660+
661+
## Advanced design: Styled completed tasks
662+
663+
Here's how your app will look at the start and at the end of this section.
664+
665+
| Completed tasks - No style | Completed tasks - Styled |
666+
|-----|-------------|
667+
| ![Unstyled completed tasks](/screenshots/ns-playground/completed-tasks-unstyled.jpg) | ![Styled completed tasks](/screenshots/ns-playground/completed-tasks-styled.jpg) |
668+
669+
### Some NativeScript basics
670+
671+
This section applies the basic NativeScript knowledge from [Advanced design: Styled active tasks](#advanced-design-styled-active-tasks).
672+
673+
### Requirement implementation
674+
675+
1. In `app.js`, on line 76, set an `id` for the `<Label>` that represents completed tasks and enable text wrapping. Enabling text wrapping ensures that longer text shows properly in your list
676+
677+
```HTML
678+
<Label id="completed-task" :text="done.name" textWrap="true" />
679+
```
680+
1. On line 74, set an `id`, add the `separatorColor` property, and set it to `transparent`. This way, the separator will no longer appear in your list. You can use the `id` to style the margins for the `<ListView>`.
681+
682+
```HTML
683+
<ListView id="completed-list" for="done in dones" @itemTap="onDoneTap" height="100%" separatorColor="transparent" >
684+
```
685+
1. In `app.css`, create the style for completed tasks. Set font size, color, text decoration, and some padding to position the text on the page. Play with margins and paddings until you get a result that works for you.
686+
687+
```CSS
688+
#completed-task {
689+
font-size: 20;
690+
color: #d3d3d3;
691+
margin-left: 20;
692+
padding-top: 5;
693+
padding-bottom: 10;
694+
text-decoration: line-through;
695+
}
696+
```
697+
698+
1. Create a style for the entire `<ListView>` and set a top margin for it. This way, text will not show directly below the action bar. Play with the top margin until you get a result that works for you.
699+
700+
```CSS
701+
#completed-list {
702+
margin-top: 20;
703+
}
704+
```
Loading
Loading

0 commit comments

Comments
 (0)