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
b9fe2174
Commit
b9fe2174
authored
Feb 16, 2023
by
NguyenTienManh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 16-2
parent
c0c1c56e
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
725 additions
and
721 deletions
+725
-721
lib/app/module/comment/widgets/comment_widget.dart
lib/app/module/comment/widgets/comment_widget.dart
+121
-134
lib/app/module/course/widgets/course_widget.dart
lib/app/module/course/widgets/course_widget.dart
+99
-107
lib/app/module/coursedetail/widgets/course_detail.dart
lib/app/module/coursedetail/widgets/course_detail.dart
+115
-122
lib/app/module/lession/widgets/lession_widget.dart
lib/app/module/lession/widgets/lession_widget.dart
+16
-22
lib/app/module/login/widget/login_details.dart
lib/app/module/login/widget/login_details.dart
+4
-4
lib/app/module/login/widget/login_widget.dart
lib/app/module/login/widget/login_widget.dart
+85
-77
lib/app/module/new/widgets/new_widget.dart
lib/app/module/new/widgets/new_widget.dart
+109
-117
lib/app/module/playvideo/page/play_video.dart
lib/app/module/playvideo/page/play_video.dart
+71
-24
lib/app/module/school/widgets/school_widget.dart
lib/app/module/school/widgets/school_widget.dart
+101
-110
lib/main.dart
lib/main.dart
+4
-4
No files found.
lib/app/module/comment/widgets/comment_widget.dart
View file @
b9fe2174
...
...
@@ -9,152 +9,139 @@ import '../bloc/comment_bloc.dart';
import
'../model/comment_model.dart'
;
class
CommentWidget
extends
StatelessWidget
{
//CommentWidget({Key? key}) : super(key: key);
CommentModel
?
commentModel
;
Function
(
CommentModel
commentModel
)?
onData
;
CommentWidget
(
this
.
onData
,
{
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
{
BlocProvider
.
of
<
CommentBloc
>(
context
).
add
(
RequestComment
(
context:
context
));
PageController
_pageController
=
new
PageController
();
return
BlocConsumer
<
CommentBloc
,
CommentState
>(
listener:
(
context
,
state
)
async
{},
builder:
(
context
,
state
)
{
return
Container
(
color:
AppColors
.
background
,
child:
Column
(
Container
(
color:
AppColors
.
background
,
child:
Column
(
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
0
,
0
,
0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
0
,
0
,
0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
const
Text
(
'Nhan xet cua phu huynh'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
15
),),
TextButton
(
child:
Text
(
'Xem Them >>'
),
onPressed:
()
{
print
(
'Pressed'
);
}
)
],
),
),
BlocBuilder
<
CommentBloc
,
CommentState
>(
builder:
(
context
,
state
)
{
if
(
state
is
CommentInitial
){
return
const
Text
(
'CommentInitial'
);
}
if
(
state
is
CommentFailed
){
//const CircularProgressIndicator();
return
Text
(
'CommentFailed'
);
}
if
(
state
is
CommentLoading
){
return
const
Text
(
'CommentLoading'
);
}
if
(
state
is
CommentSuccess
){
commentModel
=
state
.
commentModel
;
onData
!(
commentModel
!);
return
Container
(
decoration:
const
BoxDecoration
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
boxShadow:
[
BoxShadow
(
color:
AppColors
.
primary
,
spreadRadius:
0.5
,
),
],
),
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.5
:
getHeight
(
context
)*
0.3
,
width:
double
.
maxFinite
,
child:
PageView
.
builder
(
//itemCount: state.commentModel.data!.length,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Stack
(
children:
[
Container
(
decoration:
const
BoxDecoration
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
color:
AppColors
.
white
,
boxShadow:
[
BoxShadow
(
color:
AppColors
.
primary_light
,
spreadRadius:
1
,
const
Text
(
'Nhan xet cua phu huynh'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
15
),),
TextButton
(
child:
Text
(
'Xem Them >>'
),
onPressed:
()
{}
)
],
),
),
BlocBuilder
<
CommentBloc
,
CommentState
>(
builder:
(
context
,
state
)
{
if
(
state
is
CommentInitial
){
return
const
Text
(
'CommentInitial'
);
}
if
(
state
is
CommentFailed
){
return
const
Text
(
'CommentFailed'
);
}
if
(
state
is
CommentLoading
){
return
const
Text
(
'CommentLoading'
);
}
if
(
state
is
CommentSuccess
){
commentModel
=
state
.
commentModel
;
onData
!(
commentModel
!);
return
Container
(
decoration:
const
BoxDecoration
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
boxShadow:
[
BoxShadow
(
color:
AppColors
.
primary
,
spreadRadius:
0.5
,
),
],
),
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.5
:
getHeight
(
context
)*
0.3
,
width:
double
.
maxFinite
,
child:
PageView
.
builder
(
//itemCount: state.commentModel.data!.length,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Stack
(
children:
[
Container
(
decoration:
const
BoxDecoration
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
color:
AppColors
.
white
,
boxShadow:
[
BoxShadow
(
color:
AppColors
.
primary_light
,
spreadRadius:
1
,
),
],
),
child:
PageView
.
builder
(
controller:
_pageController
,
itemBuilder:
(
context
,
index
)
{
return
Column
(
children:
[
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Row
(
children:
[
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
50
),
child:
Image
.
network
(
state
.
commentModel
.
data
![
index
].
createUserAvatar
!=
null
?
state
.
commentModel
.
data
![
index
].
createUserAvatar
!:
Images
.
ongbut_happy
,
fit:
BoxFit
.
fill
,
height:
60
,
width:
60
,
),
),
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Column
(
children:
[
Text
(
state
.
commentModel
.
data
![
index
].
createUserFullName
!),
Text
(
state
.
commentModel
.
data
![
index
].
createUserFullName
!)
],),
)
],),
),
Text
(
state
.
commentModel
.
data
![
index
].
courseKeyword
!=
null
?
state
.
commentModel
.
data
![
index
].
courseKeyword
!:
''
,
style:
const
TextStyle
(
fontWeight:
FontWeight
.
bold
),),
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10
,
0
,
10
,
0
),
child:
Text
(
state
.
commentModel
.
data
![
index
].
content
!=
null
?
state
.
commentModel
.
data
![
index
].
content
!:
''
,
style:
const
TextStyle
(
fontSize:
15
),
softWrap:
false
,
maxLines:
4
,
overflow:
TextOverflow
.
ellipsis
),
),
],
),
child:
PageView
.
builder
(
controller:
_pageController
,
itemBuilder:
(
context
,
index
)
{
return
Column
(
children:
[
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Row
(
children:
[
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
50
),
child:
Image
.
network
(
state
.
commentModel
.
data
![
index
].
createUserAvatar
!=
null
?
state
.
commentModel
.
data
![
index
].
createUserAvatar
!:
Images
.
ongbut_happy
,
fit:
BoxFit
.
fill
,
height:
60
,
width:
60
,
),
),
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Column
(
children:
[
Text
(
state
.
commentModel
.
data
![
index
].
createUserFullName
!),
Text
(
state
.
commentModel
.
data
![
index
].
createUserFullName
!)
],),
)
],),
),
Text
(
state
.
commentModel
.
data
![
index
].
courseKeyword
!=
null
?
state
.
commentModel
.
data
![
index
].
courseKeyword
!:
''
,
style:
const
TextStyle
(
fontWeight:
FontWeight
.
bold
),),
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10
,
0
,
10
,
0
),
child:
Text
(
state
.
commentModel
.
data
![
index
].
content
!=
null
?
state
.
commentModel
.
data
![
index
].
content
!:
''
,
style:
const
TextStyle
(
fontSize:
15
),
softWrap:
false
,
maxLines:
4
,
overflow:
TextOverflow
.
ellipsis
),
),
],
);
},
itemCount:
state
.
commentModel
.
data
!.
length
,
),
),
Column
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
Container
(
padding:
const
EdgeInsets
.
all
(
10
),
child:
Center
(
child:
SmoothPageIndicator
(
controller:
_pageController
,
count:
state
.
commentModel
.
data
!.
length
,
effect:
const
WormEffect
(),
onDotClicked:
(
index
)
=>
_pageController
.
animateToPage
(
index
,
duration:
const
Duration
(
milliseconds:
1
),
curve:
Curves
.
bounceOut
),
),),
),
],),
],);
},
onPageChanged:
(
int
index
)
{
}),
);
}
return
const
Text
(
'NewFailed'
);
}
),
const
SizedBox
(
height:
100
,),
],
);
},
itemCount:
state
.
commentModel
.
data
!.
length
,
),
),
Column
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
Container
(
padding:
const
EdgeInsets
.
all
(
10
),
child:
Center
(
child:
SmoothPageIndicator
(
controller:
_pageController
,
count:
state
.
commentModel
.
data
!.
length
,
effect:
const
WormEffect
(),
onDotClicked:
(
index
)
=>
_pageController
.
animateToPage
(
index
,
duration:
const
Duration
(
milliseconds:
1
),
curve:
Curves
.
bounceOut
),
),),
),
],),
],);
},
onPageChanged:
(
int
index
)
{}),
);
}
return
const
Text
(
'NewFailed'
);
}
),
);
}
SizedBox
(
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.1
:
getHeight
(
context
)*
0.1
,),
],
),
);
}
}
lib/app/module/course/widgets/course_widget.dart
View file @
b9fe2174
...
...
@@ -18,120 +18,112 @@ class CourseWidget extends StatelessWidget {
List
<
ListData
>
listData
=
[];
@override
Widget
build
(
BuildContext
context
)
{
BlocProvider
.
of
<
CourseBloc
>(
context
).
add
(
RequestCourse
(
context:
context
));
return
BlocConsumer
<
CourseBloc
,
CourseState
>(
listener:
(
context
,
state
)
async
{},
builder:
(
context
,
state
)
{
return
Container
(
color:
AppColors
.
background
,
child:
Column
(
return
Container
(
color:
AppColors
.
background
,
child:
Column
(
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
0
,
0
,
0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
0
,
0
,
0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
const
Text
(
'Tham Gia Khoa Hoc Thu'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
15
),),
TextButton
(
child:
const
Text
(
'Xem Them>>'
),
onPressed:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
SearchWidget
(),
const
Text
(
'Tham Gia Khoa Hoc Thu'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
15
),),
TextButton
(
child:
const
Text
(
'Xem Them>>'
),
onPressed:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
SearchWidget
(),
)).
then
((
value
)
{
if
(
value
!=
null
&&
value
is
bool
&&
value
)
{}
});
}
)
],
),
),
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
!;
)).
then
((
value
)
{
if
(
value
!=
null
&&
value
is
bool
&&
value
)
{}
});
}
)
],
),
),
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
Swiper
(
itemHeight:
340
,
itemWidth:
double
.
maxFinite
,
layout:
SwiperLayout
.
TINDER
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Swiper
(
itemHeight:
340
,
itemWidth:
double
.
maxFinite
,
layout:
SwiperLayout
.
TINDER
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Container
(
decoration:
const
BoxDecoration
(
boxShadow:
[
BoxShadow
(
color:
AppColors
.
primary
,
spreadRadius:
1
,
),
],
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
),
child:
Column
(
children:
[
Container
(
decoration:
const
BoxDecoration
(
boxShadow:
[
BoxShadow
(
color:
AppColors
.
primary
,
spreadRadius:
1
,
),
],
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
),
child:
Column
(
children:
[
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
8.0
),
child:
Image
.
network
(
listData
[
index
].
image
!=
null
?
listData
[
index
].
image
!:
'https://oss.myitsol.com/imes-public/2022/12/11/neymar_145527553.PNG'
,
fit:
BoxFit
.
fill
,
height:
200
,
width:
double
.
maxFinite
,
errorBuilder:
(
BuildContext
context
,
Object
exception
,
StackTrace
?
stackTrace
)
{
return
Image
.
asset
(
Images
.
load_err
);
},
),
),
Padding
(
padding:
const
EdgeInsets
.
all
(
10.0
),
child:
Text
(
listData
[
index
].
type
!),
//Text('abc'),
),
Padding
(
padding:
const
EdgeInsets
.
all
(
10.0
),
child:
Text
(
listData
[
index
].
name
!),
),
],),
);
},
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
8.0
),
child:
Image
.
network
(
listData
[
index
].
image
!=
null
?
listData
[
index
].
image
!:
'https://oss.myitsol.com/imes-public/2022/12/11/neymar_145527553.PNG'
,
fit:
BoxFit
.
fill
,
height:
200
,
width:
double
.
maxFinite
,
errorBuilder:
(
BuildContext
context
,
Object
exception
,
StackTrace
?
stackTrace
)
{
return
Image
.
asset
(
Images
.
load_err
);
},
),
),
Padding
(
padding:
const
EdgeInsets
.
all
(
10.0
),
child:
Text
(
listData
[
index
].
type
!),
//Text('abc'),
),
Padding
(
padding:
const
EdgeInsets
.
all
(
10.0
),
child:
Text
(
listData
[
index
].
name
!),
),
],),
);
},
itemCount:
listData
.
length
,
onTap:
(
index
){
itemCount:
listData
.
length
,
onTap:
(
index
){
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
CourseDetailWidget
(
listData
[
index
].
courseId
!,
listData
[
index
].
image
!=
null
?
listData
[
index
].
image
!
:
'https://oss.myitsol.com/imes-public/2022/12/11/neymar_145527553.PNG'
),
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
CourseDetailWidget
(
listData
[
index
].
courseId
!,
listData
[
index
].
image
!=
null
?
listData
[
index
].
image
!
:
'https://oss.myitsol.com/imes-public/2022/12/11/neymar_145527553.PNG'
),
)).
then
((
value
)
{
if
(
value
!=
null
&&
value
is
bool
&&
value
)
{}
});
},
)).
then
((
value
)
{
if
(
value
!=
null
&&
value
is
bool
&&
value
)
{}
});
},
);
}
return
const
Text
(
'CourseFailed'
);
}
)
],
),
);
}
);
);
}
return
const
Text
(
'CourseFailed'
);
}
)
],
),
);
}
}
lib/app/module/coursedetail/widgets/course_detail.dart
View file @
b9fe2174
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
...
...
@@ -9,7 +8,6 @@ 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
'../../playvideo/page/play_video.dart'
;
import
'../bloc/course_detail_bloc.dart'
;
class
CourseDetailWidget
extends
StatelessWidget
{
...
...
@@ -20,104 +18,100 @@ class CourseDetailWidget extends StatelessWidget {
List
<
ListLesson
>
listLesion
=
[];
CourseDetailWidget
(
this
.
courseId
,
this
.
image
,
{
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
{
BlocProvider
.
of
<
CourseDetailBloc
>(
context
).
add
(
RequestCourseDetail
(
context:
context
,
idCourse:
courseId
));
CourseDetailBloc
bloc
=
CourseDetailBloc
()..
add
(
RequestCourseDetail
(
context:
context
,
idCourse:
courseId
));
// BlocProvider.of<CourseDetailBloc>(context).add(
// RequestCourseDetail(context: context,idCourse: courseId));
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'Chi Tiet Khoa Hoc'
),),
body:
Column
(
children:
[
Image
.
network
(
image
,
fit:
BoxFit
.
fill
,
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.5
:
getHeight
(
context
)*
0.3
,
width:
double
.
maxFinite
,
errorBuilder:
(
BuildContext
context
,
Object
exception
,
StackTrace
?
stackTrace
)
{
return
Image
.
asset
(
Images
.
load_err
,
fit:
BoxFit
.
fill
,
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.5
:
getHeight
(
context
)*
0.3
,
width:
double
.
maxFinite
,);
},
),
Expanded
(
child:
BlocConsumer
<
CourseDetailBloc
,
CourseDetailState
>(
listener:
(
context
,
state
)
async
{},
builder:
(
context
,
state
)
{
return
BlocBuilder
<
CourseDetailBloc
,
CourseDetailState
>(
builder:
(
context
,
state
)
{
if
(
state
is
CourseDetailInitial
){
return
const
Text
(
'SchoolInitial'
);
}
if
(
state
is
CourseDetailFailed
){
return
Text
(
state
.
message
.
toString
());
}
if
(
state
is
CourseDetailLoading
){
return
const
CircularProgressIndicator
();
}
if
(
state
is
CourseDetailSuccess
){
chapters
=
state
.
courseDetailModel
.
data
!.
chapters
!;
appBar:
AppBar
(
title:
const
Text
(
'Chi Tiet Khoa Hoc'
),),
body:
Column
(
children:
[
Image
.
network
(
image
,
fit:
BoxFit
.
fill
,
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.5
:
getHeight
(
context
)*
0.3
,
width:
double
.
maxFinite
,
errorBuilder:
(
BuildContext
context
,
Object
exception
,
StackTrace
?
stackTrace
)
{
return
Image
.
asset
(
Images
.
load_err
,
fit:
BoxFit
.
fill
,
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.5
:
getHeight
(
context
)*
0.3
,
width:
double
.
maxFinite
,);
},
),
Expanded
(
child:
BlocBuilder
<
CourseDetailBloc
,
CourseDetailState
>(
bloc:
bloc
,
builder:
(
context
,
state
)
{
if
(
state
is
CourseDetailInitial
){
return
const
CircularProgressIndicator
();
}
if
(
state
is
CourseDetailFailed
){
return
Text
(
state
.
message
.
toString
());
}
if
(
state
is
CourseDetailLoading
){
return
const
CircularProgressIndicator
();
}
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
),);
}
if
(
chapters
.
isNotEmpty
){
return
Column
(
mainAxisSize:
MainAxisSize
.
max
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
if
(
chapters
.
isEmpty
){
return
const
Text
(
'Chua Co Noi Dung Khoa Hoc'
,
style:
TextStyle
(
fontSize:
15
,
color:
AppColors
.
red_light
),);
}
if
(
chapters
.
isNotEmpty
){
return
Column
(
mainAxisSize:
MainAxisSize
.
max
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10
,
10
,
0
,
0
),
child:
Column
(
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10
,
10
,
0
,
0
),
child:
Column
(
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
// Image.asset(Images.see,height: 20,width: 20,),
TextButton
(
onPressed:
(){},
child:
const
Text
(
'Thong Tin chi tiet'
,
// Image.asset(Images.see,height: 20,width: 20,),
TextButton
(
onPressed:
(){},
child:
const
Text
(
'Thong Tin chi tiet'
,
style:
TextStyle
(
fontSize:
15
),)),
// const Text('Thong Tin chi tiet',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15),),
TextButton
(
child:
const
Text
(
'Nhan xet ve khoa hoc'
,
style:
TextStyle
(
color:
AppColors
.
black
),),
onPressed:
()
{
print
(
'Pressed'
);
}
)
],
),
// const Text('Thong Tin chi tiet',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15),),
TextButton
(
child:
const
Text
(
'Nhan xet ve khoa hoc'
,
style:
TextStyle
(
color:
AppColors
.
black
),),
onPressed:
()
{
print
(
'Pressed'
);
}
)
],
),
),
Expanded
(
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10
,
10
,
0
,
0
),
child:
ListView
.
builder
(
itemCount:
chapters
.
length
,
physics:
const
AlwaysScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
return
],
),
),
Expanded
(
child:
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10
,
10
,
0
,
0
),
child:
ListView
.
builder
(
itemCount:
chapters
.
length
,
physics:
const
AlwaysScrollableScrollPhysics
(),
itemBuilder:
(
context
,
index
)
{
return
ExpansionTile
(
title:
Text
(
chapters
[
index
].
name
!),
children:
[
chapters
[
index
].
listLesson
!.
isNotEmpty
?
_buildLesion
(
chapters
[
index
]):
const
Text
(
''
),
],
);
},
),
),
ExpansionTile
(
title:
Text
(
chapters
[
index
].
name
!),
children:
[
chapters
[
index
].
listLesson
!.
isNotEmpty
?
_buildLesion
(
chapters
[
index
]):
const
Text
(
''
),
],
);
},
),
],);
}
}
return
const
Text
(
'Default CourseDetail!!!!!'
);
}
);
}
),
),
],);
}
}
return
const
Text
(
'Default CourseDetail!!!!!'
);
}
),
),
),
],)
],)
);
}
...
...
@@ -128,46 +122,45 @@ class CourseDetailWidget extends StatelessWidget {
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
),
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
,
mainAxisSize:
MainAxisSize
.
max
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
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.25
:
getHeight
(
context
)*
0.25
,
child:
Text
(
chapters
.
listLesson
![
index
].
name
!=
null
?
chapters
.
listLesson
![
index
].
name
!:
''
,
style:
TextStyle
(
fontSize:
12
,
overflow:
TextOverflow
.
ellipsis
),
softWrap:
false
,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
),
maxLines:
1
,
),
),
),
),
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
3
,
20
,
3
),
child:
chapters
.
listLesson
![
0
].
free
==
true
?
Padding
(
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
,),
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
,),
),
),
),
],),
);
],),
);
}
);
}
}
}
\ No newline at end of file
lib/app/module/lession/widgets/lession_widget.dart
View file @
b9fe2174
...
...
@@ -14,29 +14,23 @@ String lessonID;
BlocProvider
.
of
<
LessonBloc
>(
context
).
add
(
RequestLesson
(
context:
context
,
lessonID:
lessonID
));
return
BlocConsumer
<
LessonBloc
,
LessonState
>(
listener:
(
context
,
state
)
async
{},
BlocBuilder
<
LessonBloc
,
LessonState
>(
builder:
(
context
,
state
)
{
return
BlocBuilder
<
LessonBloc
,
LessonState
>(
builder:
(
context
,
state
)
{
if
(
state
is
LessonInitial
){
return
const
Text
(
'LessonInitial'
);
}
if
(
state
is
LessonFailed
){
return
const
Text
(
'LessonFailed'
);
}
if
(
state
is
LessonLoading
){
return
const
CircularProgressIndicator
();
}
if
(
state
is
LessonSuccess
){
return
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'
);
}
);
if
(
state
is
LessonInitial
){
return
const
CircularProgressIndicator
();
}
if
(
state
is
LessonFailed
){
return
const
Text
(
'LessonFailed'
);
}
if
(
state
is
LessonLoading
){
return
const
CircularProgressIndicator
();
}
if
(
state
is
LessonSuccess
){
return
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'
);
}
);
}
...
...
lib/app/module/login/widget/login_details.dart
View file @
b9fe2174
...
...
@@ -2,14 +2,14 @@ import 'package:flutter/material.dart';
import
'../model/login_model.dart'
;
class
LoginDetail
s
Page
extends
StatelessWidget
{
LoginModel
loginModels
;
LoginDetail
sPage
(
this
.
loginModels
,
{
Key
?
key
})
:
super
(
key:
key
);
class
LoginDetailPage
extends
StatelessWidget
{
LoginDetail
Page
(
{
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'Details!'
)),
body:
Text
(
loginModels
.
session_state
),
body:
Text
(
"acssea"
),
);
}
}
lib/app/module/login/widget/login_widget.dart
View file @
b9fe2174
...
...
@@ -15,94 +15,102 @@ class LoginPage extends StatelessWidget {
return
BlocConsumer
<
LoginBloc
,
LoginState
>(
listener:
(
context
,
state
)
async
{
// if(state is LoginSuccess){
// _userController.text='';
// _passController.text='';
// }
// hàm sẽ đc gọi mỗi khi có sự thay đổi state của Bloc.ví dụ:
// if(state is MyStateSuccess){
// // Thực hiện hành động
// }
},
builder:
(
context
,
state
)
{
return
Container
(
color:
AppColors
.
background
,
child:
Column
(
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
0
,
20
,
0
,
0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
const
[
Text
(
'Dang Ky & Tu Van'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
16
),),
],
),
),
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
60
,
right:
60
),
child:
TextFormField
(
decoration:
const
InputDecoration
(
labelText:
'Product Name'
,
),
controller:
_userController
,
),
),
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
60
,
right:
60
),
child:
TextFormField
(
decoration:
const
InputDecoration
(
labelText:
'PassWord'
,
),
controller:
_passController
,
),
),
return
_buildUI
(
context
);
},
);
}
}
Padding
(
padding:
const
EdgeInsets
.
all
(
20.0
),
child:
OutlinedButton
(
style:
OutlinedButton
.
styleFrom
(
minimumSize:
const
Size
.
fromHeight
(
50
),
backgroundColor:
AppColors
.
primary
,
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
20.0
),
),
),
onPressed:
()
async
{
BlocProvider
.
of
<
LoginBloc
>(
context
).
add
(
RequestLogin
(
context:
context
,
username:
_userController
.
text
,
password:
_passController
.
text
));
},
child:
Text
(
"Dang Nhap"
.
toUpperCase
(),
style:
const
TextStyle
(
color:
AppColors
.
white
,
fontWeight:
FontWeight
.
bold
),)
Widget
_buildUI
(
BuildContext
context
){
return
Container
(
color:
AppColors
.
background
,
child:
Column
(
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
0
,
20
,
0
,
0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
const
[
Text
(
'Dang Ky & Tu Van'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
16
),),
],
),
),
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
60
,
right:
60
),
child:
TextFormField
(
decoration:
const
InputDecoration
(
labelText:
'Product Name'
,
),
controller:
_userController
,
),
),
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
60
,
right:
60
),
child:
TextFormField
(
decoration:
const
InputDecoration
(
labelText:
'PassWord'
,
),
controller:
_passController
,
),
),
Padding
(
padding:
const
EdgeInsets
.
all
(
20.0
),
child:
OutlinedButton
(
style:
OutlinedButton
.
styleFrom
(
minimumSize:
const
Size
.
fromHeight
(
50
),
backgroundColor:
AppColors
.
primary
,
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
20.0
),
),
),
BlocBuilder
<
LoginBloc
,
LoginState
>(
builder:
(
context
,
state
)
{
if
(
state
is
LoginLoading
)
{
return
const
CircularProgressIndicator
();
}
if
(
state
is
LoginFailed
)
{
return
const
Text
(
'login false!'
);
}
if
(
state
is
LoginInitial
)
{
return
const
Text
(
'LoginInitial'
);
}
if
(
state
is
LoginSuccess
)
{
return
const
Text
(
'Dang Nhap Thanh Cong'
);
}
return
const
CircularProgressIndicator
();
}),
],
onPressed:
()
async
{
BlocProvider
.
of
<
LoginBloc
>(
context
).
add
(
RequestLogin
(
context:
context
,
username:
_userController
.
text
,
password:
_passController
.
text
));
},
child:
Text
(
"Dang Nhap"
.
toUpperCase
(),
style:
const
TextStyle
(
color:
AppColors
.
white
,
fontWeight:
FontWeight
.
bold
),)
),
);
},
),
BlocBuilder
<
LoginBloc
,
LoginState
>(
builder:
(
context
,
state
)
{
if
(
state
is
LoginLoading
)
{
return
const
CircularProgressIndicator
();
}
if
(
state
is
LoginFailed
)
{
return
const
Text
(
'login false!'
);
}
if
(
state
is
LoginInitial
)
{
return
const
Text
(
'LoginInitial'
);
}
if
(
state
is
LoginSuccess
)
{
return
const
Text
(
'Dang Nhap Thanh Cong'
);
}
return
const
CircularProgressIndicator
();
}),
],
),
);
}
}
lib/app/module/new/widgets/new_widget.dart
View file @
b9fe2174
...
...
@@ -14,130 +14,122 @@ class NewWidget extends StatelessWidget {
NewModel
?
newModel
;
@override
Widget
build
(
BuildContext
context
)
{
BlocProvider
.
of
<
NewBloc
>(
context
).
add
(
RequestNew
(
context:
context
));
return
BlocConsumer
<
NewBloc
,
NewState
>(
listener:
(
context
,
state
)
async
{},
builder:
(
context
,
state
)
{
return
Container
(
color:
AppColors
.
background
,
child:
Column
(
Container
(
color:
AppColors
.
background
,
child:
Column
(
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
0
,
0
,
0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
0
,
0
,
0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
const
Text
(
'Tin Tuc'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
15
),),
TextButton
(
child:
const
Text
(
'Xem Them>>'
),
onPressed:
()
{
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => SearchWidget(),
//
// )).then((value) {
// if (value != null && value is bool && value) {}
// });
}
)
],
),
),
BlocBuilder
<
NewBloc
,
NewState
>(
builder:
(
context
,
state
)
{
if
(
state
is
NewInitial
){
return
const
Text
(
'NewInitial'
);
}
if
(
state
is
NewFailed
){
//const CircularProgressIndicator();
return
Text
(
'NewInitial'
);
}
if
(
state
is
NewLoading
){
return
const
Text
(
'NewInitial'
);
}
if
(
state
is
NewSuccess
){
return
Container
(
padding:
EdgeInsets
.
fromLTRB
(
20
,
0
,
0
,
0
),
decoration:
const
BoxDecoration
(
const
Text
(
'Tin Tuc'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
15
),),
TextButton
(
child:
const
Text
(
'Xem Them>>'
),
onPressed:
()
{
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => SearchWidget(),
//
// )).then((value) {
// if (value != null && value is bool && value) {}
// });
}
)
],
),
),
BlocBuilder
<
NewBloc
,
NewState
>(
builder:
(
context
,
state
)
{
if
(
state
is
NewInitial
){
return
const
Text
(
'NewInitial'
);
}
if
(
state
is
NewFailed
){
//const CircularProgressIndicator();
return
Text
(
'NewInitial'
);
}
if
(
state
is
NewLoading
){
return
const
Text
(
'NewInitial'
);
}
if
(
state
is
NewSuccess
){
return
Container
(
padding:
EdgeInsets
.
fromLTRB
(
20
,
0
,
0
,
0
),
decoration:
const
BoxDecoration
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
// boxShadow: [
// BoxShadow(
// //color: AppColors.primary_light,
// spreadRadius: 1,
// ),
// ],
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
// boxShadow: [
// BoxShadow(
// //color: AppColors.primary_light,
// spreadRadius: 1,
// ),
// ],
),
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.5
:
getHeight
(
context
)*
0.35
,
width:
double
.
maxFinite
,
child:
ListView
.
builder
(
scrollDirection:
Axis
.
horizontal
,
itemCount:
state
.
newModel
.
data
!.
length
,
itemBuilder:
(
context
,
index
)
{
return
Container
(
padding:
const
EdgeInsets
.
all
(
10
),
decoration:
const
BoxDecoration
(
color:
AppColors
.
background
,
),
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.5
:
getHeight
(
context
)*
0.3
5
,
width:
double
.
maxFinite
,
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.5
:
getHeight
(
context
)*
0.3
,
width:
checkLandscape
(
context
)?
getWidth
(
context
)*
0.3
:
getWidth
(
context
)*
0.6
,
child:
ListView
.
builder
(
scrollDirection:
Axis
.
horizontal
,
itemCount:
state
.
newModel
.
data
!.
length
,
itemBuilder:
(
context
,
index
)
{
return
Container
(
padding:
const
EdgeInsets
.
all
(
10
),
decoration:
const
BoxDecoration
(
color:
AppColors
.
background
,
),
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.5
:
getHeight
(
context
)*
0.3
,
width:
checkLandscape
(
context
)?
getWidth
(
context
)*
0.3
:
getWidth
(
context
)*
0.6
,
child:
Container
(
decoration:
const
BoxDecoration
(
color:
AppColors
.
white
,
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
boxShadow:
[
BoxShadow
(
color:
AppColors
.
primary
,
spreadRadius:
0.5
,
),
],
),
child:
Column
(
//load_err
children:
[
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
8.0
),
child:
Image
.
network
(
state
.
newModel
.
data
![
index
].
urlImageRepresent
!,
fit:
BoxFit
.
fill
,
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.3
:
getHeight
(
context
)*
0.2
,
width:
double
.
maxFinite
,
errorBuilder:
(
BuildContext
context
,
Object
exception
,
StackTrace
?
stackTrace
)
{
return
Image
.
asset
(
Images
.
load_err
,
fit:
BoxFit
.
fill
,
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.3
:
getHeight
(
context
)*
0.2
,
width:
double
.
maxFinite
,);
},
),
),
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
0
,
20
,
0
,
0
),
child:
Text
(
state
.
newModel
.
data
![
index
].
title
!),
),
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
0
,
5
,
0
,
0
),
child:
Text
(
state
.
newModel
.
data
![
index
].
title
!),
),
],
),
Container
(
decoration:
const
BoxDecoration
(
color:
AppColors
.
white
,
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
boxShadow:
[
BoxShadow
(
color:
AppColors
.
primary
,
spreadRadius:
0.5
,
),
],
),
child:
Column
(
//load_err
children:
[
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
8.0
),
child:
Image
.
network
(
state
.
newModel
.
data
![
index
].
urlImageRepresent
!,
fit:
BoxFit
.
fill
,
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.3
:
getHeight
(
context
)*
0.2
,
width:
double
.
maxFinite
,
errorBuilder:
(
BuildContext
context
,
Object
exception
,
StackTrace
?
stackTrace
)
{
return
Image
.
asset
(
Images
.
load_err
,
fit:
BoxFit
.
fill
,
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.3
:
getHeight
(
context
)*
0.2
,
width:
double
.
maxFinite
,);
},
),
);
},
),
);
),
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
0
,
20
,
0
,
0
),
child:
Text
(
state
.
newModel
.
data
![
index
].
title
!),
),
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
0
,
5
,
0
,
0
),
child:
Text
(
state
.
newModel
.
data
![
index
].
title
!),
),
],
),
),
);
},
),
);
}
return
const
Text
(
'NewFailed'
);
}
)
],
),
);
}
}
return
const
Text
(
'NewFailed'
);
}
)
],
),
);
}
}
lib/app/module/playvideo/page/play_video.dart
View file @
b9fe2174
...
...
@@ -3,38 +3,85 @@ import 'package:flutter/material.dart';
import
'package:flutter/services.dart'
;
import
'package:youtube_player_flutter/youtube_player_flutter.dart'
;
class
PlayVideoPage
extends
State
less
Widget
{
class
PlayVideoPage
extends
State
ful
Widget
{
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
)
{
_controller
=
YoutubePlayerController
(
initialVideoId:
YoutubePlayer
.
convertUrlToId
(
link
).
toString
(),
flags:
const
YoutubePlayerFlags
(
mute:
false
,
autoPlay:
true
,
disableDragSeek:
false
,
loop:
false
,
isLive:
false
,
forceHD:
false
,
enableCaption:
true
,
),
);
return
YoutubePlayerBuilder
(
onExitFullScreen:
()
{
SystemChrome
.
setPreferredOrientations
(
DeviceOrientation
.
values
);},
player:
YoutubePlayer
(
controller:
_controller
,
showVideoProgressIndicator:
true
,
progressIndicatorColor:
Colors
.
blueAccent
,
),
builder:
(
context
,
player
)
=>
Scaffold
(
appBar:
AppBar
(
title:
Text
(
YoutubePlayer
.
convertUrlToId
(
link
).
toString
()),),
body:
Container
(
child:
player
),
),
);
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 @
b9fe2174
...
...
@@ -22,125 +22,116 @@ class SchoolWidget extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
BlocProvider
.
of
<
SchoolBloc
>(
context
).
add
(
RequestSchool
(
context:
context
));
return
BlocConsumer
<
SchoolBloc
,
SchoolState
>(
listener:
(
context
,
state
)
async
{},
builder:
(
context
,
state
)
{
return
Container
(
color:
AppColors
.
background
,
child:
Column
(
return
Container
(
color:
AppColors
.
background
,
child:
Column
(
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
0
,
0
,
0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
0
,
0
,
0
),
const
Text
(
'Tham Gia Khoa Hoc Thu'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
15
),),
TextButton
(
child:
Text
(
'Xem Them >>'
),
onPressed:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
SearchWidget
(),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
const
Text
(
'Tham Gia Khoa Hoc Thu'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
15
),),
TextButton
(
child:
Text
(
'Xem Them >>'
),
onPressed:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
SearchWidget
(),
)).
then
((
value
)
{
if
(
value
!=
null
&&
value
is
bool
&&
value
)
{}
});
}
)
],
),
),
BlocBuilder
<
SchoolBloc
,
SchoolState
>(
builder:
(
context
,
state
)
{
if
(
state
is
SchoolInitial
){
return
const
Text
(
'SchoolInitial'
);
}
if
(
state
is
SchoolFailed
){
const
CircularProgressIndicator
();
return
Text
(
state
.
message
.
toString
());
}
if
(
state
is
SchoolLoading
){
return
const
CircularProgressIndicator
();
}
if
(
state
is
SchoolSuccess
){
listData
=
state
.
schoolModel
.
data
!.
listData
!;
onData
!(
listData
);
return
Swiper
(
itemHeight:
340
,
itemWidth:
double
.
maxFinite
,
layout:
SwiperLayout
.
TINDER
,
)).
then
((
value
)
{
if
(
value
!=
null
&&
value
is
bool
&&
value
)
{}
});
}
)
],
),
),
BlocBuilder
<
SchoolBloc
,
SchoolState
>(
builder:
(
context
,
state
)
{
if
(
state
is
SchoolInitial
){
return
const
Text
(
'SchoolInitial'
);
}
if
(
state
is
SchoolFailed
){
const
CircularProgressIndicator
();
return
Text
(
state
.
message
.
toString
());
}
if
(
state
is
SchoolLoading
){
return
const
CircularProgressIndicator
();
}
if
(
state
is
SchoolSuccess
){
listData
=
state
.
schoolModel
.
data
!.
listData
!;
onData
!(
listData
);
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Swiper
(
itemHeight:
340
,
itemWidth:
double
.
maxFinite
,
layout:
SwiperLayout
.
TINDER
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Container
(
decoration:
const
BoxDecoration
(
boxShadow:
[
BoxShadow
(
color:
AppColors
.
primary
,
spreadRadius:
1
,
),
],
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
),
child:
Column
(
children:
[
Container
(
decoration:
const
BoxDecoration
(
boxShadow:
[
BoxShadow
(
color:
AppColors
.
primary
,
spreadRadius:
1
,
),
],
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
),
child:
Column
(
children:
[
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
8.0
),
child:
Image
.
network
(
listData
[
index
].
image
!,
fit:
BoxFit
.
fill
,
height:
200
,
width:
double
.
maxFinite
,
errorBuilder:
(
BuildContext
context
,
Object
exception
,
StackTrace
?
stackTrace
)
{
return
Image
.
asset
(
Images
.
load_err
);
},
),
),
Padding
(
padding:
const
EdgeInsets
.
all
(
10.0
),
child:
Text
(
listData
[
index
].
type
!),
//Text('abc'),
),
Padding
(
padding:
const
EdgeInsets
.
all
(
10.0
),
child:
Text
(
listData
[
index
].
name
!),
//Text('123'),
),
],),
);
},
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
8.0
),
child:
Image
.
network
(
listData
[
index
].
image
!,
fit:
BoxFit
.
fill
,
height:
200
,
width:
double
.
maxFinite
,
errorBuilder:
(
BuildContext
context
,
Object
exception
,
StackTrace
?
stackTrace
)
{
return
Image
.
asset
(
Images
.
load_err
);
},
),
),
Padding
(
padding:
const
EdgeInsets
.
all
(
10.0
),
child:
Text
(
listData
[
index
].
type
!),
//Text('abc'),
),
Padding
(
padding:
const
EdgeInsets
.
all
(
10.0
),
child:
Text
(
listData
[
index
].
name
!),
//Text('123'),
),
],),
);
},
itemCount:
listData
.
length
,
onTap:
(
index
){
itemCount:
listData
.
length
,
onTap:
(
index
){
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
CourseDetailWidget
(
listData
[
index
].
courseId
!,
listData
[
index
].
image
!),
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
CourseDetailWidget
(
listData
[
index
].
courseId
!,
listData
[
index
].
image
!),
)).
then
((
value
)
{
if
(
value
!=
null
&&
value
is
bool
&&
value
)
{}
});
},
)).
then
((
value
)
{
if
(
value
!=
null
&&
value
is
bool
&&
value
)
{}
});
},
);
}
return
const
Text
(
'SchoolFailed'
);
}
)
],
),
);
}
);
);
}
return
const
Text
(
'SchoolFailed'
);
}
)
],
),
);
}
}
...
...
lib/main.dart
View file @
b9fe2174
...
...
@@ -48,15 +48,15 @@ class MainBloc {
BlocProvider
<
CounterBloc
>(
create:
(
BuildContext
context
)
=>
CounterBloc
()),
BlocProvider
<
CourseBloc
>(
create:
(
BuildContext
context
)
=>
CourseBloc
()),
create:
(
BuildContext
context
)
=>
CourseBloc
()
..
add
(
RequestCourse
(
context:
context
))
),
BlocProvider
<
SchoolBloc
>(
create:
(
BuildContext
context
)
=>
SchoolBloc
()),
create:
(
BuildContext
context
)
=>
SchoolBloc
()
..
add
(
RequestSchool
(
context:
context
))
),
BlocProvider
<
LoginBloc
>(
create:
(
BuildContext
context
)
=>
LoginBloc
()),
BlocProvider
<
NewBloc
>(
create:
(
BuildContext
context
)
=>
NewBloc
()),
create:
(
BuildContext
context
)
=>
NewBloc
()
..
add
(
RequestNew
(
context:
context
))
),
BlocProvider
<
CommentBloc
>(
create:
(
BuildContext
context
)
=>
CommentBloc
()),
create:
(
BuildContext
context
)
=>
CommentBloc
()
..
add
(
RequestComment
(
context:
context
))
),
BlocProvider
<
CourseDetailBloc
>(
create:
(
BuildContext
context
)
=>
CourseDetailBloc
()),
BlocProvider
<
LessonBloc
>(
...
...
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