Skip to content

Commit

Permalink
add cache library
Browse files Browse the repository at this point in the history
  • Loading branch information
Ida631 committed Dec 9, 2024
1 parent 5c372fb commit 582a3a5
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 5 deletions.
7 changes: 7 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ PODS:
- FlutterMacOS
- sign_in_with_apple (0.0.1):
- Flutter
- sqflite (0.0.3):
- Flutter
- FlutterMacOS
- url_launcher_ios (0.0.1):
- Flutter

Expand All @@ -59,6 +62,7 @@ DEPENDENCIES:
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)

SPEC REPOS:
Expand Down Expand Up @@ -91,6 +95,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sign_in_with_apple:
:path: ".symlinks/plugins/sign_in_with_apple/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"

Expand All @@ -110,6 +116,7 @@ SPEC CHECKSUMS:
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe

PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048
Expand Down
19 changes: 17 additions & 2 deletions lib/presentation/settings/views/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import 'package:swiftcomp/presentation/settings/views/user_profile_page.dart';
import '../viewModels/settings_view_model.dart';
import 'login_page.dart';
import 'tool_setting_page.dart';
import 'package:cached_network_image/cached_network_image.dart';


class SettingsPage extends StatefulWidget {
const SettingsPage({Key? key}) : super(key: key);
Expand Down Expand Up @@ -62,14 +64,27 @@ class _SettingsPageState extends State<SettingsPage> {
key: ValueKey(viewModel.user?.name ?? ""),
leading: viewModel.user?.avatarUrl != null
? CircleAvatar(
backgroundImage: NetworkImage(viewModel.user!.avatarUrl!),
radius: 22.5, // Adjust the radius to match the icon size
backgroundColor: Colors.transparent,
child: ClipOval(
child: CachedNetworkImage(
imageUrl: viewModel.user!.avatarUrl!,
placeholder: (context, url) => const CircularProgressIndicator(strokeWidth: 2),
errorWidget: (context, url, error) {
debugPrint('Error loading image: $url, Error: $error');
return const Icon(Icons.error, color: Colors.red);
},
fit: BoxFit.cover,
),

),
)
: Icon(
: const Icon(
Icons.account_circle,
size: 45,
color: Colors.blueGrey,
),

title: Text(
viewModel.user?.name ?? "",
style: TextStyle(
Expand Down
18 changes: 15 additions & 3 deletions lib/presentation/settings/views/user_profile_page.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:provider/provider.dart';
Expand Down Expand Up @@ -42,10 +43,21 @@ class UserProfilePage extends StatelessWidget {
children: [
viewModel.user?.avatarUrl != null
? CircleAvatar(
backgroundImage: NetworkImage(viewModel.user!.avatarUrl!),
radius: 27.5, // Matches size of 55
radius: 27.5, // Adjust the radius to match the icon size
backgroundColor: Colors.transparent,
child: ClipOval(
child: CachedNetworkImage(
imageUrl: viewModel.user!.avatarUrl!,
placeholder: (context, url) => const CircularProgressIndicator(strokeWidth: 2),
errorWidget: (context, url, error) {
debugPrint('Error loading image: $url, Error: $error');
return const Icon(Icons.error, color: Colors.red);
},
fit: BoxFit.cover,
),
),
)
: Icon(
: const Icon(
Icons.account_circle,
size: 55,
color: Colors.blueGrey,
Expand Down
72 changes: 72 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "8.9.2"
cached_network_image:
dependency: "direct main"
description:
name: cached_network_image
sha256: "28ea9690a8207179c319965c13cd8df184d5ee721ae2ce60f398ced1219cea1f"
url: "https://pub.dev"
source: hosted
version: "3.3.1"
cached_network_image_platform_interface:
dependency: transitive
description:
name: cached_network_image_platform_interface
sha256: "9e90e78ae72caa874a323d78fa6301b3fb8fa7ea76a8f96dc5b5bf79f283bf2f"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
cached_network_image_web:
dependency: transitive
description:
name: cached_network_image_web
sha256: "205d6a9f1862de34b93184f22b9d2d94586b2f05c581d546695e3d8f6a805cd7"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
characters:
dependency: transitive
description:
Expand Down Expand Up @@ -244,6 +268,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_cache_manager:
dependency: transitive
description:
name: flutter_cache_manager
sha256: "8207f27539deb83732fdda03e259349046a39a4c767269285f449ade355d54ba"
url: "https://pub.dev"
source: hosted
version: "3.3.1"
flutter_dotenv:
dependency: "direct main"
description:
Expand Down Expand Up @@ -586,6 +618,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.0"
octo_image:
dependency: transitive
description:
name: octo_image
sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
package_config:
dependency: transitive
description:
Expand Down Expand Up @@ -714,6 +754,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
rxdart:
dependency: transitive
description:
name: rxdart
sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb"
url: "https://pub.dev"
source: hosted
version: "0.27.7"
share_plus:
dependency: "direct main"
description:
Expand Down Expand Up @@ -839,6 +887,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "7.0.0"
sqflite:
dependency: transitive
description:
name: sqflite
sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d
url: "https://pub.dev"
source: hosted
version: "2.3.3+1"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
sha256: "3da423ce7baf868be70e2c0976c28a1bb2f73644268b7ffa7d2e08eab71f16a4"
url: "https://pub.dev"
source: hosted
version: "2.5.4"
stack_trace:
dependency: transitive
description:
Expand All @@ -863,6 +927,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
synchronized:
dependency: transitive
description:
name: synchronized
sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558"
url: "https://pub.dev"
source: hosted
version: "3.1.0+1"
term_glyph:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ dependencies:
flutter_secure_storage: ^9.2.2
google_sign_in: ^6.2.2
sign_in_with_apple: ^6.1.3
cached_network_image: ^3.3.1



Expand Down

0 comments on commit 582a3a5

Please sign in to comment.