diff --git a/lib/app.dart b/lib/app.dart index 3eab781..b968f20 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -53,8 +53,7 @@ class FlewsAppState extends State 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(), ), ), diff --git a/lib/hackernews/stories_page.dart b/lib/hackernews/stories_page.dart index 1ce8d94..a64a0ef 100644 --- a/lib/hackernews/stories_page.dart +++ b/lib/hackernews/stories_page.dart @@ -51,11 +51,10 @@ class _StoriesPageState extends State { } void loadStories() { - _repository.getTopStories() - .listen((List stories) { - setState(() { - _stories = stories; - }); - }); + _repository.getTopStories().listen((List stories) { + setState(() { + _stories = stories; + }); + }); } } diff --git a/lib/hackernews/stories_repository.dart b/lib/hackernews/stories_repository.dart index 7d485db..9ba6ee4 100644 --- a/lib/hackernews/stories_repository.dart +++ b/lib/hackernews/stories_repository.dart @@ -8,7 +8,8 @@ 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> getTopStories(); @@ -16,7 +17,6 @@ abstract class StoriesRepository { } 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'; @@ -31,8 +31,8 @@ class StoriesRepositoryImpl extends StoriesRepository { .where((Response response) => response != null) .map((Response response) => json.decode(response.body)) .flatMap((dynamic body) { - BuiltList topStoryIds = serializers.deserialize(body, - specifiedType: listOfInts); + BuiltList topStoryIds = + serializers.deserialize(body, specifiedType: listOfInts); return Observable.fromIterable(topStoryIds); }) .take(50) @@ -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)); } } diff --git a/lib/imgur/images_page.dart b/lib/imgur/images_page.dart index a5549cb..f4ec4bf 100644 --- a/lib/imgur/images_page.dart +++ b/lib/imgur/images_page.dart @@ -49,8 +49,7 @@ class _ImagesPageState extends State { return RefreshIndicator( child: AnimatedCrossFade( firstChild: Center(child: CircularProgressIndicator()), - secondChild: - Column(children: [Expanded(child: gridView)]), + secondChild: Column(children: [Expanded(child: gridView)]), crossFadeState: _images.isEmpty ? CrossFadeState.showFirst : CrossFadeState.showSecond, diff --git a/lib/serializers.dart b/lib/serializers.dart index 876f340..9e16115 100644 --- a/lib/serializers.dart +++ b/lib/serializers.dart @@ -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(); diff --git a/lib/util.dart b/lib/util.dart index e67099f..e5d3cce 100644 --- a/lib/util.dart +++ b/lib/util.dart @@ -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'))); } }