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 'package:flutter/material.dart';

void main() {

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

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

  final String title;

  _MyHomePageState createState() => _MyHomePageState();

class _MyHomePageState extends State<MyHomePage> {
  final PageController _controller = PageController(
    // リストの一番初めのページを初期表示に設定
    initialPage: 0,

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(widget.title)),
      body: PageView(
        controller: _controller,
        scrollDirection: Axis.vertical,
        children: <Widget>[
          myPage("Page0 : red",,
          myPage("Page1 : blue",,
          myPage("Page2 : green",,
        // 画面遷移ごとにSnackBarを表示する
        onPageChanged: (index){

  // ページを作成するメソッド
  Widget myPage(String text, Color color) {
    return Padding(
      padding: const EdgeInsets.all(15.0),
      child: Container(
        color: color,
        child: Center(child: Text(text)),

  // SnackBarを作るメソッド
  Widget makeSnackBar(int index) {
    return SnackBar(
      content: Text("moved to Page No.$index"),
      action: SnackBarAction(
        label: "close",
        onPressed: () {},