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

nmn update

parent 105cbb03
...@@ -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,6 +21,7 @@ class ScoresPage extends GetView<ScoresController> { ...@@ -21,6 +21,7 @@ class ScoresPage extends GetView<ScoresController> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GetBuilder<ScoresController>(builder: (controller) {
return Obx(() => Container( return Obx(() => Container(
margin: EdgeInsets.symmetric(horizontal: 8.w), margin: EdgeInsets.symmetric(horizontal: 8.w),
child: Column( child: Column(
...@@ -86,12 +87,10 @@ class ScoresPage extends GetView<ScoresController> { ...@@ -86,12 +87,10 @@ class ScoresPage extends GetView<ScoresController> {
child: Text("LIVE",style: TextStyle(color: Colors.black,fontSize: 10.sp),), child: Text("LIVE",style: TextStyle(color: Colors.black,fontSize: 10.sp),),
), ),
), ),
Expanded(child: Column( Expanded(child:
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
DatePicker( DatePicker(
DateTime.now().subtract(const Duration(days: 60)), DateTime.now().subtract(const Duration(days: 60)),
initialSelectedDate: DateTime.now(), initialSelectedDate:DateTime.now(),
selectionColor: Colors.transparent, selectionColor: Colors.transparent,
selectedTextColor: ColorUtils.PRIMARY_COLOR, selectedTextColor: ColorUtils.PRIMARY_COLOR,
height: 63.h, height: 63.h,
...@@ -103,9 +102,9 @@ class ScoresPage extends GetView<ScoresController> { ...@@ -103,9 +102,9 @@ class ScoresPage extends GetView<ScoresController> {
onDateChange: (date) { onDateChange: (date) {
controller.selectedDay.value = controller.outputDateToDateFormat.format(date) ; controller.selectedDay.value = controller.outputDateToDateFormat.format(date) ;
Get.find<FootballController>().getListMatchesOnDay('', controller.selectedDay,''); Get.find<FootballController>().getListMatchesOnDay('', controller.selectedDay,'');
controller.selectDate = date;
}, },
),
],
)), )),
InkWell( InkWell(
onTap: () { onTap: () {
...@@ -131,27 +130,30 @@ class ScoresPage extends GetView<ScoresController> { ...@@ -131,27 +130,30 @@ class ScoresPage extends GetView<ScoresController> {
], ],
), ),
) ); ) );
},);
} }
} selectDate(stringTime, format, context) async {
selectDate(stringTime, format, context) async { var current = controller.selectDate;
var curent = DateTime.now();
if (!stringTime.isEmpty) { if (!stringTime.isEmpty) {
curent = TimeUtils.convertStringToDate(stringTime, format); current = TimeUtils.convertStringToDate(stringTime, format);
} else {
curent = DateTime.now();
} }
var date = ""; var date = "";
await DateTimePicker.showDatePicker(Get.context!, curent, await DateTimePicker.showDatePicker(Get.context!, current,
initialDate: DateTime(DateTime.now().year - 10)) initialDate: DateTime(DateTime.now().year - 10))
.then((value) async { .then((value) async {
date = date = TimeUtils.convertDateTimeToFormat(value, DateTimeFormat.formatDateBetting);
TimeUtils.convertDateTimeToFormat(value, DateTimeFormat.formatDateBetting);
}); });
if (date.isNotEmpty) { if (date.isNotEmpty) {
controller.selectDate= DateTime.parse(date);
controller.controllerDatePicker.setDateAndAnimate(DateTime.parse(date));
controller.update();
Get.find<FootballController>().getListMatchesOnDay('', date, ''); Get.find<FootballController>().getListMatchesOnDay('', date, '');
Get.find<FootballController>().listMatches.refresh(); 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