2021-09-29 23:57:09 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2021-11-11 03:00:38 +00:00
|
|
|
import 'package:pikapika/basic/Entities.dart';
|
2021-09-29 23:57:09 +00:00
|
|
|
import 'Images.dart';
|
|
|
|
|
|
|
|
const double _avatarMargin = 5;
|
|
|
|
const double _avatarBorderSize = 1.5;
|
|
|
|
|
|
|
|
// 头像
|
2021-11-12 05:41:26 +00:00
|
|
|
class Avatar extends StatelessWidget {
|
|
|
|
final RemoteImageInfo avatarImage;
|
2021-09-29 23:57:09 +00:00
|
|
|
final double size;
|
|
|
|
|
2022-03-17 03:31:25 +00:00
|
|
|
const Avatar(this.avatarImage, {this.size = 50, Key? key}) : super(key: key);
|
2021-09-29 23:57:09 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
var theme = Theme.of(context);
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.all(_avatarMargin),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
border: Border.all(
|
|
|
|
color: theme.colorScheme.secondary,
|
|
|
|
style: BorderStyle.solid,
|
|
|
|
width: _avatarBorderSize,
|
|
|
|
)),
|
|
|
|
child: ClipRRect(
|
2021-11-12 05:41:26 +00:00
|
|
|
borderRadius: BorderRadius.all(Radius.circular(this.size)),
|
|
|
|
child: RemoteImage(
|
|
|
|
fileServer: this.avatarImage.fileServer,
|
|
|
|
path: this.avatarImage.path,
|
|
|
|
width: this.size,
|
|
|
|
height: this.size,
|
|
|
|
),
|
2021-09-29 23:57:09 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|