Add emote menu widget (#47)
This commit is contained in:
parent
522dc377a0
commit
3285639bc1
2 changed files with 40 additions and 1 deletions
40
lib/screens/channel/chat/emote_menu.dart
Normal file
40
lib/screens/channel/chat/emote_menu.dart
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:frosty/models/emotes.dart';
|
||||
|
||||
import 'chat_store.dart';
|
||||
|
||||
class EmoteMenu extends StatelessWidget {
|
||||
final ChatStore chatStore;
|
||||
final EmoteType emoteType;
|
||||
|
||||
const EmoteMenu({Key? key, required this.chatStore, required this.emoteType}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final emotes = chatStore.emoteToObject.values.toList().where((emote) => emote.type == emoteType).toList();
|
||||
return SizedBox(
|
||||
height: MediaQuery.of(context).size.height / 4,
|
||||
child: GridView.builder(
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 8,
|
||||
mainAxisSpacing: 10.0,
|
||||
crossAxisSpacing: 10.0,
|
||||
),
|
||||
itemCount: emotes.length,
|
||||
itemBuilder: (context, index) {
|
||||
return GestureDetector(
|
||||
onTap: () => chatStore.textController.text += ' ' + emotes[index].name,
|
||||
child: Tooltip(
|
||||
message: emotes[index].name,
|
||||
preferBelow: false,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: emotes[index].url,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -24,7 +24,6 @@ class Video extends StatelessWidget {
|
|||
children: [
|
||||
WebView(
|
||||
initialUrl: 'https://player.twitch.tv/?channel=$userLogin&controls=false&muted=false&parent=frosty',
|
||||
backgroundColor: const Color(0x00000000),
|
||||
javascriptMode: JavascriptMode.unrestricted,
|
||||
allowsInlineMediaPlayback: true,
|
||||
initialMediaPlaybackPolicy: AutoMediaPlaybackPolicy.always_allow,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue