Pen Settings

JavaScript

Babel includes JSX processing.

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

Flutter

              
                import 'package:flutter/material.dart';

void main() {
  runApp(
    MaterialApp(
      home: MyWidget(),
    ),
  );
}

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Container(
          width: 400,
          height: 400,
          child: Stack(
            children: <Widget>[
              const Cell(width: 116, height: 120, x: 194, y: 0),
              const Cell(width: 140, height: 66, x: 220, y: 94),
              const Cell(width: 85, height: 96, x: 245, y: 144),
              const Cell(width: 125, height: 114, x: 216, y: 226),
              const Cell(width: 105, height: 110, x: 150, y: 288),
              const Cell(width: 75, height: 80, x: 85, y: 294),
              const Cell(width: 56, height: 96, x: 60, y: 230),
              const Cell(width: 104, height: 100, x: 5, y: 166),
              const Cell(width: 80, height: 86, x: 0, y: 84),
              const Cell(width: 80, height: 80, x: 56, y: 110),
              const Cell(width: 80, height: 86, x: 64, y: 44),
              const Cell(width: 88, height: 88, x: 113, y: 0),
              const Eye(width: 54, height: 52, x: 239, y: 13),
              const Eye(width: 46, height: 46, x: 10, y: 102),
              const Eye(width: 46, height: 46, x: 48, y: 199),
              const Eye(width: 40, height: 40, x: 177, y: 344),
              const Eye(width: 64, height: 58, x: 272, y: 259),
            ],
          ),
        ),
      ),
    );
  }
}

class Cell extends StatelessWidget {
  final double width;
  final double height;
  final double x;
  final double y;
  const Cell({Key key, this.width, this.height, this.x, this.y})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Positioned(
      left: x,
      top: y,
      child: Container(
        width: width,
        height: height,
        decoration: BoxDecoration(
          color: Colors.red,
          borderRadius: BorderRadius.all(
            Radius.elliptical(width, height),
          ),
        ),
      ),
    );
  }
}

class Eye extends StatelessWidget {
  final double width;
  final double height;
  final double x;
  final double y;
  const Eye({Key key, this.width, this.height, this.x, this.y})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Positioned(
      left: x,
      top: y,
      child: Stack(
        children: [
          Container(
            width: width,
            height: height,
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.all(
                Radius.elliptical(width, height),
              ),
            ),
          ),
          Container(
            width: width * 0.4,
            height: height * 0.4,
            margin: EdgeInsets.all(6),
            decoration: BoxDecoration(
              color: Colors.blue,
              borderRadius: BorderRadius.all(
                Radius.elliptical(width * 0.4, height * 0.4),
              ),
            ),
          ),
        ],
      ),
    );
  }
}

              
            
!
999px

Console