Text

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


 
library demo;

import 'dart:math';
import 'dart:html' as html;
import 'package:stagexl/stagexl.dart';

part 'text_demo.dart';

Stage stage = new Stage(html.querySelector('#stage'), webGL: true);
RenderLoop renderLoop = new RenderLoop();

void main() {
  renderLoop.addStage(stage);
  stage.addChild(new TextDemo());
}                      
part of demo;

class TextDemo extends DisplayObjectContainer {

  final String text = 
'Filet mignon leberkas pig pork chop biltong, short loin strip steak turkey brisket ' 
'venison. Pastrami venison pancetta, leberkas pork chop chicken prosciutto beef ribs '
'bresaola kielbasa swine biltong capicola. Hamburger beef ribs ball tip drumstick salami '  
'pig. Capicola pork loin shank, salami chicken hamburger tail. Sirloin spare ribs '
'ground round cow strip steak prosciutto swine bacon corned beef.';

  TextDemo() {
    
    var textField1 = new TextField();
    var textFormat1 = new TextFormat('Helvetica,Arial', 14, Color.Green, bold:true, italic:true);
    textField1.defaultTextFormat = textFormat1;
    textField1.text = text;
    textField1.x = 10;
    textField1.y = 10;
    textField1.width = 920;
    textField1.height = 20;
    addChild(textField1);

    //------------------------------------------------------------------

    var textField2 = new TextField();
    var textFormat2 = new TextFormat('Helvetica,Arial', 16, Color.Red);
    textField2.defaultTextFormat = textFormat2;
    textField2.text = text;
    textField2.x = 10;
    textField2.y = 50;
    textField2.width = 200;
    textField2.height = 300;
    textField2.wordWrap = true;
    addChild(textField2);

    //------------------------------------------------------------------

    var textField3 = new TextField();
    var textFormat3 = new TextFormat('Helvetica,Arial', 16, Color.Blue, align:TextFormatAlign.RIGHT);
    textField3.defaultTextFormat = textFormat3;
    textField3.text = text;
    textField3.x = 300;
    textField3.y = 50;
    textField3.width = 200;
    textField3.height = 300;
    textField3.wordWrap = true;
    addChild(textField3);

    //------------------------------------------------------------------

    var textField4 = new TextField();
    var textFormat4 = new TextFormat('Caesar Dressing', 30, Color.Black, align:TextFormatAlign.CENTER);
    textField4.defaultTextFormat = textFormat4;
    textField4.text = text;
    textField4.x = 590;
    textField4.y = 50;
    textField4.width = 340;
    textField4.height = 300;
    textField4.wordWrap = true;
    addChild(textField4);    
  }
}