"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 @override
void initState() { void initState() {
final state = context.read<HistoryAiChatState>(); final state = context.read<HistoryAiChatState>();
Future.delayed(
Duration.zero,
() {
if (state.refresh) {
state.getBots(); state.getBots();
state.refresh = false;
}
state.getBots();
},
);
super.initState(); 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(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: InkWell( child: InkWell(

View File

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

View File

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

View File

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