Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
feelver
Overview
Overview
Details
Activity
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
2F-ART
feelver
Commits
5a8e208f
Commit
5a8e208f
authored
Aug 24, 2020
by
Mobile : Ball (Apprentice)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
ad689343
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
71 deletions
+114
-71
lib/main.dart
+1
-1
lib/service/api.dart
+18
-18
lib/ui/favorite/favorite.dart
+27
-21
lib/ui/favorite/favorite_presenter.dart
+7
-5
pubspec.lock
+61
-26
No files found.
lib/main.dart
View file @
5a8e208f
...
...
@@ -33,7 +33,7 @@ class MyApp extends StatelessWidget {
),
home:
SplashScreenPag
e
()
home:
Favorit
e
()
...
...
lib/service/api.dart
View file @
5a8e208f
...
...
@@ -33,27 +33,27 @@ class Api<T> {
static
final
String
baseApi
=
"https://backend-uat.feelver.com/api"
;
Future
<
Response
<
T
>>
deletefavorite
(
Object
body
)
async
{
var
_model
;
var
_fail
;
var
result
;
print
(
"this is body"
+
body
.
toString
());
await
_httpConnection
(
"
${this._baseApi}
/wishlist-item/delete"
,
this
.
_headerApi
,
body
).
then
((
response
){
print
(
"ผลลัพท เท่ากับ"
+
"
${response.body}
"
);
if
(
response
.
statusCode
==
200
){
_model
=
DeletefavoriteModel
.
fromJson
(
json
.
decode
(
response
.
body
));
}
else
{
_fail
=
FailModel
.
fromJson
(
json
.
decode
(
response
.
body
));
}
result
=
new
Response
<
T
>(
_model
,
_fail
);
});
return
result
;
}
static
final
String
baseApiforimage
=
"https://backend-uat.feelver.com/api/storage/"
;
static
final
String
baseApiforimage
=
"https://backend-uat.feelver.com/api/storage/"
;
Future
<
Response
<
T
>>
deletefavorite
(
Object
body
)
async
{
var
_model
;
var
_fail
;
var
result
;
print
(
"this is body"
+
body
.
toString
());
await
_httpConnection
(
"
${this._baseApi}
/wishlist-item/delete"
,
this
.
_headerApi
,
body
).
then
((
response
){
print
(
"ผลลัพท์ เท่ากับ"
+
"
${response.body}
"
);
if
(
response
.
statusCode
==
200
){
_model
=
DeletefavoriteModel
.
fromJson
(
json
.
decode
(
response
.
body
));
}
else
{
_fail
=
FailModel
.
fromJson
(
json
.
decode
(
response
.
body
));
}
result
=
new
Response
<
T
>(
_model
,
_fail
);
});
return
result
;
}
Future
<
Response
<
T
>>
favorite
(
Object
body
)
async
{
var
_model
;
...
...
lib/ui/favorite/favorite.dart
View file @
5a8e208f
import
'package:feelverapp/service/api.dart'
;
import
'package:feelverapp/ui/favorite/favorite_presenter.dart'
;
import
'package:feelverapp/ui/menu/menu.dart'
;
import
'package:feelverapp/ui/my_order_status/my_order_status.dart'
;
...
...
@@ -5,6 +6,9 @@ import 'package:feelverapp/util/SizeConfig.dart';
import
'package:flutter/material.dart'
;
class
Favorite
extends
StatefulWidget
{
@override
_FavoriteState
createState
()
=>
_FavoriteState
();
}
...
...
@@ -14,7 +18,6 @@ class _FavoriteState extends State<Favorite> {
FavoritePresenter
presenter
;
@override
void
initState
()
{
super
.
initState
();
...
...
@@ -22,7 +25,7 @@ class _FavoriteState extends State<Favorite> {
presenter
=
FavoritePresenter
(
this
);
presenter
.
Favoriteitem
();
presenter
.
Deletefavoriteitem
();
}
@override
...
...
@@ -37,7 +40,7 @@ class _FavoriteState extends State<Favorite> {
body:
_setupView
(),
bottomNavigationBar:
Container
(
color:
Color
.
fromRGBO
(
69
,
85
,
79
,
1
),
height:
SizeConfig
.
getHeight
(
10
0
),
height:
SizeConfig
.
getHeight
(
5
0
),
),
);
}
...
...
@@ -73,9 +76,7 @@ class _FavoriteState extends State<Favorite> {
);
}
Widget
list
(
int
index
)
{
Widget
list
(
int
index
,)
{
return
Container
(
// color: Colors.red,
margin:
EdgeInsets
.
only
(
bottom:
15
),
...
...
@@ -94,7 +95,9 @@ class _FavoriteState extends State<Favorite> {
fit:
BoxFit
.
fitWidth
,
)
:
Image
.
network
(
presenter
.
favoriteModel
.
wishListItem
[
index
].
product
.
cover
,
"https://backend-uat.feelver.com/storage/"
+
presenter
.
favoriteModel
.
wishListItem
[
index
].
product
.
cover
,
width:
SizeConfig
.
getWidth
(
110
),
height:
SizeConfig
.
getHeight
(
150
),
fit:
BoxFit
.
fitWidth
,
...
...
@@ -113,30 +116,32 @@ class _FavoriteState extends State<Favorite> {
child:
Row
(
children:
<
Widget
>[
Text
(
presenter
.
favoriteModel
.
wishListItem
[
index
].
product
.
name
,
presenter
.
favoriteModel
.
wishListItem
[
index
]
.
product
.
name
,
style:
TextStyle
(
color:
Colors
.
black
,
fontSize:
SizeConfig
.
getFontSize
(
15
)),
),
Spacer
(),
IconButton
(
icon:
Icon
(
Icons
.
favorite
),
color:
Color
(
0xFFDD175F
),
onPressed:
()
{
setState
(()
{
});
print
(
'delete'
);
presenter
.
Deletefavoriteitem
(
presenter
.
favoriteModel
.
wishListItem
[
index
].
id
.
toString
());
},
icon:
Icon
(
Icons
.
favorite
),
color:
Color
(
0xFFDD175F
),
),
],
),
),
Container
(
// color: Colors.white,
child:
Text
(
'นวดเเผนไทย'
,
style:
TextStyle
(
color:
Colors
.
black
,
),),
child:
Text
(
'นวดเเผนไทย'
,
style:
TextStyle
(
color:
Colors
.
black
,
),
),
),
SizedBox
(
height:
SizeConfig
.
getHeight
(
5
),
...
...
@@ -153,7 +158,8 @@ class _FavoriteState extends State<Favorite> {
SizedBox
(
width:
SizeConfig
.
getWidth
(
5
),
),
Text
(
presenter
.
favoriteModel
.
wishListItem
[
index
].
product
.
duration
),
Text
(
presenter
.
favoriteModel
.
wishListItem
[
index
]
.
product
.
duration
),
Spacer
(),
Icon
(
Icons
.
local_offer
,
...
...
@@ -180,7 +186,9 @@ class _FavoriteState extends State<Favorite> {
children:
<
Widget
>[
Spacer
(),
Text
(
"฿"
+
presenter
.
favoriteModel
.
wishListItem
[
index
].
product
.
price
,
"฿"
+
presenter
.
favoriteModel
.
wishListItem
[
index
]
.
product
.
price
,
style:
TextStyle
(
fontSize:
SizeConfig
.
getFontSize
(
20
),
color:
Color
(
0xFFFD2956
),
...
...
@@ -197,14 +205,12 @@ class _FavoriteState extends State<Favorite> {
),
],
),
],
),
),
);
}
Widget
header
()
{
return
Container
(
child:
Stack
(
...
...
lib/ui/favorite/favorite_presenter.dart
View file @
5a8e208f
...
...
@@ -28,21 +28,23 @@ class FavoritePresenter extends BasePresenter<Favorite> {
}
}
Deletefavoriteitem
()
async
{
Deletefavoriteitem
(
String
id
)
async
{
_api
=
Api
<
DeletefavoriteModel
>();
var
res
=
await
_api
.
deletefavorite
({
"id"
:
"146"
,
"id"
:
id
,
});
if
(
res
.
fail
==
null
)
{
setState
(()
{
deletefavoriteModel
=
res
.
success
;
if
(
deletefavoriteModel
.
message
==
"delete Successfully"
)
{
Favoriteitem
();
}
else
{
print
(
deletefavoriteModel
.
message
);
}
});
}
else
{
print
(
'res Fail'
);
}
}
}
pubspec.lock
View file @
5a8e208f
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.
2
"
version: "2.4.
1
"
boolean_selector:
dependency: transitive
description:
...
...
@@ -29,34 +43,34 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
char
acters
:
char
code
:
dependency: transitive
description:
name: char
acters
name: char
code
url: "https://pub.dartlang.org"
source: hosted
version: "1.
0.0
"
c
harcode
:
version: "1.
1.3
"
c
ollection
:
dependency: transitive
description:
name: c
harcode
name: c
ollection
url: "https://pub.dartlang.org"
source: hosted
version: "1.1
.3
"
c
lock
:
version: "1.1
4.12
"
c
onvert
:
dependency: transitive
description:
name: c
lock
name: c
onvert
url: "https://pub.dartlang.org"
source: hosted
version: "
1.0
.1"
c
ollection
:
version: "
2.1
.1"
c
rypto
:
dependency: transitive
description:
name: c
ollection
name: c
rypto
url: "https://pub.dartlang.org"
source: hosted
version: "
1.14.13
"
version: "
2.1.4
"
csslib:
dependency: transitive
description:
...
...
@@ -78,13 +92,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.8"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
file:
dependency: transitive
description:
...
...
@@ -149,6 +156,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.12"
image_cropper:
dependency: "direct main"
description:
...
...
@@ -197,7 +211,7 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.
8
"
version: "0.12.
6
"
meta:
dependency: transitive
description:
...
...
@@ -211,7 +225,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.
7.0
"
version: "1.
6.4
"
path_provider_linux:
dependency: transitive
description:
...
...
@@ -233,6 +247,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
platform:
dependency: transitive
description:
...
...
@@ -268,6 +289,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.4"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
rflutter_alert:
dependency: "direct main"
description:
...
...
@@ -328,7 +356,7 @@ packages:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.
5
"
version: "1.9.
3
"
stream_channel:
dependency: transitive
description:
...
...
@@ -356,14 +384,14 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.1
7
"
version: "0.2.1
5
"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.
2.0
"
version: "1.
1.6
"
url_launcher:
dependency: "direct main"
description:
...
...
@@ -413,6 +441,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.1"
sdks:
dart: ">=2.
9.0-14.0.dev
<3.0.0"
dart: ">=2.
6.0
<3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
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