https://github.com/rodrigobertotti/flutter_url_image_load_fail
Flutter - Load a Image and depending of the state show a loading icon or error message
https://github.com/rodrigobertotti/flutter_url_image_load_fail
flutter
Last synced: 6 months ago
JSON representation
Flutter - Load a Image and depending of the state show a loading icon or error message
- Host: GitHub
- URL: https://github.com/rodrigobertotti/flutter_url_image_load_fail
- Owner: RodrigoBertotti
- License: mit
- Created: 2019-02-27T11:03:50.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-01-09T01:18:53.000Z (over 3 years ago)
- Last Synced: 2024-04-24T11:26:27.204Z (about 1 year ago)
- Topics: flutter
- Language: Dart
- Homepage: https://pub.dartlang.org/packages/flutter_url_image_load_fail
- Size: 977 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# flutter_url_image_load_fail
Flutter Widget that allows load images from an URL and define the Widgets that will be shown on loading, loaded with success and failed to load states
## Getting Started

Add the dependency on pubspec.yaml
```yaml
dependencies:
flutter_url_image_load_fail: ^1.0.0
```Import the Widget
```dart
import 'package:flutter_url_image_load_fail/flutter_url_image_load_fail.dart';
```Instantiate the LoadImageFromUrl Widget and use it
```dart
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('flutter_url_image_load_fail example'),
),
body: Center(
child: LoadImageFromUrl(
imageUrl: 'https://upload.wikimedia.org/wikipedia/commons/1/17/Google-flutter-logo.png', //Image URL to load
buildSuccessWidget: (image) => image,
buildLoadingWidget: () => Text('Loading...'),
buildFailedWidget: (retryLoadImage, code, message){
return ElevatedButton(
child: Text('Try Again'),
onPressed: (){
retryLoadImage();
},
);
},
requestTimeout: Duration(seconds: 5) //Optionally set the timeout
),
),
);
}
```