1import '/core/ui/screens/views/faild_to_fetch_data_view.dart';
2import '/core/ui/widgets/custom_scaffold.dart';
3import '/features/elearning/presentation/logic/cubit/elearning_cubit.dart';
4import '/features/elearning/presentation/screens/news_updates_screen/views/videos_loaded_view.dart';
5import 'package:flutter/material.dart';
6import 'package:flutter_bloc/flutter_bloc.dart';
8import '../../../../authentication/presentation/logic/authentication_bloc/authentication_bloc.dart';
14 State<ElearningScreen>
createState() => _ElearningScreenState();
17class _ElearningScreenState
extends State<ElearningScreen> {
19 final authenticationState = context.read<AuthenticationBloc>().state;
20 if (authenticationState is AuthenticatedState) {
21 int?
uid = authenticationState.session.uid;
23 context.read<ElearningCubit>().loadVideos();
35 Widget
build(BuildContext context) {
36 return BlocBuilder<ElearningCubit, ElearningState>(
37 builder: (context, state) {
38 return CustomScaffold(
40 isLoading: state is LoadingVideosState,
41 isLeadingVisible:
false,
49 if (state is VideosLoadedState) {
50 return VideosLoadedView(videos: state.
videos);
52 return FailedToFetchDataView(
56 return const SizedBox();
final List< VideoEntity > videos
override void initState()
_adaptViewToState(DashboardState state)
class ElearningScreen extends StatefulWidget _triggerEnvironmentalDashboardLoaderEvent()
const ElearningScreen({super.key})
const VideosLoadingFailureState({required this.failure})
override Widget build(BuildContext context)