Commit 9ceeb706 authored by NguyenTienManh's avatar NguyenTienManh

update 16-2

parent b9fe2174
...@@ -23,6 +23,8 @@ class _ApplicationState extends State<Application> { ...@@ -23,6 +23,8 @@ class _ApplicationState extends State<Application> {
super.initState(); super.initState();
} }
// _counterWidget(context),
// bottomNavigationBar: appBar(),
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
...@@ -31,6 +33,8 @@ class _ApplicationState extends State<Application> { ...@@ -31,6 +33,8 @@ class _ApplicationState extends State<Application> {
backgroundColor: AppColors.primary, backgroundColor: AppColors.primary,
), ),
body: body:
// RefreshIndicator(
// onRefresh: () async{await Future.delayed(const Duration(seconds: 1));}, child:_counterWidget(context),),
_counterWidget(context), _counterWidget(context),
bottomNavigationBar: appBar(), bottomNavigationBar: appBar(),
); );
......
...@@ -4,7 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; ...@@ -4,7 +4,7 @@ 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 'package:ongbut_ntmanh/widgets/widgets_util.dart';
import '../../../../res/images/images.dart'; import '../../../../res/images/images.dart';
import '../../../ui/search_page.dart'; import '../../../ui/search_page.dart';
import '../../coursedetail/widgets/course_detail.dart'; import '../../coursedetail/widgets/course_detail.dart';
...@@ -59,7 +59,7 @@ class CourseWidget extends StatelessWidget { ...@@ -59,7 +59,7 @@ class CourseWidget extends StatelessWidget {
listData = state.courseModel.data!.listData!; listData = state.courseModel.data!.listData!;
return return
Swiper( Swiper(
itemHeight: 340, itemHeight: checkLandscape(context)?getHeight(context)*0.5:getHeight(context)*0.4,
itemWidth: double.maxFinite, itemWidth: double.maxFinite,
layout: SwiperLayout.TINDER, layout: SwiperLayout.TINDER,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
...@@ -81,7 +81,7 @@ class CourseWidget extends StatelessWidget { ...@@ -81,7 +81,7 @@ class CourseWidget extends StatelessWidget {
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
child: child:
Image.network(listData[index].image!=null?listData[index].image!:'https://oss.myitsol.com/imes-public/2022/12/11/neymar_145527553.PNG', 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, fit: BoxFit.fill,height: checkLandscape(context)?getHeight(context)*0.5:getHeight(context)*0.28,width: double.maxFinite,
errorBuilder: (BuildContext context, Object exception, errorBuilder: (BuildContext context, Object exception,
StackTrace? stackTrace) { StackTrace? stackTrace) {
return Image.asset(Images.load_err); return Image.asset(Images.load_err);
...@@ -109,7 +109,7 @@ class CourseWidget extends StatelessWidget { ...@@ -109,7 +109,7 @@ class CourseWidget extends StatelessWidget {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (_) => CourseDetailWidget(listData[index].courseId!,listData[index].image!=null?listData[index].image! builder: (_) => CourseDetailWidget(listData[index].courseId!,listData[index].name!,listData[index].image!=null?listData[index].image!
:'https://oss.myitsol.com/imes-public/2022/12/11/neymar_145527553.PNG'), :'https://oss.myitsol.com/imes-public/2022/12/11/neymar_145527553.PNG'),
)).then((value) { )).then((value) {
......
...@@ -13,25 +13,23 @@ import '../bloc/course_detail_bloc.dart'; ...@@ -13,25 +13,23 @@ import '../bloc/course_detail_bloc.dart';
class CourseDetailWidget extends StatelessWidget { class CourseDetailWidget extends StatelessWidget {
String courseId; String courseId;
String image; String image;
String name;
CourseDetailModel? courseDetailModel; CourseDetailModel? courseDetailModel;
List<Chapters> chapters = []; List<Chapters> chapters = [];
List<ListLesson> listLesion = []; List<ListLesson> listLesion = [];
CourseDetailWidget(this.courseId,this.image, {super.key}); CourseDetailWidget(this.courseId,this.name,this.image, {super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
CourseDetailBloc bloc = CourseDetailBloc()..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 return
Scaffold( Scaffold(
appBar: AppBar(title: const Text('Chi Tiet Khoa Hoc'),), appBar: AppBar(title: const Text('Chi Tiet Khoa Hoc'),),
body: body:
Column(children: [ Column(children: [
Image.network(image, fit: BoxFit.fill,height: checkLandscape(context)?getHeight(context)*0.5:getHeight(context)*0.3,width: double.maxFinite, Image.network(image, fit: BoxFit.fill,height: checkLandscape(context)?getHeight(context)*0.5:getHeight(context)*0.26,width: double.maxFinite,
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { 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,); return Image.asset(Images.load_err,fit: BoxFit.fill,height: checkLandscape(context)?getHeight(context)*0.5:getHeight(context)*0.26,width: double.maxFinite,);
}, },
), ),
Expanded( Expanded(
...@@ -62,16 +60,30 @@ class CourseDetailWidget extends StatelessWidget { ...@@ -62,16 +60,30 @@ class CourseDetailWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.fromLTRB(10, 10, 0, 0), padding: const EdgeInsets.fromLTRB(10, 0, 0, 0),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding(
padding: const EdgeInsets.fromLTRB(10, 0, 0, 0),
child: Text(name,style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),),
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
child: Image.asset(Images.rate,height: 20,width: 150,),
),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
// Image.asset(Images.see,height: 20,width: 20,),
TextButton(onPressed: (){}, TextButton(onPressed: (){},
child: const Text('Thong Tin chi tiet', child: Row(
style: TextStyle(fontSize: 15),)), children: [
Text('Thong Tin chi tiet',
style: TextStyle(fontSize: 15),),
],
)),
// const Text('Thong Tin chi tiet',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15),), // const Text('Thong Tin chi tiet',style: TextStyle(fontWeight: FontWeight.bold,fontSize: 15),),
TextButton( TextButton(
child: const Text('Nhan xet ve khoa hoc',style: TextStyle(color: AppColors.black),), child: const Text('Nhan xet ve khoa hoc',style: TextStyle(color: AppColors.black),),
...@@ -86,16 +98,18 @@ class CourseDetailWidget extends StatelessWidget { ...@@ -86,16 +98,18 @@ class CourseDetailWidget extends StatelessWidget {
), ),
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(10, 10, 0, 0), padding: const EdgeInsets.fromLTRB(0, 10, 0, 0),
child: child:
ListView.builder( ListView.builder(
itemCount: chapters.length, itemCount: chapters.length,
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return return
ExpansionTile( ExpansionTile(
title: Text(chapters[index].name!), textColor: AppColors.primary,
iconColor: AppColors.red_light,
backgroundColor: AppColors.white,
title: Text(chapters[index].name!,style: TextStyle(color: AppColors.semi_grey),),
children: [ children: [
chapters[index].listLesson!.isNotEmpty?_buildLesion(chapters[index]):const Text(''), chapters[index].listLesson!.isNotEmpty?_buildLesion(chapters[index]):const Text(''),
], ],
...@@ -143,7 +157,7 @@ class CourseDetailWidget extends StatelessWidget { ...@@ -143,7 +157,7 @@ class CourseDetailWidget extends StatelessWidget {
child: child:
Container( Container(
width: checkLandscape(context)?getWidth(context)*0.25:getHeight(context)*0.25, 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), child: Text(chapters.listLesson![index].name!=null?chapters.listLesson![index].name!:'',style: TextStyle(fontSize: 14, overflow: TextOverflow.ellipsis),
softWrap: false, softWrap: false,
maxLines: 1,), maxLines: 1,),
), ),
......
...@@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; ...@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import '../model/lesson_model.dart'; import '../model/lesson_model.dart';
// https://imes-api.myitsol.com/api/v1/student/course/part?lessonId=fb228efa-7b32-419e-98b4-a6d5135f4361
// https://imes-api.myitsol.com/api/v1/student/course/part?lessonId=fb228efa-7b32-419e-98b4-a6d5135f4361 // https://imes-api.myitsol.com/api/v1/student/course/part?lessonId=fb228efa-7b32-419e-98b4-a6d5135f4361
class RemoteLesson{ class RemoteLesson{
Future<LessonModel?> getLessonModel({required BuildContext context,required String lessonID}) async{ Future<LessonModel?> getLessonModel({required BuildContext context,required String lessonID}) async{
......
...@@ -4,7 +4,6 @@ import 'package:ongbut_ntmanh/const/colors.dart'; ...@@ -4,7 +4,6 @@ import 'package:ongbut_ntmanh/const/colors.dart';
import '../bloc/login_bloc.dart'; import '../bloc/login_bloc.dart';
import '../model/login_model.dart'; import '../model/login_model.dart';
final TextEditingController _userController = TextEditingController(); final TextEditingController _userController = TextEditingController();
final TextEditingController _passController = TextEditingController(); final TextEditingController _passController = TextEditingController();
LoginModel? loginModels; LoginModel? loginModels;
...@@ -15,6 +14,19 @@ class LoginPage extends StatelessWidget { ...@@ -15,6 +14,19 @@ class LoginPage extends StatelessWidget {
return return
BlocConsumer<LoginBloc, LoginState>( BlocConsumer<LoginBloc, LoginState>(
listener: (context, state) async { listener: (context, state) async {
if(state is LoginSuccess){
return showCustomDialog(context, 'Dang Nhap Thanh Cong!');
}
if(state is LoginFailed){
return showCustomDialog(context,'Dang Nhap Khong Thanh Cong!');
}
if(_userController.text.isEmpty){
return showCustomDialog(context,'Hay Nhap usename');
}
if(_passController.text.isEmpty){
return showCustomDialog(context,'Hay Nhap pass');
}
// else{return showCustomDialog(context,'');}
// if(state is LoginSuccess){ // if(state is LoginSuccess){
// _userController.text=''; // _userController.text='';
// _passController.text=''; // _passController.text='';
...@@ -23,9 +35,18 @@ class LoginPage extends StatelessWidget { ...@@ -23,9 +35,18 @@ class LoginPage extends StatelessWidget {
// if(state is MyStateSuccess){ // if(state is MyStateSuccess){
// // Thực hiện hành động // // Thực hiện hành động
// } // }
// if(state is LoginSuccess){
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (_) => LoginDetailPage(),
//
// ));
// }
}, },
builder: (context, state) { builder: (context, state) {
return _buildUI(context); return _buildUI(context);
}, },
); );
} }
...@@ -83,6 +104,7 @@ Widget _buildUI(BuildContext context){ ...@@ -83,6 +104,7 @@ Widget _buildUI(BuildContext context){
context: context, context: context,
username: _userController.text, username: _userController.text,
password: _passController.text)); password: _passController.text));
}, },
child: Text("Dang Nhap".toUpperCase(), child: Text("Dang Nhap".toUpperCase(),
style: const TextStyle( style: const TextStyle(
...@@ -96,21 +118,56 @@ Widget _buildUI(BuildContext context){ ...@@ -96,21 +118,56 @@ Widget _buildUI(BuildContext context){
return const CircularProgressIndicator(); return const CircularProgressIndicator();
} }
if (state is LoginFailed) { if (state is LoginFailed) {
return const Text('login false!'); return const Text('LoginFailed!');
} }
if (state is LoginInitial) { if (state is LoginInitial) {
return return
const Text('LoginInitial'); const Text('LoginInitial!');
} }
if (state is LoginSuccess) { if (state is LoginSuccess) {
return return const Text('LoginSuccess!');
const Text('Dang Nhap Thanh Cong');
} }
return const CircularProgressIndicator(); return const Text('');
}), }),
], ],
), ),
); );
} }
void showCustomDialog(BuildContext context, String mes) {
showGeneralDialog(
context: context,
barrierLabel: "Barrier",
barrierDismissible: true,
barrierColor: Colors.black.withOpacity(0.5),
transitionDuration: Duration(milliseconds: 700),
pageBuilder: (_, __, ___) {
return Center(
child: Container(
height: 240,
margin: EdgeInsets.symmetric(horizontal: 20),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(40)),
child: Column(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(15, 60, 0, 15),
child: Text(mes,style: const TextStyle(fontSize: 18,color: Colors.black),),
),
Center(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.primary,
onPrimary: Colors.black, // foreground
),
onPressed: () => Navigator.pop(context, true),
child: const Text('OK', style: TextStyle(fontSize: 28)),),
)
],
),
),
);
},
);
}
...@@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart'; ...@@ -2,7 +2,6 @@ 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/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 '../../../../res/images/images.dart';
import '../../../../widgets/widgets_util.dart'; import '../../../../widgets/widgets_util.dart';
...@@ -56,16 +55,9 @@ class NewWidget extends StatelessWidget { ...@@ -56,16 +55,9 @@ class NewWidget extends StatelessWidget {
if(state is NewSuccess){ if(state is NewSuccess){
return return
Container( Container(
padding: EdgeInsets.fromLTRB(20, 0, 0, 0), padding: const EdgeInsets.fromLTRB(20, 0, 0, 0),
decoration: const BoxDecoration( decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)), 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, height: checkLandscape(context)?getHeight(context)*0.5:getHeight(context)*0.35,
width: double.maxFinite, width: double.maxFinite,
...@@ -123,7 +115,6 @@ class NewWidget extends StatelessWidget { ...@@ -123,7 +115,6 @@ class NewWidget extends StatelessWidget {
}, },
), ),
); );
} }
return const Text('NewFailed'); return const Text('NewFailed');
} }
......
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:ongbut_ntmanh/widgets/widgets_util.dart';
import 'package:youtube_player_flutter/youtube_player_flutter.dart'; import 'package:youtube_player_flutter/youtube_player_flutter.dart';
import '../../../../const/colors.dart';
class PlayVideoPage extends StatefulWidget { class PlayVideoPage extends StatefulWidget {
String link; String link;
PlayVideoPage({required this.link,Key? key}) : super(key: key); bool clicked = true;
PlayVideoPage({required this.link,Key? key}) : super(key: key);
@override @override
State<PlayVideoPage> createState() => _PlayVideoPageState(); State<PlayVideoPage> createState() => _PlayVideoPageState();
} }
class _PlayVideoPageState extends State<PlayVideoPage> { class _PlayVideoPageState extends State<PlayVideoPage> {
late YoutubePlayerController _controller; late YoutubePlayerController _controller;
bool clicked = true;
// late TextEditingController _idController; // late TextEditingController _idController;
// late TextEditingController _seekToController; // late TextEditingController _seekToController;
...@@ -60,9 +64,17 @@ class _PlayVideoPageState extends State<PlayVideoPage> { ...@@ -60,9 +64,17 @@ class _PlayVideoPageState extends State<PlayVideoPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return return Scaffold(
appBar: AppBar(title: Text(YoutubePlayer.convertUrlToId(widget.link).toString())),
YoutubePlayerBuilder( body: Column(
children: [
Container(
decoration: const BoxDecoration(
color: AppColors.orange,
),
height: checkLandscape(context)?getHeight(context)*0.5:getHeight(context)*0.3,
width: double.maxFinite,
child: YoutubePlayerBuilder(
onExitFullScreen: () { onExitFullScreen: () {
SystemChrome.setPreferredOrientations(DeviceOrientation.values); SystemChrome.setPreferredOrientations(DeviceOrientation.values);
}, },
...@@ -78,10 +90,117 @@ class _PlayVideoPageState extends State<PlayVideoPage> { ...@@ -78,10 +90,117 @@ class _PlayVideoPageState extends State<PlayVideoPage> {
// .load(_ids[(_ids.indexOf(data.videoId) + 1) % _ids.length]); // .load(_ids[(_ids.indexOf(data.videoId) + 1) % _ids.length]);
// }, // },
), ),
builder: (context, player) => Scaffold( builder: (context, player) => Container(child: player)),
appBar: AppBar(title: Text(YoutubePlayer.convertUrlToId(widget.link).toString()),), ),
body: Container(child: player), Column(children: [
DefaultTabController(
length: 6,
child: TabBar(
indicatorColor: AppColors.primary,
onTap: (index) {
},
tabs: [
Tab(
child: Container(
alignment: Alignment.center,
height: 35,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(0),
//color: clicked==true?AppColors.orange:AppColors.primary
),
child: const Text('Bai Giang',style: TextStyle(color: AppColors.primary_light,fontSize: 10),
softWrap: false,
maxLines: 1,
overflow: TextOverflow.ellipsis)
),
),
Tab(
child: Container(
alignment: Alignment.center,
height: 35,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
//color: clicked==true?AppColors.orange:AppColors.primary
),
child: const Text('Vo Viet',style: TextStyle(color: AppColors.primary_light,fontSize: 10),
softWrap: false,
maxLines: 1,
overflow: TextOverflow.ellipsis)
),
),
Tab(
child: Container(
alignment: Alignment.center,
height: 35,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
//color: clicked==true?AppColors.orange:AppColors.primary
),
child: Text('Bai Tap',style: TextStyle(color: AppColors.primary_light,fontSize: 10),
softWrap: false,
maxLines: 1,
overflow: TextOverflow.ellipsis)
), ),
),
Tab(
child: Container(
alignment: Alignment.center,
height: 35,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
//color: clicked==true?AppColors.orange:AppColors.primary
),
child: Text('Dap An',style: TextStyle(color: AppColors.primary_light,fontSize: 10),
softWrap: false,
maxLines: 1,
overflow: TextOverflow.ellipsis)
),
),
Tab(
child: Container(
alignment: Alignment.center,
height: 35,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
//color: clicked==true?AppColors.orange:AppColors.primary
),
child: Text('ViDeo',style: TextStyle(color: AppColors.primary_light,fontSize: 10),
softWrap: false,
maxLines: 1,
overflow: TextOverflow.ellipsis)
),
),
Tab(
child: Container(
alignment: Alignment.center,
height: 35,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
//color: clicked==true?AppColors.orange:AppColors.primary
),
child: Text('Thao Luan',style: TextStyle(color: AppColors.primary_light,fontSize: 10),
softWrap: false,
maxLines: 1,
overflow: TextOverflow.ellipsis)
),
),
]),
),
Container(
decoration: const BoxDecoration(
color: AppColors.white,
),
height: checkLandscape(context)?getHeight(context)*0.6:getHeight(context)*0.5,
width: double.maxFinite,
)
],)
],),
); );
} }
} }
...@@ -7,6 +7,7 @@ import 'package:ongbut_ntmanh/app/module/school/model/list_data.dart'; ...@@ -7,6 +7,7 @@ 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 '../../../../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/school_bloc.dart'; import '../bloc/school_bloc.dart';
...@@ -65,7 +66,7 @@ class SchoolWidget extends StatelessWidget { ...@@ -65,7 +66,7 @@ class SchoolWidget extends StatelessWidget {
onData!(listData); onData!(listData);
return return
Swiper( Swiper(
itemHeight: 340, itemHeight: checkLandscape(context)?getHeight(context)*0.5:getHeight(context)*0.4,
itemWidth: double.maxFinite, itemWidth: double.maxFinite,
layout: SwiperLayout.TINDER, layout: SwiperLayout.TINDER,
...@@ -88,7 +89,7 @@ class SchoolWidget extends StatelessWidget { ...@@ -88,7 +89,7 @@ class SchoolWidget extends StatelessWidget {
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
child: child:
Image.network(listData[index].image!, Image.network(listData[index].image!,
fit: BoxFit.fill,height: 200,width: double.maxFinite, fit: BoxFit.fill,height: checkLandscape(context)?getHeight(context)*0.5:getHeight(context)*0.28,width: double.maxFinite,
errorBuilder: (BuildContext context, Object exception, errorBuilder: (BuildContext context, Object exception,
StackTrace? stackTrace) { StackTrace? stackTrace) {
return Image.asset(Images.load_err); return Image.asset(Images.load_err);
...@@ -117,7 +118,7 @@ class SchoolWidget extends StatelessWidget { ...@@ -117,7 +118,7 @@ class SchoolWidget extends StatelessWidget {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (_) => CourseDetailWidget(listData[index].courseId!,listData[index].image!), builder: (_) => CourseDetailWidget(listData[index].courseId!,listData[index].name!,listData[index].image!),
)).then((value) { )).then((value) {
if (value != null && value is bool && value) {} if (value != null && value is bool && value) {}
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:ongbut_ntmanh/widgets/widgets_util.dart';
import '../../../const/colors.dart';
class AccountPage extends StatelessWidget { class AccountPage extends StatelessWidget {
const AccountPage({Key? key}) : super(key: key); const AccountPage({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const Scaffold(body: Text('AccountPage'),); return Scaffold(
body:
Column(children: [
Container(
height: checkLandscape(context)?getHeight(context)*0.5:getHeight(context)*0.25,
width: double.maxFinite,
decoration: const BoxDecoration(
color: AppColors.primary_light,
),
),
Container(
height: checkLandscape(context)?getHeight(context)*0.5:getHeight(context)*0.6,
width: double.infinity,
decoration: const BoxDecoration(
color: AppColors.orange,
),
),
],)
);
} }
} }
...@@ -69,6 +69,7 @@ class _HomePageState extends State<HomePage> { ...@@ -69,6 +69,7 @@ class _HomePageState extends State<HomePage> {
], ],
), ),
); );
} }
Container buildAppBar() { Container buildAppBar() {
return Container( return Container(
...@@ -151,7 +152,6 @@ class _HomePageState extends State<HomePage> { ...@@ -151,7 +152,6 @@ class _HomePageState extends State<HomePage> {
children: [ children: [
Column( Column(
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.fromLTRB(10, 20, 10, 10), padding: const EdgeInsets.fromLTRB(10, 20, 10, 10),
child: Stack( child: Stack(
......
...@@ -50,7 +50,7 @@ class SearchWidget extends StatelessWidget { ...@@ -50,7 +50,7 @@ class SearchWidget extends StatelessWidget {
maxCrossAxisExtent: 350, maxCrossAxisExtent: 350,
mainAxisSpacing: 0, mainAxisSpacing: 0,
crossAxisSpacing: 0, crossAxisSpacing: 0,
childAspectRatio: 0.65, childAspectRatio: 0.62,
), ),
delegate: SliverChildBuilderDelegate( delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) { (BuildContext context, int index) {
...@@ -84,7 +84,7 @@ Widget _courseList( listData, BuildContext context) { ...@@ -84,7 +84,7 @@ Widget _courseList( listData, BuildContext context) {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (_) => CourseDetailWidget(listData.courseId!,listData.image!=null?listData.image!:'https://oss.myitsol.com/imes-public/2022/12/11/neymar_145527553.PNG'), builder: (_) => CourseDetailWidget(listData.courseId!,listData.name!,listData.image!=null?listData.image!:'https://oss.myitsol.com/imes-public/2022/12/11/neymar_145527553.PNG'),
) )
); );
// .then((value) { // .then((value) {
......
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