Pen Settings

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(primarySwatch: Colors.purple),
      debugShowCheckedModeBanner: false,
      home: PlayersList(),
    );
  }
}

class PlayersList extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(
          "Week's top 5".toUpperCase(),
          textAlign: TextAlign.start,
          style: TextStyle(fontSize: 25),
        ),
      ),
      backgroundColor: Colors.purpleAccent,
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: ListView(
          children: players.map((player) {
            return Padding(
              padding: const EdgeInsets.all(8.0),
              child: InkWell(
                onTap: () {
                  Navigator.of(context).push(MaterialPageRoute(
                      builder: (context) => PlayerDetails(player)));
                },
                child: Card(
                  shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(16)),
                  child: Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: Row(
                      children: <Widget>[
                        Hero(
                          tag: player.name,
                          child: ClipRRect(
                            borderRadius: BorderRadius.circular(200),
                            child: Image.network(
                              player.imageURL,
                              height: 70,
                              width: 70,
                            ),
                          ),
                        ),
                        Padding(
                          padding: const EdgeInsets.all(8.0),
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: <Widget>[
                              Text(
                                player.name,
                                style: Theme.of(context).textTheme.headline,
                              ),
                              Text(
                                player.shirtNumber.toString() +
                                    "   " +
                                    player.club,
                                style: Theme.of(context).textTheme.subhead,
                              )
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
              ),
            );
          }).toList(),
        ),
      ),
    );
  }
}

class PlayerDetails extends StatelessWidget {
  const PlayerDetails(this.player);

  final Player player;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.purpleAccent,
      appBar: AppBar(
        title: Text(
          "Player Details",
          style: TextStyle(fontSize: 25),
        ),
      ),
      body: Padding(
        padding: const EdgeInsets.all(48.0),
        child: ListView(
          children: <Widget>[
            Stack(
              fit: StackFit.loose,
              children: <Widget>[
                Column(
                  children: <Widget>[
                    Image.network(fifaCardBG),
                    Container(
                      height: 24,
                    ),
                    Text(
                      loremIpsumText,
                      textAlign: TextAlign.center,
                      style: TextStyle(color: Colors.white, fontSize: 20),
                    )
                  ],
                ),
                Column(
                  children: <Widget>[
                    Padding(
                      padding:
                          const EdgeInsets.only(top: 84, left: 24, right: 24),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: <Widget>[
                          Column(
                            children: <Widget>[
                              Text(
                                player.rating.toString(),
                                style: TextStyle(fontSize: 52),
                              ),
                              Text(
                                "LW".toString(),
                                style: TextStyle(fontSize: 28),
                              ),
                              Container(
                                height: 48,
                              ),
                              Text(
                                player.shirtNumber.toString(),
                                style: TextStyle(fontSize: 32),
                              )
                            ],
                            mainAxisSize: MainAxisSize.min,
                          ),
                          ClipRRect(
                            borderRadius: BorderRadius.circular(10),
                            child: Hero(
                              tag: player.name,
                              child: Image.network(
                                player.imageURL,
                                height: 200,
                                width: 200,
                              ),
                            ),
                          ),
                        ],
                      ),
                    ),
                    Container(
                      height: 32,
                    ),
                    Text(
                      player.name,
                      style: TextStyle(
                        fontSize: 32,
                      ),
                    ),
                    Text(
                      player.club,
                      style: TextStyle(fontSize: 24),
                    )
                  ],
                ),
              ],
            ),
          ],
        ),
      ),
    );
  }
}

String fifaCardBG = "https://fut-watch.com/img/20/card/goldrare_gold.png";

class Player {
  String name;
  String club;
  int shirtNumber;
  int rating;
  String imageURL;

  Player(this.name, this.club, this.rating, this.shirtNumber, this.imageURL);
}

List<Player> players = [
  Player("Raheem Sterling", "Manchester City", 94, 7,
      "https://resources.premierleague.com/premierleague/photos/players/250x250/p103955.png"),
  Player("Mesut Özil", "Arsenal", 94, 11,
      "https://resources.premierleague.com/premierleague/photos/players/250x250/p37605.png"),
  Player("Virgil van Dijk", "Liverpool FC", 94, 4,
      "https://resources.premierleague.com/premierleague/photos/players/250x250/p97032.png"),
  Player("Sergio Agüero", "Manchester City", 94, 10,
      "https://resources.premierleague.com/premierleague/photos/players/250x250/p37572.png"),
  Player("Mohamed Salah", "Liverpool FC", 94, 10,
      "https://resources.premierleague.com/premierleague/photos/players/250x250/p118748.png"),
];

String loremIpsumText =
    "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum";

              
            
!
999px

Console