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
2 years ago
by
NguyenTienManh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 16-2
parent
c0c1c56e
Changes
10
Show 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,20 +9,13 @@ 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
,
...
...
@@ -36,9 +29,7 @@ class CommentWidget extends StatelessWidget {
const
Text
(
'Nhan xet cua phu huynh'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
15
),),
TextButton
(
child:
Text
(
'Xem Them >>'
),
onPressed:
()
{
print
(
'Pressed'
);
}
onPressed:
()
{}
)
],
),
...
...
@@ -49,8 +40,7 @@ class CommentWidget extends StatelessWidget {
return
const
Text
(
'CommentInitial'
);
}
if
(
state
is
CommentFailed
){
//const CircularProgressIndicator();
return
Text
(
'CommentFailed'
);
return
const
Text
(
'CommentFailed'
);
}
if
(
state
is
CommentLoading
){
return
const
Text
(
'CommentLoading'
);
...
...
@@ -133,7 +123,8 @@ class CommentWidget extends StatelessWidget {
children:
[
Container
(
padding:
const
EdgeInsets
.
all
(
10
),
child:
Center
(
child:
SmoothPageIndicator
(
controller:
_pageController
,
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
),
...
...
@@ -142,19 +133,15 @@ class CommentWidget extends StatelessWidget {
],),
],);
},
onPageChanged:
(
int
index
)
{
}),
onPageChanged:
(
int
index
)
{}),
);
}
return
const
Text
(
'NewFailed'
);
}
),
const
SizedBox
(
height:
100
,),
SizedBox
(
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.1
:
getHeight
(
context
)*
0.1
,),
],
),
);
}
);
}
}
This diff is collapsed.
Click to expand it.
lib/app/module/course/widgets/course_widget.dart
View file @
b9fe2174
...
...
@@ -18,12 +18,6 @@ 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
(
...
...
@@ -132,6 +126,4 @@ class CourseWidget extends StatelessWidget {
),
);
}
);
}
}
This diff is collapsed.
Click to expand it.
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,11 +18,11 @@ 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
(
...
...
@@ -37,14 +35,12 @@ class CourseDetailWidget extends StatelessWidget {
},
),
Expanded
(
child:
BlocConsumer
<
CourseDetailBloc
,
CourseDetailState
>(
listener:
(
context
,
state
)
async
{},
builder:
(
context
,
state
)
{
return
child:
BlocBuilder
<
CourseDetailBloc
,
CourseDetailState
>(
bloc:
bloc
,
builder:
(
context
,
state
)
{
if
(
state
is
CourseDetailInitial
){
return
const
Text
(
'SchoolInitial'
);
return
const
CircularProgressIndicator
(
);
}
if
(
state
is
CourseDetailFailed
){
return
Text
(
state
.
message
.
toString
());
...
...
@@ -113,8 +109,6 @@ class CourseDetailWidget extends StatelessWidget {
}
return
const
Text
(
'Default CourseDetail!!!!!'
);
}
);
}
),
),
],)
...
...
@@ -138,6 +132,8 @@ class CourseDetailWidget extends StatelessWidget {
},
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
mainAxisSize:
MainAxisSize
.
max
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
30
,
3
,
0
,
3
),
...
...
@@ -146,11 +142,10 @@ class CourseDetailWidget extends StatelessWidget {
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
),
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
(
...
...
@@ -169,5 +164,3 @@ class CourseDetailWidget extends StatelessWidget {
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
lib/app/module/lession/widgets/lession_widget.dart
View file @
b9fe2174
...
...
@@ -13,15 +13,11 @@ String lessonID;
Widget
build
(
BuildContext
context
)
{
BlocProvider
.
of
<
LessonBloc
>(
context
).
add
(
RequestLesson
(
context:
context
,
lessonID:
lessonID
));
return
BlocConsumer
<
LessonBloc
,
LessonState
>(
listener:
(
context
,
state
)
async
{},
builder:
(
context
,
state
)
{
return
BlocBuilder
<
LessonBloc
,
LessonState
>(
builder:
(
context
,
state
)
{
if
(
state
is
LessonInitial
){
return
const
Text
(
'LessonInitial'
);
return
const
CircularProgressIndicator
(
);
}
if
(
state
is
LessonFailed
){
return
const
Text
(
'LessonFailed'
);
...
...
@@ -38,8 +34,6 @@ String lessonID;
}
);
}
);
}
}
This diff is collapsed.
Click to expand it.
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"
),
);
}
}
This diff is collapsed.
Click to expand it.
lib/app/module/login/widget/login_widget.dart
View file @
b9fe2174
...
...
@@ -15,12 +15,23 @@ 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
_buildUI
(
context
);
},
);
}
}
Widget
_buildUI
(
BuildContext
context
){
return
Container
(
color:
AppColors
.
background
,
...
...
@@ -100,9 +111,6 @@ class LoginPage extends StatelessWidget {
],
),
);
},
);
}
}
This diff is collapsed.
Click to expand it.
lib/app/module/new/widgets/new_widget.dart
View file @
b9fe2174
...
...
@@ -14,12 +14,6 @@ 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
,
...
...
@@ -138,6 +132,4 @@ class NewWidget extends StatelessWidget {
),
);
}
);
}
}
This diff is collapsed.
Click to expand it.
lib/app/module/playvideo/page/play_video.dart
View file @
b9fe2174
...
...
@@ -3,16 +3,33 @@ 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
Widget
build
(
BuildContext
context
)
{
_controller
=
YoutubePlayerController
(
initialVideoId:
YoutubePlayer
.
convertUrlToId
(
link
).
toString
(),
void
initState
()
{
super
.
initState
();
_controller
=
YoutubePlayerController
(
// initialVideoId: "nPt8bK2gbaU",
// initialVideoId: widget.link,
initialVideoId:
YoutubePlayer
.
convertUrlToId
(
widget
.
link
).
toString
(),
flags:
const
YoutubePlayerFlags
(
mute:
false
,
autoPlay:
true
,
...
...
@@ -21,18 +38,48 @@ class PlayVideoPage extends StatelessWidget {
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
);},
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
(
link
).
toString
()),),
appBar:
AppBar
(
title:
Text
(
YoutubePlayer
.
convertUrlToId
(
widget
.
link
).
toString
()),),
body:
Container
(
child:
player
),
),
);
...
...
This diff is collapsed.
Click to expand it.
lib/app/module/school/widgets/school_widget.dart
View file @
b9fe2174
...
...
@@ -22,19 +22,12 @@ 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
(
children:
[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
0
,
0
,
0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
...
...
@@ -140,8 +133,6 @@ class SchoolWidget extends StatelessWidget {
),
);
}
);
}
}
This diff is collapsed.
Click to expand it.
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
>(
...
...
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