1// Copyright 2014 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// This example shows how to show the text 'Hello, world.' using the underlying
6// render tree.
7
8import 'package:flutter/rendering.dart';
9
10import 'src/binding.dart';
11
12void main() {
13 // We use ViewRenderingFlutterBinding to attach the render tree to the window.
14 ViewRenderingFlutterBinding(
15 // The root of our render tree is a RenderPositionedBox, which centers its
16 // child both vertically and horizontally.
17 root: RenderPositionedBox(
18 // We use a RenderParagraph to display the text 'Hello, world.' without
19 // any explicit styling.
20 child: RenderParagraph(
21 const TextSpan(text: 'Hello, world.'),
22 // The text is in English so we specify the text direction as
23 // left-to-right. If the text had been in Hebrew or Arabic, we would
24 // have specified right-to-left. The Flutter framework does not assume a
25 // particular text direction.
26 textDirection: TextDirection.ltr,
27 ),
28 ),
29 ).scheduleFrame();
30}
31