Commit 4dcc87e2 authored by NguyenTienManh's avatar NguyenTienManh

update

parent 7b73b6a0
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,19 +18,22 @@ class CommentWidget extends StatelessWidget { ...@@ -15,19 +18,22 @@ 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(
color: AppColors.background,
child: Column(
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.fromLTRB(10, 10, 0, 0), padding: const EdgeInsets.fromLTRB(20, 0, 0, 0),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
const Text('Nhan xet cua phu huynh',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15),), const Text('Nhan xet cua phu huynh',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15),),
const SizedBox(width: 100),
TextButton( TextButton(
child: Text('Xem Them >>'), child: Text('Xem Them >>'),
onPressed: () { onPressed: () {
...@@ -56,28 +62,95 @@ class CommentWidget extends StatelessWidget { ...@@ -56,28 +62,95 @@ class CommentWidget extends StatelessWidget {
Container( Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)), borderRadius: BorderRadius.all(Radius.circular(10)),
color: AppColors.background,
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: AppColors.primary_light, color: AppColors.primary,
spreadRadius: 1, spreadRadius: 0.5,
), ),
], ],
), ),
height: 250, height: checkLandscape(context)?getHeight(context)*0.5:getHeight(context)*0.3,
width: double.maxFinite, width: double.maxFinite,
child: child:
PageView.builder( PageView.builder(
itemCount: state.commentModel.data!.length, //itemCount: state.commentModel.data!.length,
itemBuilder: (BuildContext context, int index) { 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 return
Column( Column(
children: [ children: [
Text(state.commentModel.data![index].courseName!), Padding(
//Text(state.commentModel.data![index].content!), 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) { onPageChanged: (int index) {
}), }),
...@@ -88,6 +161,7 @@ class CommentWidget extends StatelessWidget { ...@@ -88,6 +161,7 @@ class CommentWidget extends StatelessWidget {
), ),
const SizedBox(height: 100,), const SizedBox(height: 100,),
], ],
),
); );
} }
); );
......
...@@ -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,14 +22,16 @@ class CourseWidget extends StatelessWidget { ...@@ -25,14 +22,16 @@ 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(
color: AppColors.background,
child: Column(
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.fromLTRB(10, 10, 0, 0), padding: const EdgeInsets.fromLTRB(20, 0, 0, 0),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
const Text('Tham Gia Khoa Hoc Thu',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15),), const Text('Tham Gia Khoa Hoc Thu',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15),),
const SizedBox(width: 100),
TextButton( TextButton(
child: const Text('Xem Them>>'), child: const Text('Xem Them>>'),
onPressed: () { onPressed: () {
...@@ -128,6 +127,7 @@ class CourseWidget extends StatelessWidget { ...@@ -128,6 +127,7 @@ class CourseWidget extends StatelessWidget {
} }
) )
], ],
),
); );
} }
); );
......
...@@ -15,16 +15,3 @@ class RemoteCourseDetail{ ...@@ -15,16 +15,3 @@ class RemoteCourseDetail{
return null; return null;
} }
} }
// 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
...@@ -22,8 +22,19 @@ class LoginPage extends StatelessWidget { ...@@ -22,8 +22,19 @@ class LoginPage extends StatelessWidget {
}, },
builder: (context, state) { builder: (context, state) {
return return
Column( Container(
color: AppColors.background,
child: Column(
children: [ 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(
padding: const EdgeInsets.only(left: 60, right: 60), padding: const EdgeInsets.only(left: 60, right: 60),
child: child:
...@@ -34,7 +45,6 @@ class LoginPage extends StatelessWidget { ...@@ -34,7 +45,6 @@ class LoginPage extends StatelessWidget {
controller: _userController, controller: _userController,
), ),
), ),
Padding( Padding(
padding: const EdgeInsets.only(left: 60, right: 60), padding: const EdgeInsets.only(left: 60, right: 60),
child: child:
...@@ -46,8 +56,12 @@ class LoginPage extends StatelessWidget { ...@@ -46,8 +56,12 @@ class LoginPage extends StatelessWidget {
), ),
), ),
OutlinedButton( Padding(
style: OutlinedButton.styleFrom(minimumSize: Size(400, 50),backgroundColor: AppColors.primary, padding: const EdgeInsets.all(20.0),
child: OutlinedButton(
style: OutlinedButton.styleFrom(
minimumSize: const Size.fromHeight(50),
backgroundColor: AppColors.primary,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0), borderRadius: BorderRadius.circular(20.0),
), ),
...@@ -59,11 +73,12 @@ class LoginPage extends StatelessWidget { ...@@ -59,11 +73,12 @@ class LoginPage extends StatelessWidget {
username: _userController.text, username: _userController.text,
password: _passController.text)); password: _passController.text));
}, },
child: Text("Submit Form".toUpperCase(), child: Text("Dang Nhap".toUpperCase(),
style: const TextStyle( style: const TextStyle(
color: AppColors.white, color: AppColors.white,
fontWeight: FontWeight.bold),) fontWeight: FontWeight.bold),)
), ),
),
BlocBuilder<LoginBloc, LoginState>( BlocBuilder<LoginBloc, LoginState>(
builder: (context, state) { builder: (context, state) {
if (state is LoginLoading) { if (state is LoginLoading) {
...@@ -83,6 +98,7 @@ class LoginPage extends StatelessWidget { ...@@ -83,6 +98,7 @@ class LoginPage extends StatelessWidget {
return const CircularProgressIndicator(); return const CircularProgressIndicator();
}), }),
], ],
),
); );
}, },
); );
......
...@@ -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,18 +20,27 @@ class NewWidget extends StatelessWidget { ...@@ -21,18 +20,27 @@ class NewWidget extends StatelessWidget {
listener: (context, state) async {}, listener: (context, state) async {},
builder: (context, state) { builder: (context, state) {
return return
Column( Container(
color: AppColors.background,
child: Column(
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.fromLTRB(10, 10, 0, 0), padding: const EdgeInsets.fromLTRB(20, 0, 0, 0),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
const Text('Tin Tuc',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15),), const Text('Tin Tuc',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15),),
const SizedBox(width: 100),
TextButton( TextButton(
child: Text('Xem Them >>'), child: const Text('Xem Them>>'),
onPressed: () { onPressed: () {
print('Pressed'); // Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => SearchWidget(),
//
// )).then((value) {
// if (value != null && value is bool && value) {}
// });
} }
) )
], ],
...@@ -53,66 +61,72 @@ class NewWidget extends StatelessWidget { ...@@ -53,66 +61,72 @@ class NewWidget extends StatelessWidget {
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)), borderRadius: BorderRadius.all(Radius.circular(10)),
boxShadow: [ // boxShadow: [
BoxShadow( // BoxShadow(
color: AppColors.primary_light, // //color: AppColors.primary_light,
spreadRadius: 1, // spreadRadius: 1,
// ),
// ],
), ),
], height: checkLandscape(context)?getHeight(context)*0.5:getHeight(context)*0.3,
),
height: 250,
width: double.maxFinite, width: double.maxFinite,
child: child:
ListView.builder( ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: state.newModel!.data!.length, itemCount: state.newModel.data!.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return Container( return
Container(
decoration: BoxDecoration( 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, color: AppColors.white,
borderRadius: const BorderRadius.all(Radius.circular(10)), borderRadius: BorderRadius.all(Radius.circular(10)),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: AppColors.lightGrey.withOpacity(1), color: AppColors.primary,
spreadRadius: 1, spreadRadius: 0.5,
offset: const Offset(0, 0), // changes position of shadow
), ),
], ],
), ),
height: 250, child: Column(
width: 250,
child:
Column(
//load_err //load_err
children: [ children: [
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
child: child:
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', 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, fit: BoxFit.fill,height:checkLandscape(context)?getHeight(context)*0.3:getHeight(context)*0.2,width: double.maxFinite,
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return const Text('😢'); return const Text('😢');
}, },
), ),
), ),
Padding( Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(0.0),
child: child:
Text(state.newModel!.data![index].title!), Text(state.newModel.data![index].title!),
//Text('abc'), //Text('abc'),
), ),
Padding( Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(0.0),
child: child:
Text(state.newModel!.data![index].title!), Text(state.newModel.data![index].title!),
//Text('123'), //Text('123'),
), ),
], ],
), ),
),
); );
}, },
), ),
...@@ -123,6 +137,7 @@ class NewWidget extends StatelessWidget { ...@@ -123,6 +137,7 @@ class NewWidget extends StatelessWidget {
} }
) )
], ],
),
); );
} }
); );
......
...@@ -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,14 +26,17 @@ class SchoolWidget extends StatelessWidget { ...@@ -30,14 +26,17 @@ 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(
color: AppColors.background,
child: Column(
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.fromLTRB(10, 10, 0, 0), padding: const EdgeInsets.fromLTRB(20, 0, 0, 0),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
const Text('Tham Gia Khoa Hoc Thu',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15),), const Text('Tham Gia Khoa Hoc Thu',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15),),
const SizedBox(width: 100),
TextButton( TextButton(
child: Text('Xem Them >>'), child: Text('Xem Them >>'),
onPressed: () { onPressed: () {
...@@ -135,6 +134,7 @@ class SchoolWidget extends StatelessWidget { ...@@ -135,6 +134,7 @@ class SchoolWidget extends StatelessWidget {
} }
) )
], ],
),
); );
} }
); );
......
...@@ -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: 40,), Image.asset(Images.notify,height: 30,width: 30,),
],), ],),
); );
} }
......
...@@ -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:
......
...@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment