Pen Settings


Babel includes JSX processing.


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.


Auto Save

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.


                import 'dart:async';
import 'dart:ui';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

/// Tom Thumb

void main() {
    home: Scaffold(body: Board()),
    debugShowCheckedModeBanner: false,

final size = window.physicalSize / window.devicePixelRatio;

class Board extends StatefulWidget {
  _BoardState createState() => _BoardState();

class _BoardState extends State<Board> {
  final List<Offset> _points = [];

  final StreamController<List<Offset>> _streamer =

  Stream<List<Offset>> get _point$ =>;

  Widget build(BuildContext context) => MouseRegion(
        onHover: (details) =>
        child: StreamBuilder<List<Offset>>(
          initialData: _points,
          stream: _point$,
          builder: (context, snapshot) =>
              CustomPaint(size: size, painter: Painter(_points)),

class Painter extends CustomPainter {
  static const radius = 10.0;

  static final fill = Paint()..color =;

  final List<Offset> points;

  const Painter(this.points);

  void paint(Canvas canvas, Size size) {
    for (final point in points) canvas.drawCircle(point, 10, fill);

  bool shouldRepaint(Painter oldDelegate) =>
      listEquals(points, oldDelegate.points);