avatar_stack
带设置的高级且灵活的头像堆叠。它允许在小空间内放置大量头像或其他小部件。
cyrax111/avatar_stack open-source repository details.
以下为英文项目原文快照,最新内容请访问 GitHub。
Avatar stack is used to visually represent users, places, and things in a limited space.
Try Live Demo :-)
import 'package:avatar_stack/animated_avatar_stack.dart';
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
home: Scaffold(
body: Center(
child: AnimatedAvatarStack(
height: 50,
avatars: [
for (var n = 0; n < 15; n++) NetworkImage('https://i.pravatar.cc/150?img=$n'),
],
),
),
),
));
Usually the stack avatar shows all items as possible but you can restrict it by, say, five items.
By default the stack avatar has left alignment one can change it.
You can set how avatars will coverage each others.
The negative coverage will set space between items.
You can use any widget to stack not only avatars
The additional space between an info item (if exists) and other items.
The way to tile items.
One can use any widget for stacking. Apply WidgetStack widget for that. For example:
import 'package:avatar_stack/avatar_stack.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MaterialApp(home: Example7WidgetStack()));
}
class Example7WidgetStack extends StatelessWidget {
const Example7WidgetStack({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final settings = RestrictedPositions(
maxCoverage: -0.1,
minCoverage: -0.5,
align: StackAlign.right,
);
return Column(
children: [
const Text(
'Any widgets for stack:',
),
const SizedBox(height: 10),
SizedBox(
height: 50,
child: WidgetStack(
positions: settings,
stackedWidgets: [
for (var n = 0; n < 12; n++)
FlutterLogo(
style: FlutterLogoStyle.stacked,
textColor: Color(0xFF * 0x1000000 +
n * 10 * 0x10000 +
(0xFF - n * 10) * 0x100),
),
const FittedBox(
fit: BoxFit.fitHeight,
child: Text('A',
style: TextStyle(height: 0.9, color: Colors.orange))),
const FittedBox(
fit: BoxFit.fitHeight,
child: Text('B', style: TextStyle(height: 0.9))),
const FittedBox(
fit: BoxFit.fitHeight,
child: Text('C',
style: TextStyle(height: 0.9, color: Colors.green))),
],
buildInfoWidget: (surplus) {
return Center(
child: Text(
'+$surplus',
style: Theme.of(context).textTheme.headline5,
));
},
),
),
],
);
}
}
You can also use the example from github https://github.com/cyrax111/avatar_stack/tree/master/example
If you have any ideas on how to enhance this package or have any concern, feel free to make an issue.
依赖清单 3 项
{"sdk":"flutter"}{"sdk":"flutter"}^5.0.0先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗