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

Merge branch 'dev/nhat_nm' into 'develop'

nmn update

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