35 lines
1.2 KiB
Dart
35 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// Central place for rendering emoji glyphs (reactions, pickers, …).
|
|
///
|
|
/// Gives every emoji a uniform, comfortably large size and forces the
|
|
/// platform's color-emoji font, so rendering stays consistent everywhere —
|
|
/// bare `Text(emoji)` inherited the small body size and looked inconsistent.
|
|
class EmojiText extends StatelessWidget {
|
|
/// Size for emojis shown inline next to other text, e.g. reaction chips.
|
|
static const double sizeInline = 15;
|
|
|
|
/// Default size for standalone emojis, e.g. list leadings.
|
|
static const double sizeStandard = 20;
|
|
|
|
/// Size for primary tap targets, e.g. the quick-reaction buttons.
|
|
static const double sizeLarge = 24;
|
|
|
|
final String emoji;
|
|
final double size;
|
|
|
|
const EmojiText(this.emoji, {this.size = sizeStandard, super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Text(
|
|
emoji,
|
|
style: TextStyle(
|
|
fontSize: size,
|
|
height: 1.0,
|
|
// Render emojis with the platform color-emoji font instead of the app
|
|
// font, so they look identical across all usages and devices.
|
|
fontFamilyFallback: const ['Noto Color Emoji', 'Apple Color Emoji'],
|
|
),
|
|
);
|
|
}
|