Skip to content

TheSmiths/libwidgetExamples

Repository files navigation

LibWidget Examples

travis status License

Quick examples of the library libwidget.

Button Widget

See the source code of button.widget

In button.widget's controller :

var widgetBuilder = require("libwidget/libWidget").newBuilder(this);

_.extend(this, {
    construct: function (config) {
        widgetBuilder.addRules({
            title: "#label.text",
            type: function (value) {
                var changeColor = function (color) {
                    widgetBuilder.setProperty("#outer", "backgroundColor", color);
                    widgetBuilder.setProperty("#inner", "backgroundColor", color);
                }
                switch(value) {
                    case "primary": changeColor("#1DB7FF"); break;
                    case "cancel": changeColor("#E52D35"); break;
                    default: changeColor("#BABABA");
                }
            }
        }).build(config);
    }
});

and, the related TSS in the app .tss file :

"#button1": {
    top: 100,
    title: "AWESOME",
    type: "cancel"
},

"#button2": {
    top: 20,
    type: "ThisTypeDoesntExist"
}

button.widget

About

Quick examples of the library libwidget

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published