Bernds Feedback 2026-10-07: - Schrift-Standard Handy 110 % (statt 115 %). - PyrIconBtn: im Handy-Layout Symbol 22 px (vorher fest 16), Flaeche 40, Tippflaeche 44; Farben aus dem Farbmodus statt fest verdrahtet. - Eingabeleiste: Anhaengen/GIF/Emoji/Senden auf dem Handy 22-23 px statt 12-13 px. - Chat-Kopf (Handy): Anrufen + Videoanruf sichtbar, Suchen + Mitglieder im Drei-Punkte-Menue. - Aufklappbarer DM-Kopf als Ebenen: Zurueck + Symbole bleiben oben, Profilbereich gleitet darunter und nutzt die volle Breite (vorher Name zu "p..." gekuerzt, Symbole rutschten in die Mitte); Kuerzel im Avatar mittig, skaliert mit. - SpringPress (widgets/spring_press.dart): federnde Druck-Rueckmeldung, aus bei "Animationen 0 %". Co-Authored-By: Claude Opus 5.5 <[email protected]>
129 lines
3.6 KiB
Dart
129 lines
3.6 KiB
Dart
import 'dart:math' as math;
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:pyramid/core/appearance.dart';
|
|
import 'package:pyramid/core/theme.dart';
|
|
import 'package:pyramid/widgets/spring_press.dart';
|
|
|
|
// Simple hover-aware widget for desktop hover effects
|
|
class HoverRegion extends StatefulWidget {
|
|
final Widget Function(BuildContext context, bool hovered) builder;
|
|
final MouseCursor cursor;
|
|
|
|
const HoverRegion({
|
|
super.key,
|
|
required this.builder,
|
|
this.cursor = SystemMouseCursors.click,
|
|
});
|
|
|
|
@override
|
|
State<HoverRegion> createState() => _HoverRegionState();
|
|
}
|
|
|
|
class _HoverRegionState extends State<HoverRegion> {
|
|
bool _hovered = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MouseRegion(
|
|
cursor: widget.cursor,
|
|
onEnter: (_) => setState(() => _hovered = true),
|
|
onExit: (_) => setState(() => _hovered = false),
|
|
child: widget.builder(context, _hovered),
|
|
);
|
|
}
|
|
}
|
|
|
|
// Icon button styled to match Pyramid's .icon-btn.
|
|
// Handy-Layout (Bernds Feedback 2026-10-07: Symbole zu klein): Symbol 22 px
|
|
// statt 16, Fläche mind. 40 px, Tippfläche mind. 44 px. Farben folgen dem
|
|
// gewählten Farbmodus, Druck federt (SpringPress).
|
|
class PyrIconBtn extends StatefulWidget {
|
|
final Widget icon;
|
|
final VoidCallback? onPressed;
|
|
final String? tooltip;
|
|
final bool active;
|
|
final Color? activeColor;
|
|
final Color? dangerColor;
|
|
final double size;
|
|
|
|
/// Symbolgröße; ohne Angabe 16 (PC) bzw. 22 (Handy-Layout).
|
|
final double? iconSize;
|
|
|
|
const PyrIconBtn({
|
|
super.key,
|
|
required this.icon,
|
|
this.onPressed,
|
|
this.tooltip,
|
|
this.active = false,
|
|
this.activeColor,
|
|
this.dangerColor,
|
|
this.size = 32,
|
|
this.iconSize,
|
|
});
|
|
|
|
@override
|
|
State<PyrIconBtn> createState() => _PyrIconBtnState();
|
|
}
|
|
|
|
class _PyrIconBtnState extends State<PyrIconBtn> {
|
|
bool _hovered = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final pt = PyramidTheme.of(context);
|
|
final mobile = isMobileLayout(MediaQuery.sizeOf(context));
|
|
|
|
final color = widget.active
|
|
? (widget.activeColor ?? pt.accent)
|
|
: _hovered ? pt.fg : pt.fgMuted;
|
|
|
|
final boxSize = mobile ? math.max(widget.size, 40.0) : widget.size;
|
|
final touchSize = mobile ? math.max(boxSize, 44.0) : boxSize;
|
|
final iconSize = widget.iconSize ?? (mobile ? 22.0 : 16.0);
|
|
|
|
final btn = MouseRegion(
|
|
cursor: SystemMouseCursors.click,
|
|
onEnter: (_) => setState(() => _hovered = true),
|
|
onExit: (_) => setState(() => _hovered = false),
|
|
child: GestureDetector(
|
|
onTap: widget.onPressed,
|
|
child: SpringPress(
|
|
enabled: widget.onPressed != null,
|
|
child: SizedBox(
|
|
width: touchSize,
|
|
height: touchSize,
|
|
child: Center(
|
|
child: AnimatedContainer(
|
|
duration: const Duration(milliseconds: 150),
|
|
curve: Curves.easeOutCubic,
|
|
width: boxSize,
|
|
height: boxSize,
|
|
decoration: BoxDecoration(
|
|
color: _hovered ? pt.bgHover : Colors.transparent,
|
|
borderRadius: BorderRadius.circular(mobile ? boxSize / 2 : 7),
|
|
),
|
|
child: Center(
|
|
child: IconTheme(
|
|
data: IconThemeData(color: color, size: iconSize),
|
|
child: widget.icon,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
|
|
if (widget.tooltip != null) {
|
|
return Tooltip(
|
|
message: widget.tooltip!,
|
|
waitDuration: const Duration(milliseconds: 500),
|
|
child: btn,
|
|
);
|
|
}
|
|
return btn;
|
|
}
|
|
}
|