Skip to content

Commit

Permalink
Merge pull request #279 from LezdCS/develop
Browse files Browse the repository at this point in the history
Replace NetworkImage for CachedNetworkImage
  • Loading branch information
LezdCS authored Oct 8, 2024
2 parents f13beae + d50f5c4 commit a3fa675
Show file tree
Hide file tree
Showing 10 changed files with 176 additions and 39 deletions.
7 changes: 7 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ PODS:
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite_darwin (0.0.4):
- Flutter
- FlutterMacOS
- url_launcher_ios (0.0.1):
- Flutter
- wakelock_plus (0.0.1):
Expand Down Expand Up @@ -249,6 +252,7 @@ DEPENDENCIES:
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/darwin`)
Expand Down Expand Up @@ -327,6 +331,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite_darwin:
:path: ".symlinks/plugins/sqflite_darwin/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
wakelock_plus:
Expand Down Expand Up @@ -384,6 +390,7 @@ SPEC CHECKSUMS:
ReachabilitySwift: 7f151ff156cea1481a8411701195ac6a984f4979
share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite_darwin: a553b1fd6fe66f53bbb0fe5b4f5bab93f08d7a13
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1
webview_flutter_wkwebview: 0982481e3d9c78fd5c6f62a002fcd24fc791f1e4
Expand Down
20 changes: 14 additions & 6 deletions lib/src/presentation/views/login_view.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:get/get.dart';
Expand Down Expand Up @@ -94,13 +95,20 @@ class LoginView extends GetView<LoginViewController> {
),
),
controller.twitchCredentials.value != null
? CircleAvatar(
backgroundColor: Theme.of(context).colorScheme.surface,
foregroundImage: NetworkImage(
controller
.twitchCredentials.value!.twitchUser.profileImageUrl,
? CachedNetworkImage(
imageUrl: controller
.twitchCredentials.value!.twitchUser.profileImageUrl,
placeholder: (BuildContext context, String url) =>
CircularProgressIndicator(
color: Theme.of(context).colorScheme.tertiary,
),
errorWidget:
(BuildContext context, String url, dynamic error) =>
const Icon(Icons.error),
imageBuilder: (context, imageProvider) => CircleAvatar(
radius: 36,
backgroundImage: imageProvider,
),
radius: 36,
)
: const SizedBox(),
Visibility(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';

class KickEmote extends StatelessWidget {
Expand All @@ -12,10 +13,14 @@ class KickEmote extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Image(
height: height,
return CachedNetworkImage(
imageUrl: "https://files.kick.com/emotes/$emoteId/fullsize",
width: height,
image: NetworkImage("https://files.kick.com/emotes/$emoteId/fullsize"),
height: height,
placeholder: (BuildContext context, String url) =>
const CircularProgressIndicator(),
errorWidget: (BuildContext context, String url, dynamic error) =>
const Icon(Icons.error),
);
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:irllink/src/domain/entities/chat/chat_badge.dart';
Expand All @@ -20,11 +21,15 @@ class Badges extends StatelessWidget {
Container(
padding: const EdgeInsets.only(right: 4),
child: Uri.parse(badge.imageUrl1x).isAbsolute
? Image(
? CachedNetworkImage(
imageUrl: badge.imageUrl1x,
width: textSize,
height: textSize,
image: NetworkImage(badge.imageUrl1x),
filterQuality: FilterQuality.high,
placeholder: (BuildContext context, String url) =>
const CircularProgressIndicator(),
errorWidget:
(BuildContext context, String url, dynamic error) =>
const Icon(Icons.error),
)
: badge.imageUrl1x.endsWith('.svg')
? SvgPicture.asset(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:irllink/src/domain/entities/chat/chat_emote.dart';

Expand All @@ -13,9 +14,13 @@ class ThirdPartEmote extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Image(
return CachedNetworkImage(
imageUrl: emote.url1x,
height: height,
image: NetworkImage(emote.url1x),
placeholder: (BuildContext context, String url) =>
const CircularProgressIndicator(),
errorWidget: (BuildContext context, String url, dynamic error) =>
const Icon(Icons.error),
);
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:irllink/src/domain/entities/chat/chat_emote.dart';

Expand All @@ -15,8 +16,12 @@ class CheerEmote extends StatelessWidget {
Widget build(BuildContext context) {
return Wrap(
children: [
Image(
image: NetworkImage(cheerEmote.url1x),
CachedNetworkImage(
imageUrl: cheerEmote.url1x,
placeholder: (BuildContext context, String url) =>
const CircularProgressIndicator(),
errorWidget: (BuildContext context, String url, dynamic error) =>
const Icon(Icons.error),
),
Text(
'${cheerEmote.id} ',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';

class TwitchEmote extends StatelessWidget {
Expand All @@ -12,10 +13,14 @@ class TwitchEmote extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Image(
return CachedNetworkImage(
imageUrl:
"https://static-cdn.jtvnw.net/emoticons/v2/${emote.key}/default/dark/1.0",
height: height,
image: NetworkImage(
"https://static-cdn.jtvnw.net/emoticons/v2/${emote.key}/default/dark/1.0"),
placeholder: (BuildContext context, String url) =>
const CircularProgressIndicator(),
errorWidget: (BuildContext context, String url, dynamic error) =>
const Icon(Icons.error),
);
}
}
14 changes: 11 additions & 3 deletions lib/src/presentation/widgets/settings/stream_elements.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
Expand Down Expand Up @@ -245,9 +246,16 @@ class StreamElements extends GetView<SettingsViewController> {
Widget _profile(SeMe me) {
return Row(
children: [
CircleAvatar(
foregroundImage: NetworkImage(me.avatar),
radius: 18,
CachedNetworkImage(
imageUrl: me.avatar,
placeholder: (BuildContext context, String url) =>
const CircularProgressIndicator(),
errorWidget: (BuildContext context, String url, dynamic error) =>
const Icon(Icons.error),
imageBuilder: (context, imageProvider) => CircleAvatar(
radius: 18,
backgroundImage: imageProvider,
),
),
const SizedBox(
width: 8,
Expand Down
Loading

0 comments on commit a3fa675

Please sign in to comment.