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(ListViewWidget());
}

// ListView.custom
// 自定义列表
// childrenDelegate 必传参数,
// 需要传入一个实现了 SliverChildDelegate 抽象类的组件,
// 用来给 ListView 组件添加列表项
//
// 它的实现类有 SliverChildListDelegate 和 SliverChildBuilderDelegate
class ListViewWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    List<Widget> _items = List<Widget>.generate(
      100,
      (index) => Container(
        padding: EdgeInsets.all(16.0),
        child: Text("Item $index"),
      ),
    );
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('ListView.custom'),
        ),
        body: ListView.custom(
          childrenDelegate: SliverChildListDelegate(_items),
        ),
      ),
    );
  }
}

              
            
!
999px

Console