Files
GroundedHelper/frontend/lib/Grounded/designs/MemberAvatar.dart
alvocool d3431ca5de Switch to Inter, round the corners softly and make the nav switch tabs
Inter replaces General Sans (Inter Display for titles and big numbers).
Corners come back from before the squaring commit, scaled to a soft set
(16 cards, 14 buttons, 12 rows, 8 chips) and applied to the screens built
since. The nav is now a cluster of round frosted buttons that switches
Today, Routines, Goals, Groups and Progress in place inside Home: no
pushed pages, no back arrows, and Android back returns to Today.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KhQh614DMeYoQEH9SoMRUw
2026-11-09 07:08:46 +03:00

81 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import '../about/internal/application/TextType.dart';
import '../utils/Colors.dart';
import '../utils/CommonUtils.dart';
import 'scene/SceneArt.dart';
import 'text/Text.dart';
/// A member's round portrait: a landscape picked from their name with the
/// initial on it, so everyone is recognisable without a photo.
Widget memberAvatar(String name, double size, {Color? border}) {
const List<List<Color>> palettes = <List<Color>>[
sceneWorkout,
sceneMeditation,
sceneMustDo,
];
final int seed = sceneSeed(name.isEmpty ? "?" : name);
final String initial =
name.isEmpty ? "?" : name.substring(0, 1).toUpperCase();
return Container(
width: size,
height: size,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color: border ?? colorWhite, width: 2),
),
child: ClipOval(
child: Stack(
fit: StackFit.expand,
children: [
SceneArt(palette: palettes[seed % palettes.length], seed: seed),
Center(
child:
text(initial, size * 0.42, TextType.Medium, color: colorWhite),
),
],
),
),
);
}
/// Several portraits overlapping, with "+N" once there are more than fit.
Widget avatarStack(List<String> names, double size,
{int max = 4, Color? border}) {
final List<String> shown = names.take(max).toList();
final int extra = names.length - shown.length;
final double step = size * 0.68;
final int slots = shown.length + (extra > 0 ? 1 : 0);
return SizedBox(
width: slots == 0 ? 0 : size + step * (slots - 1),
height: size,
child: Stack(
children: [
for (int index = 0; index < shown.length; index++)
Positioned(
left: step * index,
child: memberAvatar(shown[index], size, border: border),
),
if (extra > 0)
Positioned(
left: step * shown.length,
child: Container(
width: size,
height: size,
alignment: Alignment.center,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: colorNight,
border: Border.all(color: border ?? colorWhite, width: 2),
),
child: text("+$extra", size * 0.34, TextType.Medium,
color: colorWhite),
),
),
],
),
);
}