mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-31 20:52:32 +00:00
* chore(packages): Added pedantic package to enforce linting and styling * feat(lunasea): Enforce effective dart styling * Comment and format colours class * Localize additional classes in Dashboard, cleanup additional code * chore(lunasea): Major refactor by running dartfmt on the entire codebase, added widget return for page routers * Additional work on conforming to effective dart style * fix(share_plus): Roll back share_plus package to 2.0.0 to support iOS 12 or lower * chore(lunasea): Fix remaining enabled analysis warnings
51 lines
1.6 KiB
Dart
51 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:lunasea/core.dart';
|
|
|
|
class LunaNetworkImage extends ClipRRect {
|
|
LunaNetworkImage({
|
|
double height,
|
|
double width,
|
|
String url,
|
|
@required String placeholderAsset,
|
|
Map headers,
|
|
bool roundCorners = true,
|
|
}) : super(
|
|
child: Container(
|
|
child: Stack(
|
|
fit: StackFit.expand,
|
|
children: [
|
|
Image.asset(
|
|
placeholderAsset,
|
|
height: height,
|
|
width: width,
|
|
),
|
|
if (url != null && url.isNotEmpty)
|
|
FadeInImage(
|
|
height: height,
|
|
width: width,
|
|
fadeInDuration: Duration(
|
|
milliseconds: LunaUI.ANIMATION_IMAGE_FADE_IN_SPEED),
|
|
fadeOutDuration: Duration(milliseconds: 1),
|
|
placeholder: AssetImage(placeholderAsset),
|
|
fit: BoxFit.cover,
|
|
image: NetworkImage(url,
|
|
headers: headers?.cast<String, String>()),
|
|
imageErrorBuilder: (context, error, stack) => Container(
|
|
height: height,
|
|
width: width,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
height: height,
|
|
width: width,
|
|
),
|
|
borderRadius:
|
|
roundCorners ? BorderRadius.circular(LunaUI.BORDER_RADIUS) : null,
|
|
) {
|
|
// assert(height != null);
|
|
// assert(width != null);
|
|
assert(placeholderAsset != null);
|
|
}
|
|
}
|