reorganize
This commit is contained in:
parent
b9a2e09e74
commit
220c13a245
12 changed files with 39 additions and 29 deletions
29
lib/widgets/chat_page/spoiler_text.dart
Normal file
29
lib/widgets/chat_page/spoiler_text.dart
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import "package:flutter/material.dart";
|
||||
import "package:flutter_hooks/flutter_hooks.dart";
|
||||
|
||||
class SpoilerText extends HookWidget {
|
||||
final String text;
|
||||
|
||||
const SpoilerText({super.key, required this.text});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final revealed = useState(false);
|
||||
|
||||
return InkWell(
|
||||
onTap: () => revealed.value = !revealed.value,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: revealed.value ? Colors.transparent : Colors.blueGrey,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(color: revealed.value ? null : Colors.transparent),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue