Skip to content

Commit

Permalink
indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenGrider committed Jun 25, 2018
1 parent 465651e commit 72b6099
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion news/lib/src/models/item_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion news/lib/src/screens/news_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class NewsDetail extends StatelessWidget {
final children = <Widget>[];
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);

Expand Down
7 changes: 4 additions & 3 deletions news/lib/src/widgets/comment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import '../models/item_model.dart';
class Comment extends StatelessWidget {
final int itemId;
final Map<int, Future<ItemModel>> itemMap;
final int depth;

Comment({this.itemId, this.itemMap});
Comment({this.itemId, this.itemMap, this.depth});

Widget build(context) {
return FutureBuilder(
Expand All @@ -21,13 +22,13 @@ class Comment extends StatelessWidget {
final children = <Widget>[
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),
);
});

Expand Down

0 comments on commit 72b6099

Please sign in to comment.