File tree Expand file tree Collapse file tree 8 files changed +62
-34
lines changed Expand file tree Collapse file tree 8 files changed +62
-34
lines changed Original file line number Diff line number Diff line change @@ -5,5 +5,5 @@ nativescript-fab.sln
5
5
.sln
6
6
* .sln
7
7
demo /
8
- sample1.png
9
- sample2.png
8
+ screens /
9
+
Original file line number Diff line number Diff line change @@ -8,25 +8,33 @@ XML widget to create the Material Design Floating Action Button for Android Nati
8
8
9
9
### Screenshot
10
10
---------------
11
- ![ FAB Screenshot] ( sample .png)
11
+ ![ FAB Screenshot] ( screens/fab .png)
12
12
13
13
## Usage
14
14
15
15
#### XML
16
16
##### ** NOTE** The sample XML here will position the FAB on top of the ListView. There is no need for absolute positioning.
17
17
``` XML
18
- <Page xmlns =" http://schemas.nativescript.org/tns.xsd"
18
+ <Page xmlns =" http://schemas.nativescript.org/tns.xsd" loaded = " pageLoaded "
19
19
xmlns : FAB =" nativescript-floatingactionbutton" >
20
- <grid-layout rows =" auto, *, auto" >
21
- <list-view row =" 1" >
22
- <list-view .itemTemplate>
23
- <label text =" Hello" />
24
- </list-view .itemTemplate>
25
- </list-view >
26
- <android row =" 1" >
27
- <FAB : fab tap =" fabTap" icon =" ic_menu_camera" backColor =" #ff4081" rippleColor =" #f1f1f1" class =" fab-button" />
28
- </android >
29
- </grid-layout >
20
+ <Page .actionBar>
21
+ <ActionBar title =" Native FAB" backgroundColor =" #3F51B5" color =" #fff" />
22
+ </Page .actionBar>
23
+ <grid-layout rows =" auto, *" >
24
+ <list-view row =" 1" items =" {{ users }}" >
25
+ <list-view .itemTemplate>
26
+ <label text =" {{ name }}" textWrap =" true" fontSize =" 18" margin =" 20" />
27
+ </list-view .itemTemplate>
28
+ </list-view >
29
+ <android row =" 1" >
30
+ <FAB : fab tap =" fabTap"
31
+ row =" 1"
32
+ icon =" res://ic_add_white"
33
+ backColor =" #ff4081"
34
+ rippleColor =" #f1f1f1"
35
+ class =" fab-button" />
36
+ </android >
37
+ </grid-layout >
30
38
</Page >
31
39
```
32
40
Original file line number Diff line number Diff line change 1
1
var app = require ( "application" ) ;
2
+ var observable = require ( "data/observable" ) ;
2
3
var platformModule = require ( "platform" ) ;
3
4
var color = require ( "color" ) ;
5
+
6
+ var users = [
7
+ { name : 'Billy Bob' } ,
8
+ { name : 'Tweeder' } ,
9
+ { name : 'Mox' } ,
10
+ { name : 'Coach' } ,
11
+ { name : 'Lance' } ,
12
+ { name : 'Johnson' } ,
13
+ { name : 'William' } ,
14
+ { name : 'Franklin' } ,
15
+ { name : 'Napoleon' } ,
16
+ ] ;
17
+ var viewModel = new observable . Observable ( {
18
+ users : users
19
+ } ) ;
4
20
5
21
function pageLoaded ( args ) {
6
22
var page = args . object ;
@@ -9,5 +25,6 @@ function pageLoaded(args) {
9
25
var window = app . android . startActivity . getWindow ( ) ;
10
26
window . setStatusBarColor ( new color . Color ( "#303F9F" ) . android ) ;
11
27
}
28
+ page . bindingContext = viewModel ;
12
29
}
13
30
exports . pageLoaded = pageLoaded ;
Original file line number Diff line number Diff line change 1
- <Page xmlns =" http://schemas.nativescript.org/tns.xsd"
2
- xmlns : FAB =" nativescript-floatingactionbutton" loaded =" pageLoaded" >
3
- <Page .actionBar>
4
- <ActionBar title =" NativeScript-SignaturePad" color =" #fff" backgroundColor =" #3F51B5" />
5
- </Page .actionBar>
6
- <StackLayout >
7
- <grid-layout rows =" auto, *" id =" main-content" >
8
- <label text =" Native FAB down there..." class =" title" row =" 0" />
9
-
10
- <FAB : fab tap =" fabTap"
11
- row =" 1"
12
- icon =" res://ic_add_white"
13
- backColor =" #ff4081"
14
- rippleColor =" #f1f1f1"
15
- class =" fab-button" />
16
- </grid-layout >
17
- </StackLayout >
18
- </Page >
1
+ <Page xmlns =" http://schemas.nativescript.org/tns.xsd" loaded =" pageLoaded"
2
+ xmlns : FAB =" nativescript-floatingactionbutton" >
3
+ <Page .actionBar>
4
+ <ActionBar title =" Native FAB" backgroundColor =" #3F51B5" color =" #fff" />
5
+ </Page .actionBar>
6
+ <grid-layout rows =" auto, *" >
7
+ <list-view row =" 1" items =" {{ users }}" >
8
+ <list-view .itemTemplate>
9
+ <label text =" {{ name }}" textWrap =" true" fontSize =" 18" margin =" 20" />
10
+ </list-view .itemTemplate>
11
+ </list-view >
12
+ <android row =" 1" >
13
+ <FAB : fab tap =" fabTap"
14
+ row =" 1"
15
+ icon =" res://ic_add_white"
16
+ backColor =" #ff4081"
17
+ rippleColor =" #f1f1f1"
18
+ class =" fab-button" />
19
+ </android >
20
+ </grid-layout >
21
+ </Page >
Original file line number Diff line number Diff line change 30
30
this . _android . setBackgroundTintList ( android . content . res . ColorStateList . valueOf ( this . backColor . android ) ) ;
31
31
32
32
if ( this . icon ) {
33
- iconDrawable = null ;
33
+ var iconDrawable = null ;
34
34
35
35
if ( ImageSource . isFileOrResourcePath ( this . icon ) ) {
36
36
iconDrawable = ImageSource . fromFileOrResource ( this . icon ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " nativescript-floatingactionbutton" ,
3
- "version" : " 0.1.71 " ,
3
+ "version" : " 0.1.8 " ,
4
4
"description" : " A NativeScript plugin to provide an XML widget to implement the Material Design Floating Action Button in an Android app." ,
5
5
"main" : " fab.js" ,
6
6
"nativescript" : {
You can’t perform that action at this time.
0 commit comments