Files
buzz/mobile/lib/features/channels/channel_link_navigation.dart
Tom Brow 2687a2a185 [BOT-1264] fix(mobile): #channel tags not tappable (#1695)
Signed-off-by: npub1shglkdhngx3hrnhf4gf8vhpqdrmeludctechdvpwd3988zzs7ncq2cmtxu <85d1fb36f341a371cee9aa12765c2068f79ff1b85e7176b02e6c4a738850f4f0@sprout-oss.stage.blox.sqprod.co>
Co-authored-by: npub1shglkdhngx3hrnhf4gf8vhpqdrmeludctechdvpwd3988zzs7ncq2cmtxu <85d1fb36f341a371cee9aa12765c2068f79ff1b85e7176b02e6c4a738850f4f0@sprout-oss.stage.blox.sqprod.co>
2026-07-12 08:11:06 -07:00

39 lines
991 B
Dart

import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'channel.dart';
import 'channel_detail_page.dart';
import 'channels_provider.dart';
void openChannelLink({
required BuildContext context,
required WidgetRef ref,
required String channelId,
required String currentChannelId,
}) {
if (channelId == currentChannelId) return;
final channelsAsync = ref.read(channelsProvider);
final channels = channelsAsync.hasValue ? channelsAsync.value : null;
Channel? targetChannel;
for (final channel in channels ?? const <Channel>[]) {
if (channel.id == channelId) {
targetChannel = channel;
break;
}
}
if (targetChannel == null) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Channel could not be opened')),
);
return;
}
Navigator.of(context).push(
MaterialPageRoute<void>(
builder: (_) => ChannelDetailPage(channel: targetChannel!),
),
);
}