fluffychat/lib/pangea/message_token_text/hidden_text.dart
wcjord 379e4a8db9
Reading assistance (#2175)
* still in draft

* feat(reading_assistance): whole message activity oriented

* chore: fix .env file path

* feat: animate selected toolbar into middle of screen

* chore: initial work for message bubble size animation

* refactor(reading_assistance): hooking up the choice interactions and polishing UI

* chore: animate in content and buttons

* formatting

* position reading content relative to selected token

* working on limiting choices

* chore: fix positioning of toolbar animation

* chore: simplify positioning logic

* chore: animate in button height

* getting there

* rough draft with restricted activity number is complete

---------

Co-authored-by: ggurdin <ggurdin@gmail.com>
2025-03-24 15:20:07 -04:00

46 lines
1,001 B
Dart

import 'package:flutter/material.dart';
class HiddenText extends StatelessWidget {
final String text;
final TextStyle style;
const HiddenText({
super.key,
required this.text,
required this.style,
});
@override
Widget build(BuildContext context) {
final TextPainter textPainter = TextPainter(
text: TextSpan(text: text, style: style),
textDirection: TextDirection.ltr,
)..layout();
final textWidth = textPainter.size.width;
final textHeight = textPainter.size.height;
textPainter.dispose();
return SizedBox(
height: textHeight,
child: Stack(
children: [
Container(
width: textWidth,
height: textHeight,
color: Colors.transparent,
),
Positioned(
bottom: 0,
child: Container(
width: textWidth,
height: 1,
color: style.color,
),
),
],
),
);
}
}