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

nmn update

parent 9247caa7
......@@ -9,38 +9,37 @@ import 'package:betting/view/mobile/scores/football/football_controller.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
class FixturesScreen extends StatelessWidget {
FixturesScreen({Key? key}) : super(key: key);
final fixtureController = Get.put(FixturesController());
final controller = Get.put(FixturesController());
@override
Widget build(BuildContext context) {
return GetBuilder<FixturesController>(builder: (controller) {
return RefreshIndicator(
onRefresh: () async {
fixtureController.getListMatchesOnTeamFavourite();
controller.getListMatchesOnTeamFavourite();
Get.find<HomeController>().onRefreshPressed();
},
child: fixtureController.isLoading.value ?
child: controller.isLoading.value ?
Obx(() => ListView.builder(
shrinkWrap: true,
itemCount: fixtureController.listMatChesFavourite.length,
itemCount: controller.listMatChesFavourite.length,
itemBuilder: (context, index) {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
Get.toNamed(Routes.detailTournamentPage, arguments: fixtureController.listMatChesFavourite[index]);
Get.toNamed(Routes.detailTournamentPage, arguments: controller.listMatChesFavourite[index]);
},
child: TournamentsWidget(
logo: fixtureController.listMatChesFavourite[index].logo ??
logo: controller.listMatChesFavourite[index].logo ??
'https://upload.wikimedia.org/wikipedia/vi/thumb/5/5c/Chelsea_crest.svg/1200px-Chelsea_crest.svg.png',
nameTournaments: fixtureController.listMatChesFavourite[index].name!,
typeTournaments: fixtureController.listMatChesFavourite[index].name!,
isFavourite: fixtureController.listMatChesFavourite[index].favourite,
nameTournaments: controller.listMatChesFavourite[index].name!,
typeTournaments: controller.listMatChesFavourite[index].name!,
isFavourite: controller.listMatChesFavourite[index].favourite,
),
),
SizedBox(
......@@ -53,21 +52,28 @@ class FixturesScreen extends StatelessWidget {
child: ListView.builder(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: fixtureController.listMatChesFavourite[index].matches?.length,
itemCount: controller.listMatChesFavourite[index].matches?.length,
itemBuilder: (context, indexMatches) {
Matches? match = fixtureController.listMatChesFavourite[index].matches?[indexMatches];
Matches? match = controller.listMatChesFavourite[index].matches?[indexMatches];
return GestureDetector(
onTap: () {
Get.toNamed(Routes.detailMatchesRegions, arguments: fixtureController.listMatChesFavourite[index].matches![indexMatches]);
Get.toNamed(Routes.detailMatchesRegions, arguments: controller.listMatChesFavourite[index].matches![indexMatches]);
},
child: ItemFixtureWidget(
match: match,
funcFavouriteMatch: () {
Get.find<FootballController>().deleteCompetitionsFavorites(fixtureController.listMatChesFavourite[index].sId!);
fixtureController.listMatChesFavourite.refresh();
}, isFavouriteMatch: true,
),
child:
Obx(() => ItemFixtureWidget(
isNotification: Get.find<HomeController>().isNotification.value,
match: match,
funcFavouriteMatch: () {
Get.find<HomeController>().isNotification.value ==true ?
controller.listMatChesFavourite[index].matches![indexMatches].favourite =! controller.listMatChesFavourite[index].matches![indexMatches].favourite!:
Get.find<FootballController>().deleteCompetitionsFavorites(controller.listMatChesFavourite[index].sId!);
controller.listMatChesFavourite.refresh();
},
isFavouriteMatch:
Get.find<HomeController>().isNotification.value ==true ?
controller.listMatChesFavourite[index].matches![indexMatches].favourite!: true,
)),
);
},
),
......
......@@ -10,17 +10,21 @@ class ItemFixtureWidget extends StatelessWidget {
const ItemFixtureWidget({
Key? key,
required this.isFavouriteMatch,
required this.isNotification,
required this.funcFavouriteMatch,
this.match,
}) : super(key: key);
final bool isFavouriteMatch;
final Function funcFavouriteMatch;
final bool isNotification;
final Matches? match;
@override
Widget build(BuildContext context) {
return Container(
return
Container(
margin: const EdgeInsets.only(bottom: 8),
padding: const EdgeInsets.symmetric(horizontal: 8),
decoration: BoxDecoration(
......@@ -167,16 +171,23 @@ class ItemFixtureWidget extends StatelessWidget {
],
),
GestureDetector(
onTap: () => funcFavouriteMatch,
onTap: () => funcFavouriteMatch(),
child: Container(
margin: const EdgeInsets.only(right: 8),
child: Icon(
isNotification == false ?
isFavouriteMatch == true
? Icons.star_rounded
: Icons.star_border_rounded,
color: isFavouriteMatch == true
: Icons.star_border_rounded :
isFavouriteMatch == true ?
Icons.notifications:
Icons.notifications_off_outlined ,
color:
isNotification == false ?
isFavouriteMatch == true
? ColorUtils.PRIMARY_COLOR
: Colors.white,
: Colors.white :
ColorUtils.PRIMARY_COLOR,
size: 22.sp,
),
),
......
......@@ -62,6 +62,7 @@ class FixturesTeamInfo extends StatelessWidget {
},
child: Expanded(
child: ItemFixtureWidget(
isNotification: false,
match: match,
isFavouriteMatch: true, funcFavouriteMatch: (){},
),
......
......@@ -16,6 +16,7 @@ class HomeController extends GetxController with GetSingleTickerProviderStateMix
AnimationController? animationController;
RxInt indexSport = 0.obs;
RxBool isRotating = false.obs;
RxBool isNotification = false.obs;
InterstitialAd? interstitialAd;
RewardedAd? rewardedAd;
var outputDateToDateFormat = DateFormat('yyyy-MM-dd');
......
......@@ -49,7 +49,14 @@ class _HomePageState extends State<HomePage> {
actions: [
Visibility(
visible: controller.currentIndex.value == 1,
child: const Icon(Icons.notifications_active_outlined,color: Colors.white,)),
child: InkWell(
onTap: (){
controller.isNotification.value =! controller.isNotification.value;
},
child: controller.isNotification.value == false?
const Icon(Icons.notifications,color: Colors.white,) :
const Icon(Icons.notifications,color: ColorUtils.PRIMARY_COLOR,),
)),
SizedBox(width: 8.w,),
InkWell(
highlightColor: Colors.transparent,
......
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