1+ <style >
2+ ActionBar {
3+ background-color : #ed3e04 ;
4+ color : white ;
5+ }
6+ .item {
7+ padding : 10 ;
8+ color : white ;
9+ }
10+ .title {
11+ font-size : 17 ;
12+ font-weight : bold ;
13+ }
14+ .subtitle {
15+ font-size : 14 ;
16+ }
17+ </style >
18+
119<script lang =" ts" >
220 import { Template } from ' svelte-native/components' ;
321 const items = [
4- { index: 0 , name: ' TURQUOISE' , color: ' #1abc9c' },
5- { index: 1 , name: ' EMERALD' , color: ' #2ecc71' },
6- { index: 2 , name: ' PETER RIVER' , color: ' #3498db' },
7- { index: 3 , name: ' AMETHYST' , color: ' #9b59b6' },
8- { index: 4 , name: ' WET ASPHALT' , color: ' #34495e' },
9- { index: 5 , name: ' GREEN SEA' , color: ' #16a085' },
10- { index: 6 , name: ' NEPHRITIS' , color: ' #27ae60' },
11- { index: 7 , name: ' BELIZE HOLE' , color: ' #2980b9' },
12- { index: 8 , name: ' WISTERIA' , color: ' #8e44ad' },
13- { index: 9 , name: ' MIDNIGHT BLUE' , color: ' #2c3e50' },
14- { index: 10 , name: ' SUN FLOWER' , color: ' #f1c40f' },
15- { index: 11 , name: ' CARROT' , color: ' #e67e22' },
16- { index: 12 , name: ' ALIZARIN' , color: ' #e74c3c' },
17- { index: 13 , name: ' CLOUDS' , color: ' #ecf0f1' },
18- { index: 14 , name: ' CONCRETE' , color: ' #95a5a6' },
19- { index: 15 , name: ' ORANGE' , color: ' #f39c12' },
20- { index: 16 , name: ' PUMPKIN' , color: ' #d35400' },
21- { index: 17 , name: ' POMEGRANATE' , color: ' #c0392b' },
22- { index: 18 , name: ' SILVER' , color: ' #bdc3c7' },
23- { index: 19 , name: ' ASBESTOS' , color: ' #7f8c8d' }
24- ];
25-
22+ { index: 0 , name: ' TURQUOISE' , color: ' #1abc9c' },
23+ { index: 1 , name: ' EMERALD' , color: ' #2ecc71' },
24+ { index: 2 , name: ' PETER RIVER' , color: ' #3498db' },
25+ { index: 3 , name: ' AMETHYST' , color: ' #9b59b6' },
26+ { index: 4 , name: ' WET ASPHALT' , color: ' #34495e' },
27+ { index: 5 , name: ' GREEN SEA' , color: ' #16a085' },
28+ { index: 6 , name: ' NEPHRITIS' , color: ' #27ae60' },
29+ { index: 7 , name: ' BELIZE HOLE' , color: ' #2980b9' },
30+ { index: 8 , name: ' WISTERIA' , color: ' #8e44ad' },
31+ { index: 9 , name: ' MIDNIGHT BLUE' , color: ' #2c3e50' },
32+ { index: 10 , name: ' SUN FLOWER' , color: ' #f1c40f' },
33+ { index: 11 , name: ' CARROT' , color: ' #e67e22' },
34+ { index: 12 , name: ' ALIZARIN' , color: ' #e74c3c' },
35+ { index: 13 , name: ' CLOUDS' , color: ' #ecf0f1' },
36+ { index: 14 , name: ' CONCRETE' , color: ' #95a5a6' },
37+ { index: 15 , name: ' ORANGE' , color: ' #f39c12' },
38+ { index: 16 , name: ' PUMPKIN' , color: ' #d35400' },
39+ { index: 17 , name: ' POMEGRANATE' , color: ' #c0392b' },
40+ { index: 18 , name: ' SILVER' , color: ' #bdc3c7' },
41+ { index: 19 , name: ' ASBESTOS' , color: ' #7f8c8d' }
42+ ];
43+
2644 function onItemTap({ index , item }) {
2745 console .log (` EVENT TRIGGERED: Tapped on ${index } ${item .name } ` );
2846 }
3452<page >
3553 <actionBar title =" Simple Grid" />
3654 <gridLayout >
37- <collectionView
38- {items }
39-
40- colWidth =" 50%"
41- rowHeight =" 50%"
42- on :itemTap =" {onItemTap }"
43- on :loadMoreItems =" {onLoadMoreItems }"
44- orientation =" horizontal"
45- >
55+ <collectionView colWidth ="50%" {items } orientation ="horizontal" rowHeight ="50%" on:itemTap ={onItemTap } on:loadMoreItems ={onLoadMoreItems }>
4656 <Template let:item >
47- <gridlayout rows = "*, auto " backgroundColor =" {item .color }" class = " item " >
57+ <gridlayout class = "item " backgroundColor ={item .color } rows = " *, auto " >
4858 <stacklayout row =" 1" >
49- <label row ="1" text =" {item .name }" class = " title " />
50- <label row ="1" text =" {item .color }" class = " subtitle " />
59+ <label class = "title" row ="1" text ={item .name } />
60+ <label class = "subtitle" row ="1" text ={item .color } />
5161 </stacklayout >
5262 </gridlayout >
5363 </Template >
5464 </collectionView >
5565 </gridLayout >
5666</page >
57-
58- <style >
59- ActionBar {
60- background-color :#ed3e04 ;
61- color : white ;
62- }
63- .item {
64- padding : 10 ;
65- color : white ;
66- }
67- .title {
68- font-size : 17 ;
69- font-weight : bold ;
70- }
71- .subtitle {
72- font-size : 14 ;
73- }
74- </style >
0 commit comments