Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Betting
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyễn Minh Nhật
Betting
Commits
90592f3e
Commit
90592f3e
authored
Sep 09, 2023
by
Nguyễn Minh Nhật
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nmn update
parent
f16c9d4e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
201 additions
and
193 deletions
+201
-193
bottom_sheet_widget.dart
...ourites_view/bottom_sheet_widget/bottom_sheet_widget.dart
+6
-4
competitions_screen.dart
...avourites_view/competitions_view/competitions_screen.dart
+88
-80
teams_screen.dart
lib/view/mobile/favourites_view/teams/teams_screen.dart
+103
-100
teams_screen_controller.dart
...mobile/favourites_view/teams/teams_screen_controller.dart
+4
-9
No files found.
lib/view/mobile/favourites_view/bottom_sheet_widget/bottom_sheet_widget.dart
View file @
90592f3e
...
...
@@ -13,7 +13,7 @@ class BottomSheetWidget extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
padding:
EdgeInsets
.
only
(
left:
10
.
w
,
right:
10
.
w
,
top:
2
.
h
,
bottom:
10
.
h
),
padding:
EdgeInsets
.
only
(
left:
10
.
w
,
right:
10
.
w
),
decoration:
BoxDecoration
(
color:
Colors
.
grey
.
shade800
,
borderRadius:
const
BorderRadius
.
only
(
...
...
@@ -162,7 +162,9 @@ class BottomSheetWidget extends StatelessWidget {
SizedBox
(
height:
12
.
h
,
),
ElevatedButton
(
SizedBox
(
width:
double
.
infinity
,
child:
ElevatedButton
(
onPressed:
()
{
Get
.
back
();
},
...
...
@@ -171,13 +173,13 @@ class BottomSheetWidget extends StatelessWidget {
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
8
),
),
minimumSize:
Size
.
fromHeight
(
40
.
h
),
),
child:
Text
(
'Done'
,
style:
TextStyleUtils
.
sizeText14Weight500
()!
.
copyWith
(
color:
Colors
.
black87
),
),
),
)
],
),
...
...
lib/view/mobile/favourites_view/competitions_view/competitions_screen.dart
View file @
90592f3e
...
...
@@ -42,18 +42,25 @@ class CompetitionsScreen extends StatelessWidget {
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Obx
(()
=>
Wrap
(
crossAxisAlignment:
WrapCrossAlignment
.
start
,
spacing:
10
,
children:
competitionController
.
listCompetitionsFavourites
.
asMap
().
entries
.
map
((
entry
)
{
return
GestureDetector
(
SizedBox
(
height:
15
.
h
,),
Obx
(()
=>
GridView
.
builder
(
scrollDirection:
Axis
.
vertical
,
itemCount:
competitionController
.
listCompetitionsFavourites
.
length
,
shrinkWrap:
true
,
physics:
const
NeverScrollableScrollPhysics
(),
gridDelegate:
const
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisSpacing:
10
,
mainAxisSpacing:
10
,
crossAxisCount:
2
),
itemBuilder:
(
context
,
index
)
{
return
Obx
(()
=>
GestureDetector
(
onTap:
()
{
Get
.
toNamed
(
Routes
.
detailTournamentPage
,
arguments:
competitionController
.
listCompetitionsFavourites
[
entry
.
key
],
arguments:
competitionController
.
listCompetitionsFavourites
[
index
],
);
},
child:
Container
(
margin:
const
EdgeInsets
.
only
(
top:
15
,
left:
5
),
height:
!
Device
.
get
().
isTablet
?
Get
.
width
*
0.45
:
(
isLandScape
)
?
Get
.
width
/
6
-
49
:
Get
.
width
/
4
-
20
,
width:
!
Device
.
get
().
isTablet
?
Get
.
width
*
0.45
:
(
isLandScape
)
?
Get
.
width
/
6
-
49
:
Get
.
width
/
4
-
20
,
decoration:
BoxDecoration
(
...
...
@@ -67,13 +74,14 @@ class CompetitionsScreen extends StatelessWidget {
tileMode:
TileMode
.
repeated
,
),
borderRadius:
const
BorderRadius
.
all
(
Radius
.
circular
(
8
))),
child:
Row
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Column
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Container
(
padding:
const
EdgeInsets
.
only
(
left:
20
,
top:
10
),
...
...
@@ -82,30 +90,10 @@ class CompetitionsScreen extends StatelessWidget {
width:
45
,
),
),
Container
(
width:
!
Device
.
get
().
isTablet
?
Get
.
width
*
0.45
-
45
:
(
isLandScape
)
?
(
Get
.
width
/
6
-
50
)
-
45
:
(
Get
.
width
/
4
-
20
)
-
45
,
padding:
const
EdgeInsets
.
only
(
left:
10
,
bottom:
10
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
'
${competitionController.listCompetitionsFavourites[entry.key].name}
'
,
softWrap:
true
,
maxLines:
3
,
style:
TextStyleUtils
.
sizeText12Weight600
()!.
copyWith
(
color:
Colors
.
white
),
),
Text
(
competitionController
.
listCompetitionsFavourites
[
entry
.
key
].
country
!.
name
!,
style:
TextStyleUtils
.
sizeText10Weight400
()!.
copyWith
(
color:
Colors
.
white
),
),
],
),
)
],
),
GestureDetector
(
onTap:
()
{
competitionController
.
deleteCompetitionsFavorites
(
competitionController
.
listCompetitionsFavourites
[
entry
.
key
].
id
!);
competitionController
.
listCompetitions
.
firstWhere
((
element
)
=>
element
.
id
==
competitionController
.
listCompetitionsFavourites
[
entry
.
key
].
id
).
favourite
=
false
;
competitionController
.
deleteCompetitionsFavorites
(
competitionController
.
listCompetitionsFavourites
[
index
].
id
!);
competitionController
.
listCompetitions
.
firstWhere
((
element
)
=>
element
.
id
==
competitionController
.
listCompetitionsFavourites
[
index
].
id
).
favourite
=
false
;
competitionController
.
listCompetitions
.
refresh
();
competitionController
.
listCompetitionsFavourites
.
refresh
();
competitionController
.
update
();
...
...
@@ -123,11 +111,31 @@ class CompetitionsScreen extends StatelessWidget {
),
],
),
Container
(
width:
!
Device
.
get
().
isTablet
?
Get
.
width
*
0.45
-
45
:
(
isLandScape
)
?
(
Get
.
width
/
6
-
50
)
-
45
:
(
Get
.
width
/
4
-
20
)
-
45
,
padding:
const
EdgeInsets
.
only
(
left:
10
,
bottom:
10
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
'
${competitionController.listCompetitionsFavourites[index].name}
'
,
softWrap:
true
,
maxLines:
3
,
style:
TextStyleUtils
.
sizeText12Weight600
()!.
copyWith
(
color:
Colors
.
white
),
),
Text
(
competitionController
.
listCompetitionsFavourites
[
index
].
country
!.
name
!,
style:
TextStyleUtils
.
sizeText10Weight400
()!.
copyWith
(
color:
Colors
.
white
),
),
);
}).
toList
(),
],
),
)
],
),
),
));
},)),
const
SizedBox
(
height:
10
,
),
...
...
lib/view/mobile/favourites_view/teams/teams_screen.dart
View file @
90592f3e
...
...
@@ -44,19 +44,24 @@ class TeamsScreen extends StatelessWidget {
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Obx
(
()
=>
Wrap
(
crossAxisAlignment:
WrapCrossAlignment
.
start
,
spacing:
10
,
children:
teamsScreenController
.
favouriteTeams
.
asMap
().
entries
.
map
((
entry
)
{
return
GestureDetector
(
SizedBox
(
height:
15
.
h
,),
Obx
(()
=>
GridView
.
builder
(
shrinkWrap:
true
,
physics:
const
NeverScrollableScrollPhysics
(),
itemCount:
teamsScreenController
.
favouriteTeams
.
length
,
gridDelegate:
const
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
2
,
mainAxisSpacing:
10
,
crossAxisSpacing:
10
),
itemBuilder:
(
context
,
index
)
{
return
Obx
(()
=>
GestureDetector
(
onTap:
()
{
Get
.
toNamed
(
Routes
.
detailTeams
,
arguments:
teamsScreenController
.
favouriteTeams
[
entry
.
key
]
Routes
.
detailTeams
,
arguments:
teamsScreenController
.
favouriteTeams
[
index
]
);
},
child:
Container
(
margin:
const
EdgeInsets
.
only
(
top:
15
,
left:
5
),
height:
!
Device
.
get
().
isTablet
?
Get
.
width
*
0.45
:
(
isLandScape
)
?
Get
.
width
/
6
-
49
:
Get
.
width
/
4
-
20
,
...
...
@@ -88,7 +93,7 @@ class TeamsScreen extends StatelessWidget {
padding:
const
EdgeInsets
.
only
(
left:
20
,
top:
10
),
child:
Image
.
network
(
teamsScreenController
.
favouriteTeams
[
entry
.
key
]!.
logo
??
'https://upload.wikimedia.org/wikipedia/vi/thumb/5/5c/Chelsea_crest.svg/1200px-Chelsea_crest.svg.png'
,
teamsScreenController
.
favouriteTeams
[
index
]!.
logo
??
'https://upload.wikimedia.org/wikipedia/vi/thumb/5/5c/Chelsea_crest.svg/1200px-Chelsea_crest.svg.png'
,
height:
45
,
width:
45
,
),
...
...
@@ -99,13 +104,13 @@ class TeamsScreen extends StatelessWidget {
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
'
${teamsScreenController.favouriteTeams[entry.key
]!.name}
'
,
Text
(
'
${teamsScreenController.favouriteTeams[index
]!.name}
'
,
softWrap:
true
,
maxLines:
3
,
style:
TextStyleUtils
.
sizeText12Weight600
()!.
copyWith
(
color:
Colors
.
white
),
),
Text
(
teamsScreenController
.
favouriteTeams
[
entry
.
key
]!.
country
.
name
,
teamsScreenController
.
favouriteTeams
[
index
]!.
country
.
name
,
style:
TextStyleUtils
.
sizeText10Weight400
()!.
copyWith
(
color:
Colors
.
white
),
),
],
...
...
@@ -115,8 +120,8 @@ class TeamsScreen extends StatelessWidget {
),
GestureDetector
(
onTap:
()
{
teamsScreenController
.
deleteFavouriteTeam
(
teamsScreenController
.
favouriteTeams
[
entry
.
key
].
id
);
teamsScreenController
.
teams
.
firstWhere
((
element
)
=>
element
.
id
==
teamsScreenController
.
favouriteTeams
[
entry
.
key
].
id
).
favourite
=
false
;
teamsScreenController
.
deleteFavouriteTeam
(
teamsScreenController
.
favouriteTeams
[
index
].
id
);
teamsScreenController
.
teams
.
firstWhere
((
element
)
=>
element
.
id
==
teamsScreenController
.
favouriteTeams
[
index
].
id
).
favourite
=
false
;
teamsScreenController
.
favouriteTeams
.
refresh
();
teamsScreenController
.
teams
.
refresh
();
teamsScreenController
.
update
();
...
...
@@ -140,10 +145,8 @@ class TeamsScreen extends StatelessWidget {
],
),
),
);
}).
toList
(),
),
),
));
},)),
const
SizedBox
(
height:
10
,
),
...
...
lib/view/mobile/favourites_view/teams/teams_screen_controller.dart
View file @
90592f3e
...
...
@@ -35,7 +35,7 @@ class TeamsScreenController extends GetxController {
@override
void
onInit
()
{
// TODO: implement onInit
super
.
onInit
();
getListTeam
(
''
);
getFavouriteTeams
();
...
...
@@ -43,7 +43,7 @@ class TeamsScreenController extends GetxController {
controllerSearchScroll
=
ScrollController
()..
addListener
(
_loadMoreSearch
);
}
/// todo: Method refresh
void
onRefresh
()
async
{
getListTeam
(
''
);
getFavouriteTeams
();
...
...
@@ -51,7 +51,7 @@ class TeamsScreenController extends GetxController {
}
/// todo: Method get teams
void
getListTeam
(
String
?
name
)
async
{
await
_teamRepo
.
getListTeam
(
0
,
20
,
name
).
then
((
value
)
async
{
if
(
value
.
state
==
Status
.
SUCCESS
)
{
...
...
@@ -60,7 +60,7 @@ class TeamsScreenController extends GetxController {
});
}
/// todo: Method add team to list favourite
void
addFavourite
(
List
<
ItemTeams
>
favourites
,
List
listNotifyMatch
,
List
listNotifyNews
,
ItemTeams
item
)
async
{
await
_teamRepo
.
addTeamFollow
(
favourites
,
listNotifyMatch
,
listNotifyNews
).
then
((
value
)
{
if
(
value
.
state
==
Status
.
SUCCESS
)
{
...
...
@@ -72,7 +72,6 @@ class TeamsScreenController extends GetxController {
});
}
/// todo: Method get list favourite team
void
getFavouriteTeams
()
async
{
await
_teamRepo
.
getFavouriteTeams
().
then
((
value
)
{
if
(
value
.
state
==
Status
.
SUCCESS
)
{
...
...
@@ -81,7 +80,6 @@ class TeamsScreenController extends GetxController {
});
}
/// todo: delete favourite team
void
deleteFavouriteTeam
(
String
id
)
async
{
await
_teamRepo
.
delFavouriteTeam
(
id
).
then
((
value
)
{
if
(
value
.
state
==
Status
.
SUCCESS
)
{
...
...
@@ -93,7 +91,6 @@ class TeamsScreenController extends GetxController {
});
}
/// todo: add team to favourite list
void
addFavouriteTeam
(
BuildContext
context
,
int
index
,
SwitchController
switchController
)
{
teams
[
index
].
favourite
=
!
teams
[
index
].
favourite
;
isFavourite
.
value
=
teams
[
index
].
favourite
;
...
...
@@ -125,7 +122,6 @@ class TeamsScreenController extends GetxController {
update
();
}
/// todo: load more
void
_scrollTeams
(){
if
(
controllerEx
.
position
.
pixels
==
controllerEx
.
position
.
maxScrollExtent
){
if
(
itemLoadMoreEx
.
isNotEmpty
){
...
...
@@ -146,7 +142,6 @@ class TeamsScreenController extends GetxController {
}
}
/// todo: load more search
void
_loadMoreSearch
(){
if
(
controllerSearchScroll
.
position
.
pixels
==
controllerSearchScroll
.
position
.
maxScrollExtent
){
if
(
itemLoadMoreSearch
.
isNotEmpty
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment