Files
PiliPlus/lib/common/widgets/avatars.dart
My-Responsitories 9d94c72e95 tweaks (#2426)
* opt: danmaku weight

* opt: cache clean

* opt: level img

* opt: play icon

* opt: svg big-vip

* opt: webview ua

* opt: simple dialog

* feat: export vtt

* tweak

* opt: mapIndexed

* feat: more subtitle

* refa: settings page

* feat: codec list options

* drawPath

Signed-off-by: dom <githubaccount56556@proton.me>

* custom dialog option

Signed-off-by: dom <githubaccount56556@proton.me>

* update

Signed-off-by: dom <githubaccount56556@proton.me>

* Revert "drawPath"

This reverts commit e8a4b19f0f.

* opt: _initStreamIndex

* fix: avoid gap

* fix: scale [skip ci]

* fix: hide repost menu not login

* tweaks

Signed-off-by: dom <githubaccount56556@proton.me>

---------

Co-authored-by: dom <githubaccount56556@proton.me>
2026-06-26 10:51:41 +08:00

58 lines
1.5 KiB
Dart

import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
import 'package:PiliPlus/models/model_owner.dart';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
Widget avatars({
required ColorScheme colorScheme,
required Iterable<Owner> users,
double gap = 6.0,
}) {
const size = 22.0;
const padding = 0.8;
final offset = size - gap;
const imgSize = size - 2 * padding;
if (users.length == 1) {
return NetworkImgLayer(
src: users.first.face,
width: imgSize,
height: imgSize,
type: .avatar,
);
} else {
final decoration = BoxDecoration(
shape: .circle,
border: Border.all(color: colorScheme.surface),
);
return SizedBox(
height: size,
width: offset * users.length + gap,
child: Stack(
clipBehavior: .none,
children: users
.mapIndexed(
(i, e) => Positioned(
top: 0,
bottom: 0,
width: size,
left: i * offset,
child: DecoratedBox(
decoration: decoration,
child: Padding(
padding: const .all(padding),
child: NetworkImgLayer(
src: e.face,
width: imgSize,
height: imgSize,
type: .avatar,
),
),
),
),
)
.toList(),
),
);
}
}