feat: Add static + button to pick reaction

This commit is contained in:
S1m 2021-12-22 09:04:19 +00:00 committed by Krille Fear
parent 1c3e0e4d1e
commit 52e51a74ce

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/app_emojis.dart'; import 'package:fluffychat/config/app_emojis.dart';
import 'package:fluffychat/pages/chat/chat.dart'; import 'package:fluffychat/pages/chat/chat.dart';
@ -20,7 +21,7 @@ class ReactionsPicker extends StatelessWidget {
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
height: (display) ? 56 : 0, height: (display) ? 56 : 0,
child: Material( child: Material(
color: Theme.of(context).secondaryHeaderColor, color: Colors.transparent,
child: Builder(builder: (context) { child: Builder(builder: (context) {
if (!display) { if (!display) {
return Container(); return Container();
@ -37,21 +38,19 @@ class ReactionsPicker extends StatelessWidget {
emojis.remove(event.content['m.relates_to']['key']); emojis.remove(event.content['m.relates_to']['key']);
} catch (_) {} } catch (_) {}
} }
return ListView.builder( return Row(children: [
scrollDirection: Axis.horizontal, Expanded(
itemCount: emojis.length + 1,
itemBuilder: (c, i) => i == emojis.length
? InkWell(
borderRadius: BorderRadius.circular(8),
onTap: () => controller.pickEmojiAction(allReactionEvents),
child: Container( child: Container(
width: 56, decoration: BoxDecoration(
height: 56, color: Theme.of(context).secondaryHeaderColor,
alignment: Alignment.center, borderRadius: const BorderRadius.only(
child: const Icon(Icons.add_outlined), bottomRight:
), Radius.circular(AppConfig.borderRadius))),
) padding: const EdgeInsets.only(right: 1),
: InkWell( child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: emojis.length,
itemBuilder: (c, i) => InkWell(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
onTap: () => controller.sendEmojiAction(emojis[i]), onTap: () => controller.sendEmojiAction(emojis[i]),
child: Container( child: Container(
@ -64,7 +63,21 @@ class ReactionsPicker extends StatelessWidget {
), ),
), ),
), ),
); ))),
InkWell(
borderRadius: BorderRadius.circular(8),
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 8),
width: 36,
height: 56,
decoration: BoxDecoration(
color: Theme.of(context).secondaryHeaderColor,
shape: BoxShape.circle,
),
child: const Icon(Icons.add_outlined),
),
onTap: () => controller.pickEmojiAction(allReactionEvents))
]);
}), }),
), ),
); );