diff --git a/lib/ui/home_page.dart b/lib/ui/home_page.dart index b11686e..ef56eb1 100644 --- a/lib/ui/home_page.dart +++ b/lib/ui/home_page.dart @@ -3,6 +3,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; import 'package:share/share.dart'; +import 'package:transparent_image/transparent_image.dart'; import 'gif_page.dart'; @@ -53,8 +54,10 @@ class _HomePageState extends State { itemBuilder: (context, index) { if (_search == null || index < snapshot.data['data'].length) { return GestureDetector( - child: Image.network( - snapshot.data['data'][index]['images']['fixed_height']['url'], + child: FadeInImage.memoryNetwork( + placeholder: kTransparentImage, + image: snapshot.data['data'][index]['images']['fixed_height'] + ['url'], height: 300.0, fit: BoxFit.cover, ), @@ -66,7 +69,8 @@ class _HomePageState extends State { GifPage(snapshot.data['data'][index]))); }, onLongPress: () { - Share.share(snapshot.data['data'][index]['images']['fixed_height']['url']); + Share.share(snapshot.data['data'][index]['images']['fixed_height'] + ['url']); }, ); } else { diff --git a/pubspec.lock b/pubspec.lock index abb953d..c5745b4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -331,6 +331,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.12.37" + transparent_image: + dependency: "direct main" + description: + name: transparent_image + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.0" typed_data: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 924a563..73db53f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,6 +9,7 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^0.1.2 share: ^0.5.3 + transparent_image: ^0.1.0 dev_dependencies: flutter_test: