|
|
|
@ -12,7 +12,6 @@ import 'package:huixiang/view_widget/my_appbar.dart';
|
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ExchangeOrderPage extends StatefulWidget { |
|
|
|
|
final Map<String, dynamic> arguments; |
|
|
|
|
|
|
|
|
@ -33,7 +32,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
super.initState(); |
|
|
|
|
|
|
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
|
apiService = ApiService(Dio(), context: context, token: value.getString("token")), |
|
|
|
|
apiService = ApiService(Dio(), |
|
|
|
|
context: context, token: value.getString("token")), |
|
|
|
|
points = |
|
|
|
|
UserInfo.fromJson(jsonDecode(value.getString('user'))).points, |
|
|
|
|
}); |
|
|
|
@ -92,19 +92,19 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 18, |
|
|
|
|
height: 18.h, |
|
|
|
|
), |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
S.of(context).lingqufangshi, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: Color(0xFF353535), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
width: 12, |
|
|
|
|
width: 12.w, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
widget.arguments["useTyped"] == 1 |
|
|
|
@ -113,7 +113,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
? S.of(context).peisong |
|
|
|
|
: S.of(context).xianshangfafang, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: Color(0xFF353535), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -121,7 +121,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
), |
|
|
|
|
Visibility( |
|
|
|
|
child: SizedBox( |
|
|
|
|
height: 13, |
|
|
|
|
height: 13.h, |
|
|
|
|
), |
|
|
|
|
visible: widget.arguments["useTyped"] != 3, |
|
|
|
|
), |
|
|
|
@ -131,12 +131,12 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
Text( |
|
|
|
|
S.of(context).zitidizhi, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: Color(0xFF353535), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
width: 12, |
|
|
|
|
width: 12.w, |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: GestureDetector( |
|
|
|
@ -162,7 +162,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
: S.of(context).xuni, |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -183,7 +183,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
visible: widget.arguments["useTyped"] != 3, |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 12, |
|
|
|
|
height: 12.h, |
|
|
|
|
), |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
@ -192,13 +192,13 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
child: Text( |
|
|
|
|
S.of(context).zitishijian, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14, color: Color(0xFF353535)), |
|
|
|
|
fontSize: 14.sp, color: Color(0xFF353535)), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Visibility( |
|
|
|
|
visible: widget.arguments["useTyped"] != 3, |
|
|
|
|
child: SizedBox( |
|
|
|
|
width: 12, |
|
|
|
|
width: 12.w, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
@ -208,7 +208,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
? S.of(context).duihuanhoufahuo |
|
|
|
|
: S.of(context).feishiwushangpin, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: widget.arguments["useTyped"] == 3 |
|
|
|
|
? Color(0xFF32A060) |
|
|
|
|
: Color(0xFF353535)), |
|
|
|
@ -265,8 +265,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
Image.network( |
|
|
|
|
widget.arguments["image"], |
|
|
|
|
fit: BoxFit.cover, |
|
|
|
|
width: 80.w, |
|
|
|
|
height: 80.h, |
|
|
|
|
width: 80, |
|
|
|
|
height: 80, |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: Container( |
|
|
|
@ -279,17 +279,18 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
Text( |
|
|
|
|
widget.arguments["name"], |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
color: Color(0xFF353535)), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 4, |
|
|
|
|
height: 4.h, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
"x1", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12, color: Color(0xFF727272)), |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
color: Color(0xFF727272)), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
@ -299,7 +300,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 12, |
|
|
|
|
height: 12.h, |
|
|
|
|
), |
|
|
|
|
// Row( |
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
@ -331,16 +332,16 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
"实付积分", |
|
|
|
|
style: |
|
|
|
|
TextStyle(fontSize: 14, color: Color(0xFF353535)), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14.sp, color: Color(0xFF353535)), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
width: 12, |
|
|
|
|
width: 12.w, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
S.of(context).jifen_(widget.arguments["price"]), |
|
|
|
|
style: |
|
|
|
|
TextStyle(fontSize: 12, color: Color(0xFF32A060)), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, color: Color(0xFF32A060)), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
@ -366,7 +367,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
child: Text( |
|
|
|
|
S.of(context).querenduihuan, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 16, |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
color: MaterialStateColor.resolveWith((states) => |
|
|
|
|
storeIsSelected ? Colors.white : Color(0xFFA0A0A0)), |
|
|
|
|
fontWeight: FontWeight.bold), |
|
|
|
@ -420,9 +421,12 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
if (widget.arguments["useTyped"] == 2) "userAddressId": userAddressId, |
|
|
|
|
}); |
|
|
|
|
if (baseDate.isSuccess) { |
|
|
|
|
await Navigator.of(context).pushNamed( |
|
|
|
|
'/router/exchange_order_success_page', |
|
|
|
|
arguments: {"price": widget.arguments["price"], "points": points, "id": baseDate.data}); |
|
|
|
|
await Navigator.of(context) |
|
|
|
|
.pushNamed('/router/exchange_order_success_page', arguments: { |
|
|
|
|
"price": widget.arguments["price"], |
|
|
|
|
"points": points, |
|
|
|
|
"id": baseDate.data |
|
|
|
|
}); |
|
|
|
|
points = |
|
|
|
|
"${int.tryParse(points) - int.tryParse(widget.arguments["price"])}"; |
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|