Skip to content

Commit

Permalink
add: custom commands base (without creation menu for now), fixed Blur…
Browse files Browse the repository at this point in the history
…Modal going below keyboard, fixed tooltips going below the finger, added custom mentions base, added imgur upload for supported images, added expandable input field for long sentences
  • Loading branch information
Anonymous authored and Anonymous committed Jun 30, 2021
1 parent a104f6b commit 1859675
Show file tree
Hide file tree
Showing 16 changed files with 477 additions and 183 deletions.
9 changes: 9 additions & 0 deletions lib/Commands/Command.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Command {
final String trigger;
final String command;

Command({
required this.trigger,
required this.command,
});
}
16 changes: 16 additions & 0 deletions lib/Commands/CommandsCubit.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:bloc/bloc.dart';
import 'package:chatsen/Commands/Command.dart';

class CommandsCubit extends Cubit<List<Command>> {
CommandsCubit()
: super([
Command(trigger: '/tuck', command: '/me tucks {1} to bed FeelsOkayMan {2+}'),
Command(trigger: '/test3', command: '{2+} {1} z'),
Command(trigger: '/ee', command: '{1} {2} {1} {2} {1} {2} {1} {2} {1} {2} {1} {2} {1} {2} {1} {2} {1} {2} {1} {2} {1} {2} {1} {2} {1} {2} {1} {2} {1} {2} {1} {2}'),
Command(trigger: '/kaomoji', command: '(⌐■_■) kaomoji users (⌐■_■) kaomoji users (⌐■_■) kaomoji users (⌐■_■) kaomoji users'),
Command(trigger: '/dongers', command: 'ヽ༼ຈل͜ຈ༽ノ raise your dongersヽ༼ຈل͜ຈ༽ノ raise your dongers ヽ༼ຈل͜ຈ༽ノ raise your dongers ヽ༼ຈل͜ຈ༽ノ raise your dongers ヽ༼ຈل͜ຈ༽ノ raise your dongers'),
]);

void add(Command cmd) => emit([...state, cmd]);
void remove(Command cmd) => state.removeWhere((element) => element == cmd);
}
272 changes: 179 additions & 93 deletions lib/Components/ChatInputBox.dart

Large diffs are not rendered by default.

113 changes: 89 additions & 24 deletions lib/Components/ChatMessage.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:chatsen/Badges/ChatsenBadges.dart';
import 'package:chatsen/Badges/ChatterinoBadges.dart';
import 'package:chatsen/Badges/FFZAPBadges.dart';
Expand All @@ -12,6 +13,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_chatsen_irc/Twitch.dart' as twitch;
import 'package:octo_image/octo_image.dart';
import '/Pages/Search.dart';
import 'package:url_launcher/url_launcher.dart';
import 'dart:ui' as ui;
Expand Down Expand Up @@ -110,7 +112,13 @@ class ChatMessage extends StatelessWidget {
padding: const EdgeInsets.all(2.0),
child: InkWell(
onTap: () async => launch(token.data),
child: Image.network('${token.data}'),
// child: Image.network('${token.data}'),
child: OctoImage(
image: CachedNetworkImageProvider(token.data),
filterQuality: FilterQuality.high,
// height: 96.0,
// errorBuilder: OctoError.icon(color: Colors.red),
),
),
),
),
Expand All @@ -135,11 +143,18 @@ class ChatMessage extends StatelessWidget {
children: [
Padding(
padding: const EdgeInsets.only(bottom: 4.0),
child: Image.network(
(token.data as twitch.Emote).mipmap!.last!,
isAntiAlias: true,
// child: Image.network(
// (token.data as twitch.Emote).mipmap!.last!,
// isAntiAlias: true,
// filterQuality: FilterQuality.high,
// height: 96.0,
// fit: BoxFit.fitHeight,
// ),
child: OctoImage(
image: CachedNetworkImageProvider((token.data as twitch.Emote).mipmap!.last!),
filterQuality: FilterQuality.high,
height: 96.0,
errorBuilder: OctoError.icon(color: Colors.red),
fit: BoxFit.fitHeight,
),
),
Expand All @@ -150,11 +165,27 @@ class ChatMessage extends StatelessWidget {
),
child: Padding(
padding: const EdgeInsets.only(right: 4.0),
child: Image.network(
token.data.provider == 'Twitch' ? token.data.mipmap[1] : token.data.mipmap.last,
// child: Image.network(
// token.data.provider == 'Twitch' ? token.data.mipmap[1] : token.data.mipmap.last,
// filterQuality: FilterQuality.high,
// isAntiAlias: true,
// scale: token.data.provider == 'Twitch' ? 2.0 : (token.data.mipmap.length == 1 ? 1.0 : 4.0),
// ),
// child: Image(
// image: CachedNetworkImageProvider(
// token.data.provider == 'Twitch' ? token.data.mipmap[1] : token.data.mipmap.last,
// scale: token.data.provider == 'Twitch' ? 2.0 : (token.data.mipmap.length == 1 ? 1.0 : 4.0),
// ),
// filterQuality: FilterQuality.high,
// isAntiAlias: true,
// ),
child: OctoImage(
image: CachedNetworkImageProvider(
token.data.provider == 'Twitch' ? token.data.mipmap[1] : token.data.mipmap.last,
scale: token.data.provider == 'Twitch' ? 2.0 : (token.data.mipmap.length == 1 ? 1.0 : 4.0),
),
filterQuality: FilterQuality.high,
isAntiAlias: true,
scale: token.data.provider == 'Twitch' ? 2.0 : (token.data.mipmap.length == 1 ? 1.0 : 4.0),
errorBuilder: OctoError.icon(color: Colors.red),
),
),
),
Expand All @@ -178,11 +209,18 @@ class ChatMessage extends StatelessWidget {
children: [
Padding(
padding: const EdgeInsets.only(bottom: 4.0),
child: Image.network(
(token.data as List<twitch.Emote>).first.mipmap!.last!,
isAntiAlias: true,
// child: Image.network(
// (token.data as List<twitch.Emote>).first.mipmap!.last!,
// isAntiAlias: true,
// filterQuality: FilterQuality.high,
// height: 96.0,
// fit: BoxFit.fitHeight,
// ),
child: OctoImage(
image: CachedNetworkImageProvider((token.data as List<twitch.Emote>).first.mipmap!.last!),
filterQuality: FilterQuality.high,
height: 96.0,
errorBuilder: OctoError.icon(color: Colors.red),
fit: BoxFit.fitHeight,
),
),
Expand All @@ -196,7 +234,12 @@ class ChatMessage extends StatelessWidget {
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: Image.network(emote.mipmap!.first!),
// child: Image.network(emote.mipmap!.first!),
child: OctoImage(
image: CachedNetworkImageProvider(emote.mipmap!.first!),
filterQuality: FilterQuality.high,
errorBuilder: OctoError.icon(color: Colors.red),
),
),
Text(emote.name!),
],
Expand All @@ -207,11 +250,19 @@ class ChatMessage extends StatelessWidget {
),
child: Padding(
padding: const EdgeInsets.only(right: 4.0),
child: Image.network(
emote.provider == 'Twitch' ? emote.mipmap[1] : emote.mipmap.last,
// child: Image.network(
// emote.provider == 'Twitch' ? emote.mipmap[1] : emote.mipmap.last,
// filterQuality: FilterQuality.high,
// isAntiAlias: true,
// scale: emote.provider == 'Twitch' ? 2.0 : 4.0,
// ),
child: OctoImage(
image: CachedNetworkImageProvider(
emote.provider == 'Twitch' ? emote.mipmap[1] : emote.mipmap.last,
scale: emote.provider == 'Twitch' ? 2.0 : 4.0,
),
filterQuality: FilterQuality.high,
isAntiAlias: true,
scale: emote.provider == 'Twitch' ? 2.0 : 4.0,
errorBuilder: OctoError.icon(color: Colors.red),
),
),
),
Expand Down Expand Up @@ -258,7 +309,7 @@ class ChatMessage extends StatelessWidget {
// ),
// ),
// ),
for (var badge in BlocProvider.of<ChatsenBadges>(context).getBadgesForUser('${message.user?.id}') + BlocProvider.of<SevenTVBadges>(context).getBadgesForUser('${message.user?.id}') + message.badges + BlocProvider.of<FFZBadges>(context).getBadgesForUser('${message.user?.login?.toLowerCase()}') + BlocProvider.of<FFZAPBadges>(context).getBadgesForUser('${message.user?.id}') + BlocProvider.of<ChatterinoBadges>(context).getBadgesForUser('${message.user?.id}'))
for (var badge in message.badges + BlocProvider.of<FFZBadges>(context).getBadgesForUser('${message.user?.login?.toLowerCase()}') + BlocProvider.of<FFZAPBadges>(context).getBadgesForUser('${message.user?.id}') + BlocProvider.of<ChatterinoBadges>(context).getBadgesForUser('${message.user?.id}') + BlocProvider.of<SevenTVBadges>(context).getBadgesForUser('${message.user?.id}') + BlocProvider.of<ChatsenBadges>(context).getBadgesForUser('${message.user?.id}'))
WidgetSpan(
child: WidgetTooltip(
message: Padding(
Expand All @@ -272,11 +323,18 @@ class ChatMessage extends StatelessWidget {
borderRadius: badge.color != null ? BorderRadius.circular(96.0 / 8.0) : BorderRadius.zero,
child: Container(
color: badge.color != null ? Color(int.tryParse(badge.color ?? '777777', radix: 16) ?? 0x777777).withAlpha(255) : null,
child: Image.network(
badge.mipmap!.last!,
isAntiAlias: true,
// child: Image.network(
// badge.mipmap!.last!,
// isAntiAlias: true,
// filterQuality: FilterQuality.high,
// height: 96.0,
// fit: BoxFit.fitHeight,
// ),
child: OctoImage(
image: CachedNetworkImageProvider(badge.mipmap!.last!),
filterQuality: FilterQuality.high,
height: 96.0,
errorBuilder: OctoError.icon(color: Colors.red),
fit: BoxFit.fitHeight,
),
),
Expand All @@ -293,12 +351,19 @@ class ChatMessage extends StatelessWidget {
borderRadius: badge.color != null ? BorderRadius.circular(2.0) : BorderRadius.zero,
child: Container(
color: badge.color != null ? Color(int.tryParse(badge.color ?? '777777', radix: 16) ?? 0x777777).withAlpha(255) : null,
child: Image.network(
badge.mipmap!.last!,
// child: Image.network(
// badge.mipmap!.last!,
// filterQuality: FilterQuality.high,
// isAntiAlias: true,
// scale: 4.0,
// height: 18.0,
// fit: BoxFit.fitHeight,
// ),
child: OctoImage(
image: CachedNetworkImageProvider(badge.mipmap!.last!),
filterQuality: FilterQuality.high,
isAntiAlias: true,
scale: 4.0,
height: 18.0,
errorBuilder: OctoError.icon(color: Colors.red),
fit: BoxFit.fitHeight,
),
),
Expand Down
26 changes: 20 additions & 6 deletions lib/Components/EmoteListModal.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:chatsen/Components/WidgetTooltip.dart';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:octo_image/octo_image.dart';
import '/Components/UI/WidgetBlur.dart';
import 'package:flutter_chatsen_irc/Twitch.dart' as twitch;
import 'package:hive/hive.dart';
Expand Down Expand Up @@ -150,11 +152,18 @@ class _EmoteListModalState extends State<EmoteListModal> {
children: [
Padding(
padding: const EdgeInsets.only(bottom: 4.0),
child: Image.network(
emote.mipmap!.last!,
isAntiAlias: true,
// child: Image.network(
// emote.mipmap!.last!,
// isAntiAlias: true,
// filterQuality: FilterQuality.high,
// height: 96.0,
// fit: BoxFit.fitHeight,
// ),
child: OctoImage(
image: CachedNetworkImageProvider(emote.mipmap!.last!),
filterQuality: FilterQuality.high,
height: 96.0,
errorBuilder: OctoError.icon(color: Colors.red),
fit: BoxFit.fitHeight,
),
),
Expand All @@ -167,10 +176,15 @@ class _EmoteListModalState extends State<EmoteListModal> {
onTap: () => widget.insertEmote(emote.name),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Image.network(
emote.mipmap!.last!,
// child: Image.network(
// emote.mipmap!.last!,
// filterQuality: FilterQuality.high,
// isAntiAlias: true,
// ),
child: OctoImage(
image: CachedNetworkImageProvider(emote.mipmap!.last!),
filterQuality: FilterQuality.high,
isAntiAlias: true,
errorBuilder: OctoError.icon(color: Colors.red),
),
),
),
Expand Down
15 changes: 14 additions & 1 deletion lib/Components/HomeEndDrawer.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:chatsen/Components/ChatMessage.dart';
import 'package:chatsen/Mentions/MentionsCubit.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:octo_image/octo_image.dart';
import '/Components/UI/WidgetBlur.dart';
import 'package:flutter_chatsen_irc/Twitch.dart' as twitch;

Expand Down Expand Up @@ -49,7 +51,18 @@ class HomeEndDrawer extends StatelessWidget {
text: 'Mentions would go here\n...if you had any ',
children: [
WidgetSpan(
child: Image.network('https://cdn.frankerfacez.com/emote/425196/2', scale: 2.0),
// child: Image.network(
// 'https://cdn.frankerfacez.com/emote/425196/2',
// scale: 2.0,
// ),
child: OctoImage(
image: CachedNetworkImageProvider(
'https://cdn.frankerfacez.com/emote/425196/2',
scale: 2.0,
),
filterQuality: FilterQuality.high,
errorBuilder: OctoError.icon(color: Colors.red),
),
),
],
),
Expand Down
Loading

0 comments on commit 1859675

Please sign in to comment.