flutter/examples/layers/rendering/hello_world.dart
Adam Barth 1ab3d3a71c Add a raw hello_world that shows "Hello, world"
Previously, hello_world.dart was an interactive circle. I've moved that
to touch_input.dart. We should eventually harmonize the touch input
examples at all the layers.
2016-02-13 16:51:00 -08:00

23 lines
830 B
Dart

// 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.
// This example shows how to show the text 'Hello, world.' using the underlying
// render tree.
import 'package:flutter/rendering.dart';
void main() {
// We use RenderingFlutterBinding to attach the render tree to the window.
new RenderingFlutterBinding(
// The root of our render tree is a RenderPositionedBox, which centers its
// child both vertically and horizontally.
root: new RenderPositionedBox(
alignment: const FractionalOffset(0.5, 0.5),
// We use a RenderParagraph to display the text 'Hello, world.' without
// any explicit styling.
child: new RenderParagraph(new PlainTextSpan('Hello, world.'))
)
);
}