hello_world.dart 822 Bytes
Newer Older
1 2 3 4
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5 6 7
// This example shows how to show the text 'Hello, world.' using the underlying
// render tree.

8 9 10
import 'package:flutter/rendering.dart';

void main() {
11
  // We use RenderingFlutterBinding to attach the render tree to the window.
12
  new RenderingFlutterBinding(
13 14
    // The root of our render tree is a RenderPositionedBox, which centers its
    // child both vertically and horizontally.
15
    root: new RenderPositionedBox(
16
      alignment: FractionalOffset.center,
17
      // We use a RenderParagraph to display the text 'Hello, world.' without
18
      // any explicit styling.
Adam Barth's avatar
Adam Barth committed
19
      child: new RenderParagraph(new TextSpan(text: 'Hello, world.'))
20 21 22
    )
  );
}