Building the Comic Page

The ComicPage is going to be the simplest of the widgets we talked about until now: we’re going to give it an AppBar that shows the comic number, and the body is simply going to be a scrollable ListView that shows the comic’s title, image and alt-text:

 class​ ComicPage ​extends​ StatelessWidget {
  ComicPage(​this​.comic);
 
 final​ Map<​String​, ​dynamic​> comic;
 
  @override
  Widget build(BuildContext context) {
 return​ Scaffold(
  appBar: AppBar(title: Text(​"#​​${comic["num"]}​​"​)),
  body: ListView(children: <Widget>[
  Center(
  child: Text(
  comic[​"title"​],
  style: Theme.of(context).textTheme.display3,
  ),
  ),
  Image.network(comic[​"img"​]),
  Padding( ...

Get Programming Flutter now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.