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

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.

Flutter

              
                import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Basic Properties'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  bool _pushed = false;

  // 子ウィジェットの表示位置のリスト
  List<Map<int, TableColumnWidth>> _list = [
    // 各ウィジェットを1:2:3の比で表示する
    {0: FlexColumnWidth(1), 1: FlexColumnWidth(2), 2: FlexColumnWidth(3)},
    /* IntrinsicColumnWidthは子ウィジェットの横幅に合わせて表示
       引数なしのFlexColumnWidthは余った幅いっぱいに表示
       FixedColumnWidthは幅を固定表示
    */
    {0: IntrinsicColumnWidth(), 1: FlexColumnWidth(), 2: FixedColumnWidth(100)},
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(widget.title)),
      floatingActionButton: FloatingActionButton(
        child: Text("B"),
        onPressed: () {
          setState(() {
            _pushed = !_pushed;
          });
        },
      ),
      body: Table(
        // ポーダーラインをつける
        border: TableBorder.all(color: Colors.blueAccent),
        // ウィジェットの表示を設定する
        columnWidths: _pushed ? _list[1] : _list[0],
        children: <TableRow>[
          TableRow(
            children: [
              myWidget(
                color: Colors.red,
                text: "red",
                height: 200.0,
              ),
              // セルごとに細かな設定も可能
              TableCell(
                verticalAlignment: TableCellVerticalAlignment.bottom,
                child: myWidget(
                  color: Colors.blue,
                  text: "blue",
                  height: 100.0,
                ),
              ),
              myWidget(
                color: Colors.green,
                text: "green",
                height: 100.0,
              ),
            ],
          ),
          TableRow(
            children: [
              myWidget(
                color: Colors.green,
                text: "green",
                height: 100.0,
              ),
              myWidget(
                color: Colors.red,
                text: "red",
                height: 100.0,
              ),
              myWidget(
                color: Colors.blue,
                text: "blue",
                height: 200.0,
              ),
            ],
          ),
        ],
      ),
    );
  }

  Widget myWidget({Color color, String text, double height}) {
    return Padding(
      padding: const EdgeInsets.all(8.0),
      child: Container(
        height: height,
        color: color,
        child: Text(text),
      ),
    );
  }
}

              
            
!
999px

Console