pikapika/lib/screens/components/Avatar.dart

39 lines
1.0 KiB
Dart
Raw Normal View History

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(
2022-03-19 04:12:27 +00:00
margin: const EdgeInsets.all(_avatarMargin),
2021-09-29 23:57:09 +00:00
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
),
);
}
}