"Refactor AI and Home views, remove delayed function calls, and update video player controller initialization"

This commit is contained in:
OkaykOrhmn 2024-12-04 16:50:06 +03:30
parent b0d6566ac3
commit e4c9c1f369
5 changed files with 12 additions and 18 deletions

View File

@ -31,16 +31,8 @@ class _AiState extends State<Ai> {
@override
void initState() {
final state = context.read<HistoryAiChatState>();
Future.delayed(
Duration.zero,
() {
if (state.refresh) {
state.getBots();
state.refresh = false;
}
state.getBots();
},
);
state.getBots();
super.initState();
}

View File

@ -552,7 +552,9 @@ class _AiChatPageState extends State<AiChatPage> {
),
),
),
if (message.file != null && !Platform.isIOS)
if (message.file != null &&
!kIsWeb &&
!Platform.isIOS)
Padding(
padding: const EdgeInsets.all(8.0),
child: InkWell(

View File

@ -148,7 +148,7 @@ class _HoshanDrawerState extends State<HoshanDrawer> {
slivers: [
SliverStateHandler(
state: state,
centerEmptyState: true,
centerEmptyState: false,
emptyState: const EmptyList(),
// enableEmptyState: state.chats.isEmpty,
placeholder: chatRowPlaceholder(),

View File

@ -139,11 +139,11 @@ class _HomeState extends State<Home>
state.tabController = _tabController;
_tabController.addListener(() {
state.currentPageIndex = _tabController.index;
if (_tabController.index == 2) {
homeScaffKey.currentState!.closeDrawer();
// if (_tabController.index == 2) {
// homeScaffKey.currentState!.closeDrawer();
context.read<HistoryAiChatState>().getBots();
}
// context.read<HistoryAiChatState>().getBots();
// }
});
if (!kIsWeb) {
Future.delayed(Duration.zero, () {

View File

@ -31,8 +31,8 @@ class _ChatVideoPlayerState extends State<ChatVideoPlayer> {
}
Future<void> _handleVideoPlayback() async {
_videoPlayerController = VideoPlayerController.network(widget.src,
httpHeaders: {'Authorization': 'Bearer ${RequestService.token}'});
_videoPlayerController = VideoPlayerController.network(
'${widget.src}?accessToken=${RequestService.token}');
await _videoPlayerController.initialize().then((_) {
setState(() {