Skip to content

Commit

Permalink
Format all dart files
Browse files Browse the repository at this point in the history
  • Loading branch information
jbarr21 committed Aug 10, 2018
1 parent d403742 commit 6e519fa
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 25 deletions.
3 changes: 1 addition & 2 deletions lib/app.dart
Expand Up @@ -53,8 +53,7 @@ class FlewsAppState extends State<FlewsApp>
indicatorColor: themeData.textTheme.title.color,
tabs: PAGES.map((Page page) {
return Tab(
icon: ImageIcon(
AssetImage('images/icons/${page.icon}')));
icon: ImageIcon(AssetImage('images/icons/${page.icon}')));
}).toList(),
),
),
Expand Down
11 changes: 5 additions & 6 deletions lib/hackernews/stories_page.dart
Expand Up @@ -51,11 +51,10 @@ class _StoriesPageState extends State<StoriesPage> {
}

void loadStories() {
_repository.getTopStories()
.listen((List<Story> stories) {
setState(() {
_stories = stories;
});
});
_repository.getTopStories().listen((List<Story> stories) {
setState(() {
_stories = stories;
});
});
}
}
11 changes: 6 additions & 5 deletions lib/hackernews/stories_repository.dart
Expand Up @@ -8,15 +8,15 @@ import 'package:flews/util.dart';
import 'package:http/http.dart';
import 'package:rxdart/rxdart.dart';

const FullType listOfInts = const FullType(BuiltList, const [const FullType(int)]);
const FullType listOfInts =
const FullType(BuiltList, const [const FullType(int)]);

abstract class StoriesRepository {
Observable<List<Story>> getTopStories();
Observable<Story> getStory(int id);
}

class StoriesRepositoryImpl extends StoriesRepository {

static const String baseUrl = 'https://hacker-news.firebaseio.com/v0/';
static const String topStoriesUrl = 'topstories.json';
static const String storyDetailsUrl = 'item';
Expand All @@ -31,8 +31,8 @@ class StoriesRepositoryImpl extends StoriesRepository {
.where((Response response) => response != null)
.map((Response response) => json.decode(response.body))
.flatMap((dynamic body) {
BuiltList<int> topStoryIds = serializers.deserialize(body,
specifiedType: listOfInts);
BuiltList<int> topStoryIds =
serializers.deserialize(body, specifiedType: listOfInts);
return Observable.fromIterable(topStoryIds);
})
.take(50)
Expand All @@ -47,6 +47,7 @@ class StoriesRepositoryImpl extends StoriesRepository {
return Observable.fromFuture(client.get(url))
.where((Response response) => response != null)
.map((Response response) => json.decode(response.body))
.map((dynamic body) => serializers.deserializeWith(Story.serializer, body));
.map((dynamic body) =>
serializers.deserializeWith(Story.serializer, body));
}
}
3 changes: 1 addition & 2 deletions lib/imgur/images_page.dart
Expand Up @@ -49,8 +49,7 @@ class _ImagesPageState extends State<ImagesPage> {
return RefreshIndicator(
child: AnimatedCrossFade(
firstChild: Center(child: CircularProgressIndicator()),
secondChild:
Column(children: <Widget>[Expanded(child: gridView)]),
secondChild: Column(children: <Widget>[Expanded(child: gridView)]),
crossFadeState: _images.isEmpty
? CrossFadeState.showFirst
: CrossFadeState.showSecond,
Expand Down
11 changes: 5 additions & 6 deletions lib/serializers.dart
Expand Up @@ -11,11 +11,10 @@ import 'package:flews/reddit/post.dart';
part 'serializers.g.dart';

@SerializersFor(const [
Story, // HN
Posts, // Reddit
Story, // HN
Posts, // Reddit
GalleryItems, // Imgur
Repos // GH
Repos // GH
])
final Serializers serializers = (_$serializers.toBuilder()
..addPlugin(StandardJsonPlugin())
).build();
final Serializers serializers =
(_$serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build();
7 changes: 3 additions & 4 deletions lib/util.dart
Expand Up @@ -21,15 +21,14 @@ class Url {

class Dates {
static lastWeek({String format = 'yyyy-MM-dd'}) {
return DateFormat(format)
.format(DateTime.now().add(Duration(days: -7)));
return DateFormat(format).format(DateTime.now().add(Duration(days: -7)));
}
}

class ClipboardUtils {
static copyText(BuildContext context, String text) {
Clipboard.setData(ClipboardData(text: text));
Scaffold.of(context).showSnackBar(SnackBar(
content: Text('Copied to clipboard:\n$text')));
Scaffold.of(context)
.showSnackBar(SnackBar(content: Text('Copied to clipboard:\n$text')));
}
}

0 comments on commit 6e519fa

Please sign in to comment.