API Reference 0.7.1rikulo_layoutAbstractLayout

AbstractLayout abstract class

A skeletal implementation of Layout. By extending from this class, the derive can implement only measureWidth, measureHeight and doLayout_.

Notice the default implementation of doLayout already handles the preLayout callback, anchored views and the recursive callback of doLayout of sub views. The derive shall override doLayout_ and handle only the give sub views.

abstract class AbstractLayout extends Layout {
 /** Arranges the layout of non-anchored views.
  * Instead of overriding [doLayout], it is simpler to override this method.
  */
 void doLayout_(MeasureContext mctx, View view, List<View> children);

 /** Default: true.
  */
 bool get isProfileInherited => true;
 /** Default: false.
  */
 bool get isFlex => false;
 void doLayout(MeasureContext mctx, View view) {
   if (view.firstChild != null) {
     final AnchorRelation ar = new AnchorRelation(view);
     for (final View child in ar.indeps) {
       mctx.preLayout(child);
       //unlike View.onLayout_, the layout shall invoke mctx.preLayout
     }

     //1) layout independents
     doLayout_(mctx, view, ar.indeps);

     //2) do anchored
     ar.layoutAnchored(mctx);

     //3) pass control to children
     for (final View child in view.children) {
       if (child.visible)
         child.doLayout_(mctx); //no matter shallLayout_(child)
     }
   }
 }
}

Extends

Layout > AbstractLayout

Subclasses

FreeLayout, LinearLayout, TileLayout

Properties

final bool isFlex #

Default: false.

bool get isFlex => false;

final bool isProfileInherited #

Default: true.

bool get isProfileInherited => true;

Methods

void doLayout(MeasureContext mctx, View view) #

Handles the layout of the given view.

docs inherited from Layout
void doLayout(MeasureContext mctx, View view) {
 if (view.firstChild != null) {
   final AnchorRelation ar = new AnchorRelation(view);
   for (final View child in ar.indeps) {
     mctx.preLayout(child);
     //unlike View.onLayout_, the layout shall invoke mctx.preLayout
   }

   //1) layout independents
   doLayout_(mctx, view, ar.indeps);

   //2) do anchored
   ar.layoutAnchored(mctx);

   //3) pass control to children
   for (final View child in view.children) {
     if (child.visible)
       child.doLayout_(mctx); //no matter shallLayout_(child)
   }
 }
}

abstract void doLayout_(MeasureContext mctx, View view, List<View> children) #

Arranges the layout of non-anchored views. Instead of overriding doLayout, it is simpler to override this method.

abstract int measureHeight(MeasureContext mctx, View view) #

inherited from Layout

Measure the height of the given view.

abstract int measureWidth(MeasureContext mctx, View view) #

inherited from Layout

Measure the width of the given view.