custom_coordinate_systems.dart 1.17 KB
Newer Older
1 2 3 4
// Copyright 2015 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 build a render tree with a non-cartesian coordinate
// system. Most of the guts of this examples are in src/sector_layout.dart.

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

RenderBox buildSectorExample() {
12
  final RenderSectorRing rootCircle = new RenderSectorRing(padding: 20.0);
13 14
  rootCircle.add(new RenderSolidColor(const Color(0xFF00FFFF), desiredDeltaTheta: kTwoPi * 0.15));
  rootCircle.add(new RenderSolidColor(const Color(0xFF0000FF), desiredDeltaTheta: kTwoPi * 0.4));
15
  final RenderSectorSlice stack = new RenderSectorSlice(padding: 2.0);
16 17 18 19 20 21 22 23
  stack.add(new RenderSolidColor(const Color(0xFFFFFF00), desiredDeltaRadius: 20.0));
  stack.add(new RenderSolidColor(const Color(0xFFFF9000), desiredDeltaRadius: 20.0));
  stack.add(new RenderSolidColor(const Color(0xFF00FF00)));
  rootCircle.add(stack);
  return new RenderBoxToRenderSectorAdapter(innerRadius: 50.0, child: rootCircle);
}

void main() {
Ian Hickson's avatar
Ian Hickson committed
24
  new RenderingFlutterBinding(root: buildSectorExample());
25
}