blob: 208bcf1c05db6b544a3b8ad9be6235f3c67b5292 [file] [log] [blame]
Collin Jackson633b6502015-07-16 11:54:25 -07001// Copyright 2015 The Chromium 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
Adam Barth025c43d2016-02-13 14:30:37 -08005// This example shows how to build a render tree with a non-cartesian coordinate
6// system. Most of the guts of this examples are in src/sector_layout.dart.
7
Adam Barth65eba902015-10-09 20:44:52 -07008import 'package:flutter/rendering.dart';
Adam Barth948ae152016-02-13 00:52:56 -08009import 'src/sector_layout.dart';
Collin Jackson633b6502015-07-16 11:54:25 -070010
11RenderBox buildSectorExample() {
Alexandre Ardhuind927c932018-09-12 08:29:29 +020012 final RenderSectorRing rootCircle = RenderSectorRing(padding: 20.0);
13 rootCircle.add(RenderSolidColor(const Color(0xFF00FFFF), desiredDeltaTheta: kTwoPi * 0.15));
14 rootCircle.add(RenderSolidColor(const Color(0xFF0000FF), desiredDeltaTheta: kTwoPi * 0.4));
15 final RenderSectorSlice stack = RenderSectorSlice(padding: 2.0);
16 stack.add(RenderSolidColor(const Color(0xFFFFFF00), desiredDeltaRadius: 20.0));
17 stack.add(RenderSolidColor(const Color(0xFFFF9000), desiredDeltaRadius: 20.0));
18 stack.add(RenderSolidColor(const Color(0xFF00FF00)));
Collin Jackson633b6502015-07-16 11:54:25 -070019 rootCircle.add(stack);
Alexandre Ardhuind927c932018-09-12 08:29:29 +020020 return RenderBoxToRenderSectorAdapter(innerRadius: 50.0, child: rootCircle);
Collin Jackson633b6502015-07-16 11:54:25 -070021}
22
23void main() {
Alexandre Ardhuind927c932018-09-12 08:29:29 +020024 RenderingFlutterBinding(root: buildSectorExample());
Collin Jackson633b6502015-07-16 11:54:25 -070025}