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
c0c1c56e
Commit
c0c1c56e
authored
2 years ago
by
NguyenTienManh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 14-2
parent
bc980cbc
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
52 deletions
+63
-52
lib/app/module/course/request/course_request.dart
lib/app/module/course/request/course_request.dart
+1
-0
lib/app/module/course/widgets/course_widget.dart
lib/app/module/course/widgets/course_widget.dart
+0
-2
lib/app/module/coursedetail/request/course_detail_request.dart
...pp/module/coursedetail/request/course_detail_request.dart
+1
-1
lib/app/module/coursedetail/widgets/course_detail.dart
lib/app/module/coursedetail/widgets/course_detail.dart
+57
-3
lib/app/module/lession/widgets/lession_widget.dart
lib/app/module/lession/widgets/lession_widget.dart
+4
-46
No files found.
lib/app/module/course/request/course_request.dart
View file @
c0c1c56e
...
...
@@ -3,6 +3,7 @@ import '../model/course_model.dart';
// https://imes-api.myitsol.com/api/v1/public/search-courses
// https://imes-api.myitsol.com/api/v1/public/courses/lesson-free?startRecord=0&size=10
// https://imes-api.myitsol.com/api/v1/public/course/02483841-81c4-4d64-b0de-d271654854fe
class
RemoteCourse
{
Future
<
CourseModel
?>
getCourseModel
()
async
{
var
dio
=
Dio
();
...
...
This diff is collapsed.
Click to expand it.
lib/app/module/course/widgets/course_widget.dart
View file @
c0c1c56e
...
...
@@ -68,7 +68,6 @@ class CourseWidget extends StatelessWidget {
itemHeight:
340
,
itemWidth:
double
.
maxFinite
,
layout:
SwiperLayout
.
TINDER
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Container
(
...
...
@@ -105,7 +104,6 @@ class CourseWidget extends StatelessWidget {
padding:
const
EdgeInsets
.
all
(
10.0
),
child:
Text
(
listData
[
index
].
name
!),
//Text('123'),
),
],),
);
...
...
This diff is collapsed.
Click to expand it.
lib/app/module/coursedetail/request/course_detail_request.dart
View file @
c0c1c56e
...
...
@@ -2,7 +2,7 @@ import 'package:dio/dio.dart';
import
'package:flutter/material.dart'
;
import
'../model/course_detail_model.dart'
;
// https://imes-api.myitsol.com/api/v1/public/course/
ef6c4a7b-54f7-46b7-9ffd-99b057baa757
// https://imes-api.myitsol.com/api/v1/public/course/
02483841-81c4-4d64-b0de-d271654854fe
class
RemoteCourseDetail
{
Future
<
CourseDetailModel
?>
getCourseDetailModel
({
required
BuildContext
context
,
required
String
idCourse
})
async
{
var
dio
=
Dio
();
...
...
This diff is collapsed.
Click to expand it.
lib/app/module/coursedetail/widgets/course_detail.dart
View file @
c0c1c56e
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
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/course_detail_model.dart'
;
import
'package:ongbut_ntmanh/app/module/coursedetail/model/list_lesson.dart'
;
import
'package:ongbut_ntmanh/app/module/lession/widgets/lession_widget.dart'
;
import
'package:ongbut_ntmanh/const/colors.dart'
;
import
'package:ongbut_ntmanh/widgets/widgets_util.dart'
;
import
'../../../../res/images/images.dart'
;
import
'../../
lession/widgets/lession_widget
.dart'
;
import
'../../
playvideo/page/play_video
.dart'
;
import
'../bloc/course_detail_bloc.dart'
;
class
CourseDetailWidget
extends
StatelessWidget
{
...
...
@@ -14,6 +17,7 @@ class CourseDetailWidget extends StatelessWidget {
String
image
;
CourseDetailModel
?
courseDetailModel
;
List
<
Chapters
>
chapters
=
[];
List
<
ListLesson
>
listLesion
=
[];
CourseDetailWidget
(
this
.
courseId
,
this
.
image
,
{
super
.
key
});
...
...
@@ -50,6 +54,7 @@ class CourseDetailWidget extends StatelessWidget {
}
if
(
state
is
CourseDetailSuccess
){
chapters
=
state
.
courseDetailModel
.
data
!.
chapters
!;
if
(
chapters
.
isEmpty
){
return
const
Text
(
'Chua Co Noi Dung Khoa Hoc'
,
style:
TextStyle
(
fontSize:
15
,
color:
AppColors
.
red_light
),);
}
...
...
@@ -73,7 +78,7 @@ class CourseDetailWidget extends StatelessWidget {
style:
TextStyle
(
fontSize:
15
),)),
// const Text('Thong Tin chi tiet',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15),),
TextButton
(
child:
Text
(
'Nhan xet ve khoa hoc'
,
style:
TextStyle
(
color:
AppColors
.
black
),),
child:
const
Text
(
'Nhan xet ve khoa hoc'
,
style:
TextStyle
(
color:
AppColors
.
black
),),
onPressed:
()
{
print
(
'Pressed'
);
}
...
...
@@ -92,10 +97,11 @@ class CourseDetailWidget extends StatelessWidget {
physics:
const
AlwaysScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
return
ExpansionTile
(
title:
Text
(
chapters
[
index
].
name
!),
children:
[
chapters
[
index
].
listLesson
!.
isNotEmpty
?
LessionWidget
(
chapters
[
index
].
listLesson
![
0
].
lessonId
!
):
const
Text
(
''
),
chapters
[
index
].
listLesson
!.
isNotEmpty
?
_buildLesion
(
chapters
[
index
]
):
const
Text
(
''
),
],
);
},
...
...
@@ -114,6 +120,54 @@ class CourseDetailWidget extends StatelessWidget {
],)
);
}
ListView
_buildLesion
(
Chapters
chapters
){
return
ListView
.
builder
(
shrinkWrap:
true
,
itemCount:
chapters
.
listLesson
!.
length
,
itemBuilder:
(
context
,
index
){
return
InkWell
(
onTap:
(){
chapters
.
listLesson
![
0
].
free
==
true
?
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
LessionWidget
(
lessonID:
chapters
.
listLesson
![
index
].
lessonId
!)),
):
const
Text
(
''
);
},
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
30
,
3
,
0
,
3
),
child:
Image
.
asset
(
Images
.
o
,
height:
10
,
width:
10
,)),
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
0
,
0
,
0
,
0
),
child:
Container
(
width:
checkLandscape
(
context
)?
getWidth
(
context
)*
0.8
:
getWidth
(
context
)*
0.6
,
child:
Text
(
chapters
.
listLesson
![
index
].
name
!=
null
?
chapters
.
listLesson
![
index
].
name
!:
''
,
style:
const
TextStyle
(
fontSize:
12
),
softWrap:
false
,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
),
),
),
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
3
,
20
,
3
),
child:
chapters
.
listLesson
![
0
].
free
==
true
?
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
3
,
20
,
3
),
child:
Image
.
asset
(
Images
.
see
,
height:
20
,
width:
20
,),
):
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
3
,
20
,
3
),
child:
Image
.
asset
(
Images
.
uneye
,
height:
20
,
width:
20
,),
),
),
],),
);
}
);
}
}
This diff is collapsed.
Click to expand it.
lib/app/module/lession/widgets/lession_widget.dart
View file @
c0c1c56e
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'../../../../res/images/images.dart'
;
import
'../../playvideo/page/play_video.dart'
;
import
'../bloc/lesson_bloc.dart'
;
import
'../model/lesson_model.dart'
;
class
LessionWidget
extends
StatelessWidget
{
String
lessonID
;
LessionWidget
(
this
.
lessonID
,
{
Key
?
key
})
:
super
(
key:
key
);
String
lessonID
;
LessionWidget
({
Key
?
key
,
required
this
.
lessonID
})
:
super
(
key:
key
);
LessonModel
?
lessonModel
;
String
pl
=
'Playlist video'
;
@override
Widget
build
(
BuildContext
context
)
{
BlocProvider
.
of
<
LessonBloc
>(
context
).
add
(
...
...
@@ -36,45 +31,8 @@ class LessionWidget extends StatelessWidget {
}
if
(
state
is
LessonSuccess
){
return
state
.
lessonModel
.
data
!.
isNotEmpty
?
ListView
.
builder
(
shrinkWrap:
true
,
itemCount:
state
.
lessonModel
.
data
!.
length
,
itemBuilder:
(
context
,
index
){
return
InkWell
(
onTap:
(){
state
.
lessonModel
.
data
![
index
].
partType
==
'YOUTUBE'
?
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
PlayVideoPage
(
link:
state
.
lessonModel
.
data
![
index
].
playlist
![
0
].
link
!)),
):
const
Text
(
'---------'
);
},
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
30
,
3
,
0
,
3
),
child:
Image
.
asset
(
Images
.
o
,
height:
10
,
width:
10
,)),
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
0
,
0
,
0
,
0
),
child:
Text
(
state
.
lessonModel
.
data
![
index
].
title
!=
null
?
state
.
lessonModel
.
data
![
index
].
title
!:
''
),
),
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
3
,
20
,
3
),
child:
state
.
lessonModel
.
data
![
index
].
partType
==
'YOUTUBE'
?
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
3
,
20
,
3
),
child:
Image
.
asset
(
Images
.
see
,
height:
20
,
width:
20
,),
):
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
3
,
20
,
3
),
child:
Image
.
asset
(
Images
.
uneye
,
height:
20
,
width:
20
,),
),
),
],),
);
}
):
const
Text
(
''
);
PlayVideoPage
(
link:
state
.
lessonModel
.
data
!.
length
>
3
?
state
.
lessonModel
.
data
![
3
].
playlist
![
0
].
link
!:
'ES1NU-uwX-Q'
);
// state.lessonModel.data!.length>3?PlayVideoPage(link: state.lessonModel.data![3].playlist![0].link!):const Text('Xin Loi khong co Video');
}
return
const
Text
(
'NewFailed'
);
}
...
...
This diff is collapsed.
Click to expand it.
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