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

nmn update

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