Commit cf634a70 authored by Nguyễn Thành Tâm's avatar Nguyễn Thành Tâm

nmn update

parent 949cb551
...@@ -88,7 +88,7 @@ class CompetitionsScreen extends StatelessWidget { ...@@ -88,7 +88,7 @@ class CompetitionsScreen extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text('${competitionController.listCompetitionsFavourites[entry.key].name}', Text('${competitionController.listCompetitionsFavourites[entry.key].name?.trim()}',
softWrap: true, softWrap: true,
maxLines: 3, maxLines: 3,
style: TextStyleUtils.sizeText12Weight600()!.copyWith(color: Colors.white), style: TextStyleUtils.sizeText12Weight600()!.copyWith(color: Colors.white),
......
import 'package:betting/commom/widget/loading_custom.dart'; import 'package:betting/commom/widget/loading_custom.dart';
import 'package:betting/data/model/res/matches/matches.dart';
import 'package:betting/routes/app_pages.dart'; import 'package:betting/routes/app_pages.dart';
import 'package:betting/view/mobile/favourites_view/matches_view/list_fixtures/fixtures_screen_controller.dart'; import 'package:betting/view/mobile/favourites_view/matches_view/list_fixtures/fixtures_screen_controller.dart';
import 'package:betting/view/mobile/favourites_view/matches_view/list_fixtures/widgets/item_fixture_widget.dart'; import 'package:betting/view/mobile/favourites_view/matches_view/list_fixtures/widgets/item_fixture_widget.dart';
...@@ -54,26 +55,19 @@ class FixturesScreen extends StatelessWidget { ...@@ -54,26 +55,19 @@ class FixturesScreen extends StatelessWidget {
shrinkWrap: true, shrinkWrap: true,
itemCount: fixtureController.listMatChesFavourite[index].matches?.length, itemCount: fixtureController.listMatChesFavourite[index].matches?.length,
itemBuilder: (context, indexMatches) { itemBuilder: (context, indexMatches) {
Matches? match = fixtureController.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: fixtureController.listMatChesFavourite[index].matches![indexMatches]);
}, },
child: Obx( child: ItemFixtureWidget(
() => ItemFixtureWidget( match: match,
date: '${fixtureController.listMatChesFavourite[index].matches?[indexMatches].date}',
time: DateFormat.Hm().format(DateTime.parse('${fixtureController.listMatChesFavourite[index].matches?[indexMatches].date} ${fixtureController.listMatChesFavourite[index].matches![indexMatches].time!}')),
logoTeamHome: fixtureController.listMatChesFavourite[index].matches![indexMatches].home!.logo ?? 'https://upload.wikimedia.org/wikipedia/vi/thumb/5/5c/Chelsea_crest.svg/1200px-Chelsea_crest.svg.png',
teamHomeName: fixtureController.listMatChesFavourite[index].matches![indexMatches].home!.name!,
logoTeamAway: fixtureController.listMatChesFavourite[index].matches![indexMatches].away!.logo ?? 'https://upload.wikimedia.org/wikipedia/vi/thumb/5/5c/Chelsea_crest.svg/1200px-Chelsea_crest.svg.png',
teamNameAway: fixtureController.listMatChesFavourite[index].matches![indexMatches].away!.name!,
isHomeFavourite: fixtureController.listMatChesFavourite[index].matches![indexMatches].home!.favourite!,
isAwayFavourite: fixtureController.listMatChesFavourite[index].matches![indexMatches].away!.favourite!,
funcFavouriteMatch: () { funcFavouriteMatch: () {
Get.find<FootballController>().deleteCompetitionsFavorites(fixtureController.listMatChesFavourite[index].sId!); Get.find<FootballController>().deleteCompetitionsFavorites(fixtureController.listMatChesFavourite[index].sId!);
fixtureController.listMatChesFavourite.refresh(); fixtureController.listMatChesFavourite.refresh();
}, isFavouriteMatch: true, }, isFavouriteMatch: true,
), ),
),
); );
}, },
), ),
......
import 'package:betting/commom/utils/color_utils.dart'; import 'package:betting/commom/utils/color_utils.dart';
import 'package:betting/commom/utils/textstyle.dart'; import 'package:betting/commom/utils/textstyle.dart';
import 'package:betting/data/model/res/matches/matches.dart';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.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';
class ItemFixtureWidget extends StatelessWidget { class ItemFixtureWidget extends StatelessWidget {
const ItemFixtureWidget( const ItemFixtureWidget({
{Key? key, this.date, Key? key,
required this.time,
required this.logoTeamHome,
required this.teamHomeName,
required this.logoTeamAway,
required this.teamNameAway,
required this.isHomeFavourite,
required this.isAwayFavourite,
required this.isFavouriteMatch, required this.isFavouriteMatch,
required this.funcFavouriteMatch}) required this.funcFavouriteMatch,
: super(key: key); this.match,
final String? date; }) : super(key: key);
final String time;
final String logoTeamHome;
final String teamHomeName;
final bool isHomeFavourite;
final String logoTeamAway;
final String teamNameAway;
final bool isAwayFavourite;
final bool isFavouriteMatch; final bool isFavouriteMatch;
final Function funcFavouriteMatch; final Function funcFavouriteMatch;
final Matches? match;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
...@@ -53,21 +42,29 @@ class ItemFixtureWidget extends StatelessWidget { ...@@ -53,21 +42,29 @@ class ItemFixtureWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
(date == null) ? const SizedBox() : Text( (match?.date == null)
date!, ? const SizedBox()
: Text(
'${match?.date}',
style: TextStyleUtils.sizeText10Weight500()! style: TextStyleUtils.sizeText10Weight500()!
.copyWith(color: Colors.white60), .copyWith(color: Colors.white60),
), ),
(date == null) ? const SizedBox() : const SizedBox(height: 16,), (match?.date == null)
? const SizedBox()
: const SizedBox(
height: 16,
),
Text( Text(
time, '${match?.time}',
style: TextStyleUtils.sizeText10Weight500()! style: TextStyleUtils.sizeText10Weight500()!
.copyWith(color: Colors.white60), .copyWith(color: Colors.white60),
), ),
], ],
), ),
), ),
const SizedBox(width: 10,), const SizedBox(
width: 10,
),
Column( Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
...@@ -76,7 +73,8 @@ class ItemFixtureWidget extends StatelessWidget { ...@@ -76,7 +73,8 @@ class ItemFixtureWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
CachedNetworkImage( CachedNetworkImage(
imageUrl: logoTeamHome, imageUrl: match?.home?.logo ??
'https://upload.wikimedia.org/wikipedia/vi/thumb/5/5c/Chelsea_crest.svg/1200px-Chelsea_crest.svg.png',
imageBuilder: (context, imageProvider) => Container( imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
...@@ -85,18 +83,20 @@ class ItemFixtureWidget extends StatelessWidget { ...@@ -85,18 +83,20 @@ class ItemFixtureWidget extends StatelessWidget {
), ),
), ),
), ),
placeholder: (context, url) => const CupertinoActivityIndicator(), placeholder: (context, url) =>
const CupertinoActivityIndicator(),
memCacheHeight: 150, memCacheHeight: 150,
memCacheWidth: 150, memCacheWidth: 150,
errorWidget: (context, url, error) => errorWidget: (context, url, error) => Image.network(
Image.network( "https://files.lms.xteldev.com/files/n1/static/img",), "https://files.lms.xteldev.com/files/n1/static/img",
),
width: 25, width: 25,
height: 25, height: 25,
), ),
SizedBox( SizedBox(
width: 10.w, width: 10.w,
), ),
Text(teamHomeName, Text('${match?.home?.name}',
maxLines: 3, maxLines: 3,
softWrap: true, softWrap: true,
style: TextStyleUtils.sizeText12Weight500()! style: TextStyleUtils.sizeText12Weight500()!
...@@ -105,7 +105,7 @@ class ItemFixtureWidget extends StatelessWidget { ...@@ -105,7 +105,7 @@ class ItemFixtureWidget extends StatelessWidget {
width: 5.w, width: 5.w,
), ),
Visibility( Visibility(
visible: isHomeFavourite, visible: match!.home!.favourite!,
child: Icon( child: Icon(
Icons.star_rounded, Icons.star_rounded,
color: Colors.white54, color: Colors.white54,
...@@ -121,7 +121,8 @@ class ItemFixtureWidget extends StatelessWidget { ...@@ -121,7 +121,8 @@ class ItemFixtureWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
CachedNetworkImage( CachedNetworkImage(
imageUrl: logoTeamAway, imageUrl: match?.away?.logo ??
'https://upload.wikimedia.org/wikipedia/vi/thumb/5/5c/Chelsea_crest.svg/1200px-Chelsea_crest.svg.png',
imageBuilder: (context, imageProvider) => Container( imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
...@@ -130,18 +131,20 @@ class ItemFixtureWidget extends StatelessWidget { ...@@ -130,18 +131,20 @@ class ItemFixtureWidget extends StatelessWidget {
), ),
), ),
), ),
placeholder: (context, url) => const CupertinoActivityIndicator(), placeholder: (context, url) =>
const CupertinoActivityIndicator(),
memCacheHeight: 150, memCacheHeight: 150,
memCacheWidth: 150, memCacheWidth: 150,
errorWidget: (context, url, error) => errorWidget: (context, url, error) => Image.network(
Image.network( "https://files.lms.xteldev.com/files/n1/static/img",), "https://files.lms.xteldev.com/files/n1/static/img",
),
width: 25, width: 25,
height: 25, height: 25,
), ),
SizedBox( SizedBox(
width: 10.w, width: 10.w,
), ),
Text(teamNameAway, Text('${match?.away?.name}',
maxLines: 3, maxLines: 3,
softWrap: true, softWrap: true,
style: TextStyleUtils.sizeText12Weight500()! style: TextStyleUtils.sizeText12Weight500()!
...@@ -150,7 +153,7 @@ class ItemFixtureWidget extends StatelessWidget { ...@@ -150,7 +153,7 @@ class ItemFixtureWidget extends StatelessWidget {
width: 5.w, width: 5.w,
), ),
Visibility( Visibility(
visible: isAwayFavourite, visible: match!.away!.favourite!,
child: Icon( child: Icon(
Icons.star_rounded, Icons.star_rounded,
color: Colors.white54, color: Colors.white54,
...@@ -167,9 +170,13 @@ class ItemFixtureWidget extends StatelessWidget { ...@@ -167,9 +170,13 @@ class ItemFixtureWidget extends StatelessWidget {
onTap: () => funcFavouriteMatch, onTap: () => funcFavouriteMatch,
child: Container( child: Container(
margin: const EdgeInsets.only(right: 8), margin: const EdgeInsets.only(right: 8),
child: Icon(isFavouriteMatch == true? child: Icon(
Icons.star_rounded : Icons.star_border_rounded, isFavouriteMatch == true
color: isFavouriteMatch == true? ColorUtils.PRIMARY_COLOR : Colors.white, ? Icons.star_rounded
: Icons.star_border_rounded,
color: isFavouriteMatch == true
? ColorUtils.PRIMARY_COLOR
: Colors.white,
size: 22.sp, size: 22.sp,
), ),
), ),
......
import 'package:betting/data/model/res/matches/matches.dart';
import 'package:betting/routes/app_pages.dart'; import 'package:betting/routes/app_pages.dart';
import 'package:betting/view/mobile/favourites_view/matches_view/list_fixtures/widgets/item_fixture_widget.dart'; import 'package:betting/view/mobile/favourites_view/matches_view/list_fixtures/widgets/item_fixture_widget.dart';
import 'package:betting/view/mobile/favourites_view/matches_view/list_fixtures/widgets/tournaments_widget.dart'; import 'package:betting/view/mobile/favourites_view/matches_view/list_fixtures/widgets/tournaments_widget.dart';
...@@ -6,7 +7,6 @@ import 'package:betting/view/mobile/home_page/home_controller.dart'; ...@@ -6,7 +7,6 @@ import 'package:betting/view/mobile/home_page/home_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 FixturesTeamInfo extends StatelessWidget { class FixturesTeamInfo extends StatelessWidget {
FixturesTeamInfo({Key? key}) : super(key: key); FixturesTeamInfo({Key? key}) : super(key: key);
...@@ -54,24 +54,18 @@ class FixturesTeamInfo extends StatelessWidget { ...@@ -54,24 +54,18 @@ class FixturesTeamInfo extends StatelessWidget {
shrinkWrap: true, shrinkWrap: true,
itemCount: fixturesTeamController.listMatChesFavouriteOfTeam[index].matches?.length, itemCount: fixturesTeamController.listMatChesFavouriteOfTeam[index].matches?.length,
itemBuilder: (context, indexMatches) { itemBuilder: (context, indexMatches) {
Matches match = fixturesTeamController.listMatChesFavouriteOfTeam[index].matches![indexMatches];
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Get.toNamed(Routes.detailMatchesRegions, arguments: fixturesTeamController.listMatChesFavouriteOfTeam[index].matches![indexMatches]); Get.toNamed(Routes.detailMatchesRegions, arguments: fixturesTeamController.listMatChesFavouriteOfTeam[index].matches![indexMatches]);
}, },
child: Obx(() => Expanded( child: Expanded(
child: ItemFixtureWidget( child: ItemFixtureWidget(
date: '${fixturesTeamController.listMatChesFavouriteOfTeam[index].matches?[indexMatches].date}', match: match,
time: DateFormat.Hm().format(DateTime.parse('${fixturesTeamController.listMatChesFavouriteOfTeam[index].matches?[indexMatches].date} ${fixturesTeamController.listMatChesFavouriteOfTeam[index].matches![indexMatches].time!}')),
logoTeamHome: fixturesTeamController.listMatChesFavouriteOfTeam[index].matches![indexMatches].home!.logo ?? 'https://upload.wikimedia.org/wikipedia/vi/thumb/5/5c/Chelsea_crest.svg/1200px-Chelsea_crest.svg.png',
teamHomeName: fixturesTeamController.listMatChesFavouriteOfTeam[index].matches![indexMatches].home!.name!,
logoTeamAway: fixturesTeamController.listMatChesFavouriteOfTeam[index].matches![indexMatches].away!.logo ?? 'https://upload.wikimedia.org/wikipedia/vi/thumb/5/5c/Chelsea_crest.svg/1200px-Chelsea_crest.svg.png',
teamNameAway: fixturesTeamController.listMatChesFavouriteOfTeam[index].matches![indexMatches].away!.name!,
isHomeFavourite: fixturesTeamController.listMatChesFavouriteOfTeam[index].matches![indexMatches].home!.favourite!,
isAwayFavourite: fixturesTeamController.listMatChesFavouriteOfTeam[index].matches![indexMatches].away!.favourite!,
isFavouriteMatch: true, funcFavouriteMatch: (){}, isFavouriteMatch: true, funcFavouriteMatch: (){},
), ),
), ),
),
); );
}, },
), ),
......
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