Browse Source

Merge remote-tracking branch 'origin/remove_uniapp' into remove_uniapp

remove_uniapp
fmk 3 years ago
parent
commit
1baca8956f
  1. 47
      lib/community/community_view/community_dynamic.dart
  2. 48
      lib/main_page.dart
  3. 8
      lib/mine/personal_page.dart
  4. 43
      lib/retrofit/data/app_update.dart
  5. 2
      lib/retrofit/min_api.dart
  6. 7
      lib/retrofit/retrofit_api.dart
  7. 21
      lib/retrofit/retrofit_api.g.dart
  8. 15
      lib/setting/about_page.dart
  9. 126
      lib/store/store_view/product_sku.dart
  10. 37
      lib/view_widget/update_dialog.dart
  11. 2
      pubspec.yaml

47
lib/community/community_view/community_dynamic.dart

@ -317,29 +317,30 @@ class _CommunityDynamic extends State<CommunityDynamic> {
height:8.h, height:8.h,
), ),
if (widget.article.location != "") if (widget.article.location != "")
Row( Padding(padding:EdgeInsets.only(bottom:7),
children: [ child: Row(
Icon( children: [
Icons.place, Icon(
size: 16, Icons.place,
color: Color(0xFFB3B2B2), size: 16,
), color: Color(0xFFB3B2B2),
SizedBox( ),
width: 2, SizedBox(
), width: 2,
Expanded( ),
child: Text( Expanded(
widget?.article?.location ?? "", child: Text(
overflow: TextOverflow.ellipsis, widget?.article?.location ?? "",
maxLines: 1, overflow: TextOverflow.ellipsis,
style: TextStyle( maxLines: 1,
fontSize: 12.sp, style: TextStyle(
fontWeight: MyFontWeight.medium, fontSize: 12.sp,
color: Color(0xFFB3B2B2), fontWeight: MyFontWeight.medium,
), color: Color(0xFFB3B2B2),
)), ),
], )),
), ],
),),
if (!widget.isDetails) if (!widget.isDetails)
SizedBox( SizedBox(
height: 5.h, height: 5.h,

48
lib/main_page.dart

@ -5,12 +5,14 @@ import 'package:flutter/material.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_bmflocation/bdmap_location_flutter_plugin.dart'; import 'package:flutter_bmflocation/bdmap_location_flutter_plugin.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:huixiang/community/community_page.dart'; import 'package:huixiang/community/community_page.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/home/home_page.dart'; import 'package:huixiang/home/home_page.dart';
import 'package:huixiang/main.dart'; import 'package:huixiang/main.dart';
import 'package:huixiang/mine/mine_page.dart'; import 'package:huixiang/mine/mine_page.dart';
import 'package:huixiang/retrofit/data/app_update.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
@ -20,6 +22,7 @@ import 'package:huixiang/utils/bridge.dart';
import 'package:huixiang/utils/event_type.dart'; import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/utils/native_event_handler.dart'; import 'package:huixiang/utils/native_event_handler.dart';
import 'package:huixiang/view_widget/update_dialog.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:sharesdk_plugin/sharesdk_interface.dart'; import 'package:sharesdk_plugin/sharesdk_interface.dart';
@ -46,6 +49,10 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
List<String> icons; List<String> icons;
final GlobalKey homePageKey = GlobalKey(); final GlobalKey homePageKey = GlobalKey();
// List<String> iconn; // List<String> iconn;
ApiService apiService;
String version = "1.0.1";
AppUpdate appUpdate;
@override @override
void dispose() { void dispose() {
@ -113,8 +120,8 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
},invite:invite,interviewCouponList:interviewCouponList,firstLoginCouponList:firstLoginCouponList,), },invite:invite,interviewCouponList:interviewCouponList,firstLoginCouponList:firstLoginCouponList,),
// MainHomePage(), // MainHomePage(),
UnionPage(), UnionPage(),
// (Theme.of(context).platform == TargetPlatform.android) ? OrderPage() :CommunityPage(),
CommunityPage(), CommunityPage(),
// OrderPage(),
MinePage(), MinePage(),
]; ];
@ -138,6 +145,8 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
}); });
queryUserInfo(); queryUserInfo();
appAutoUpdate();
} }
final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin(); final XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin();
initSdk() async { initSdk() async {
@ -316,6 +325,31 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
} }
} }
///app自动更新
appAutoUpdate() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
showLoading: true
);
}
BaseData<AppUpdate> baseData = await apiService.appVersion().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
if(version != appUpdate?.appLastVersion ?? ""){
showAlertDialog(version);
}else{
return;
}
}else{
SmartDialog.showToast(baseData.msg,
alignment: Alignment.center);
Navigator.of(context).pop();
}
}
final PageController pageController = PageController(initialPage: 0); final PageController pageController = PageController(initialPage: 0);
@override @override
@ -359,6 +393,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
bottomNavigationItem(S.of(context).main_menu1, 0), bottomNavigationItem(S.of(context).main_menu1, 0),
bottomNavigationItem(S.of(context).main_menu2, 1), bottomNavigationItem(S.of(context).main_menu2, 1),
bottomNavigationItem(S.of(context).main_menu3 , 2), bottomNavigationItem(S.of(context).main_menu3 , 2),
// bottomNavigationItem("订单", 2),
bottomNavigationItem(S.of(context).main_menu4, 3), bottomNavigationItem(S.of(context).main_menu4, 3),
], ],
), ),
@ -440,6 +475,17 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
); );
} }
///app更新弹窗
showAlertDialog(version) {
//
showDialog(
context: context,
builder: (BuildContext context) {
return UpdateDialog(version,appUpdate);
},
);
}
// Widget bottomNavigationBigItem(text, index) { // Widget bottomNavigationBigItem(text, index) {
// var isSelected = index == clickIndex; // var isSelected = index == clickIndex;

8
lib/mine/personal_page.dart

@ -134,9 +134,9 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
refreshController.loadFailed(); refreshController.loadFailed();
} }
}); });
if(searchKey == null) { if(searchKey == null){
refreshController.refreshCompleted(); refreshController.refreshCompleted();
refreshController.loadComplete(); refreshController.loadComplete();
} }
if (baseData.isSuccess) { if (baseData.isSuccess) {
if(searchKey != null){ if(searchKey != null){
@ -640,7 +640,7 @@ class _PersonalPage extends State<PersonalPage> with WidgetsBindingObserver {
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
), ),
)), )),
dynamicList(), dynamicList()
], ],
), ),
), ),

43
lib/retrofit/data/app_update.dart

@ -0,0 +1,43 @@
/// appLastVersion : "1.0.0"
/// appLastVersionUrl : ""
/// appLastVersionUp : "1.0.0"
/// appLastVersionExplain : "优化更新"
class AppUpdate {
AppUpdate({
String appLastVersion,
String appLastVersionUrl,
String appLastVersionUp,
String appLastVersionExplain,}){
_appLastVersion = appLastVersion;
_appLastVersionUrl = appLastVersionUrl;
_appLastVersionUp = appLastVersionUp;
_appLastVersionExplain = appLastVersionExplain;
}
AppUpdate.fromJson(dynamic json) {
_appLastVersion = json['appLastVersion'];
_appLastVersionUrl = json['appLastVersionUrl'];
_appLastVersionUp = json['appLastVersionUp'];
_appLastVersionExplain = json['appLastVersionExplain'];
}
String _appLastVersion;
String _appLastVersionUrl;
String _appLastVersionUp;
String _appLastVersionExplain;
String get appLastVersion => _appLastVersion;
String get appLastVersionUrl => _appLastVersionUrl;
String get appLastVersionUp => _appLastVersionUp;
String get appLastVersionExplain => _appLastVersionExplain;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['appLastVersion'] = _appLastVersion;
map['appLastVersionUrl'] = _appLastVersionUrl;
map['appLastVersionUp'] = _appLastVersionUp;
map['appLastVersionExplain'] = _appLastVersionExplain;
return map;
}
}

2
lib/retrofit/min_api.dart

@ -32,7 +32,7 @@ part 'min_api.g.dart';
// const base_url = "http://192.168.10.37:8765/app/"; // const base_url = "http://192.168.10.37:8765/app/";
const localBaseUrl = "https://pos.api.lotus-wallet.com/app/";/// const localBaseUrl = "http://192.168.10.236:8766/app/";///
const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线 const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线

7
lib/retrofit/retrofit_api.dart

@ -21,6 +21,7 @@ import 'package:retrofit/retrofit.dart';
import 'data/achievement_detail_list.dart'; import 'data/achievement_detail_list.dart';
import 'data/activity_pos.dart'; import 'data/activity_pos.dart';
import 'data/address.dart'; import 'data/address.dart';
import 'data/app_update.dart';
import 'data/banner.dart'; import 'data/banner.dart';
import 'data/brand_data.dart'; import 'data/brand_data.dart';
import 'data/category_select_list.dart'; import 'data/category_select_list.dart';
@ -68,7 +69,7 @@ part 'retrofit_api.g.dart';
// const base_url = "http://192.168.10.132:8766/app/";/// // const base_url = "http://192.168.10.132:8766/app/";///
const localBaseUrl = "https://pos.platform.lotus-wallet.com/app/";/// const localBaseUrl = "http://192.168.10.236:8766/app/";///
const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线 const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线
@RestApi(baseUrl: localBaseUrl) @RestApi(baseUrl: localBaseUrl)
@ -518,4 +519,8 @@ abstract class ApiService {
@POST("/information/complaint") @POST("/information/complaint")
Future<BaseData> complaint(@Body() Map<String, dynamic> param); Future<BaseData> complaint(@Body() Map<String, dynamic> param);
///app自动更新
@GET("/home/version")
Future<BaseData<AppUpdate>> appVersion();
} }

21
lib/retrofit/retrofit_api.g.dart

@ -1958,4 +1958,25 @@ class _ApiService implements ApiService {
return value; return value;
} }
@override
Future<BaseData<AppUpdate>> appVersion() async {
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/home/version',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<AppUpdate>.fromJson(
_result.data,
(json) => AppUpdate.fromJson(json),
);
return value;
}
} }

15
lib/setting/about_page.dart

@ -19,7 +19,7 @@ class AboutPage extends StatefulWidget {
} }
class _AboutPage extends State<AboutPage> { class _AboutPage extends State<AboutPage> {
String version = "1.0.0"; String version = "1.0.1";
@override @override
void initState() { void initState() {
@ -89,7 +89,6 @@ class _AboutPage extends State<AboutPage> {
onTap: () { onTap: () {
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/help_feedback_page'); .pushNamed('/router/help_feedback_page');
// showAlertDialog(version);
}, },
child: textItem(S.of(context).shiyongbangzhu), child: textItem(S.of(context).shiyongbangzhu),
), ),
@ -103,7 +102,6 @@ class _AboutPage extends State<AboutPage> {
alignment: Alignment.center); alignment: Alignment.center);
} }
}); });
// showAlertDialog(version);
}, },
), ),
GestureDetector( GestureDetector(
@ -279,15 +277,4 @@ class _AboutPage extends State<AboutPage> {
), ),
); );
} }
///app更新弹窗
showAlertDialog(version) {
//
showDialog(
context: context,
builder: (BuildContext context) {
return UpdateDialog(version);
},
);
}
} }

126
lib/store/store_view/product_sku.dart

@ -198,10 +198,9 @@ class _ProductSku extends State<ProductSku> {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return attrItem( return attrItem(
(index) { (attrValue) {
state(() { state(() {
selectSkus[position] = widget.miNiDetail selectSkus[position] = attrValue;
.attrList[position].attrValueList[index].attrValue;
buildCount(); buildCount();
}); });
}, },
@ -301,7 +300,7 @@ class _ProductSku extends State<ProductSku> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only(top: 24, bottom: 16), padding: EdgeInsets.only(top: 16, bottom: 16),
child: Text( child: Text(
attrListBean.attrName, attrListBean.attrName,
style: TextStyle( style: TextStyle(
@ -311,7 +310,8 @@ class _ProductSku extends State<ProductSku> {
), ),
), ),
), ),
sweetnessStore(fc, attrListBean.attrValueList, position), sweetnessStore(fc,attrListBean.attrValueList, position),
// sweetnessStore(fc, attrListBean.attrValueList, position),
], ],
); );
else { else {
@ -319,62 +319,74 @@ class _ProductSku extends State<ProductSku> {
} }
} }
Widget sweetnessStore(Function fc, List<AttrValueListBean> arrays, position) { // Widget sweetnessStore(Function fc, List<AttrValueListBean> arrays, position) {
return GridView.builder( // return GridView.builder(
itemCount: arrays.length, // itemCount: arrays.length,
shrinkWrap: true, // shrinkWrap: true,
padding: EdgeInsets.zero, // padding: EdgeInsets.zero,
physics: NeverScrollableScrollPhysics(), // physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//Widget数量 // //Widget数量
crossAxisCount: 4, // crossAxisCount: 4,
//Widget之间间距 // //Widget之间间距
crossAxisSpacing: 6.w, // crossAxisSpacing: 6.w,
//Widget之间间距 // //Widget之间间距
mainAxisSpacing: 12.w, // mainAxisSpacing: 12.w,
//Widget之间间距 // //Widget之间间距
childAspectRatio: 3 / 1, // childAspectRatio: 3 / 1,
), // ),
itemBuilder: (context, index) { // itemBuilder: (context, index) {
return GestureDetector( // return GestureDetector(
onTap: () { // onTap: () {
fc(index); // fc(index);
}, // },
child: sweetnessItem( // child: sweetnessItem(
arrays[index].attrValue, // arrays[index].attrValue,
(arrays[index].attrValue == selectSkus[position]) ?? false, // (arrays[index].attrValue == selectSkus[position]) ?? false,
), // ),
); // );
}, // },
); // );
// }
Widget sweetnessStore(Function fc,List<AttrValueListBean> arrays, position){
return Wrap(
runSpacing: 10.0,
spacing: 10.0,
children: arrays.take(arrays.length).map<Widget>((AttrValueListBean tag) {
return GestureDetector(
onTap: () {
fc(tag.attrValue);
},
child:sweetnessItem(
tag.attrValue,
(tag.attrValue == selectSkus[position]) ?? false,
));
}).toList());
} }
Widget sweetnessItem(String name, bool isCheck) { Widget sweetnessItem(String name, bool isCheck) {
return Container( return Container(
child: Row( padding: const EdgeInsets.symmetric(vertical:5.0,horizontal: 12.0),
mainAxisAlignment: MainAxisAlignment.start, decoration: BoxDecoration(
crossAxisAlignment: CrossAxisAlignment.start, color: !isCheck ? Color(0xFFF2F2F2) : Color(0xFFF0FAF4),
children: [ border: Border.all(
Container( width: !isCheck ? 0:1,
width: 70.w, color: !isCheck ? Color(0xFFF2F2F2):Color(0xFF32A060),
height:30.h, style: BorderStyle.solid,
alignment: Alignment.center,
decoration: BoxDecoration(
color: !isCheck ? Color(0xFFE5E5E5) : Color(0xFF32A060),
borderRadius: BorderRadius.all(Radius.circular(4)),
),
child:Text(
name,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color:!isCheck ? Color(0xFF727272) : Colors.white,
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
), ),
], borderRadius: const BorderRadius.all(
), Radius.circular(4.0),
); ),
),
child: Text(
name,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color:!isCheck ? Color(0xFF4D4D4D) : Color(0xFF32A060),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
));
} }
} }

37
lib/view_widget/update_dialog.dart

@ -2,14 +2,17 @@ import 'dart:io';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/retrofit/data/app_update.dart';
import 'package:huixiang/utils/bridge.dart'; import 'package:huixiang/utils/bridge.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:url_launcher/url_launcher.dart';
class UpdateDialog extends StatefulWidget { class UpdateDialog extends StatefulWidget {
final String version; final String version;
final AppUpdate appUpdate;
UpdateDialog(this.version); UpdateDialog(this.version,this.appUpdate);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -42,17 +45,18 @@ class _UpdateDialog extends State<UpdateDialog> {
Text( Text(
"检测到新版本 v${widget.version}", "检测到新版本 v${widget.version}",
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 17.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF353535), color: Color(0xFF000000),
), ),
), ),
SizedBox(height: 12,),
Text( Text(
"是否需要更新到最新版本?", "是否需要更新到最新版本?",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 17.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: Color(0xFF353535), color: Color(0xFF333333),
), ),
), ),
], ],
@ -80,8 +84,8 @@ class _UpdateDialog extends State<UpdateDialog> {
"下次再说", "下次再说",
style: TextStyle( style: TextStyle(
fontSize: 17.sp, fontSize: 17.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF353535), color: Color(0xFF8C8C8C),
), ),
), ),
), ),
@ -95,7 +99,8 @@ class _UpdateDialog extends State<UpdateDialog> {
Expanded( Expanded(
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Bridge.toAppStore().then((value) { (Theme.of(context).platform == TargetPlatform.android) ?
androidUpdate():Bridge.toAppStore().then((value) {
}); });
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
@ -107,7 +112,7 @@ class _UpdateDialog extends State<UpdateDialog> {
"立即更新", "立即更新",
style: TextStyle( style: TextStyle(
fontSize: 17.sp, fontSize: 17.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF32A060), color: Color(0xFF32A060),
), ),
), ),
@ -125,13 +130,13 @@ class _UpdateDialog extends State<UpdateDialog> {
); );
} }
androidUpdate() async {
Future<String> _findLocalPath(BuildContext context) async { String url = "http://application.lotus-wallet.com/huixaing?release_id=627cadff23389f2fe6d57cb1";
final directory = Theme.of(context).platform == TargetPlatform.android if (await canLaunch(url)) {
? await getExternalStorageDirectory() await launch(url);
: await getApplicationDocumentsDirectory(); } else {
return directory.path; throw 'Could not launch $url';
}
} }
} }

2
pubspec.yaml

@ -3,7 +3,7 @@ description: 一心回乡.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1 version: 1.0.1+2
environment: environment:
sdk: ">=2.7.0 <3.0.0" sdk: ">=2.7.0 <3.0.0"

Loading…
Cancel
Save