Commit 3ccdeb05 authored by Nguyễn Minh Nhật's avatar Nguyễn Minh Nhật

nmn update

parent 105cbb03
...@@ -294,7 +294,7 @@ class H2hMatchesRegionsPage extends GetWidget<H2hMatchesRegionsController>{ ...@@ -294,7 +294,7 @@ class H2hMatchesRegionsPage extends GetWidget<H2hMatchesRegionsController>{
}, },
) )
: :
ListView.builder( ListView.builder(
itemCount: controller.h2hMatch.length, itemCount: controller.h2hMatch.length,
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
......
...@@ -14,8 +14,6 @@ class FootballController extends GetxController { ...@@ -14,8 +14,6 @@ class FootballController extends GetxController {
var outputTimeFormat = DateFormat('HH:mm'); var outputTimeFormat = DateFormat('HH:mm');
var listIdMatchesFavourites = <String>[].obs; var listIdMatchesFavourites = <String>[].obs;
var isReady = false.obs; var isReady = false.obs;
int valueSelected1 =0;
int valueSelected2 =0;
@override @override
void onInit() { void onInit() {
......
...@@ -12,6 +12,7 @@ class ScoresController extends GetxController with GetSingleTickerProviderStateM ...@@ -12,6 +12,7 @@ class ScoresController extends GetxController with GetSingleTickerProviderStateM
var startColor = Colors.white10.obs; var startColor = Colors.white10.obs;
var controllerDate = TextEditingController().obs; var controllerDate = TextEditingController().obs;
var selectedDay = ''.obs; var selectedDay = ''.obs;
DatePickerController controllerDatePicker = DatePickerController(); DatePickerController controllerDatePicker = DatePickerController();
Timer? timer ; Timer? timer ;
int _start = 1; int _start = 1;
...@@ -19,6 +20,8 @@ class ScoresController extends GetxController with GetSingleTickerProviderStateM ...@@ -19,6 +20,8 @@ class ScoresController extends GetxController with GetSingleTickerProviderStateM
var outputDateToDateFormat = DateFormat('yyyy-MM-dd'); var outputDateToDateFormat = DateFormat('yyyy-MM-dd');
final _teamRepo = TeamsRepo(); final _teamRepo = TeamsRepo();
RxList favouriteTeams = <ItemTeams>[].obs; RxList favouriteTeams = <ItemTeams>[].obs;
DateTime selectDate = DateTime.now();
......
...@@ -21,137 +21,139 @@ class ScoresPage extends GetView<ScoresController> { ...@@ -21,137 +21,139 @@ class ScoresPage extends GetView<ScoresController> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Obx(() => Container( return GetBuilder<ScoresController>(builder: (controller) {
margin: EdgeInsets.symmetric(horizontal: 8.w), return Obx(() => Container(
child: Column( margin: EdgeInsets.symmetric(horizontal: 8.w),
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
controller.favouriteTeams.isNotEmpty children: [
? SizedBox( controller.favouriteTeams.isNotEmpty
height: 24.h, ? SizedBox(
child: ListView.builder( height: 24.h,
itemCount: controller.favouriteTeams.length, child: ListView.builder(
shrinkWrap: true, itemCount: controller.favouriteTeams.length,
scrollDirection: Axis.horizontal, shrinkWrap: true,
itemBuilder: (context, index) { scrollDirection: Axis.horizontal,
return itemBuilder: (context, index) {
return
InkWell( InkWell(
onTap: (){ onTap: (){
if(controller.favouriteTeams[index].name == "EDIT"){ if(controller.favouriteTeams[index].name == "EDIT"){
Get.find<HomeController>().currentIndex.value = 1; Get.find<HomeController>().currentIndex.value = 1;
Get.find<HomeController>().update(); Get.find<HomeController>().update();
Get.find<FavouriteController>().tabController.animateTo(2); Get.find<FavouriteController>().tabController.animateTo(2);
}else{ }else{
Get.toNamed(Routes.detailTeams, arguments: controller.favouriteTeams[index]); Get.toNamed(Routes.detailTeams, arguments: controller.favouriteTeams[index]);
} }
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric(horizontal: 8.w), padding: EdgeInsets.symmetric(horizontal: 8.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.r), borderRadius: BorderRadius.circular(8.r),
color: Colors.white24 color: Colors.white24
), ),
margin: EdgeInsets.only(right: 8.w), margin: EdgeInsets.only(right: 8.w),
child: Row( child: Row(
children: [ children: [
controller.favouriteTeams[index].name =='EDIT'? const Icon(Icons.compare_arrows,color: Colors.white) : const Icon(Icons.logo_dev_outlined,color: Colors.white,), controller.favouriteTeams[index].name =='EDIT'? const Icon(Icons.compare_arrows,color: Colors.white) : const Icon(Icons.logo_dev_outlined,color: Colors.white,),
SizedBox(width: 4.w,), SizedBox(width: 4.w,),
Text(controller.favouriteTeams[index].name,style: TextStyle(color: Colors.white,fontSize: 10.sp)), Text(controller.favouriteTeams[index].name,style: TextStyle(color: Colors.white,fontSize: 10.sp)),
], ],
),),); ),),);
},), },),
):const SizedBox() , ):const SizedBox() ,
SizedBox(height: 8.h,), SizedBox(height: 8.h,),
Container( Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.white60)) border: Border(bottom: BorderSide(color: Colors.white60))
),
child: Row(
children: [
InkWell(
onTap: (){
Get.find<FootballController>().getListMatchesOnDay('', controller.outputDateToDateFormat.format(DateTime.now()),"IN PLAY");
},
child: Container(
decoration: BoxDecoration(
color: controller.startColor.value,
borderRadius: BorderRadius.circular(6.r),
),
padding: EdgeInsets.symmetric(horizontal: 8.w,vertical: 4.h),
child: Text("LIVE",style: TextStyle(color: Colors.black,fontSize: 10.sp),),
),
), ),
Expanded(child: Column( child: Row(
mainAxisAlignment: MainAxisAlignment.center, children: [
children: <Widget>[ InkWell(
DatePicker( onTap: (){
DateTime.now().subtract(const Duration(days: 60)), Get.find<FootballController>().getListMatchesOnDay('', controller.outputDateToDateFormat.format(DateTime.now()),"IN PLAY");
initialSelectedDate: DateTime.now(), },
selectionColor: Colors.transparent, child: Container(
selectedTextColor: ColorUtils.PRIMARY_COLOR, decoration: BoxDecoration(
height: 63.h, color: controller.startColor.value,
width: 48.w, borderRadius: BorderRadius.circular(6.r),
controller: controller.controllerDatePicker, ),
monthTextStyle: TextStyle(color: Colors.white,fontSize: 10.sp), padding: EdgeInsets.symmetric(horizontal: 8.w,vertical: 4.h),
dayTextStyle: TextStyle(color: Colors.white,fontSize: 10.sp), child: Text("LIVE",style: TextStyle(color: Colors.black,fontSize: 10.sp),),
dateTextStyle: TextStyle(color: Colors.white,fontSize: 12.sp),
onDateChange: (date) {
controller.selectedDay.value = controller.outputDateToDateFormat.format(date) ;
Get.find<FootballController>().getListMatchesOnDay('', controller.selectedDay,'');
},
), ),
],
)),
InkWell(
onTap: () {
selectDate(controller.controllerDate.value.text,
DateTimeFormat.formatDateShort,
context);
},
child: const Row(
children: [
Icon(Icons.calendar_month_outlined,color: Colors.white,),
Icon(Icons.arrow_drop_down,color: Colors.white,)
],
), ),
) Expanded(child:
], DatePicker(
DateTime.now().subtract(const Duration(days: 60)),
initialSelectedDate:DateTime.now(),
selectionColor: Colors.transparent,
selectedTextColor: ColorUtils.PRIMARY_COLOR,
height: 63.h,
width: 48.w,
controller: controller.controllerDatePicker,
monthTextStyle: TextStyle(color: Colors.white,fontSize: 10.sp),
dayTextStyle: TextStyle(color: Colors.white,fontSize: 10.sp),
dateTextStyle: TextStyle(color: Colors.white,fontSize: 12.sp),
onDateChange: (date) {
controller.selectedDay.value = controller.outputDateToDateFormat.format(date) ;
Get.find<FootballController>().getListMatchesOnDay('', controller.selectedDay,'');
controller.selectDate = date;
},
)),
InkWell(
onTap: () {
selectDate(controller.controllerDate.value.text,
DateTimeFormat.formatDateShort,
context);
},
child: const Row(
children: [
Icon(Icons.calendar_month_outlined,color: Colors.white,),
Icon(Icons.arrow_drop_down,color: Colors.white,)
],
),
)
],
),
), ),
), Expanded(child:
Expanded(child: controller.sport!),
controller.sport!), SizedBox(
SizedBox( height: 60.h,
height: 60.h, )
) ],
], ),
), ) );
) ); },);
}
}
selectDate(stringTime, format, context) async {
var curent = DateTime.now();
if (!stringTime.isEmpty) {
curent = TimeUtils.convertStringToDate(stringTime, format);
} else {
curent = DateTime.now();
} }
var date = ""; selectDate(stringTime, format, context) async {
await DateTimePicker.showDatePicker(Get.context!, curent, var current = controller.selectDate;
initialDate: DateTime(DateTime.now().year - 10)) if (!stringTime.isEmpty) {
.then((value) async { current = TimeUtils.convertStringToDate(stringTime, format);
date = }
TimeUtils.convertDateTimeToFormat(value, DateTimeFormat.formatDateBetting); var date = "";
}); await DateTimePicker.showDatePicker(Get.context!, current,
initialDate: DateTime(DateTime.now().year - 10))
.then((value) async {
date = TimeUtils.convertDateTimeToFormat(value, DateTimeFormat.formatDateBetting);
});
if (date.isNotEmpty) { if (date.isNotEmpty) {
Get.find<FootballController>().getListMatchesOnDay('', date, ''); controller.selectDate= DateTime.parse(date);
Get.find<FootballController>().listMatches.refresh(); controller.controllerDatePicker.setDateAndAnimate(DateTime.parse(date));
controller.update();
Get.find<FootballController>().getListMatchesOnDay('', date, '');
Get.find<FootballController>().listMatches.refresh();
}
FocusScope.of(context).requestFocus(FocusNode());
} }
FocusScope.of(context).requestFocus(FocusNode());
} }
...@@ -205,10 +205,10 @@ packages: ...@@ -205,10 +205,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: date_picker_timeline name: date_picker_timeline
sha256: d92956ddd6eb3070f5637b1514201342e739b6ed1ad830c365d64f9349f4f682 sha256: dc754de3a99ad654c5633072cb9edac27e0b2875c81c7286e8c6cf419082a110
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.3" version: "1.2.5"
dbus: dbus:
dependency: transitive dependency: transitive
description: description:
......
...@@ -51,7 +51,7 @@ dependencies: ...@@ -51,7 +51,7 @@ dependencies:
# url_launcher: ^6.0.13 # url_launcher: ^6.0.13
flutter_slidable: ^2.0.0 flutter_slidable: ^2.0.0
intl: ^0.18.1 intl: ^0.18.1
date_picker_timeline: ^1.2.3 date_picker_timeline: ^1.2.5
flutter_datetime_picker: flutter_datetime_picker:
git: https://github.com/Realank/flutter_datetime_picker.git git: https://github.com/Realank/flutter_datetime_picker.git
# charts_flutter: ^0.12.0 # charts_flutter: ^0.12.0
......
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