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
9fc19fb6
Commit
9fc19fb6
authored
Aug 27, 2020
by
Mobile : Art
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
6b35189b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
283 additions
and
199 deletions
+283
-199
lib/ui/booking/booking_detail.dart
+23
-4
lib/ui/booking/booking_detail_presenter.dart
+49
-40
lib/ui/home/home.dart
+79
-57
lib/ui/home/home_presenter.dart
+55
-0
lib/ui/payment/mycart.dart
+36
-45
lib/ui/shop/shop_list_detail.dart
+5
-4
lib/ui/shop/shoplistdetail_presenter.dart
+36
-49
No files found.
lib/ui/booking/booking_detail.dart
View file @
9fc19fb6
...
...
@@ -32,6 +32,8 @@ class _BookingDetailState extends State<BookingDetail> {
presenter
.
store_id
=
widget
.
store_id
;
presenter
.
getid
=
widget
.
getid
;
});
presenter
.
getudid
();
presenter
.
getDetail
();
}
...
...
@@ -120,10 +122,27 @@ class _BookingDetailState extends State<BookingDetail> {
SizedBox
(
width:
SizeConfig
.
getWidth
(
24
),
),
ImageIcon
(
AssetImage
(
'assets/images/ic_fav_active.png'
),
color:
Colors
.
grey
,
size:
SizeConfig
.
getFontSize
(
24
),
Positioned
(
right:
SizeConfig
.
getPadding
(
16
),
top:
SizeConfig
.
getPadding
(
16
),
child:
InkResponse
(
highlightShape:
BoxShape
.
circle
,
highlightColor:
Color
(
0xFFDD175F
),
focusColor:
Color
(
0xFFDD175F
),
splashColor:
Color
(
0xFFDD175F
),
onTap:
()
{
setState
(()
{
presenter
.
fav
?
presenter
.
fav
=
false
:
presenter
.
Addfav
(
widget
.
getid
.
toString
());
});
},
child:
ImageIcon
(
AssetImage
(
'assets/images/ic_fav_list.png'
),
color:
presenter
.
fav
?
Color
(
0xFFDD175F
)
:
Colors
.
grey
,
size:
SizeConfig
.
getFontSize
(
30
),
),
),
),
SizedBox
(
width:
SizeConfig
.
getWidth
(
8
),
...
...
lib/ui/booking/booking_detail_presenter.dart
View file @
9fc19fb6
import
'package:feelverapp/model/favorite/addfav_model.dart'
;
import
'package:feelverapp/model/nearme/nearme_list_model.dart'
;
import
'package:feelverapp/service/Loading.dart'
;
...
...
@@ -5,6 +6,7 @@ import 'package:feelverapp/service/api.dart';
import
'package:feelverapp/service/base_presenter.dart'
;
import
'package:feelverapp/ui/home/home.dart'
;
import
'package:feelverapp/util/Accout_util.dart'
;
import
'package:feelverapp/util/SizeConfig.dart'
;
import
'package:flutter/material.dart'
;
import
'package:rflutter_alert/rflutter_alert.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
...
...
@@ -17,9 +19,12 @@ class BookingDetailtPresenter extends BasePresenter<BookingDetail> {
final
formkey
=
GlobalKey
<
FormState
>();
Api
_api
;
String
type
=
'3'
;
int
getid
;
int
getid
;
int
vendor_id
;
int
store_id
;
bool
fav
=
false
;
AddfavModel
addmodel
;
String
uid
;
ProductModel
getmodel
;
...
...
@@ -72,43 +77,47 @@ class BookingDetailtPresenter extends BasePresenter<BookingDetail> {
}
}
// getnearme() async {
// _api = Api<NearMeListModel>();
//
// var res = await _api.getNearList({});
// print("Hii" + getmodel[0].storeName);
// print("Hii2" + res.success);
//
// if (res.fail == null) {
// setState(() {
// NearMeListModel model = res.success;
//
//// getmodel = res.success
// }
// );
// } else {
// Alert(
// style: AlertStyle(
// animationType: AnimationType.fromTop,
// isCloseButton: false,
// ),
// context: state.context,
// title: "ไม่สามารถติดต่อ\nเซิร์ฟเวอร์ได้",
// content: Icon(
// Icons.warning,
// color: Colors.orange,
// size: 80,
// ),
// buttons: [
// DialogButton(
// color: Color.fromRGBO(106, 179, 170, 1),
// onPressed: () => Navigator.pop(state.context),
// child: Text(
// "ลองอีกครั้ง",
// style: TextStyle(color: Colors.white, fontSize: 20),
// ),
// )
// ]).show();
// }
// }
getudid
()
async
{
SharedPreferences
pref
=
await
SharedPreferences
.
getInstance
();
setState
(()
{
uid
=
pref
.
getString
(
'Id'
);
});
return
uid
;
}
Addfav
(
String
id
)
async
{
LoadingView
(
state
.
context
).
show
();
_api
=
Api
<
AddfavModel
>();
var
res
=
await
_api
.
addfav
({
"customer_id"
:
uid
,
"store_id"
:
id
,
"vendor_id"
:
id
,
"product_id"
:
id
,
});
LoadingView
(
state
.
context
).
hide
();
if
(
res
.
fail
==
null
)
{
setState
(()
{
addmodel
=
res
.
success
;
print
(
"complete"
);
fav
=
true
;
});
showDialog
(
context:
state
.
context
,
builder:
(
context
)
{
Future
.
delayed
(
Duration
(
seconds:
1
),
()
{
Navigator
.
of
(
context
).
pop
(
true
);
});
return
AlertDialog
(
content:
ImageIcon
(
AssetImage
(
'assets/images/ic_fav_list.png'
),
color:
fav
?
Color
(
0xFFDD175F
)
:
Colors
.
grey
,
size:
SizeConfig
.
getFontSize
(
30
),
),
title:
Center
(
child:
Text
(
'บันทึกสำเร็จ'
)),
);
});
}
else
{
print
(
'res Fail'
);
}
}
}
lib/ui/home/home.dart
View file @
9fc19fb6
...
...
@@ -38,7 +38,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
presenter
=
HomePresenter
(
this
);
presenter
.
Listitem
();
//
presenter.getid();
presenter
.
getid
();
presenter
.
getprofile
();
//print("nenwenwenwew"+presenter.CatModel.dATA[0].cover,);
...
...
@@ -265,12 +265,14 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
child:
ClipRRect
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
SizeConfig
.
getWidth
(
56
))),
child:
presenter
.
getmodel
.
result
[
0
].
image
==
null
?
Container
():
Image
.
network
(
presenter
.
getmodel
.
result
[
0
].
image
,
fit:
BoxFit
.
contain
,
width:
SizeConfig
.
getWidth
(
30
),
height:
SizeConfig
.
getWidth
(
30
),
),
child:
presenter
.
getmodel
.
result
[
0
].
image
==
null
?
Container
()
:
Image
.
network
(
presenter
.
getmodel
.
result
[
0
].
image
,
fit:
BoxFit
.
contain
,
width:
SizeConfig
.
getWidth
(
30
),
height:
SizeConfig
.
getWidth
(
30
),
),
),
),
),
...
...
@@ -291,12 +293,14 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
child:
ClipRRect
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
SizeConfig
.
getWidth
(
56
))),
child:
presenter
.
getmodel
.
result
[
0
].
image
==
null
?
Container
():
Image
.
network
(
presenter
.
getmodel
.
result
[
0
].
image
,
fit:
BoxFit
.
contain
,
width:
SizeConfig
.
getWidth
(
30
),
height:
SizeConfig
.
getWidth
(
30
),
),
child:
presenter
.
getmodel
.
result
[
0
].
image
==
null
?
Container
()
:
Image
.
network
(
presenter
.
getmodel
.
result
[
0
].
image
,
fit:
BoxFit
.
contain
,
width:
SizeConfig
.
getWidth
(
30
),
height:
SizeConfig
.
getWidth
(
30
),
),
),
),
),
...
...
@@ -366,7 +370,8 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
);
}
Widget
_shopItem
(
String
title
,
String
image
,
String
address
,
String
detail
,
String
id
)
{
Widget
_shopItem
(
String
title
,
String
image
,
String
address
,
String
detail
,
String
id
,
String
location
)
{
return
Card
(
child:
Column
(
children:
<
Widget
>[
...
...
@@ -390,57 +395,72 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
Positioned
(
right:
SizeConfig
.
getPadding
(
16
),
top:
SizeConfig
.
getPadding
(
16
),
child:
ImageIcon
(
AssetImage
(
'assets/images/ic_fav_list.png'
),
color:
Colors
.
white
,
size:
SizeConfig
.
getFontSize
(
30
),
child:
InkResponse
(
highlightShape:
BoxShape
.
circle
,
highlightColor:
Color
(
0xFFDD175F
),
focusColor:
Color
(
0xFFDD175F
),
splashColor:
Color
(
0xFFDD175F
),
onTap:
()
{
setState
(()
{
presenter
.
fav
?
presenter
.
fav
=
false
:
presenter
.
Addfav
(
id
.
toString
());
},);
},
child:
ImageIcon
(
AssetImage
(
'assets/images/ic_fav_list.png'
),
color:
presenter
.
fav
?
Color
(
0xFFDD175F
)
:
Colors
.
white
,
size:
SizeConfig
.
getFontSize
(
30
),
),
),
),
Positioned
(
left:
SizeConfig
.
getPadding
(
16
),
top:
SizeConfig
.
getPadding
(
165
),
child:
Image
.
asset
(
'assets/images/pin_list.png'
,
width:
SizeConfig
.
getWidth
(
50
),
height:
SizeConfig
.
getWidth
(
50
),
child:
InkWell
(
onTap:
(){
print
(
location
);
List
values
=
location
.
split
(
","
);
// split() will split from . and gives new List with separated elements.
values
.
forEach
(
print
);
print
(
"lat ="
+
values
[
0
]);
print
(
"lng ="
+
values
[
1
]);
presenter
.
gotoDirection
(
values
[
0
],
values
[
1
]);
},
child:
Image
.
asset
(
'assets/images/pin_list.png'
,
width:
SizeConfig
.
getWidth
(
50
),
height:
SizeConfig
.
getWidth
(
50
),
),
),
),
Positioned
(
left:
SizeConfig
.
getPadding
(
75
),
top:
SizeConfig
.
getPadding
(
190
),
child:
InkWell
(
child:
Text
(
title
,
textAlign:
TextAlign
.
left
,
style:
TextStyle
(
decoration:
TextDecoration
.
underline
,
color:
Colors
.
black
,
fontSize:
SizeConfig
.
getFontSize
(
11
),
fontFamily:
"SF_Pro_Text"
,
fontWeight:
FontWeight
.
w700
),
child:
InkWell
(
child:
Text
(
title
,
textAlign:
TextAlign
.
left
,
style:
TextStyle
(
decoration:
TextDecoration
.
underline
,
color:
Colors
.
black
,
fontSize:
SizeConfig
.
getFontSize
(
12
),
fontFamily:
"SF_Pro_Text"
,
fontWeight:
FontWeight
.
w700
),
),
onTap:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
ShopListDetail
(
id:
id
)),
);
},
),
onTap:
()
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
ShopListDetail
(
id:
id
)),
);
},
),
),
Positioned
(
left:
SizeConfig
.
getPadding
(
2
8
0
),
top:
SizeConfig
.
getPadding
(
1
90
),
left:
SizeConfig
.
getPadding
(
2
9
0
),
top:
SizeConfig
.
getPadding
(
1
87
),
child:
Icon
(
Icons
.
star
,
color:
Colors
.
orangeAccent
,
...
...
@@ -448,10 +468,10 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
),
),
Positioned
(
left:
SizeConfig
.
getPadding
(
3
0
0
),
left:
SizeConfig
.
getPadding
(
3
1
0
),
top:
SizeConfig
.
getPadding
(
190
),
child:
Text
(
presenter
.
searchhomeModel
.
thTH
[
0
].
star
.
toString
(),
presenter
.
searchhomeModel
.
thTH
[
0
].
star
.
toString
(),
textAlign:
TextAlign
.
left
,
style:
TextStyle
(
color:
Colors
.
black
,
...
...
@@ -484,9 +504,9 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
textAlign:
TextAlign
.
left
,
style:
TextStyle
(
color:
Colors
.
grey
,
fontSize:
SizeConfig
.
getFontSize
(
1
0
),
fontSize:
SizeConfig
.
getFontSize
(
1
2
),
fontFamily:
"SF_Pro_Text"
,
fontWeight:
FontWeight
.
w500
),
fontWeight:
FontWeight
.
w500
),
maxLines:
2
,
),
),
SizedBox
(
...
...
@@ -535,7 +555,9 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
presenter
.
searchhomeModel
.
thTH
[
i
].
detail
==
null
?
""
:
presenter
.
searchhomeModel
.
thTH
[
i
].
detail
,
presenter
.
searchhomeModel
.
thTH
[
i
].
id
.
toString
(),
presenter
.
searchhomeModel
.
thTH
[
i
].
id
.
toString
(),
presenter
.
searchhomeModel
.
thTH
[
i
].
location
.
toString
(),
);
}),
),
...
...
lib/ui/home/home_presenter.dart
View file @
9fc19fb6
import
'package:feelverapp/model/Login/login_model.dart'
;
import
'package:feelverapp/model/category/category_model.dart'
;
import
'package:feelverapp/model/editprofile/getprofilemodel.dart'
;
import
'package:feelverapp/model/favorite/addfav_model.dart'
;
import
'package:feelverapp/model/home/home_model.dart'
;
import
'package:feelverapp/model/home_search/searchhomepage_model.dart'
;
import
'package:feelverapp/service/Loading.dart'
;
...
...
@@ -9,9 +10,11 @@ import 'package:feelverapp/service/api.dart';
import
'package:feelverapp/service/base_presenter.dart'
;
import
'package:feelverapp/ui/home/home.dart'
;
import
'package:feelverapp/util/Accout_util.dart'
;
import
'package:feelverapp/util/SizeConfig.dart'
;
import
'package:flutter/material.dart'
;
import
'package:rflutter_alert/rflutter_alert.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
import
'package:url_launcher/url_launcher.dart'
;
class
HomePresenter
extends
BasePresenter
<
HomePage
>
{
Api
_api
;
...
...
@@ -22,6 +25,8 @@ class HomePresenter extends BasePresenter<HomePage> {
LoginModel
logmodel
;
CategoryModel
CatModel
;
bool
fav
=
false
;
AddfavModel
addmodel
;
TextEditingController
searchCtrl
=
TextEditingController
();
SearchhomeModel
searchhomeModel
;
...
...
@@ -118,5 +123,55 @@ class HomePresenter extends BasePresenter<HomePage> {
]).
show
();
}
}
gotoDirection
(
String
lat
,
String
lng
)
{
print
(
"debug"
);
print
(
lat
);
print
(
lng
);
launch
(
'https://www.google.com/maps/dir/?api=1&destination=
${lat}
,
${lng}
'
);
}
getudid
()
async
{
SharedPreferences
pref
=
await
SharedPreferences
.
getInstance
();
setState
(()
{
uid
=
pref
.
getString
(
'Id'
);
});
return
uid
;
}
Addfav
(
String
id
)
async
{
LoadingView
(
state
.
context
).
show
();
_api
=
Api
<
AddfavModel
>();
var
res
=
await
_api
.
addfav
({
"customer_id"
:
uid
,
"store_id"
:
id
,
"vendor_id"
:
id
,
"product_id"
:
id
,
});
LoadingView
(
state
.
context
).
hide
();
if
(
res
.
fail
==
null
)
{
setState
(()
{
addmodel
=
res
.
success
;
print
(
"complete"
);
fav
=
true
;
});
showDialog
(
context:
state
.
context
,
builder:
(
context
)
{
Future
.
delayed
(
Duration
(
seconds:
1
),
()
{
Navigator
.
of
(
context
).
pop
(
true
);
});
return
AlertDialog
(
content:
ImageIcon
(
AssetImage
(
'assets/images/ic_fav_list.png'
),
color:
fav
?
Color
(
0xFFDD175F
)
:
Colors
.
grey
,
size:
SizeConfig
.
getFontSize
(
30
),
),
title:
Center
(
child:
Text
(
'บันทึกสำเร็จ'
)),
);
});
}
else
{
print
(
'res Fail'
);
}
}
}
lib/ui/payment/mycart.dart
View file @
9fc19fb6
...
...
@@ -161,55 +161,45 @@ class _MyCartState extends State<MyCart> {
return
Column
(
children:
<
Widget
>[
header
(),
SizedBox
(
height:
SizeConfig
.
getHeight
(
15
),
),
list1
(),
//
SizedBox(
// height: SizeConfig.getHeight(10
),
//
),
_getlist
(),
],
);
}
// Widget containt() {
// return Expanded(
// child: SingleChildScrollView(
// padding: EdgeInsets.only(
// left: SizeConfig.getPadding(10),
// right: SizeConfig.getPadding(10),
// top: SizeConfig.getPadding(8),
// bottom: SizeConfig.getPadding(8),
// ),
// child: Container(
// alignment: FractionalOffset.topLeft,
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: <Widget>[
// SizedBox(
// height: SizeConfig.getHeight(15),
// ),
// list1(),
// Divider(
// color: Colors.black,
// height: SizeConfig.getHeight(40),
// ),
//// list3(),
// ],
// ),
// ),
// ),
// );
// }
_getlist
()
{
return
Expanded
(
child:
Container
(
margin:
EdgeInsets
.
only
(
top:
SizeConfig
.
getPadding
(
0
),
left:
SizeConfig
.
getPadding
(
16
),
right:
SizeConfig
.
getPadding
(
16
),
bottom:
SizeConfig
.
getPadding
(
16
),
),
// child: presenter.shopModel == null
// ? Container()
// :
child:
ListView
.
builder
(
itemCount:
3
,
itemBuilder:
(
context
,
i
)
{
return
list1
();
},),
),
);
}
Widget
list1
()
{
return
Card
(
elevation:
5
,
child:
Container
(
padding:
EdgeInsets
.
only
(
left:
SizeConfig
.
getPadding
(
16
),
top:
SizeConfig
.
getPadding
(
8
),
right:
SizeConfig
.
getPadding
(
16
),
bottom:
SizeConfig
.
getPadding
(
8
),
),
// color: Colors.red,
left:
SizeConfig
.
getPadding
(
8
),
top:
SizeConfig
.
getPadding
(
8
),
bottom:
SizeConfig
.
getPadding
(
16
),
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
<
Widget
>[
...
...
@@ -236,14 +226,15 @@ class _MyCartState extends State<MyCart> {
'Ivory Relax and Spa'
,
style:
TextStyle
(
color:
Colors
.
black
,
fontWeight:
FontWeight
.
bold
,
fontSize:
SizeConfig
.
getFontSize
(
16
),
fontFamily:
"SF_Pro_Text"
,
fontWeight:
FontWeight
.
w700
,
),
),
Spacer
(),
IconButton
(
icon:
Icon
(
Icons
.
delete
),
color:
Colors
.
black
,
color:
Colors
.
grey
,
onPressed:
()
{
print
(
'delete'
);
},
...
...
@@ -252,18 +243,18 @@ class _MyCartState extends State<MyCart> {
),
),
Container
(
// color: Colors.white,
child:
Text
(
'นวดเเผนไทย'
,
style:
TextStyle
(
color:
Colors
.
black
,
fontWeight:
FontWeight
.
bold
,
fontSize:
SizeConfig
.
getFontSize
(
16
),
fontFamily:
"SF_Pro_Text"
,
fontWeight:
FontWeight
.
w600
,
),
),
),
SizedBox
(
height:
SizeConfig
.
getHeight
(
5
),
height:
SizeConfig
.
getHeight
(
12
),
),
Container
(
// color: Colors.yellow,
...
...
@@ -296,7 +287,7 @@ class _MyCartState extends State<MyCart> {
),
),
SizedBox
(
height:
SizeConfig
.
getHeight
(
5
),
height:
SizeConfig
.
getHeight
(
10
),
),
Container
(
// color: Colors.orangeAccent,
...
...
lib/ui/shop/shop_list_detail.dart
View file @
9fc19fb6
...
...
@@ -203,7 +203,7 @@ class _ShopListDetailState extends State<ShopListDetail> {
textAlign:
TextAlign
.
left
,
style:
TextStyle
(
decoration:
TextDecoration
.
underline
,
color:
Colors
.
grey
,
color:
Colors
.
black87
,
fontSize:
SizeConfig
.
getFontSize
(
13
),
fontFamily:
"SF_Pro_Text"
,
fontWeight:
FontWeight
.
w700
),
...
...
@@ -548,7 +548,7 @@ class _ShopListDetailState extends State<ShopListDetail> {
top:
SizeConfig
.
getPadding
(
15
),
left:
SizeConfig
.
getPadding
(
24
),
right:
SizeConfig
.
getPadding
(
24
),
bottom:
SizeConfig
.
getPadding
(
5
),
bottom:
SizeConfig
.
getPadding
(
0
),
),
alignment:
Alignment
.
topLeft
,
child:
Text
(
...
...
@@ -562,7 +562,7 @@ class _ShopListDetailState extends State<ShopListDetail> {
),
),
Container
(
height:
200
,
height:
SizeConfig
.
getHeight
(
180
)
,
padding:
EdgeInsets
.
only
(
top:
SizeConfig
.
getPadding
(
0
),
left:
SizeConfig
.
getPadding
(
24
),
...
...
@@ -571,6 +571,7 @@ class _ShopListDetailState extends State<ShopListDetail> {
),
alignment:
Alignment
.
topLeft
,
child:
ListView
.
builder
(
physics:
const
NeverScrollableScrollPhysics
(),
itemCount:
presenter
.
model
.
result
[
0
].
openHour
.
length
,
itemBuilder:
(
context
,
i
)
{
return
Text
(
...
...
@@ -706,7 +707,7 @@ class _ShopListDetailState extends State<ShopListDetail> {
'ความคุ้มค่า'
];
return
Container
(
height:
9
0
,
height:
7
0
,
child:
GridView
.
count
(
crossAxisCount:
4
,
physics:
const
NeverScrollableScrollPhysics
(),
...
...
lib/ui/shop/shoplistdetail_presenter.dart
View file @
9fc19fb6
...
...
@@ -9,33 +9,26 @@ import 'package:flutter/material.dart';
import
'package:shared_preferences/shared_preferences.dart'
;
import
'package:url_launcher/url_launcher.dart'
;
class
ShoplistdetailPresenter
extends
BasePresenter
<
ShopListDetail
>{
class
ShoplistdetailPresenter
extends
BasePresenter
<
ShopListDetail
>
{
Api
_api
;
final
formkey
=
GlobalKey
<
FormState
>();
shoplistdetailModel
model
;
AddfavModel
addmodel
;
bool
fav
=
false
;
ShoplistdetailPresenter
(
State
<
ShopListDetail
>
state
)
:
super
(
state
);
String
uid
;
bool
fav
=
false
;
ShoplistdetailPresenter
(
State
<
ShopListDetail
>
state
)
:
super
(
state
);
String
uid
;
Detai
(
String
id
)
async
{
Detai
(
String
id
)
async
{
_api
=
Api
<
shoplistdetailModel
>();
var
res
=
await
_api
.
shoplistDetail
({
"id"
:
id
,
});
if
(
res
.
fail
==
null
)
{
setState
(()
{
setState
(()
{
model
=
res
.
success
;
print
(
"complete"
);
});
print
(
'res Success'
);
}
else
{
...
...
@@ -43,60 +36,55 @@ class ShoplistdetailPresenter extends BasePresenter<ShopListDetail>{
}
}
getid
()
async
{
getid
()
async
{
SharedPreferences
pref
=
await
SharedPreferences
.
getInstance
();
setState
(()
{
uid
=
pref
.
getString
(
'Id'
);
});
return
uid
;
}
Addfav
(
String
id
)
async
{
LoadingView
(
state
.
context
).
show
();
Addfav
(
String
id
)
async
{
LoadingView
(
state
.
context
).
show
();
_api
=
Api
<
AddfavModel
>();
var
res
=
await
_api
.
addfav
({
"customer_id"
:
uid
,
"store_id"
:
id
,
"vendor_id"
:
id
,
"product_id"
:
id
,
"store_id"
:
id
,
"vendor_id"
:
id
,
"product_id"
:
id
,
});
LoadingView
(
state
.
context
).
hide
();
LoadingView
(
state
.
context
).
hide
();
if
(
res
.
fail
==
null
)
{
setState
(()
{
setState
(()
{
addmodel
=
res
.
success
;
print
(
"complete"
);
fav
=
true
;
fav
=
true
;
});
showDialog
(
context:
state
.
context
,
builder:
(
context
)
{
Future
.
delayed
(
Duration
(
seconds:
1
),
()
{
Navigator
.
of
(
context
).
pop
(
true
);
});
return
AlertDialog
(
content:
ImageIcon
(
AssetImage
(
'assets/images/ic_fav_list.png'
),
color:
fav
?
Color
(
0xFFDD175F
)
:
Colors
.
grey
,
size:
SizeConfig
.
getFontSize
(
30
),
)
,
title:
Center
(
child:
Text
(
'บันทึกสำเร็จ'
)),
);
});
showDialog
(
context:
state
.
context
,
builder:
(
context
)
{
Future
.
delayed
(
Duration
(
seconds:
1
),
()
{
Navigator
.
of
(
context
).
pop
(
true
);
});
return
AlertDialog
(
content:
ImageIcon
(
AssetImage
(
'assets/images/ic_fav_list.png'
),
color:
fav
?
Color
(
0xFFDD175F
)
:
Colors
.
grey
,
size:
SizeConfig
.
getFontSize
(
30
),
)
,
title:
Center
(
child:
Text
(
'บันทึกสำเร็จ'
)),
);
});
}
else
{
print
(
'res Fail'
);
}
}
gotoDirection
(
String
lat
,
String
lng
){
print
(
"debug"
);
gotoDirection
(
String
lat
,
String
lng
)
{
print
(
"debug"
);
print
(
lat
);
print
(
lng
);
print
(
lng
);
launch
(
'https://www.google.com/maps/dir/?api=1&destination=
${lat}
,
${lng}
'
);
}
}
\ No newline at end of file
}
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