39 lines
1.1 KiB
Dart
39 lines
1.1 KiB
Dart
|
import 'package:cached_network_image/cached_network_image.dart';
|
||
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:flutter_profile_picture/flutter_profile_picture.dart';
|
||
|
|
||
|
class CustomProfile extends StatelessWidget {
|
||
|
final String? imgstring;
|
||
|
final double? radius;
|
||
|
final double? fontsize;
|
||
|
final String? name;
|
||
|
const CustomProfile(
|
||
|
{super.key, this.imgstring, this.fontsize, this.radius, this.name});
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return imgstring == ""
|
||
|
? ProfilePicture(
|
||
|
name: name ?? "",
|
||
|
radius: radius!,
|
||
|
fontsize: fontsize!,
|
||
|
)
|
||
|
: ClipOval(
|
||
|
child: SizedBox.fromSize(
|
||
|
size: Size.fromRadius(radius!),
|
||
|
child: CachedNetworkImage(
|
||
|
imageUrl: imgstring!,
|
||
|
imageBuilder: (context, imageProvider) => Container(
|
||
|
decoration: BoxDecoration(
|
||
|
image: DecorationImage(
|
||
|
image: imageProvider,
|
||
|
fit: BoxFit.fill,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|