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