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
fb224c17
Commit
fb224c17
authored
Jul 21, 2020
by
Mobile : Ball (Apprentice)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
b82e93a4
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
209 additions
and
37 deletions
+209
-37
lib/main.dart
+2
-1
lib/model/category/category_model.dart
+8
-9
lib/model/shoplist/shoplist_Model.dart
+159
-0
lib/service/api.dart
+35
-12
lib/ui/home/home.dart
+1
-1
lib/ui/home/home_presenter.dart
+4
-14
No files found.
lib/main.dart
View file @
fb224c17
...
...
@@ -22,7 +22,8 @@ class MyApp extends StatelessWidget {
primarySwatch:
Colors
.
blue
,
),
home:
SplashScreenPage
(),
// home: SplashScreenPage(),
home:
HomePage
(),
);
}
...
...
lib/model/category/category_model.dart
View file @
fb224c17
class
categoryModel
{
class
categoryModel
{
List
<
DATA
>
dATA
;
categoryModel
({
this
.
dATA
});
...
...
@@ -20,9 +20,9 @@
}
return
data
;
}
}
}
class
DATA
{
class
DATA
{
int
id
;
int
parentId
;
String
name
;
...
...
@@ -30,12 +30,12 @@
String
displayName
;
String
cover
;
String
detail
;
Null
type
;
dynamic
type
;
String
status
;
int
sortOrder
;
Null
storeId
;
Null
vendorId
;
Null
createdAt
;
dynamic
storeId
;
dynamic
vendorId
;
dynamic
createdAt
;
String
updatedAt
;
String
visibility
;
...
...
@@ -93,4 +93,4 @@
data
[
'visibility'
]
=
this
.
visibility
;
return
data
;
}
}
\ No newline at end of file
}
lib/model/shoplist/shoplist_Model.dart
0 → 100644
View file @
fb224c17
class
shoplistModel
{
List
<
DATA
>
dATA
;
shoplistModel
({
this
.
dATA
});
shoplistModel
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
if
(
json
[
'DATA'
]
!=
null
)
{
dATA
=
new
List
<
DATA
>();
json
[
'DATA'
].
forEach
((
v
)
{
dATA
.
add
(
new
DATA
.
fromJson
(
v
));
});
}
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
if
(
this
.
dATA
!=
null
)
{
data
[
'DATA'
]
=
this
.
dATA
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
return
data
;
}
}
class
DATA
{
int
id
;
String
storeCode
;
String
storeName
;
String
storeCover
;
String
displayCover
;
String
isActive
;
int
storeOrder
;
int
customerGroupId
;
int
vendorId
;
Null
createdAt
;
Null
updatedAt
;
String
location
;
String
email
;
String
phone
;
String
mobile
;
String
address
;
String
city
;
String
country
;
String
zipCode
;
String
website
;
String
allowRoute
;
Null
excerpt
;
Null
detail
;
Null
storeLogo
;
Null
isFacilities
;
String
distanceWithLocation
;
int
star
;
Null
ratings
;
List
<
Null
>
storeProduct
;
DATA
(
{
this
.
id
,
this
.
storeCode
,
this
.
storeName
,
this
.
storeCover
,
this
.
displayCover
,
this
.
isActive
,
this
.
storeOrder
,
this
.
customerGroupId
,
this
.
vendorId
,
this
.
createdAt
,
this
.
updatedAt
,
this
.
location
,
this
.
email
,
this
.
phone
,
this
.
mobile
,
this
.
address
,
this
.
city
,
this
.
country
,
this
.
zipCode
,
this
.
website
,
this
.
allowRoute
,
this
.
excerpt
,
this
.
detail
,
this
.
storeLogo
,
this
.
isFacilities
,
this
.
distanceWithLocation
,
this
.
star
,
this
.
ratings
,
this
.
storeProduct
});
DATA
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
storeCode
=
json
[
'store_code'
];
storeName
=
json
[
'store_name'
];
storeCover
=
json
[
'store_cover'
];
displayCover
=
json
[
'display_cover'
];
isActive
=
json
[
'is_active'
];
storeOrder
=
json
[
'store_order'
];
customerGroupId
=
json
[
'customer_group_id'
];
vendorId
=
json
[
'vendor_id'
];
createdAt
=
json
[
'created_at'
];
updatedAt
=
json
[
'updated_at'
];
location
=
json
[
'location'
];
email
=
json
[
'email'
];
phone
=
json
[
'phone'
];
mobile
=
json
[
'mobile'
];
address
=
json
[
'address'
];
city
=
json
[
'city'
];
country
=
json
[
'country'
];
zipCode
=
json
[
'zip_code'
];
website
=
json
[
'website'
];
allowRoute
=
json
[
'allow_route'
];
excerpt
=
json
[
'excerpt'
];
detail
=
json
[
'detail'
];
storeLogo
=
json
[
'store_logo'
];
isFacilities
=
json
[
'is_facilities'
];
distanceWithLocation
=
json
[
'distance_with_location'
];
star
=
json
[
'star'
];
ratings
=
json
[
'ratings'
];
if
(
json
[
'store_product'
]
!=
null
)
{
storeProduct
=
new
List
<
Null
>();
json
[
'store_product'
].
forEach
((
v
)
{
storeProduct
.
add
(
new
Null
.
fromJson
(
v
));
});
}
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'id'
]
=
this
.
id
;
data
[
'store_code'
]
=
this
.
storeCode
;
data
[
'store_name'
]
=
this
.
storeName
;
data
[
'store_cover'
]
=
this
.
storeCover
;
data
[
'display_cover'
]
=
this
.
displayCover
;
data
[
'is_active'
]
=
this
.
isActive
;
data
[
'store_order'
]
=
this
.
storeOrder
;
data
[
'customer_group_id'
]
=
this
.
customerGroupId
;
data
[
'vendor_id'
]
=
this
.
vendorId
;
data
[
'created_at'
]
=
this
.
createdAt
;
data
[
'updated_at'
]
=
this
.
updatedAt
;
data
[
'location'
]
=
this
.
location
;
data
[
'email'
]
=
this
.
email
;
data
[
'phone'
]
=
this
.
phone
;
data
[
'mobile'
]
=
this
.
mobile
;
data
[
'address'
]
=
this
.
address
;
data
[
'city'
]
=
this
.
city
;
data
[
'country'
]
=
this
.
country
;
data
[
'zip_code'
]
=
this
.
zipCode
;
data
[
'website'
]
=
this
.
website
;
data
[
'allow_route'
]
=
this
.
allowRoute
;
data
[
'excerpt'
]
=
this
.
excerpt
;
data
[
'detail'
]
=
this
.
detail
;
data
[
'store_logo'
]
=
this
.
storeLogo
;
data
[
'is_facilities'
]
=
this
.
isFacilities
;
data
[
'distance_with_location'
]
=
this
.
distanceWithLocation
;
data
[
'star'
]
=
this
.
star
;
data
[
'ratings'
]
=
this
.
ratings
;
if
(
this
.
storeProduct
!=
null
)
{
data
[
'store_product'
]
=
this
.
storeProduct
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
return
data
;
}
}
\ No newline at end of file
lib/service/api.dart
View file @
fb224c17
...
...
@@ -19,8 +19,7 @@ class Api<T> {
"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvYmFja2VuZC11YXQuZmVlbHZlci5jb21cL2FwaVwvbG9naW4iLCJpYXQiOjE1OTQ5NzIzMjYsImV4cCI6MTYwMjE3MjMyNiwibmJmIjoxNTk0OTcyMzI2LCJqdGkiOiJsM1BldUJVcTdDNldSbzVGIiwic3ViIjo1LCJwcnYiOiI4N2UwYWYxZWY5ZmQxNTgxMmZkZWM5NzE1M2ExNGUwYjA0NzU0NmFhIn0.fwFqcbzG2T_ZHtIcGF13Ek7nIxxwbnaE9ZXGomo-nzY"
,
};
Future
<
Response
<
T
>>
forgetPassword
(
Object
body
)
async
{
Future
<
Response
<
T
>>
forgetPassword
(
Object
body
)
async
{
var
_model
;
var
_fail
;
var
result
;
...
...
@@ -29,8 +28,8 @@ Future<Response<T>> forgetPassword(Object body) async {
await
_httpConnection
(
"
${this._baseApi}
/customer/forget-password"
,
this
.
_headerApi
,
body
)
.
then
((
response
)
{
print
(
"ผลลัพ เท่ากับบบบ "
+
"
${response.body}
"
);
if
(
response
.
statusCode
==
200
)
{
print
(
"ผลลัพ เท่ากับบบบ "
+
"
${response.body}
"
);
if
(
response
.
statusCode
==
200
)
{
_model
=
FogetPasswordModel
.
fromJson
(
json
.
decode
(
response
.
body
));
}
else
{
_fail
=
FailModel
.
fromJson
(
json
.
decode
(
response
.
body
));
...
...
@@ -40,10 +39,6 @@ Future<Response<T>> forgetPassword(Object body) async {
return
result
;
}
Future
<
Response
<
T
>>
login
(
Object
body
)
async
{
var
_model
;
var
_fail
;
...
...
@@ -82,7 +77,6 @@ Future<Response<T>> forgetPassword(Object body) async {
return
result
;
}
Future
<
Response
<
T
>>
category
(
Object
body
)
async
{
var
_model
;
var
_fail
;
...
...
@@ -91,11 +85,13 @@ Future<Response<T>> forgetPassword(Object body) async {
await
_httpConnection
(
"
${this._baseApi}
/category"
,
this
.
_headerApi
,
body
)
.
then
((
response
)
{
print
(
"ผลลัพท์ เท่ากับ "
"
${response.body}
"
);
if
(
response
.
statusCode
==
200
){
if
(
response
.
statusCode
==
200
)
{
// Array to Map Json
Map
<
String
,
dynamic
>
myData
=
arrayToJson
(
response
.
body
);
print
(
'testtt'
);
print
(
myData
);
_model
=
categoryModel
.
fromJson
(
json
.
decode
(
response
.
body
)
);
_model
=
categoryModel
.
fromJson
(
myData
);
}
else
{
_fail
=
FailModel
.
fromJson
(
json
.
decode
(
response
.
body
));
}
...
...
@@ -104,7 +100,23 @@ Future<Response<T>> forgetPassword(Object body) async {
return
result
;
}
Future
<
Response
<
T
>>
shoplist
(
Object
body
)
async
{
var
_model
;
var
_fail
;
var
result
;
await
_httpConnection
(
"
${this._baseApi}
/store"
,
this
.
_headerApi
,
body
).
then
((
response
){
print
(
"ผลลัพท์ เท่ากับ "
"
${response.body}
"
);
if
(
response
.
statusCode
==
200
)
{
// Array to Map Json
Map
<
String
,
dynamic
>
myData
=
arrayToJson
(
response
.
body
);
print
(
myData
);
_model
=
}
});
}
///api environment
Future
<
http
.
Response
>
_httpConnection
(
...
...
@@ -126,6 +138,17 @@ Future<Response<T>> forgetPassword(Object body) async {
var
resJson
=
jsonDecode
(
json
);
return
resJson
;
}
dynamic
arrayToJson
(
dynamic
array
)
{
List
<
dynamic
>
data
=
_jsonDecode
(
array
);
Map
<
String
,
dynamic
>
myJson
=
{};
if
(
data
!=
null
&&
data
.
length
>
0
)
{
myJson
[
'data'
]
=
data
;
}
return
myJson
;
}
}
class
Response
<
T
>
{
...
...
lib/ui/home/home.dart
View file @
fb224c17
...
...
@@ -260,7 +260,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
fit:
BoxFit
.
fill
,
),
'SPA'
,
'99 View'
,
Nearme
List
()),
'99 View'
,
Shop
List
()),
_listItem
(
Image
.
asset
(
'assets/images/banner_massage.png'
,
...
...
lib/ui/home/home_presenter.dart
View file @
fb224c17
...
...
@@ -5,29 +5,19 @@ import 'package:feelverapp/service/base_presenter.dart';
import
'package:feelverapp/ui/home/home.dart'
;
import
'package:flutter/material.dart'
;
class
HomePresenter
extends
BasePresenter
<
HomePage
>{
class
HomePresenter
extends
BasePresenter
<
HomePage
>
{
Api
_api
;
final
formkey
=
GlobalKey
<
FormState
>();
HomePresenter
(
State
<
HomePage
>
state
)
:
super
(
state
);
Listitem
()
async
{
Listitem
()
async
{
_api
=
Api
<
categoryModel
>();
var
res
=
await
_api
.
category
({
"access_type"
:
"portal"
});
var
res
=
await
_api
.
category
({
"access_type"
:
"portal"
});
if
(
res
.
fail
==
null
)
{
print
(
'res Success'
);
}
else
{
}
else
{
print
(
'res Fail'
);
}
}
}
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