mirror of
https://github.com/nostrlabs-io/zap-stream-flutter.git
synced 2025-06-16 11:58:50 +00:00
fix: chat scroll (NDK bugs)
This commit is contained in:
@ -77,7 +77,7 @@ class _RxFilter<T> extends State<RxFilter<T>> {
|
||||
if ([0, 3].contains(ev.kind) || (ev.kind >= 10000 && ev.kind < 20000)) {
|
||||
return "${ev.kind}:${ev.pubKey}";
|
||||
} else if (ev.kind >= 30000 && ev.kind < 40000) {
|
||||
return "${ev.kind}:${ev.pubKey}:${ev.getDtag()!}";
|
||||
return "${ev.kind}:${ev.pubKey}:${ev.getDtag()}";
|
||||
} else {
|
||||
return ev.id;
|
||||
}
|
||||
|
@ -130,6 +130,9 @@ StreamInfo extractStreamInfo(Nip01Event ev) {
|
||||
matchTag(t, 'service', (v) => ret.service = v);
|
||||
if (t[0] == "relays") {
|
||||
ret.relays = t.slice(1);
|
||||
if (ret.relays!.isEmpty) {
|
||||
ret.relays = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,7 +238,7 @@ String formatSats(int n) {
|
||||
if (n >= 1000000) {
|
||||
return "${fmt.format(n / 1000000)}M";
|
||||
} else if (n >= 1500) {
|
||||
return "${fmt.format(n / 1000)}k";
|
||||
return "${fmt.format(n / 1000)}K";
|
||||
} else {
|
||||
return fmt.format(n);
|
||||
}
|
||||
|
@ -24,11 +24,8 @@ class ChatWidget extends StatelessWidget {
|
||||
|
||||
var filters = [
|
||||
Filter(kinds: [1311, 9735], limit: 200, aTags: [stream.aTag]),
|
||||
Filter(kinds: [Nip51List.kMute], authors: muteLists),
|
||||
//Filter(kinds: [Nip51List.kMute], authors: muteLists), // bugged
|
||||
];
|
||||
if (stream.info.goal != null) {
|
||||
filters.add(Filter(kinds: [9041], ids: [stream.info.goal!]));
|
||||
}
|
||||
return RxFilter<Nip01Event>(
|
||||
relays: stream.info.relays,
|
||||
filters: filters,
|
||||
@ -57,9 +54,6 @@ class ChatWidget extends StatelessWidget {
|
||||
.reversed
|
||||
.toList();
|
||||
|
||||
final goal = filteredChat.firstWhereOrNull(
|
||||
(e) => e.id == stream.info.goal,
|
||||
);
|
||||
final zaps =
|
||||
filteredChat
|
||||
.where((e) => e.kind == 9735)
|
||||
@ -70,7 +64,8 @@ class ChatWidget extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (zaps.isNotEmpty) _TopZappersWidget(events: zaps),
|
||||
if (goal != null) _StreamGoalWidget(goal: goal),
|
||||
if (stream.info.goal != null)
|
||||
_StreamGoalWidget.id(stream.info.goal!),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
reverse: true,
|
||||
@ -129,6 +124,18 @@ class _StreamGoalWidget extends StatelessWidget {
|
||||
|
||||
const _StreamGoalWidget({required this.goal});
|
||||
|
||||
static Widget id(String id) {
|
||||
return RxFilter<Nip01Event>(
|
||||
filters: [
|
||||
Filter(kinds: [9041], ids: [id]),
|
||||
],
|
||||
builder: (ctx, state) {
|
||||
final goal = state?.firstOrNull;
|
||||
return goal != null ? _StreamGoalWidget(goal: goal) : SizedBox.shrink();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final max = int.parse(goal.getFirstTag("amount") ?? "1");
|
||||
|
Reference in New Issue
Block a user