From 72b6099c16f48075fd285646805aa73a62e449aa Mon Sep 17 00:00:00 2001 From: stephengrider Date: Mon, 25 Jun 2018 14:38:31 -0600 Subject: [PATCH] indentation --- news/lib/src/models/item_model.dart | 2 +- news/lib/src/screens/news_detail.dart | 2 +- news/lib/src/widgets/comment.dart | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/news/lib/src/models/item_model.dart b/news/lib/src/models/item_model.dart index 8b5f33e..b23486d 100644 --- a/news/lib/src/models/item_model.dart +++ b/news/lib/src/models/item_model.dart @@ -19,7 +19,7 @@ class ItemModel { : id = parsedJson['id'], deleted = parsedJson['deleted'] ?? false, type = parsedJson['type'], - by = parsedJson['by'], + by = parsedJson['by'] ?? '', time = parsedJson['time'], text = parsedJson['text'] ?? '', dead = parsedJson['dead'] ?? false, diff --git a/news/lib/src/screens/news_detail.dart b/news/lib/src/screens/news_detail.dart index 6914ebe..08fef00 100644 --- a/news/lib/src/screens/news_detail.dart +++ b/news/lib/src/screens/news_detail.dart @@ -48,7 +48,7 @@ class NewsDetail extends StatelessWidget { final children = []; children.add(buildTitle(item)); final commentsList = item.kids.map((kidId) { - return Comment(itemId: kidId, itemMap: itemMap); + return Comment(itemId: kidId, itemMap: itemMap, depth: 0); }).toList(); children.addAll(commentsList); diff --git a/news/lib/src/widgets/comment.dart b/news/lib/src/widgets/comment.dart index e0c911b..542b53b 100644 --- a/news/lib/src/widgets/comment.dart +++ b/news/lib/src/widgets/comment.dart @@ -5,8 +5,9 @@ import '../models/item_model.dart'; class Comment extends StatelessWidget { final int itemId; final Map> itemMap; + final int depth; - Comment({this.itemId, this.itemMap}); + Comment({this.itemId, this.itemMap, this.depth}); Widget build(context) { return FutureBuilder( @@ -21,13 +22,13 @@ class Comment extends StatelessWidget { final children = [ ListTile( title: Text(item.text), - subtitle: Text(item.by), + subtitle: item.by == "" ? Text("Deleted") : Text(item.by), ), Divider(), ]; item.kids.forEach((kidId) { children.add( - Comment(itemId: kidId, itemMap: itemMap), + Comment(itemId: kidId, itemMap: itemMap, depth: depth + 1), ); });