look_video_page.dart
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:wow_english/pages/section/subsection/base_section/state.dart';
import 'package:wow_english/pages/video/lookvideo/bloc/look_video_bloc.dart';
import 'package:wow_english/pages/video/lookvideo/widgets/video_widget.dart';
class LookVideoPage extends StatelessWidget {
const LookVideoPage(
{super.key, this.videoUrl, this.typeTitle, this.courseLessonId, this.isTopic = false});
final String? videoUrl;
final String? typeTitle;
final String? courseLessonId;
final bool isTopic;
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (BuildContext context) => LookVideoBloc(videoUrl, typeTitle, courseLessonId, isTopic),
child: Builder(builder: (context) => _buildPage(context)),
);
}
}
Widget _buildPage(BuildContext context) {
return BlocBuilder<LookVideoBloc, BaseSectionState>(builder: (context, state) {
final bloc = BlocProvider.of<LookVideoBloc>(context);
return Container(
color: Colors.white,
child: VideoWidget(
videoUrl: bloc.videoUrl ?? '',
typeTitle: bloc.typeTitle ?? '',
courseLessonId: bloc.courseLessonId ?? '',
isTopic: bloc.isTopic,
)
);
}
);
}