Yin and yang: Difference between revisions
Content added Content deleted
m (→Flutter (without CustomPaint): cosmetics) |
(→Flutter (without CustomPaint): minimized) |
||
Line 2,191: | Line 2,191: | ||
<syntaxhighlight lang="dart">import 'package:flutter/material.dart'; |
<syntaxhighlight lang="dart">import 'package:flutter/material.dart'; |
||
const |
const color = [Colors.black, Colors.white]; |
||
Container cR(int |
Container cR(int iColor, double r, {Widget? child, bool main = false}) => Container( |
||
⚫ | |||
width: r * 2, |
|||
constraints: BoxConstraints.tight(Size.fromRadius(r)), |
|||
height: r * 2, |
|||
clipBehavior: main ? Clip.hardEdge : Clip.none, |
|||
⚫ | |||
⚫ | |||
clipBehavior: clip, |
|||
child: Center(child: child)); |
child: Center(child: child)); |
||
Container yinYang(double r, [double th = 1.0]) => cR(0, r + th, |
Container yinYang(double r, [double th = 1.0]) => cR(0, r + th, |
||
main: true, |
|||
child: cR(1, r, |
child: cR(1, r, |
||
child: Stack(alignment: Alignment.center, children: [ |
child: Stack(alignment: Alignment.center, children: [ |
||
Container(color: |
Container(color: color[0], margin: EdgeInsets.only(left: r)), |
||
Column(children: List.generate(2, (i) => cR(1 - i, r / 2, child: cR(i, r / 6)))) |
Column(children: List.generate(2, (i) => cR(1 - i, r / 2, child: cR(i, r / 6)))) |
||
]))); |
]))); |
||
void main() => runApp( |
void main() => runApp(MaterialApp( |
||
⚫ | |||
class MainApp extends StatelessWidget { |
|||
const MainApp({super.key}); |
|||
@override |
|||
Widget build(BuildContext context) => MaterialApp( |
|||
home: Container( |
|||
color: colors[1], |
|||
⚫ | |||
⚫ | |||
} |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||