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
4dcc87e2
Commit
4dcc87e2
authored
Feb 13, 2023
by
NguyenTienManh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
7b73b6a0
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
531 additions
and
431 deletions
+531
-431
lib/app/module/comment/widgets/comment_widget.dart
lib/app/module/comment/widgets/comment_widget.dart
+140
-66
lib/app/module/course/widgets/course_widget.dart
lib/app/module/course/widgets/course_widget.dart
+97
-97
lib/app/module/coursedetail/request/course_detail_request.dart
...pp/module/coursedetail/request/course_detail_request.dart
+1
-14
lib/app/module/login/widget/login_widget.dart
lib/app/module/login/widget/login_widget.dart
+70
-54
lib/app/module/new/widgets/new_widget.dart
lib/app/module/new/widgets/new_widget.dart
+112
-97
lib/app/module/school/widgets/school_widget.dart
lib/app/module/school/widgets/school_widget.dart
+99
-99
lib/app/ui/navigationbottom/home_page.dart
lib/app/ui/navigationbottom/home_page.dart
+4
-4
pubspec.lock
pubspec.lock
+7
-0
pubspec.yaml
pubspec.yaml
+1
-0
No files found.
lib/app/module/comment/widgets/comment_widget.dart
View file @
4dcc87e2
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:flutter_bloc/flutter_bloc.dart'
;
import
'package:ongbut_ntmanh/widgets/widgets_util.dart'
;
import
'package:smooth_page_indicator/smooth_page_indicator.dart'
;
import
'../../../../const/colors.dart'
;
import
'../../../../const/colors.dart'
;
import
'../../../../res/images/images.dart'
;
import
'../bloc/comment_bloc.dart'
;
import
'../bloc/comment_bloc.dart'
;
import
'../model/comment_model.dart'
;
import
'../model/comment_model.dart'
;
...
@@ -15,80 +18,151 @@ class CommentWidget extends StatelessWidget {
...
@@ -15,80 +18,151 @@ class CommentWidget extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
BlocProvider
.
of
<
CommentBloc
>(
context
).
add
(
BlocProvider
.
of
<
CommentBloc
>(
context
).
add
(
RequestComment
(
context:
context
));
RequestComment
(
context:
context
));
PageController
_pageController
=
new
PageController
();
return
return
BlocConsumer
<
CommentBloc
,
CommentState
>(
BlocConsumer
<
CommentBloc
,
CommentState
>(
listener:
(
context
,
state
)
async
{},
listener:
(
context
,
state
)
async
{},
builder:
(
context
,
state
)
{
builder:
(
context
,
state
)
{
return
return
Column
(
Container
(
children:
[
color:
AppColors
.
background
,
Padding
(
child:
Column
(
padding:
const
EdgeInsets
.
fromLTRB
(
10
,
10
,
0
,
0
),
children:
[
child:
Row
(
Padding
(
children:
[
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
0
,
0
,
0
),
const
Text
(
'Nhan xet cua phu huynh'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
15
),),
child:
Row
(
const
SizedBox
(
width:
100
),
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
TextButton
(
children:
[
child:
Text
(
'Xem Them >>'
),
const
Text
(
'Nhan xet cua phu huynh'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
15
),),
onPressed:
()
{
TextButton
(
print
(
'Pressed'
);
child:
Text
(
'Xem Them >>'
),
}
onPressed:
()
{
)
print
(
'Pressed'
);
],
}
)
],
),
),
),
),
BlocBuilder
<
CommentBloc
,
CommentState
>(
BlocBuilder
<
CommentBloc
,
CommentState
>(
builder:
(
context
,
state
)
{
builder:
(
context
,
state
)
{
if
(
state
is
CommentInitial
){
if
(
state
is
CommentInitial
){
return
const
Text
(
'CommentInitial'
);
return
const
Text
(
'CommentInitial'
);
}
}
if
(
state
is
CommentFailed
){
if
(
state
is
CommentFailed
){
//const CircularProgressIndicator();
//const CircularProgressIndicator();
return
Text
(
'CommentFailed'
);
return
Text
(
'CommentFailed'
);
}
}
if
(
state
is
CommentLoading
){
if
(
state
is
CommentLoading
){
return
const
Text
(
'CommentLoading'
);
return
const
Text
(
'CommentLoading'
);
}
}
if
(
state
is
CommentSuccess
){
if
(
state
is
CommentSuccess
){
commentModel
=
state
.
commentModel
;
commentModel
=
state
.
commentModel
;
onData
!(
commentModel
!);
onData
!(
commentModel
!);
return
return
Container
(
Container
(
decoration:
const
BoxDecoration
(
decoration:
const
BoxDecoration
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
boxShadow:
[
color:
AppColors
.
background
,
BoxShadow
(
boxShadow:
[
color:
AppColors
.
primary
,
BoxShadow
(
spreadRadius:
0.5
,
color:
AppColors
.
primary_light
,
),
spreadRadius:
1
,
],
),
),
],
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.5
:
getHeight
(
context
)*
0.3
,
),
width:
double
.
maxFinite
,
height:
250
,
child:
width:
double
.
maxFinite
,
PageView
.
builder
(
child:
//itemCount: state.commentModel.data!.length,
PageView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
)
{
itemCount:
state
.
commentModel
.
data
!.
length
,
return
itemBuilder:
(
BuildContext
context
,
int
index
)
{
Stack
(
children:
[
return
Container
(
Column
(
decoration:
const
BoxDecoration
(
children:
[
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
Text
(
state
.
commentModel
.
data
![
index
].
courseName
!),
color:
AppColors
.
white
,
//Text(state.commentModel.data![index].content!),
boxShadow:
[
],
BoxShadow
(
);
color:
AppColors
.
primary_light
,
},
spreadRadius:
1
,
onPageChanged:
(
int
index
)
{
),
],
),
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
].
courseType
!),
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
10
,
0
,
10
,
0
),
child:
Expanded
(
child:
Text
(
state
.
commentModel
.
data
![
index
].
content
!,
style:
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
),
),),
),
],),
],);
// Column(
// children: [
// Text(state.commentModel.data![index].courseName!),
// //Text(state.commentModel.data![index].content!),
// ],
// );
},
onPageChanged:
(
int
index
)
{
}),
);
}
return
const
Text
(
'NewFailed'
);
}
}
return
const
Text
(
'NewFailed'
);
),
}
const
SizedBox
(
height:
100
,),
),
],
const
SizedBox
(
height:
100
,),
),
],
);
);
}
}
);
);
}
}
...
...
lib/app/module/course/widgets/course_widget.dart
View file @
4dcc87e2
...
@@ -4,9 +4,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
...
@@ -4,9 +4,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import
'package:flutter_swiper_view/flutter_swiper_view.dart'
;
import
'package:flutter_swiper_view/flutter_swiper_view.dart'
;
import
'package:ongbut_ntmanh/app/module/course/model/list_data.dart'
;
import
'package:ongbut_ntmanh/app/module/course/model/list_data.dart'
;
import
'package:ongbut_ntmanh/const/colors.dart'
;
import
'package:ongbut_ntmanh/const/colors.dart'
;
import
'../../../../res/images/images.dart'
;
import
'../../../../widgets/widgets_util.dart'
;
import
'../../../ui/search_page.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'
;
...
@@ -25,109 +22,112 @@ class CourseWidget extends StatelessWidget {
...
@@ -25,109 +22,112 @@ class CourseWidget extends StatelessWidget {
BlocConsumer
<
CourseBloc
,
CourseState
>(
BlocConsumer
<
CourseBloc
,
CourseState
>(
listener:
(
context
,
state
)
async
{},
listener:
(
context
,
state
)
async
{},
builder:
(
context
,
state
)
{
builder:
(
context
,
state
)
{
return
Column
(
return
Container
(
children:
[
color:
AppColors
.
background
,
Padding
(
child:
Column
(
padding:
const
EdgeInsets
.
fromLTRB
(
10
,
10
,
0
,
0
),
children:
[
child:
Row
(
Padding
(
children:
[
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
0
,
0
,
0
),
const
Text
(
'Tham Gia Khoa Hoc Thu'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
15
),),
child:
Row
(
const
SizedBox
(
width:
100
),
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
TextButton
(
children:
[
child:
const
Text
(
'Xem Them>>'
),
const
Text
(
'Tham Gia Khoa Hoc Thu'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
15
),),
onPressed:
()
{
TextButton
(
Navigator
.
push
(
child:
const
Text
(
'Xem Them>>'
),
context
,
onPressed:
()
{
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
!;
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:
[
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
const
Text
(
'😢'
);
},),
),
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
){
Navigator
.
push
(
Navigator
.
push
(
context
,
context
,
MaterialPageRoute
(
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'
),
builder:
(
_
)
=>
SearchWidget
(
),
)).
then
((
value
)
{
)).
then
((
value
)
{
if
(
value
!=
null
&&
value
is
bool
&&
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
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
const
Text
(
'😢'
);
},),
),
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
){
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
)
{}
});
},
);
);
}
return
const
Text
(
'CourseFailed'
);
}
}
return
const
Text
(
'CourseFailed'
);
)
}
],
)
),
],
);
);
}
}
);
);
...
...
lib/app/module/coursedetail/request/course_detail_request.dart
View file @
4dcc87e2
...
@@ -14,17 +14,4 @@ class RemoteCourseDetail{
...
@@ -14,17 +14,4 @@ class RemoteCourseDetail{
}
}
return
null
;
return
null
;
}
}
}
}
\ No newline at end of file
// class RemoteCourseDetail{
// Future<CourseDetailModel?> getCourseDetailModel() async{
// var dio = Dio();
// String url = ("https://imes-api.myitsol.com/api/v1/public/course/ef6c4a7b-54f7-46b7-9ffd-99b057baa757");
// var response = await dio.get(url);
// if(response.statusCode == 200){
// var json = response.data;
// return CourseDetailModel.fromJson(json);
// }
// return null;
// }
// }
\ No newline at end of file
lib/app/module/login/widget/login_widget.dart
View file @
4dcc87e2
...
@@ -22,67 +22,83 @@ class LoginPage extends StatelessWidget {
...
@@ -22,67 +22,83 @@ class LoginPage extends StatelessWidget {
},
},
builder:
(
context
,
state
)
{
builder:
(
context
,
state
)
{
return
return
Column
(
Container
(
children:
[
color:
AppColors
.
background
,
Padding
(
child:
Column
(
padding:
const
EdgeInsets
.
only
(
left:
60
,
right:
60
),
children:
[
child:
Padding
(
TextFormField
(
padding:
const
EdgeInsets
.
fromLTRB
(
0
,
20
,
0
,
0
),
decoration:
const
InputDecoration
(
child:
Row
(
labelText:
'Product Name'
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
const
Text
(
'Dang Ky & Tu Van'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
16
),),
],
),
),
controller:
_userController
,
),
),
),
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
60
,
right:
60
),
Padding
(
child:
padding:
const
EdgeInsets
.
only
(
left:
60
,
right:
60
),
TextFormField
(
child:
decoration:
const
InputDecoration
(
TextFormField
(
labelText:
'Product Name'
,
decoration:
const
InputDecoration
(
),
labelText:
'PassWord'
,
controller:
_userController
,
),
),
controller:
_passController
,
),
),
),
Padding
(
padding:
const
EdgeInsets
.
only
(
left:
60
,
right:
60
),
OutlinedButton
(
child:
style:
OutlinedButton
.
styleFrom
(
minimumSize:
Size
(
400
,
50
),
backgroundColor:
AppColors
.
primary
,
TextFormField
(
shape:
RoundedRectangleBorder
(
decoration:
const
InputDecoration
(
borderRadius:
BorderRadius
.
circular
(
20.0
)
,
labelText:
'PassWord'
,
),
),
controller:
_passController
,
),
),
onPressed:
()
async
{
),
BlocProvider
.
of
<
LoginBloc
>(
context
).
add
(
RequestLogin
(
Padding
(
context:
context
,
padding:
const
EdgeInsets
.
all
(
20.0
),
username:
_userController
.
text
,
child:
OutlinedButton
(
password:
_passController
.
text
));
style:
OutlinedButton
.
styleFrom
(
},
minimumSize:
const
Size
.
fromHeight
(
50
),
child:
Text
(
"Submit Form"
.
toUpperCase
(),
backgroundColor:
AppColors
.
primary
,
style:
const
TextStyle
(
shape:
RoundedRectangleBorder
(
color:
AppColors
.
white
,
borderRadius:
BorderRadius
.
circular
(
20.0
),
fontWeight:
FontWeight
.
bold
),)
),
),
),
BlocBuilder
<
LoginBloc
,
LoginState
>(
onPressed:
()
async
{
builder:
(
context
,
state
)
{
BlocProvider
.
of
<
LoginBloc
>(
context
).
add
(
if
(
state
is
LoginLoading
)
{
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
Text
(
'LoginInitial'
);
}
if
(
state
is
LoginSuccess
)
{
return
Text
(
'Dang Nhap Thanh Cong'
);
}
return
const
CircularProgressIndicator
();
return
const
CircularProgressIndicator
();
}
}),
if
(
state
is
LoginFailed
)
{
],
return
const
Text
(
'login false!'
);
),
}
if
(
state
is
LoginInitial
)
{
return
Text
(
'LoginInitial'
);
}
if
(
state
is
LoginSuccess
)
{
return
Text
(
'Dang Nhap Thanh Cong'
);
}
return
const
CircularProgressIndicator
();
}),
],
);
);
},
},
);
);
...
...
lib/app/module/new/widgets/new_widget.dart
View file @
4dcc87e2
...
@@ -4,7 +4,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
...
@@ -4,7 +4,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import
'package:ongbut_ntmanh/app/module/new/model/new_model.dart'
;
import
'package:ongbut_ntmanh/app/module/new/model/new_model.dart'
;
import
'../../../../const/colors.dart'
;
import
'../../../../const/colors.dart'
;
import
'../../../../res/images/images.dart'
;
import
'../../../../widgets/widgets_util.dart'
;
import
'../../../../widgets/widgets_util.dart'
;
import
'../bloc/new_bloc.dart'
;
import
'../bloc/new_bloc.dart'
;
...
@@ -21,109 +20,125 @@ class NewWidget extends StatelessWidget {
...
@@ -21,109 +20,125 @@ class NewWidget extends StatelessWidget {
listener:
(
context
,
state
)
async
{},
listener:
(
context
,
state
)
async
{},
builder:
(
context
,
state
)
{
builder:
(
context
,
state
)
{
return
return
Column
(
Container
(
children:
[
color:
AppColors
.
background
,
Padding
(
child:
Column
(
padding:
const
EdgeInsets
.
fromLTRB
(
10
,
10
,
0
,
0
),
children:
[
child:
Row
(
Padding
(
children:
[
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
0
,
0
,
0
),
const
Text
(
'Tin Tuc'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
15
),),
child:
Row
(
const
SizedBox
(
width:
100
),
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
TextButton
(
children:
[
child:
Text
(
'Xem Them >>'
),
const
Text
(
'Tin Tuc'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
15
),),
onPressed:
()
{
TextButton
(
print
(
'Pressed'
);
child:
const
Text
(
'Xem Them>>'
),
}
onPressed:
()
{
)
// Navigator.push(
],
// context,
// MaterialPageRoute(
// builder: (_) => SearchWidget(),
//
// )).then((value) {
// if (value != null && value is bool && value) {}
// });
}
)
],
),
),
),
),
BlocBuilder
<
NewBloc
,
NewState
>(
BlocBuilder
<
NewBloc
,
NewState
>(
builder:
(
context
,
state
)
{
builder:
(
context
,
state
)
{
if
(
state
is
NewInitial
){
if
(
state
is
NewInitial
){
return
const
Text
(
'NewInitial'
);
return
const
Text
(
'NewInitial'
);
}
}
if
(
state
is
NewFailed
){
if
(
state
is
NewFailed
){
//const CircularProgressIndicator();
//const CircularProgressIndicator();
return
Text
(
'NewInitial'
);
return
Text
(
'NewInitial'
);
}
}
if
(
state
is
NewLoading
){
if
(
state
is
NewLoading
){
return
const
Text
(
'NewInitial'
);
return
const
Text
(
'NewInitial'
);
}
}
if
(
state
is
NewSuccess
){
if
(
state
is
NewSuccess
){
return
return
Container
(
Container
(
padding:
EdgeInsets
.
fromLTRB
(
20
,
0
,
0
,
0
),
decoration:
const
BoxDecoration
(
decoration:
const
BoxDecoration
(
color:
AppColors
.
white
,
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
boxShadow:
[
BoxShadow
(
color:
AppColors
.
primary_light
,
spreadRadius:
1
,
),
],
),
height:
250
,
width:
double
.
maxFinite
,
child:
ListView
.
builder
(
scrollDirection:
Axis
.
horizontal
,
itemCount:
state
.
newModel
!.
data
!.
length
,
itemBuilder:
(
context
,
index
)
{
return
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
color:
AppColors
.
white
,
// boxShadow: [
borderRadius:
const
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
// BoxShadow(
boxShadow:
[
// //color: AppColors.primary_light,
BoxShadow
(
// spreadRadius: 1,
color:
AppColors
.
lightGrey
.
withOpacity
(
1
),
// ),
spreadRadius:
1
,
// ],
offset:
const
Offset
(
0
,
0
),
// changes position of shadow
),
),
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.5
:
getHeight
(
context
)*
0.3
,
],
width:
double
.
maxFinite
,
),
child:
height:
250
,
ListView
.
builder
(
width:
250
,
scrollDirection:
Axis
.
horizontal
,
child:
itemCount:
state
.
newModel
.
data
!.
length
,
Column
(
itemBuilder:
(
context
,
index
)
{
//load_err
return
children:
[
Container
(
ClipRRect
(
padding:
const
EdgeInsets
.
all
(
10
),
borderRadius:
BorderRadius
.
circular
(
8.0
),
decoration:
const
BoxDecoration
(
child:
color:
AppColors
.
background
,
Image
.
network
(
state
.
newModel
!.
data
![
index
].
urlImageRepresent
!=
null
?
state
.
newModel
!.
data
![
index
].
urlImageRepresent
!:
'https://oss.myitsol.com/imes-public/2022/12/11/neymar_145527553.PNG'
,
),
fit:
BoxFit
.
fill
,
height:
150
,
width:
double
.
maxFinite
,
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.5
:
getHeight
(
context
)*
0.3
,
errorBuilder:
(
BuildContext
context
,
Object
exception
,
StackTrace
?
stackTrace
)
{
width:
checkLandscape
(
context
)?
getWidth
(
context
)*
0.3
:
getWidth
(
context
)*
0.6
,
return
const
Text
(
'😢'
);
child:
},
Container
(
decoration:
const
BoxDecoration
(
color:
AppColors
.
white
,
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10
)),
boxShadow:
[
BoxShadow
(
color:
AppColors
.
primary
,
spreadRadius:
0.5
,
),
),
],
),
),
Padding
(
child:
Column
(
padding:
const
EdgeInsets
.
all
(
10.0
),
//load_err
child:
children:
[
Text
(
state
.
newModel
!.
data
![
index
].
title
!),
ClipRRect
(
//Text('abc'),
borderRadius:
BorderRadius
.
circular
(
8.0
),
),
child:
Padding
(
Image
.
network
(
state
.
newModel
.
data
![
index
].
urlImageRepresent
!=
null
?
state
.
newModel
.
data
![
index
].
urlImageRepresent
!:
'https://oss.myitsol.com/imes-public/2022/12/11/neymar_145527553.PNG'
,
padding:
const
EdgeInsets
.
all
(
10.0
),
fit:
BoxFit
.
fill
,
height:
checkLandscape
(
context
)?
getHeight
(
context
)*
0.3
:
getHeight
(
context
)*
0.2
,
width:
double
.
maxFinite
,
child:
errorBuilder:
(
BuildContext
context
,
Object
exception
,
StackTrace
?
stackTrace
)
{
Text
(
state
.
newModel
!.
data
![
index
].
title
!),
return
const
Text
(
'😢'
);
//Text('123'),
},
),
),
Padding
(
padding:
const
EdgeInsets
.
all
(
0.0
),
child:
Text
(
state
.
newModel
.
data
![
index
].
title
!),
//Text('abc'),
),
Padding
(
padding:
const
EdgeInsets
.
all
(
0.0
),
child:
Text
(
state
.
newModel
.
data
![
index
].
title
!),
//Text('123'),
),
],
),
),
],
),
),
);
);
},
},
),
),
);
);
}
return
const
Text
(
'NewFailed'
);
}
}
return
const
Text
(
'NewFailed'
);
)
}
],
)
),
],
);
);
}
}
);
);
}
}
...
...
lib/app/module/school/widgets/school_widget.dart
View file @
4dcc87e2
...
@@ -2,14 +2,10 @@ import 'package:flutter/cupertino.dart';
...
@@ -2,14 +2,10 @@ import 'package:flutter/cupertino.dart';
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:flutter_swiper_view/flutter_swiper_view.dart'
;
import
'package:flutter_swiper_view/flutter_swiper_view.dart'
;
import
'package:ongbut_ntmanh/app/module/comment/widgets/comment_widget.dart'
;
import
'package:ongbut_ntmanh/app/module/course/widgets/course_widget.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/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
'../../../ui/search_page.dart'
;
import
'../../../ui/search_page.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'
;
import
'../model/school_model.dart'
;
import
'../model/school_model.dart'
;
...
@@ -30,111 +26,115 @@ class SchoolWidget extends StatelessWidget {
...
@@ -30,111 +26,115 @@ class SchoolWidget extends StatelessWidget {
BlocConsumer
<
SchoolBloc
,
SchoolState
>(
BlocConsumer
<
SchoolBloc
,
SchoolState
>(
listener:
(
context
,
state
)
async
{},
listener:
(
context
,
state
)
async
{},
builder:
(
context
,
state
)
{
builder:
(
context
,
state
)
{
return
Column
(
return
Container
(
children:
[
color:
AppColors
.
background
,
Padding
(
child:
Column
(
padding:
const
EdgeInsets
.
fromLTRB
(
10
,
10
,
0
,
0
),
children:
[
child:
Row
(
Padding
(
children:
[
padding:
const
EdgeInsets
.
fromLTRB
(
20
,
0
,
0
,
0
),
const
Text
(
'Tham Gia Khoa Hoc Thu'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
fontSize:
15
),),
const
SizedBox
(
width:
100
),
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
,
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:
[
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
const
Text
(
'😢'
);
},),
),
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
){
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
(
Navigator
.
push
(
context
,
context
,
MaterialPageRoute
(
MaterialPageRoute
(
builder:
(
_
)
=>
CourseDetailWidget
(
listData
[
index
].
courseId
!,
listData
[
index
].
image
!
),
builder:
(
_
)
=>
SearchWidget
(
),
)).
then
((
value
)
{
)).
then
((
value
)
{
if
(
value
!=
null
&&
value
is
bool
&&
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
,
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:
[
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
const
Text
(
'😢'
);
},),
),
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
){
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
_
)
=>
CourseDetailWidget
(
listData
[
index
].
courseId
!,
listData
[
index
].
image
!),
)).
then
((
value
)
{
if
(
value
!=
null
&&
value
is
bool
&&
value
)
{}
});
},
);
);
}
return
const
Text
(
'SchoolFailed'
);
}
}
return
const
Text
(
'SchoolFailed'
);
)
}
],
)
),
],
);
);
}
}
);
);
...
...
lib/app/ui/navigationbottom/home_page.dart
View file @
4dcc87e2
...
@@ -124,14 +124,14 @@ class _HomePageState extends State<HomePage> {
...
@@ -124,14 +124,14 @@ class _HomePageState extends State<HomePage> {
],
],
),
),
height:
40
,
height:
40
,
width:
200
,
width:
checkLandscape
(
context
)?
getWidth
(
context
)*
0.7
:
getWidth
(
context
)*
0.5
,
child:
Padding
(
child:
const
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
5
,
10
,
0
,
10
),
padding:
EdgeInsets
.
fromLTRB
(
5
,
10
,
0
,
10
),
child:
Text
(
'Tim Kiem'
,
style:
TextStyle
(
fontSize:
15
,
color:
Colors
.
white
),),
child:
Text
(
'Tim Kiem'
,
style:
TextStyle
(
fontSize:
15
,
color:
Colors
.
white
),),
),
),
),
),
),
),
Image
.
asset
(
Images
.
notify
,
height:
40
,
width:
4
0
,),
Image
.
asset
(
Images
.
notify
,
height:
30
,
width:
3
0
,),
],),
],),
);
);
}
}
...
...
pubspec.lock
View file @
4dcc87e2
...
@@ -534,6 +534,13 @@ packages:
...
@@ -534,6 +534,13 @@ packages:
description: flutter
description: flutter
source: sdk
source: sdk
version: "0.0.99"
version: "0.0.99"
smooth_page_indicator:
dependency: "direct main"
description:
name: smooth_page_indicator
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
source_gen:
source_gen:
dependency: transitive
dependency: transitive
description:
description:
...
...
pubspec.yaml
View file @
4dcc87e2
...
@@ -44,6 +44,7 @@ dependencies:
...
@@ -44,6 +44,7 @@ dependencies:
json_annotation
:
^4.7.0
json_annotation
:
^4.7.0
flutter_swiper_view
:
^1.1.8
flutter_swiper_view
:
^1.1.8
youtube_player_flutter
:
^8.1.2
youtube_player_flutter
:
^8.1.2
smooth_page_indicator
:
^1.0.1
dev_dependencies
:
dev_dependencies
:
...
...
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