2024-05-19 12:30:50 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2024-09-07 09:45:44 +00:00
|
|
|
import 'package:gap/gap.dart';
|
2024-05-19 12:30:50 +00:00
|
|
|
import 'package:get/get.dart';
|
|
|
|
import 'package:solian/models/reaction.dart';
|
|
|
|
|
|
|
|
class PostReactionPopup extends StatelessWidget {
|
2024-07-09 16:44:10 +00:00
|
|
|
final Map<String, int> reactionList;
|
2024-05-19 12:30:50 +00:00
|
|
|
final void Function(String key, ReactInfo info) onReact;
|
|
|
|
|
2024-07-09 16:44:10 +00:00
|
|
|
const PostReactionPopup({
|
|
|
|
super.key,
|
|
|
|
required this.reactionList,
|
|
|
|
required this.onReact,
|
|
|
|
});
|
2024-05-19 12:30:50 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return SizedBox(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'postReaction'.tr,
|
|
|
|
style: Theme.of(context).textTheme.headlineSmall,
|
|
|
|
).paddingOnly(left: 24, right: 24, top: 32, bottom: 16),
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Wrap(
|
|
|
|
runSpacing: 4.0,
|
|
|
|
spacing: 8.0,
|
|
|
|
children: reactions.entries.map((e) {
|
|
|
|
return ActionChip(
|
|
|
|
avatar: Text(e.value.icon),
|
|
|
|
label: Row(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
2024-09-07 09:45:44 +00:00
|
|
|
Text(
|
|
|
|
e.key,
|
|
|
|
style: const TextStyle(fontFamily: 'monospace'),
|
|
|
|
),
|
|
|
|
const Gap(6),
|
2024-07-09 16:44:10 +00:00
|
|
|
Text('x${reactionList[e.key]?.toString() ?? '0'}',
|
|
|
|
style:
|
|
|
|
const TextStyle(fontWeight: FontWeight.bold)),
|
2024-05-19 12:30:50 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
onPressed: () {
|
|
|
|
onReact(e.key, e.value);
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}).toList(),
|
|
|
|
).paddingSymmetric(horizontal: 24),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|