Skip to content

Commit

Permalink
forgot the getAvatar function
Browse files Browse the repository at this point in the history
  • Loading branch information
lukehmcc committed Jul 31, 2024
1 parent 287e03c commit 5486e25
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/functions/getAvatar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

CircleAvatar getCircleAvatar(
Uint8List? avatarBytes,
String? avatarUrl,
) {
late CircleAvatar circleAvatar;
if (kIsWeb) {
if (avatarUrl != null) {
circleAvatar =
CircleAvatar(backgroundImage: Image.network(avatarUrl).image);
} else {
circleAvatar = const CircleAvatar();
}
} else {
if (avatarBytes != null) {
circleAvatar = CircleAvatar(
backgroundImage: Image.memory(avatarBytes).image,
);
} else {
circleAvatar = const CircleAvatar();
}
}
return circleAvatar;
}

0 comments on commit 5486e25

Please sign in to comment.