feat: protrait video style

This commit is contained in:
2025-06-03 13:54:56 +01:00
parent f15e693a54
commit 6bb19ce1f5
7 changed files with 305 additions and 130 deletions

View File

@ -18,16 +18,16 @@ import 'package:zap_stream_flutter/widgets/profile.dart';
class ChatWidget extends StatelessWidget {
final StreamEvent stream;
final bool? showGoals;
final bool? showTopZappers;
final bool? showRaids;
final bool showGoals;
final bool showTopZappers;
final bool showRaids;
const ChatWidget({
super.key,
required this.stream,
this.showGoals,
this.showTopZappers,
this.showRaids,
this.showGoals = true,
this.showTopZappers = true,
this.showRaids = true,
});
@override
@ -40,7 +40,7 @@ class ChatWidget extends StatelessWidget {
var filters = [
Filter(kinds: [1311, 9735], limit: 200, aTags: [stream.aTag]),
if (showRaids ?? true)
if (showRaids)
Filter(kinds: [1312, 1313], limit: 200, aTags: [stream.aTag]),
Filter(kinds: [Nip51List.kMute], authors: moderators),
Filter(kinds: [1314], authors: moderators),
@ -118,9 +118,9 @@ class ChatWidget extends StatelessWidget {
spacing: 8,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (zaps.isNotEmpty && (showTopZappers ?? true))
if (zaps.isNotEmpty && showTopZappers)
_TopZappersWidget(events: zaps),
if (stream.info.goal != null && (showGoals ?? true))
if (stream.info.goal != null && showGoals)
GoalWidget.id(stream.info.goal!),
Expanded(
child: ListView.builder(

View File

@ -1,6 +1,7 @@
import 'package:chewie/chewie.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
import 'package:zap_stream_flutter/main.dart';
import 'package:zap_stream_flutter/theme.dart';
class MainVideoPlayerWidget extends StatefulWidget {
final String url;
@ -34,7 +35,7 @@ class _MainVideoPlayerWidget extends State<MainVideoPlayerWidget> {
aspectRatio: widget.aspectRatio,
autoPlay: widget.autoPlay,
isLive: widget.isLive,
artist: "zap.stream"
artist: "zap.stream",
);
super.initState();
@ -48,6 +49,26 @@ class _MainVideoPlayerWidget extends State<MainVideoPlayerWidget> {
@override
Widget build(BuildContext context) {
return Chewie(controller: mainPlayer.chewie!);
return ValueListenableBuilder(
valueListenable: mainPlayer.state,
builder: (context, state, _) {
final innerWidget =
mainPlayer.chewie != null
? Chewie(controller: mainPlayer.chewie!)
: Center(
child:
state?.error != null
? Text(
state!.error.toString(),
style: TextStyle(color: WARNING),
)
: CircularProgressIndicator(),
);
if (state?.isPortrait == true) {
return innerWidget;
}
return AspectRatio(aspectRatio: 16 / 9, child: innerWidget);
},
);
}
}