From 63b3794539a8eec5278b57a26ebfb30d58eb733a Mon Sep 17 00:00:00 2001 From: Saina Amiri Moghadam Date: Sat, 27 Jan 2024 10:56:51 +0100 Subject: [PATCH] clean the unused parameters --- lib/views/chat_view/chat_view.dart | 2 -- lib/views/chat_view/chat_view_state.dart | 5 ----- lib/views/chat_view/inactive_view.dart | 2 -- lib/views/{poll_view => chat_view}/poll_view.dart | 4 +--- .../{poll_view => chat_view}/poll_view_state.dart | 2 +- .../offline_video_player/offline_video_player.dart | 4 ++-- lib/views/video_view/video_player.dart | 12 +++++++----- 7 files changed, 11 insertions(+), 20 deletions(-) rename lib/views/{poll_view => chat_view}/poll_view.dart (72%) rename lib/views/{poll_view => chat_view}/poll_view_state.dart (90%) diff --git a/lib/views/chat_view/chat_view.dart b/lib/views/chat_view/chat_view.dart index ed9636a8..6a8c39e3 100644 --- a/lib/views/chat_view/chat_view.dart +++ b/lib/views/chat_view/chat_view.dart @@ -5,12 +5,10 @@ import 'package:gocast_mobile/views/chat_view/chat_view_state.dart'; class ChatView extends ConsumerStatefulWidget { - final bool isActive; final Int64? streamID; const ChatView({ super.key, - required this.isActive, this.streamID, }); diff --git a/lib/views/chat_view/chat_view_state.dart b/lib/views/chat_view/chat_view_state.dart index 0bd3f950..741e89c9 100644 --- a/lib/views/chat_view/chat_view_state.dart +++ b/lib/views/chat_view/chat_view_state.dart @@ -44,9 +44,6 @@ class ChatViewState extends ConsumerState { @override Widget build(BuildContext context) { final chatState = ref.watch(chatViewModelProvider); - var suggestedStreams = ref.watch(videoViewModelProvider).streams ?? []; - suggestedStreams = suggestedStreams.where((element) => element.id != widget.streamID).toList(); - suggestedStreams.sort((a, b) => a.start.toDateTime().compareTo(b.start.toDateTime())); bool isIOS = Theme.of(context).platform == TargetPlatform.iOS; if(chatState.isRateLimitReached){ WidgetsBinding.instance.addPostFrameCallback((_) { @@ -66,8 +63,6 @@ class ChatViewState extends ConsumerState { }); } return buildActiveChat(isIOS); - //return widget.isActive ? buildActiveChat(isIOS) : - //buildInactiveChatOverlay(isIOS, suggestedStreams); } Widget buildActiveChat(bool isIOS) { diff --git a/lib/views/chat_view/inactive_view.dart b/lib/views/chat_view/inactive_view.dart index d678394d..1063c932 100644 --- a/lib/views/chat_view/inactive_view.dart +++ b/lib/views/chat_view/inactive_view.dart @@ -8,12 +8,10 @@ import 'package:gocast_mobile/views/video_view/video_player.dart'; import 'package:gocast_mobile/base/networking/api/gocast/api_v2.pb.dart'; class InactiveView extends ConsumerStatefulWidget { - final bool isActive; final Int64? streamID; const InactiveView({ super.key, - required this.isActive, this.streamID, }); diff --git a/lib/views/poll_view/poll_view.dart b/lib/views/chat_view/poll_view.dart similarity index 72% rename from lib/views/poll_view/poll_view.dart rename to lib/views/chat_view/poll_view.dart index 7c130193..6c38c618 100644 --- a/lib/views/poll_view/poll_view.dart +++ b/lib/views/chat_view/poll_view.dart @@ -1,15 +1,13 @@ import 'package:fixnum/fixnum.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:gocast_mobile/views/poll_view/poll_view_state.dart'; +import 'package:gocast_mobile/views/chat_view/poll_view_state.dart'; class PollView extends ConsumerStatefulWidget { - final bool isActive; final Int64? streamID; const PollView({ super.key, - required this.isActive, this.streamID, }); diff --git a/lib/views/poll_view/poll_view_state.dart b/lib/views/chat_view/poll_view_state.dart similarity index 90% rename from lib/views/poll_view/poll_view_state.dart rename to lib/views/chat_view/poll_view_state.dart index bb3d8fad..a479a841 100644 --- a/lib/views/poll_view/poll_view_state.dart +++ b/lib/views/chat_view/poll_view_state.dart @@ -1,7 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:gocast_mobile/views/poll_view/poll_view.dart'; +import 'package:gocast_mobile/views/chat_view/poll_view.dart'; class PollViewState extends ConsumerState { @override diff --git a/lib/views/video_view/offline_video_player/offline_video_player.dart b/lib/views/video_view/offline_video_player/offline_video_player.dart index 1cb06d0b..bc1c477b 100644 --- a/lib/views/video_view/offline_video_player/offline_video_player.dart +++ b/lib/views/video_view/offline_video_player/offline_video_player.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:gocast_mobile/models/error/error_model.dart'; import 'package:gocast_mobile/providers.dart'; -import 'package:gocast_mobile/views/chat_view/chat_view.dart'; +import 'package:gocast_mobile/views/chat_view/inactive_view.dart'; import 'package:gocast_mobile/views/video_view/offline_video_player/offline_video_player_controller.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -31,7 +31,7 @@ class OfflineVideoPlayerPageState return Column( children: [ Expanded(child: _controllerManager.buildVideoPlayer()), - const Expanded(child: ChatView(isActive: false)), + const Expanded(child: InactiveView()), ], ); } diff --git a/lib/views/video_view/video_player.dart b/lib/views/video_view/video_player.dart index 874786b0..86088b8c 100644 --- a/lib/views/video_view/video_player.dart +++ b/lib/views/video_view/video_player.dart @@ -7,6 +7,7 @@ import 'package:gocast_mobile/models/error/error_model.dart'; import 'package:gocast_mobile/providers.dart'; import 'package:gocast_mobile/views/chat_view/chat_view.dart'; import 'package:gocast_mobile/views/chat_view/inactive_view.dart'; +import 'package:gocast_mobile/views/chat_view/poll_view.dart'; import 'package:gocast_mobile/views/video_view/utils/custom_video_control_bar.dart'; import 'package:gocast_mobile/views/video_view/utils/video_player_handler.dart'; import 'package:gocast_mobile/views/video_view/video_player_controller.dart'; @@ -46,13 +47,14 @@ class VideoPlayerPageState extends ConsumerState { isChatActive: _isChatActive, isPollActive: _isPollActive, isPollVisible: _isPollsVisible, - onDownload: (type) => _downloadVideo(widget.stream,type), + onDownload: (type) => _downloadVideo(widget.stream, type), ), Expanded( - child: _isChatVisible - ? ChatView(isActive: _isChatVisible, streamID: widget.stream.id) - : InactiveView( - isActive: !_isChatVisible, streamID: widget.stream.id), + child: _isChatVisible + ? ChatView(streamID: widget.stream.id) + : _isPollsVisible + ? PollView(streamID: widget.stream.id) + : InactiveView(streamID: widget.stream.id), ), ], );