Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
ntManhBut
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NguyenTienManh
ntManhBut
Commits
62966e8d
Commit
62966e8d
authored
Feb 10, 2023
by
NguyenTienManh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
06d48e47
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
307 additions
and
112 deletions
+307
-112
lib/app/module/course/widgets/course_widget.dart
lib/app/module/course/widgets/course_widget.dart
+9
-1
lib/app/module/coursedetail/widgets/course_detail.dart
lib/app/module/coursedetail/widgets/course_detail.dart
+1
-7
lib/app/module/lession/widgets/lession_widget.dart
lib/app/module/lession/widgets/lession_widget.dart
+1
-1
lib/app/module/lession/widgets/play_video.dart
lib/app/module/lession/widgets/play_video.dart
+92
-92
lib/app/module/playvideo/page/play_video.dart
lib/app/module/playvideo/page/play_video.dart
+92
-0
lib/app/module/school/widgets/school_widget.dart
lib/app/module/school/widgets/school_widget.dart
+9
-1
lib/app/ui/navigationbottom/home_page.dart
lib/app/ui/navigationbottom/home_page.dart
+3
-1
lib/app/ui/search_page.dart
lib/app/ui/search_page.dart
+100
-9
No files found.
lib/app/module/course/widgets/course_widget.dart
View file @
62966e8d
...
@@ -7,6 +7,7 @@ import 'package:ongbut_ntmanh/const/colors.dart';
...
@@ -7,6 +7,7 @@ import 'package:ongbut_ntmanh/const/colors.dart';
import
'../../../../res/images/images.dart'
;
import
'../../../../res/images/images.dart'
;
import
'../../../../widgets/widgets_util.dart'
;
import
'../../../../widgets/widgets_util.dart'
;
import
'../../../ui/search_page.dart'
;
import
'../../coursedetail/widgets/course_detail.dart'
;
import
'../../coursedetail/widgets/course_detail.dart'
;
import
'../bloc/course_bloc.dart'
;
import
'../bloc/course_bloc.dart'
;
import
'../model/course_model.dart'
;
import
'../model/course_model.dart'
;
...
@@ -35,7 +36,14 @@ class CourseWidget extends StatelessWidget {
...
@@ -35,7 +36,14 @@ class CourseWidget extends StatelessWidget {
TextButton
(
TextButton
(
child:
const
Text
(
'Xem Them>>'
),
child:
const
Text
(
'Xem Them>>'
),
onPressed:
()
{
onPressed:
()
{
print
(
'Pressed'
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
SearchWidget
(),
)).
then
((
value
)
{
if
(
value
!=
null
&&
value
is
bool
&&
value
)
{}
});
}
}
)
)
],
],
...
...
lib/app/module/coursedetail/widgets/course_detail.dart
View file @
62966e8d
...
@@ -4,8 +4,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
...
@@ -4,8 +4,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import
'package:ongbut_ntmanh/app/module/coursedetail/model/chapters.dart'
;
import
'package:ongbut_ntmanh/app/module/coursedetail/model/chapters.dart'
;
import
'package:ongbut_ntmanh/app/module/coursedetail/model/course_detail_model.dart'
;
import
'package:ongbut_ntmanh/app/module/coursedetail/model/course_detail_model.dart'
;
import
'package:ongbut_ntmanh/app/module/lession/widgets/lession_widget.dart'
;
import
'package:ongbut_ntmanh/app/module/lession/widgets/lession_widget.dart'
;
import
'../model/data.dart'
;
import
'../bloc/course_detail_bloc.dart'
;
import
'../bloc/course_detail_bloc.dart'
;
...
@@ -54,10 +52,8 @@ class CourseDetailWidget extends StatelessWidget {
...
@@ -54,10 +52,8 @@ class CourseDetailWidget extends StatelessWidget {
Column
(
children:
[
Column
(
children:
[
Image
.
network
(
image
!=
null
?
image:
'https://oss.myitsol.com/imes-public/2022/12/11/neymar_145527553.PNG'
,
Image
.
network
(
image
!=
null
?
image:
'https://oss.myitsol.com/imes-public/2022/12/11/neymar_145527553.PNG'
,
fit:
BoxFit
.
fill
,
height:
200
,
width:
double
.
maxFinite
,),
fit:
BoxFit
.
fill
,
height:
200
,
width:
double
.
maxFinite
,),
LessionWidget
(
chapters
[
0
].
listLesson
![
0
].
lessonId
!
),
LessionWidget
(
chapters
[
0
].
listLesson
![
0
].
lessonId
!
=
null
?
chapters
[
0
].
listLesson
![
0
].
lessonId
!:
'fb228efa-7b32-419e-98b4-a6d5135f4361'
),
],);
],);
// LessionWidget( chapters[0].listLesson![0].lessonId! );
}
}
}
}
return
const
Text
(
'Default CourseDetail!!!!!'
);
return
const
Text
(
'Default CourseDetail!!!!!'
);
...
@@ -65,8 +61,6 @@ class CourseDetailWidget extends StatelessWidget {
...
@@ -65,8 +61,6 @@ class CourseDetailWidget extends StatelessWidget {
);
);
}
}
),
),
);
);
}
}
}
}
...
...
lib/app/module/lession/widgets/lession_widget.dart
View file @
62966e8d
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'
package:ongbut_ntmanh/app/module/lession/widgets
/play_video.dart'
;
import
'
../../playvideo/page
/play_video.dart'
;
import
'../bloc/lesson_bloc.dart'
;
import
'../bloc/lesson_bloc.dart'
;
import
'../model/lesson_model.dart'
;
import
'../model/lesson_model.dart'
;
...
...
lib/app/module/lession/widgets/play_video.dart
View file @
62966e8d
import
'package:flutter/cupertino.dart'
;
//
import 'package:flutter/cupertino.dart';
import
'package:flutter/material.dart'
;
//
import 'package:flutter/material.dart';
import
'package:flutter/services.dart'
;
//
import 'package:flutter/services.dart';
import
'package:youtube_player_flutter/youtube_player_flutter.dart'
;
//
import 'package:youtube_player_flutter/youtube_player_flutter.dart';
//
class
PlayVideoPage
extends
StatefulWidget
{
//
class PlayVideoPage extends StatefulWidget {
String
link
;
//
String link;
PlayVideoPage
({
required
this
.
link
,
Key
?
key
})
:
super
(
key:
key
);
//
PlayVideoPage({required this.link,Key? key}) : super(key: key);
//
@override
//
@override
State
<
PlayVideoPage
>
createState
()
=>
_PlayVideoPageState
();
//
State<PlayVideoPage> createState() => _PlayVideoPageState();
}
//
}
//
class
_PlayVideoPageState
extends
State
<
PlayVideoPage
>
{
//
class _PlayVideoPageState extends State<PlayVideoPage> {
//
late
YoutubePlayerController
_controller
;
//
late YoutubePlayerController _controller;
//
//
//
// late TextEditingController _idController;
//
// late TextEditingController _idController;
// late TextEditingController _seekToController;
//
// late TextEditingController _seekToController;
//
// final List<String> _ids = [
//
// final List<String> _ids = [
// 'nPt8bK2gbaU',
//
// 'nPt8bK2gbaU',
// ];
//
// ];
@override
//
@override
void
initState
()
{
//
void initState() {
super
.
initState
();
//
super.initState();
_controller
=
//
_controller =
YoutubePlayerController
(
//
YoutubePlayerController(
//
// initialVideoId: "nPt8bK2gbaU",
//
// initialVideoId: "nPt8bK2gbaU",
// initialVideoId: widget.link,
//
// initialVideoId: widget.link,
initialVideoId:
YoutubePlayer
.
convertUrlToId
(
widget
.
link
).
toString
(),
//
initialVideoId: YoutubePlayer.convertUrlToId(widget.link).toString(),
//
flags:
const
YoutubePlayerFlags
(
//
flags: const YoutubePlayerFlags(
mute:
false
,
//
mute: false,
autoPlay:
true
,
//
autoPlay: true,
disableDragSeek:
false
,
//
disableDragSeek: false,
loop:
false
,
//
loop: false,
isLive:
false
,
//
isLive: false,
forceHD:
false
,
//
forceHD: false,
enableCaption:
true
,
//
enableCaption: true,
//
),
//
),
);
//
);
}
//
}
//
//
//
@override
//
@override
void
deactivate
()
{
//
void deactivate() {
// Pauses video while navigating to next page.
//
// Pauses video while navigating to next page.
_controller
.
pause
();
//
_controller.pause();
super
.
deactivate
();
//
super.deactivate();
}
//
}
//
@override
//
@override
void
dispose
()
{
//
void dispose() {
_controller
.
dispose
();
//
_controller.dispose();
// _idController.dispose();
//
// _idController.dispose();
// _seekToController.dispose();
//
// _seekToController.dispose();
super
.
dispose
();
//
super.dispose();
}
//
}
//
@override
//
@override
Widget
build
(
BuildContext
context
)
{
//
Widget build(BuildContext context) {
return
//
return
//
YoutubePlayerBuilder
(
//
YoutubePlayerBuilder(
onExitFullScreen:
()
{
//
onExitFullScreen: () {
SystemChrome
.
setPreferredOrientations
(
DeviceOrientation
.
values
);
//
SystemChrome.setPreferredOrientations(DeviceOrientation.values);
},
//
},
player:
YoutubePlayer
(
//
player: YoutubePlayer(
controller:
_controller
,
//
controller: _controller,
showVideoProgressIndicator:
true
,
//
showVideoProgressIndicator: true,
progressIndicatorColor:
Colors
.
blueAccent
,
//
progressIndicatorColor: Colors.blueAccent,
// onReady: () {
//
// onReady: () {
// _isPlayerReady = true;
//
// _isPlayerReady = true;
// },
//
// },
// onEnded: (data) {
//
// onEnded: (data) {
// _controller
//
// _controller
// .load(_ids[(_ids.indexOf(data.videoId) + 1) % _ids.length]);
//
// .load(_ids[(_ids.indexOf(data.videoId) + 1) % _ids.length]);
// },
//
// },
),
//
),
builder:
(
context
,
player
)
=>
Scaffold
(
//
builder: (context, player) => Scaffold(
appBar:
AppBar
(),
//
appBar: AppBar(),
body:
Container
(
child:
player
),
//
body: Container(child: player),
),
//
),
);
//
);
}
//
}
}
//
}
lib/app/module/playvideo/page/play_video.dart
0 → 100644
View file @
62966e8d
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:youtube_player_flutter/youtube_player_flutter.dart'
;
class
PlayVideoPage
extends
StatefulWidget
{
String
link
;
PlayVideoPage
({
required
this
.
link
,
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
PlayVideoPage
>
createState
()
=>
_PlayVideoPageState
();
}
class
_PlayVideoPageState
extends
State
<
PlayVideoPage
>
{
late
YoutubePlayerController
_controller
;
// late TextEditingController _idController;
// late TextEditingController _seekToController;
// final List<String> _ids = [
// 'nPt8bK2gbaU',
// ];
@override
void
initState
()
{
super
.
initState
();
_controller
=
YoutubePlayerController
(
// initialVideoId: "nPt8bK2gbaU",
// initialVideoId: widget.link,
initialVideoId:
YoutubePlayer
.
convertUrlToId
(
widget
.
link
).
toString
(),
flags:
const
YoutubePlayerFlags
(
mute:
false
,
autoPlay:
true
,
disableDragSeek:
false
,
loop:
false
,
isLive:
false
,
forceHD:
false
,
enableCaption:
true
,
),
);
}
@override
void
deactivate
()
{
// Pauses video while navigating to next page.
_controller
.
pause
();
super
.
deactivate
();
}
@override
void
dispose
()
{
_controller
.
dispose
();
// _idController.dispose();
// _seekToController.dispose();
super
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
YoutubePlayerBuilder
(
onExitFullScreen:
()
{
SystemChrome
.
setPreferredOrientations
(
DeviceOrientation
.
values
);
},
player:
YoutubePlayer
(
controller:
_controller
,
showVideoProgressIndicator:
true
,
progressIndicatorColor:
Colors
.
blueAccent
,
// onReady: () {
// _isPlayerReady = true;
// },
// onEnded: (data) {
// _controller
// .load(_ids[(_ids.indexOf(data.videoId) + 1) % _ids.length]);
// },
),
builder:
(
context
,
player
)
=>
Scaffold
(
appBar:
AppBar
(
title:
Text
(
YoutubePlayer
.
convertUrlToId
(
widget
.
link
).
toString
()),),
body:
Container
(
child:
player
),
),
);
}
}
lib/app/module/school/widgets/school_widget.dart
View file @
62966e8d
...
@@ -8,6 +8,7 @@ import 'package:ongbut_ntmanh/app/module/coursedetail/model/course_detail_model.
...
@@ -8,6 +8,7 @@ import 'package:ongbut_ntmanh/app/module/coursedetail/model/course_detail_model.
import
'package:ongbut_ntmanh/app/module/school/model/list_data.dart'
;
import
'package:ongbut_ntmanh/app/module/school/model/list_data.dart'
;
import
'package:ongbut_ntmanh/const/colors.dart'
;
import
'package:ongbut_ntmanh/const/colors.dart'
;
import
'../../../../res/images/images.dart'
;
import
'../../../../res/images/images.dart'
;
import
'../../../ui/search_page.dart'
;
import
'../../coursedetail/bloc/course_detail_bloc.dart'
;
import
'../../coursedetail/bloc/course_detail_bloc.dart'
;
import
'../../coursedetail/widgets/course_detail.dart'
;
import
'../../coursedetail/widgets/course_detail.dart'
;
import
'../bloc/school_bloc.dart'
;
import
'../bloc/school_bloc.dart'
;
...
@@ -40,7 +41,14 @@ class SchoolWidget extends StatelessWidget {
...
@@ -40,7 +41,14 @@ class SchoolWidget extends StatelessWidget {
TextButton
(
TextButton
(
child:
Text
(
'Xem Them >>'
),
child:
Text
(
'Xem Them >>'
),
onPressed:
()
{
onPressed:
()
{
print
(
'Pressed'
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
SearchWidget
(),
)).
then
((
value
)
{
if
(
value
!=
null
&&
value
is
bool
&&
value
)
{}
});
}
}
)
)
],
],
...
...
lib/app/ui/navigationbottom/home_page.dart
View file @
62966e8d
...
@@ -120,7 +120,9 @@ class _HomePageState extends State<HomePage> {
...
@@ -120,7 +120,9 @@ class _HomePageState extends State<HomePage> {
Navigator
.
push
(
Navigator
.
push
(
context
,
context
,
MaterialPageRoute
(
MaterialPageRoute
(
builder:
(
_
)
=>
SearchPage
(
commentModel
))).
then
((
value
)
{
builder:
(
_
)
=>
SearchWidget
(),
)).
then
((
value
)
{
if
(
value
!=
null
&&
value
is
bool
&&
value
)
{}
if
(
value
!=
null
&&
value
is
bool
&&
value
)
{}
});
});
},
},
...
...
lib/app/ui/search_page.dart
View file @
62966e8d
import
'dart:async'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:ongbut_ntmanh/app/module/course/model/list_data.dart'
;
import
'../../const/colors.dart'
;
import
'../../res/images/images.dart'
;
import
'../module/comment/model/comment_model.dart'
;
import
'../module/comment/model/comment_model.dart'
;
import
'../module/course/bloc/course_bloc.dart'
;
import
'../module/course/model/course_model.dart'
;
import
'../module/coursedetail/widgets/course_detail.dart'
;
final
scrollController
=
ScrollController
();
class
Search
Page
extends
StatelessWidget
{
class
Search
Widget
extends
StatelessWidget
{
CommentModel
?
commentModel
;
SearchWidget
({
Key
?
key
})
:
super
(
key:
key
)
;
SearchPage
(
this
.
commentModel
,{
Key
?
key
})
:
super
(
key:
key
)
;
CourseModel
?
courseModel
;
List
<
ListData
>
listData
=
[];
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
BlocProvider
.
of
<
CourseBloc
>(
context
).
add
(
// appBar: AppBar(title: const Text('Details!')),
RequestCourse
(
context:
context
));
body:
Text
(
commentModel
!.
mess
!.
code
.
toString
()),
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'asdsad'
),),
body:
BlocBuilder
<
CourseBloc
,
CourseState
>(
builder:
(
context
,
state
)
{
if
(
state
is
CourseInitial
){
const
CircularProgressIndicator
();
}
if
(
state
is
CourseLoading
){
return
const
CircularProgressIndicator
();
}
if
(
state
is
CourseFailed
){
return
Text
(
state
.
message
.
toString
());
}
if
(
state
is
CourseSuccess
){
listData
=
state
.
courseModel
.
data
!.
listData
!;
return
CustomScrollView
(
scrollDirection:
Axis
.
vertical
,
// listview vuot ngang
slivers:
<
Widget
>[
SliverGrid
(
gridDelegate:
const
SliverGridDelegateWithMaxCrossAxisExtent
(
maxCrossAxisExtent:
300
,
mainAxisSpacing:
1
,
crossAxisSpacing:
0
,
childAspectRatio:
1
,
),
delegate:
SliverChildBuilderDelegate
(
(
BuildContext
context
,
int
index
)
{
if
(
index
<
listData
.
length
)
{
return
_courseList
(
listData
[
index
],
context
);
}
else
{
Timer
(
const
Duration
(
milliseconds:
20
),
()
{
scrollController
.
jumpTo
(
scrollController
.
position
.
maxScrollExtent
);
});
return
const
CircularProgressIndicator
();
}
},
childCount:
listData
.
length
,
),
),
],
);
);
}
}
return
const
Text
(
'CourseFailed'
);
}
),);
}
}
Widget
_courseList
(
listData
,
BuildContext
context
)
{
return
InkWell
(
onTap:
(){
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
CourseDetailWidget
(
listData
.
courseId
!,
listData
.
image
!=
null
?
listData
.
image
!:
'https://oss.myitsol.com/imes-public/2022/12/11/neymar_145527553.PNG'
),
)).
then
((
value
)
{
if
(
value
!=
null
&&
value
is
bool
&&
value
)
{}
});
},
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
15
,
10
,
15
,
10
),
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
10
),
color:
AppColors
.
white
),
child:
Column
(
children:
<
Widget
>[
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
8.0
),
child:
Image
.
network
(
listData
.
image
!=
null
?
listData
.
image
!:
'https://oss.myitsol.com/imes-public/2022/12/11/neymar_145527553.PNG'
,
fit:
BoxFit
.
fill
,
height:
120
,
width:
double
.
maxFinite
,),
),
Text
(
listData
.
keyword
!=
null
?
listData
.
keyword
:
'Null'
),
Text
(
listData
.
name
!=
null
?
listData
.
name
:
'Null'
),
],
),
),
),
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment