Skip to content

Commit

Permalink
stateless container
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-lox committed Nov 20, 2024
1 parent 6a0d96b commit 30af2c1
Showing 1 changed file with 7 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,12 @@ import '../../providers/metadata_state_provider.dart';
import 'in_reply_to.dart';
import 'note_card.dart';

/// this is a container for the note cards
/// its purpose is to wrap a note with additional information, like reply to
class NoteCardContainer extends ConsumerStatefulWidget {
class NoteCardContainer extends ConsumerWidget {
final NostrNote note;

const NoteCardContainer({super.key, required this.note});

@override
ConsumerState<NoteCardContainer> createState() => _NoteCardContainerState();
}

class _NoteCardContainerState extends ConsumerState<NoteCardContainer> {
void _onNoteTab(BuildContext context, NostrNote myNote) {
static void _onNoteTab(BuildContext context, NostrNote myNote) {
var refEvents = myNote.getTagEvents;

if (myNote.isRoot) {
Expand All @@ -37,7 +29,7 @@ class _NoteCardContainerState extends ConsumerState<NoteCardContainer> {
_navigateToEventViewPage(context, root.value, reply?.value ?? myNote.id);
}

void _navigateToEventViewPage(
static void _navigateToEventViewPage(
BuildContext context,
String root,
String? scrollIntoView,
Expand All @@ -49,33 +41,16 @@ class _NoteCardContainerState extends ConsumerState<NoteCardContainer> {
}

@override
void initState() {
super.initState();
}

@override
void dispose() {
super.dispose();
}

@override
Widget build(BuildContext context) {
final myMetadataState =
ref.watch(metadataStateProvider(widget.note.pubkey));
Widget build(BuildContext context, WidgetRef ref) {
final myMetadataState = ref.watch(metadataStateProvider(note.pubkey));

final note = widget.note;
return GestureDetector(
onTap: () {
_onNoteTab(context, note);
},
onTap: () => _onNoteTab(context, note),
child: Container(
color: Colors
.transparent, // needed for comment lines and tab still working
color: Colors.transparent,
child: Column(
children: [
// check if reply
if (note.getTagEvents.isNotEmpty)
// for myNote.getTagPubkeys
Padding(
padding: const EdgeInsets.only(left: 15.0),
child: InReplyTo(
Expand Down

0 comments on commit 30af2c1

Please sign in to comment.