API Reference 0.7.1rikulo_view_selectPseudoClass

PseudoClass class

class PseudoClass {
 
 final String name;
 String parameter;
 
 PseudoClass(this.name);
 
 String toString() {
   StringBuffer sb = new StringBuffer(":${name}");
   if (parameter != null)
     sb.write("(${parameter})");
   return sb.toString();
 }
 
 // built-in implementations //
 static Function getDefinition(String name) {
   switch (name) {
     case "first-child":
       return (ViewMatchContext ctx, String param) => 
           param == null && ctx.view.previousSibling == null;
     case "last-child":
       return (ViewMatchContext ctx, String param) => 
           param == null && ctx.view.nextSibling == null;
     case "only-child":
       return (ViewMatchContext ctx, String param) => 
           param == null && ctx.view.previousSibling == null 
           && ctx.view.nextSibling == null;
     case "empty":
       return (ViewMatchContext ctx, String param) => 
           param == null && ctx.view.childCount == 0;
     case "nth-child":
       return (ViewMatchContext ctx, String param) => param != null; // TODO
     case "last-nth-child":
       return (ViewMatchContext ctx, String param) => param != null; // TODO
     default:
       return null;
   }
 }
 
}

Static Methods

Function getDefinition(String name) #

static Function getDefinition(String name) {
 switch (name) {
   case "first-child":
     return (ViewMatchContext ctx, String param) => 
         param == null && ctx.view.previousSibling == null;
   case "last-child":
     return (ViewMatchContext ctx, String param) => 
         param == null && ctx.view.nextSibling == null;
   case "only-child":
     return (ViewMatchContext ctx, String param) => 
         param == null && ctx.view.previousSibling == null 
         && ctx.view.nextSibling == null;
   case "empty":
     return (ViewMatchContext ctx, String param) => 
         param == null && ctx.view.childCount == 0;
   case "nth-child":
     return (ViewMatchContext ctx, String param) => param != null; // TODO
   case "last-nth-child":
     return (ViewMatchContext ctx, String param) => param != null; // TODO
   default:
     return null;
 }
}

Constructors

new PseudoClass(String name) #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
PseudoClass(this.name);

Properties

final String name #

final String name

String parameter #

String parameter

Methods

String toString() #

Returns a string representation of this object.

docs inherited from Object
String toString() {
 StringBuffer sb = new StringBuffer(":${name}");
 if (parameter != null)
   sb.write("(${parameter})");
 return sb.toString();
}