Compare commits

...

1 Commits

Author SHA1 Message Date
fmk cadc7f0ce0 null_safety 3 years ago
  1. 31
      lib/address/address_map_page.dart
  2. 58
      lib/address/edit_address_page.dart
  3. 10
      lib/article/hot_article_item.dart
  4. 4
      lib/article/video_playback_page.dart
  5. 6
      lib/base_state.dart
  6. 11
      lib/generated/intl/messages_all.dart
  7. 1086
      lib/generated/intl/messages_en.dart
  8. 1082
      lib/generated/intl/messages_zh_CN.dart
  9. 1082
      lib/generated/intl/messages_zh_Hans_CN.dart
  10. 1082
      lib/generated/intl/messages_zh_Hant_CN.dart
  11. 1082
      lib/generated/intl/messages_zh_TW.dart
  12. 37
      lib/generated/l10n.dart
  13. 22
      lib/home/activity_list_page.dart
  14. 2
      lib/home/guide_page.dart
  15. 61
      lib/home/home_page.dart
  16. 44
      lib/home/huixiang_brand_page.dart
  17. 4
      lib/home/main_home_page.dart
  18. 64
      lib/home/points_mall_page.dart
  19. 28
      lib/integral/integral_detailed_page.dart
  20. 92
      lib/integral/integral_page.dart
  21. 62
      lib/integral_store/integral_store_details_page.dart
  22. 55
      lib/login/login_page.dart
  23. 16
      lib/main.dart
  24. 14
      lib/main_page.dart
  25. 33
      lib/message/system_message.dart
  26. 46
      lib/mine/coupons_page.dart
  27. 4
      lib/mine/edit_name.dart
  28. 43
      lib/mine/manage_address_page.dart
  29. 30
      lib/mine/mine_card_invalid_page.dart
  30. 36
      lib/mine/mine_page.dart
  31. 30
      lib/mine/mine_vip_level_page.dart
  32. 34
      lib/mine/mine_wallet_page.dart
  33. 26
      lib/mine/recharge_page.dart
  34. 44
      lib/mine/roll_center_page.dart
  35. 44
      lib/mine/user_info_page.dart
  36. 38
      lib/mine/vip_balance_page.dart
  37. 28
      lib/mine/vip_card_page.dart
  38. 60
      lib/mine/vip_detail_page.dart
  39. 42
      lib/order/exchange_history_page.dart
  40. 72
      lib/order/exchange_order_page.dart
  41. 16
      lib/order/exchange_order_success_page.dart
  42. 38
      lib/order/logistics_information_page.dart
  43. 95
      lib/order/order_detail_page.dart
  44. 52
      lib/order/order_history_page.dart
  45. 48
      lib/order/store_selector_page.dart
  46. 24
      lib/order/write_off_page.dart
  47. 36
      lib/retrofit/data/activity.dart
  48. 26
      lib/retrofit/data/address.dart
  49. 204
      lib/retrofit/data/article.dart
  50. 22
      lib/retrofit/data/author.dart
  51. 24
      lib/retrofit/data/banner.dart
  52. 16
      lib/retrofit/data/base_data.dart
  53. 73
      lib/retrofit/data/brand.dart
  54. 18
      lib/retrofit/data/brand_data.dart
  55. 58
      lib/retrofit/data/coupon.dart
  56. 52
      lib/retrofit/data/coupon_vo.dart
  57. 4
      lib/retrofit/data/data_type.dart
  58. 33
      lib/retrofit/data/delivery_info.dart
  59. 30
      lib/retrofit/data/exchange_order.dart
  60. 38
      lib/retrofit/data/exchange_order_goods.dart
  61. 49
      lib/retrofit/data/founder.dart
  62. 211
      lib/retrofit/data/goods.dart
  63. 94
      lib/retrofit/data/goods_category.dart
  64. 22
      lib/retrofit/data/logistics.dart
  65. 63
      lib/retrofit/data/member_comment_list.dart
  66. 18
      lib/retrofit/data/member_rank.dart
  67. 238
      lib/retrofit/data/member_source.dart
  68. 111
      lib/retrofit/data/message.dart
  69. 31
      lib/retrofit/data/mini.dart
  70. 1635
      lib/retrofit/data/order_info.dart
  71. 14
      lib/retrofit/data/page.dart
  72. 40
      lib/retrofit/data/promotion.dart
  73. 94
      lib/retrofit/data/rank.dart
  74. 32
      lib/retrofit/data/sign_in.dart
  75. 12
      lib/retrofit/data/sign_info.dart
  76. 56
      lib/retrofit/data/store.dart
  77. 90
      lib/retrofit/data/store_info.dart
  78. 4
      lib/retrofit/data/store_type.dart
  79. 28
      lib/retrofit/data/task.dart
  80. 48
      lib/retrofit/data/upload_result.dart
  81. 155
      lib/retrofit/data/user_bill.dart
  82. 24
      lib/retrofit/data/user_entity.dart
  83. 32
      lib/retrofit/data/user_info.dart
  84. 16
      lib/retrofit/data/verify_code.dart
  85. 182
      lib/retrofit/data/vip_card.dart
  86. 66
      lib/retrofit/data/wx_pay.dart
  87. 15
      lib/retrofit/retrofit_api.dart
  88. 6
      lib/setting/permission_setting_page.dart
  89. 5
      lib/setting/setting_page.dart
  90. 43
      lib/union/location_map_page.dart
  91. 186
      lib/union/store_details_page.dart
  92. 236
      lib/union/union_details_page.dart
  93. 62
      lib/union/union_page.dart
  94. 24
      lib/utils/MyPainter.dart
  95. 2
      lib/utils/flutter_utils.dart
  96. 4
      lib/utils/location.dart
  97. 12
      lib/view_widget/border_text.dart
  98. 36
      lib/view_widget/classic_header.dart
  99. 1
      lib/view_widget/comment_menu.dart
  100. 35
      lib/view_widget/coupon_widget.dart
  101. Some files were not shown because too many files have changed in this diff Show More

31
lib/address/address_map_page.dart

@ -10,7 +10,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.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_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart';
import 'package:flutter_baidu_mapapi_search/flutter_baidu_mapapi_search.dart';
import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart'; import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart';
import 'package:flutter_bmflocation/bdmap_location_flutter_plugin.dart'; import 'package:flutter_bmflocation/bdmap_location_flutter_plugin.dart';
import 'package:flutter_bmflocation/flutter_baidu_location_android_option.dart'; import 'package:flutter_bmflocation/flutter_baidu_location_android_option.dart';
@ -39,7 +38,7 @@ class _AddressMapPage extends State<AddressMapPage> {
}); });
} }
LocationFlutterPlugin aMapFlutterLocation; late LocationFlutterPlugin aMapFlutterLocation;
String city = "武汉市"; String city = "武汉市";
String keyWord = ""; String keyWord = "";
@ -49,7 +48,7 @@ class _AddressMapPage extends State<AddressMapPage> {
aMapFlutterLocation.stopLocation(); aMapFlutterLocation.stopLocation();
} }
ApiService apiService; late ApiService apiService;
@override @override
void initState() { void initState() {
@ -68,13 +67,13 @@ class _AddressMapPage extends State<AddressMapPage> {
if (event != null && if (event != null &&
event["latitude"] != null && event["latitude"] != null &&
event["longitude"] != null) { event["longitude"] != null) {
city = event["city"]; city = event["city"] as String;
BMFCoordinate latLng; BMFCoordinate latLng;
if (event["latitude"] is String && event["longitude"] is String) { if (event["latitude"] is String && event["longitude"] is String) {
latLng = BMFCoordinate(double.tryParse(event["latitude"]), latLng = BMFCoordinate(double.tryParse(event["latitude"] as String),
double.tryParse(event["longitude"])); double.tryParse(event["longitude"] as String));
} else { } else {
latLng = BMFCoordinate(event["latitude"], event["longitude"]); latLng = BMFCoordinate(event["latitude"] as double, event["longitude"] as double);
} }
BMFCalculateUtils.coordConvert( BMFCalculateUtils.coordConvert(
coordinate: latLng, coordinate: latLng,
@ -138,11 +137,10 @@ class _AddressMapPage extends State<AddressMapPage> {
aMapFlutterLocation.prepareLoc(androidMap, iosMap); aMapFlutterLocation.prepareLoc(androidMap, iosMap);
} }
List<Address> poiList; late List<Address> poiList;
searchPoi(BMFCoordinate latLng) async { searchPoi(BMFCoordinate latLng) async {
keyWord = textEditingController.text; keyWord = textEditingController.text;
print("keyWord: ${keyWord}");
var addressPoi = await apiService.searchPoi( var addressPoi = await apiService.searchPoi(
"${latLng.latitude}", "${latLng.longitude}", keyWord, 20, 1); "${latLng.latitude}", "${latLng.longitude}", keyWord, 20, 1);
List<dynamic> poi = addressPoi['pois']; List<dynamic> poi = addressPoi['pois'];
@ -262,8 +260,10 @@ class _AddressMapPage extends State<AddressMapPage> {
}); });
} }
BMFMapController _mapController; late BMFMapController _mapController;
BMFCoordinate bmfCoordinate; late BMFCoordinate bmfCoordinate;
late BMFCoordinate latLng;
late BMFMarker bmfMarker;
void onMapCreated(BMFMapController controller) { void onMapCreated(BMFMapController controller) {
controller.setMapRegionDidChangeCallback(callback: (status) { controller.setMapRegionDidChangeCallback(callback: (status) {
@ -290,9 +290,6 @@ class _AddressMapPage extends State<AddressMapPage> {
}); });
} }
BMFCoordinate latLng;
BMFMarker bmfMarker;
addMarker() { addMarker() {
if (latLng == null) return; if (latLng == null) return;
if (bmfMarker == null && _mapController != null) { if (bmfMarker == null && _mapController != null) {
@ -343,8 +340,8 @@ class _AddressMapPage extends State<AddressMapPage> {
_mapController.updateMapOptions( _mapController.updateMapOptions(
BMFMapOptions( BMFMapOptions(
center: BMFCoordinate( center: BMFCoordinate(
double.tryParse(value.getString("latitude")), double.tryParse(value.getString("latitude")!),
double.tryParse(value.getString("longitude")), double.tryParse(value.getString("longitude")!),
), ),
zoomLevel: 15, zoomLevel: 15,
), ),
@ -354,7 +351,7 @@ class _AddressMapPage extends State<AddressMapPage> {
}); });
} }
BMFMapWidget map; late BMFMapWidget map;
BMFCoordinate center = BMFCoordinate(30.553111, 114.342366); BMFCoordinate center = BMFCoordinate(30.553111, 114.342366);
@override @override

58
lib/address/edit_address_page.dart

@ -10,7 +10,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
class EditAddressPage extends StatefulWidget { class EditAddressPage extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic>? arguments;
EditAddressPage({this.arguments}); EditAddressPage({this.arguments});
@ -26,7 +26,7 @@ class _EditAddressPage extends State<EditAddressPage> {
TextEditingController addressController = TextEditingController(); TextEditingController addressController = TextEditingController();
TextEditingController houseNumberController = TextEditingController(); TextEditingController houseNumberController = TextEditingController();
ApiService apiService; late ApiService apiService;
@override @override
void initState() { void initState() {
@ -39,16 +39,16 @@ class _EditAddressPage extends State<EditAddressPage> {
}); });
} }
Address preAddress; Address? preAddress;
queryAddress() async { queryAddress() async {
if (widget.arguments == null) return; if (widget.arguments == null) return;
preAddress = Address.fromJson(widget.arguments); preAddress = Address.fromJson(widget.arguments!);
nameController.text = preAddress.username; nameController.text = preAddress!.username!;
mobileController.text = preAddress.phone; mobileController.text = preAddress!.phone!;
addressController.text = addressController.text =
"${preAddress.province}${preAddress.city}${preAddress.area}"; "${preAddress!.province}${preAddress!.city}${preAddress!.area}";
houseNumberController.text = preAddress.address; houseNumberController.text = preAddress!.address!;
setState(() {}); setState(() {});
} }
@ -86,13 +86,13 @@ class _EditAddressPage extends State<EditAddressPage> {
children: [ children: [
editItem( editItem(
S.of(context).xingming, S.of(context).xingming,
preAddress != null ? preAddress.username : "", preAddress != null ? preAddress!.username : "",
S.of(context).qingtianxiexingming, S.of(context).qingtianxiexingming,
nameController, nameController,
false), false),
editItem( editItem(
S.of(context).dianhua, S.of(context).dianhua,
preAddress != null ? preAddress.phone : "", preAddress != null ? preAddress!.phone : "",
S.of(context).qingtianxieshoujihao, S.of(context).qingtianxieshoujihao,
mobileController, mobileController,
false), false),
@ -102,14 +102,14 @@ class _EditAddressPage extends State<EditAddressPage> {
}, },
child: editItem( child: editItem(
S.of(context).dizhi, S.of(context).dizhi,
preAddress != null ? preAddress.address : "", preAddress != null ? preAddress!.address : "",
S.of(context).shouhuodizhi, S.of(context).shouhuodizhi,
addressController, addressController,
true), true),
), ),
editItem( editItem(
S.of(context).xiangxidizhi, S.of(context).xiangxidizhi,
preAddress != null ? preAddress.address : "", preAddress != null ? preAddress!.address : "",
S.of(context).menpaihao, S.of(context).menpaihao,
houseNumberController, houseNumberController,
false), false),
@ -141,21 +141,21 @@ class _EditAddressPage extends State<EditAddressPage> {
); );
} }
Map addressMap; Map? addressMap;
toMap() async { toMap() async {
Navigator.of(context).pushNamed('/router/address_map_page').then( Navigator.of(context).pushNamed('/router/address_map_page').then(
(value) => { (value) => {
if (value != null) if (value != null)
{ {
addressMap = value, addressMap = value as Map?,
addressController.text = addressController.text =
"${(value as Map)['province']}${(value as Map)['city']}${(value as Map)['area']}", "${(value as Map)['province']}${(value as Map)['city']}${(value as Map)['area']}",
if (preAddress != null) if (preAddress != null)
{ {
preAddress.province = addressMap['province'], preAddress!.province = addressMap?['province'],
preAddress.city = addressMap['city'], preAddress!.city = addressMap?['city'],
preAddress.area = addressMap['area'], preAddress!.area = addressMap?['area'],
}, },
houseNumberController.text = "${(value as Map)['address']}", houseNumberController.text = "${(value as Map)['address']}",
} }
@ -189,35 +189,35 @@ class _EditAddressPage extends State<EditAddressPage> {
if (preAddress == null) { if (preAddress == null) {
baseData = await apiService.addAddress({ baseData = await apiService.addAddress({
"address": address, "address": address,
"area": addressMap != null ? addressMap['area'] : "", "area": addressMap != null ? addressMap!['area'] : "",
"city": addressMap != null ? addressMap['city'] : "", "city": addressMap != null ? addressMap!['city'] : "",
"cityInfo": "", "cityInfo": "",
"isDefault": true, "isDefault": true,
"latitude": addressMap != null ? addressMap['latitude'] : 0, "latitude": addressMap != null ? addressMap!['latitude'] : 0,
"longitude": addressMap != null ? addressMap['longitude'] : 0, "longitude": addressMap != null ? addressMap!['longitude'] : 0,
"phone": mobile, "phone": mobile,
"province": addressMap != null ? addressMap['province'] : "", "province": addressMap != null ? addressMap!['province'] : "",
"tag": "", "tag": "",
"username": name "username": name
}); });
} else { } else {
baseData = await apiService.updateAddress({ baseData = await apiService.updateAddress({
"address": address, "address": address,
"area": preAddress != null ? preAddress.area : "", "area": preAddress != null ? preAddress!.area : "",
"city": preAddress != null ? preAddress.city : "", "city": preAddress != null ? preAddress!.city : "",
"province": preAddress != null ? preAddress.province : "", "province": preAddress != null ? preAddress!.province : "",
"cityInfo": "", "cityInfo": "",
"isDefault": true, "isDefault": true,
"latitude": preAddress != null ? preAddress.latitude : 0, "latitude": preAddress != null ? preAddress!.latitude : 0,
"longitude": preAddress != null ? preAddress.longitude : 0, "longitude": preAddress != null ? preAddress!.longitude : 0,
"phone": mobile, "phone": mobile,
"tag": "", "tag": "",
"id": preAddress != null ? preAddress.id : 0, "id": preAddress != null ? preAddress!.id : 0,
"username": name "username": name
}); });
} }
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
SmartDialog.showToast(preAddress == null SmartDialog.showToast(preAddress == null
? S.of(context).baocunchenggong ? S.of(context).baocunchenggong
: S.of(context).xiugaichenggong, alignment: Alignment.center); : S.of(context).xiugaichenggong, alignment: Alignment.center);

10
lib/article/hot_article_item.dart

@ -22,7 +22,7 @@ class HotArticlePage extends StatefulWidget {
} }
class _HotArticlePage extends State<HotArticlePage> { class _HotArticlePage extends State<HotArticlePage> {
ApiService apiService; late ApiService apiService;
@override @override
void dispose() { void dispose() {
@ -48,7 +48,7 @@ class _HotArticlePage extends State<HotArticlePage> {
queryArticle(); queryArticle();
} }
List<Article> articles = []; List<Article?> articles = [];
queryArticle() async { queryArticle() async {
BaseData<PageInfo<Article>> baseData = await apiService.queryArticle({ BaseData<PageInfo<Article>> baseData = await apiService.queryArticle({
@ -61,14 +61,14 @@ class _HotArticlePage extends State<HotArticlePage> {
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
refreshController.refreshCompleted(); refreshController.refreshCompleted();
refreshController.loadComplete(); refreshController.loadComplete();
if(pageNum == 1) { if(pageNum == 1) {
articles.clear(); articles.clear();
} }
articles.addAll(baseData.data.list); articles.addAll(baseData.data!.list!);
if (baseData.data.pageNum == baseData.data.pages) { if (baseData.data!.pageNum == baseData.data!.pages) {
refreshController.loadNoData(); refreshController.loadNoData();
} else { } else {
pageNum += 1; pageNum += 1;

4
lib/article/video_playback_page.dart

@ -13,8 +13,8 @@ class VideoPlaybackPage extends StatefulWidget {
class _VideoPlaybackPage extends State<VideoPlaybackPage> { class _VideoPlaybackPage extends State<VideoPlaybackPage> {
var controller = new ScrollController(); var controller = new ScrollController();
VideoPlayerController videoPlayerController; late VideoPlayerController videoPlayerController;
ChewieController chewieController; late ChewieController chewieController;
@override @override
void initState() { void initState() {

6
lib/base_state.dart

@ -10,7 +10,7 @@ abstract class BaseState<T extends StatefulWidget> extends State<T> with Widgets
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
WidgetsBinding.instance.removeObserver(this); WidgetsBinding.instance!.removeObserver(this);
} }
@override @override
@ -32,14 +32,14 @@ abstract class BaseState<T extends StatefulWidget> extends State<T> with Widgets
@override @override
void initState() { void initState() {
super.initState(); super.initState();
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance!.addObserver(this);
} }
pushRoute() async { pushRoute() async {
String startIntent = await Bridge.getStartIntent(); String startIntent = await Bridge.getStartIntent();
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
print("intent:$startIntent"); print("intent:$startIntent");
String pushData = ""; String? pushData = "";
if (startIntent != null && startIntent != "") { if (startIntent != null && startIntent != "") {
pushData = startIntent; pushData = startIntent;
} else { } else {

11
lib/generated/intl/messages_all.dart

@ -30,7 +30,7 @@ Map<String, LibraryLoader> _deferredLibraries = {
'zh_TW': () => new Future.value(null), 'zh_TW': () => new Future.value(null),
}; };
MessageLookupByLibrary _findExact(String localeName) { MessageLookupByLibrary? _findExact(String localeName) {
switch (localeName) { switch (localeName) {
case 'en': case 'en':
return messages_en.messages; return messages_en.messages;
@ -50,8 +50,7 @@ MessageLookupByLibrary _findExact(String localeName) {
/// User programs should call this before using [localeName] for messages. /// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) async { Future<bool> initializeMessages(String localeName) async {
var availableLocale = Intl.verifiedLocale( var availableLocale = Intl.verifiedLocale(
localeName, localeName, (locale) => _deferredLibraries[locale] != null,
(locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null); onFailure: (_) => null);
if (availableLocale == null) { if (availableLocale == null) {
return new Future.value(false); return new Future.value(false);
@ -71,9 +70,9 @@ bool _messagesExistFor(String locale) {
} }
} }
MessageLookupByLibrary _findGeneratedMessagesFor(String locale) { MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) {
var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor, var actualLocale =
onFailure: (_) => null); Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null);
if (actualLocale == null) return null; if (actualLocale == null) return null;
return _findExact(actualLocale); return _findExact(actualLocale);
} }

1086
lib/generated/intl/messages_en.dart

File diff suppressed because it is too large Load Diff

1082
lib/generated/intl/messages_zh_CN.dart

File diff suppressed because it is too large Load Diff

1082
lib/generated/intl/messages_zh_Hans_CN.dart

File diff suppressed because it is too large Load Diff

1082
lib/generated/intl/messages_zh_Hant_CN.dart

File diff suppressed because it is too large Load Diff

1082
lib/generated/intl/messages_zh_TW.dart

File diff suppressed because it is too large Load Diff

37
lib/generated/l10n.dart

@ -10,28 +10,43 @@ import 'intl/messages_all.dart';
// ignore_for_file: non_constant_identifier_names, lines_longer_than_80_chars // ignore_for_file: non_constant_identifier_names, lines_longer_than_80_chars
// ignore_for_file: join_return_with_assignment, prefer_final_in_for_each // ignore_for_file: join_return_with_assignment, prefer_final_in_for_each
// ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_redundant_argument_values, avoid_escaping_inner_quotes
class S { class S {
S(); S();
static S current; static S? _current;
static const AppLocalizationDelegate delegate = static S get current {
AppLocalizationDelegate(); assert(_current != null,
'No instance of S was loaded. Try to initialize the S delegate before accessing S.current.');
return _current!;
}
static const AppLocalizationDelegate delegate = AppLocalizationDelegate();
static Future<S> load(Locale locale) { static Future<S> load(Locale locale) {
final name = (locale.countryCode?.isEmpty ?? false) ? locale.languageCode : locale.toString(); final name = (locale.countryCode?.isEmpty ?? false)
? locale.languageCode
: locale.toString();
final localeName = Intl.canonicalizedLocale(name); final localeName = Intl.canonicalizedLocale(name);
return initializeMessages(localeName).then((_) { return initializeMessages(localeName).then((_) {
Intl.defaultLocale = localeName; Intl.defaultLocale = localeName;
S.current = S(); final instance = S();
S._current = instance;
return S.current; return instance;
}); });
} }
static S of(BuildContext context) { static S of(BuildContext context) {
final instance = S.maybeOf(context);
assert(instance != null,
'No instance of S present in the widget tree. Did you add S.delegate in localizationsDelegates?');
return instance!;
}
static S? maybeOf(BuildContext context) {
return Localizations.of<S>(context, S); return Localizations.of<S>(context, S);
} }
@ -4743,8 +4758,10 @@ class AppLocalizationDelegate extends LocalizationsDelegate<S> {
return const <Locale>[ return const <Locale>[
Locale.fromSubtags(languageCode: 'en'), Locale.fromSubtags(languageCode: 'en'),
Locale.fromSubtags(languageCode: 'zh', countryCode: 'CN'), Locale.fromSubtags(languageCode: 'zh', countryCode: 'CN'),
Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans', countryCode: 'CN'), Locale.fromSubtags(
Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant', countryCode: 'CN'), languageCode: 'zh', scriptCode: 'Hans', countryCode: 'CN'),
Locale.fromSubtags(
languageCode: 'zh', scriptCode: 'Hant', countryCode: 'CN'),
Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW'), Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW'),
]; ];
} }
@ -4757,13 +4774,11 @@ class AppLocalizationDelegate extends LocalizationsDelegate<S> {
bool shouldReload(AppLocalizationDelegate old) => false; bool shouldReload(AppLocalizationDelegate old) => false;
bool _isSupported(Locale locale) { bool _isSupported(Locale locale) {
if (locale != null) {
for (var supportedLocale in supportedLocales) { for (var supportedLocale in supportedLocales) {
if (supportedLocale.languageCode == locale.languageCode) { if (supportedLocale.languageCode == locale.languageCode) {
return true; return true;
} }
} }
}
return false; return false;
} }
} }

22
lib/home/activity_list_page.dart

@ -25,7 +25,7 @@ class ActivityListPage extends StatefulWidget {
class _ActivityListPage extends State<ActivityListPage> class _ActivityListPage extends State<ActivityListPage>
with AutomaticKeepAliveClientMixin { with AutomaticKeepAliveClientMixin {
ApiService apiService; late ApiService apiService;
@override @override
void initState() { void initState() {
@ -43,7 +43,7 @@ class _ActivityListPage extends State<ActivityListPage>
}); });
} }
List<Activity> activityList; late List<Activity?> activityList;
queryActivity() async { queryActivity() async {
BaseData<PageInfo<Activity>> baseData = await apiService.informationList({ BaseData<PageInfo<Activity>> baseData = await apiService.informationList({
@ -55,10 +55,10 @@ class _ActivityListPage extends State<ActivityListPage>
}).catchError((error) { }).catchError((error) {
_refreshController.refreshFailed(); _refreshController.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
_refreshController.refreshCompleted(); _refreshController.refreshCompleted();
setState(() { setState(() {
activityList = baseData.data.list; activityList = baseData.data!.list!;
}); });
} }
} }
@ -95,7 +95,7 @@ class _ActivityListPage extends State<ActivityListPage>
return InkWell( return InkWell(
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/store_detail_page', Navigator.of(context).pushNamed('/router/store_detail_page',
arguments: {"activityId": activityList[position].id}); arguments: {"activityId": activityList[position]!.id});
}, },
child: FrameSeparateWidget( child: FrameSeparateWidget(
child: activityItem(activityList[position]), child: activityItem(activityList[position]),
@ -127,7 +127,7 @@ class _ActivityListPage extends State<ActivityListPage>
); );
} }
Widget activityItem(Activity activity) { Widget activityItem(Activity? activity) {
return Container( return Container(
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 8.h, bottom: 12.h), margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 8.h, bottom: 12.h),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -145,7 +145,7 @@ class _ActivityListPage extends State<ActivityListPage>
child: Column( child: Column(
children: [ children: [
MImage( MImage(
activity.coverImg, activity!.coverImg!,
aspectRatio: 2.1, aspectRatio: 2.1,
radius: BorderRadius.only( radius: BorderRadius.only(
topLeft: Radius.circular(8), topLeft: Radius.circular(8),
@ -163,7 +163,7 @@ class _ActivityListPage extends State<ActivityListPage>
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
activity.mainTitle, activity!.mainTitle!,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -198,7 +198,7 @@ class _ActivityListPage extends State<ActivityListPage>
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
activity.storeName == null ? "" : activity.storeName, activity.storeName == null ? "" : activity.storeName!,
style: TextStyle( style: TextStyle(
color: Color(0xFF060606), color: Color(0xFF060606),
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@ -210,7 +210,7 @@ class _ActivityListPage extends State<ActivityListPage>
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text( Text(
activity.startTime.split(" ")[0], activity.startTime!.split(" ")[0],
style: TextStyle( style: TextStyle(
color: Color(0xFFB5B5B5), color: Color(0xFFB5B5B5),
fontSize: 12.sp, fontSize: 12.sp,
@ -221,7 +221,7 @@ class _ActivityListPage extends State<ActivityListPage>
width: 4.w, width: 4.w,
), ),
Text( Text(
activity.startTime.split(" ")[1], activity.startTime!.split(" ")[1],
style: TextStyle( style: TextStyle(
color: Color(0xFFB5B5B5), color: Color(0xFFB5B5B5),
fontSize: 12.sp, fontSize: 12.sp,

2
lib/home/guide_page.dart

@ -370,7 +370,7 @@ class _GuidePage extends State<GuidePage> {
toNext() { toNext() {
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
value.setBool("isFirst", false); value.setBool("isFirst", false);
String token = value.getString("token"); String? token = value.getString("token");
if (token == null || token == "") { if (token == null || token == "") {
Navigator.of(context).popAndPushNamed('/router/login_page'); Navigator.of(context).popAndPushNamed('/router/login_page');
} else { } else {

61
lib/home/home_page.dart

@ -32,15 +32,14 @@ class HomePage extends StatefulWidget {
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _HomePage(callback); return _HomePage();
} }
} }
class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin { class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
ApiService apiService; late ApiService apiService;
final GestureTapCallback callback; // late final GestureTapCallback? callback;
// _HomePage(this.callback);
_HomePage(this.callback);
@override @override
void initState() { void initState() {
@ -77,11 +76,11 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
SwiperController controller = SwiperController(); SwiperController controller = SwiperController();
List<BannerData> bannerData = []; List<BannerData?> bannerData = [];
List<Brand> brandData = []; List<Brand?> brandData = [];
List<Article> articles = []; List<Article?> articles = [];
List<Goods> gooods = []; List<Goods?> gooods = [];
Founder founder; late Founder founder;
queryHome() async { queryHome() async {
SmartDialog.showLoading( SmartDialog.showLoading(
@ -92,9 +91,9 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
}).catchError((onError) { }).catchError((onError) {
refreshController.refreshFailed(); refreshController.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
bannerData.clear(); bannerData.clear();
bannerData.addAll(baseData.data.records); bannerData.addAll(baseData.data!.records!);
setState(() { setState(() {
if (bannerData.length > 0) if (bannerData.length > 0)
controller.move(0, animation: false); controller.move(0, animation: false);
@ -104,7 +103,7 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
BaseData brand = await apiService.queryHomeBrand().catchError((onError) { BaseData brand = await apiService.queryHomeBrand().catchError((onError) {
refreshController.refreshFailed(); refreshController.refreshFailed();
}); });
if (brand != null && brand.isSuccess) { if (brand != null && brand.isSuccess!) {
brandData.clear(); brandData.clear();
brandData.addAll((brand.data["brandList"] as List<dynamic>) brandData.addAll((brand.data["brandList"] as List<dynamic>)
.map((e) => Brand.fromJson(e)) .map((e) => Brand.fromJson(e))
@ -122,8 +121,8 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
refreshController.refreshFailed(); refreshController.refreshFailed();
}); });
articles.clear(); articles.clear();
if (article != null && article.isSuccess) { if (article != null && article.isSuccess!) {
articles.addAll(article.data.list); articles.addAll(article.data!.list!);
} }
BaseData<PageInfo<Goods>> goodsData = await apiService.creditGoods({ BaseData<PageInfo<Goods>> goodsData = await apiService.creditGoods({
@ -133,12 +132,12 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
"pageSize": 10, "pageSize": 10,
"state": 1 "state": 1
}); });
if (goodsData != null && goodsData.isSuccess) { if (goodsData != null && goodsData.isSuccess!) {
gooods.clear(); gooods.clear();
gooods.addAll(goodsData.data.list); gooods.addAll(goodsData.data!.list!);
} }
SmartDialog.dismiss(); SmartDialog.dismiss();
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
refreshController.refreshCompleted(); refreshController.refreshCompleted();
if (mounted) setState(() {}); if (mounted) setState(() {});
} else { } else {
@ -259,7 +258,9 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
), ),
), ),
GestureDetector( GestureDetector(
onTap: callback, onTap: (){
widget.callback();
},
child: Container( child: Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 3.h, horizontal: 8.w), vertical: 3.h, horizontal: 8.w),
@ -352,7 +353,7 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
children: [ children: [
MImage( MImage(
founder != null ? founder.imgUrl : "", founder != null ? founder.imgUrl! : "",
aspectRatio: 2, aspectRatio: 2,
radius: BorderRadius.circular(4.w), radius: BorderRadius.circular(4.w),
fit: BoxFit.cover, fit: BoxFit.cover,
@ -391,7 +392,7 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
), ),
), ),
Text( Text(
founder != null ? founder.name : "", founder != null ? founder.name! : "",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -460,7 +461,7 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/integral_store_page', Navigator.of(context).pushNamed('/router/integral_store_page',
arguments: {"goodsId": gooods[index].id}); arguments: {"goodsId": gooods[index]!.id});
}, },
child: buildItem(gooods[index]), child: buildItem(gooods[index]),
); );
@ -468,13 +469,13 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
); );
} }
Widget buildItem(Goods goods) { Widget buildItem(Goods? goods) {
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
child: Column( child: Column(
children: [ children: [
MImage( MImage(
goods.mainImgPath, goods!.mainImgPath!,
aspectRatio: 5 / 3, aspectRatio: 5 / 3,
radius: BorderRadius.circular(4), radius: BorderRadius.circular(4),
fit: BoxFit.cover, fit: BoxFit.cover,
@ -498,7 +499,7 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
Expanded( Expanded(
flex: 1, flex: 1,
child: Text( child: Text(
goods.name, goods.name!,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: Color(0xff353535), color: Color(0xff353535),
@ -522,7 +523,7 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
height: 5.h, height: 5.h,
), ),
Text( Text(
goods.description, goods.description!,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 2, maxLines: 2,
style: TextStyle( style: TextStyle(
@ -619,7 +620,7 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
child: MImage( child: MImage(
brandData != null ? brandData[position].image : "", brandData != null ? brandData[position]!.image! : "",
radius: BorderRadius.circular(8), radius: BorderRadius.circular(8),
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_2_1.png", errorSrc: "assets/image/default_2_1.png",
@ -663,7 +664,7 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
), ),
child: MImage( child: MImage(
(bannerData != null && position < bannerData.length) (bannerData != null && position < bannerData.length)
? bannerData[position].imgUrl ?? "" ? bannerData[position]!.imgUrl! ?? ""
: "", : "",
radius: BorderRadius.circular(8), radius: BorderRadius.circular(8),
fit: BoxFit.cover, fit: BoxFit.cover,
@ -680,8 +681,8 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
} }
/// contentType 0123 /// contentType 0123
bannerClick(BannerData bannerData) async { bannerClick(BannerData? bannerData) async {
switch (bannerData.contentType) { switch (bannerData!.contentType) {
case 1: case 1:
Navigator.of(context).pushNamed('/router/integral_store_page', Navigator.of(context).pushNamed('/router/integral_store_page',
arguments: {"goodsId": bannerData.content}); arguments: {"goodsId": bannerData.content});

44
lib/home/huixiang_brand_page.dart

@ -34,11 +34,11 @@ class _BrandPage extends State<BrandPage>
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin { with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
ScrollController scrollController = ScrollController(); ScrollController scrollController = ScrollController();
ApiService apiService; late ApiService apiService;
List<Brand> brands = []; List<Brand>? brands = [];
BrandData brandData; BrandData? brandData;
List<GlobalKey> globaKeys = []; List<GlobalKey> globaKeys = [];
List<BannerData> bannerData = []; List<BannerData?> bannerData = [];
// List<String> brandText = []; // List<String> brandText = [];
var isShowMore = false; var isShowMore = false;
@ -53,20 +53,20 @@ class _BrandPage extends State<BrandPage>
refreshController.refreshFailed(); refreshController.refreshFailed();
}); });
bannerData.clear(); bannerData.clear();
bannerData.addAll(banner.data.records); bannerData.addAll(banner.data!.records!);
BaseData brand = await apiService.queryHomeBrand().catchError((onError) { BaseData brand = await apiService.queryHomeBrand().catchError((onError) {
refreshController.refreshFailed(); refreshController.refreshFailed();
}).catchError((onError) { }).catchError((onError) {
refreshController.refreshFailed(); refreshController.refreshFailed();
}); });
if (brand != null && brand.isSuccess) { if (brand != null && brand.isSuccess!) {
brands.clear(); brands!.clear();
globaKeys.clear(); globaKeys.clear();
brands.addAll((brand.data["brandList"] as List<dynamic>) brands!.addAll((brand.data["brandList"] as List<dynamic>)
.map((e) => Brand.fromJson(e)) .map((e) => Brand.fromJson(e))
.toList()); .toList());
brands.forEach((element) { brands!.forEach((element) {
globaKeys.add(GlobalKey()); globaKeys.add(GlobalKey());
}); });
setState(() {}); setState(() {});
@ -74,7 +74,7 @@ class _BrandPage extends State<BrandPage>
refreshController.refreshFailed(); refreshController.refreshFailed();
} }
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
refreshController.refreshCompleted(); refreshController.refreshCompleted();
brandData = baseData.data; brandData = baseData.data;
setState(() {}); setState(() {});
@ -145,12 +145,12 @@ class _BrandPage extends State<BrandPage>
left: 0, left: 0,
right: 0, right: 0,
), ),
if (brands != null && brands.length > 0) if (brands != null && brands!.length > 0)
Positioned( Positioned(
child: Container( child: Container(
color: Colors.white, color: Colors.white,
child: StoreTitleTab( child: StoreTitleTab(
brands, brands!,
globaKeys, globaKeys,
scrollController, scrollController,
isScroll: true, isScroll: true,
@ -178,9 +178,9 @@ class _BrandPage extends State<BrandPage>
) )
]; ];
if (brands == null) return widgets; if (brands == null) return widgets;
brands.forEach((value) { brands!.forEach((value) {
widgets.add(Container( widgets.add(Container(
key: globaKeys[brands.indexOf(value)], key: globaKeys[brands!.indexOf(value)],
child: Container( child: Container(
color: Colors.white, color: Colors.white,
child: Html( child: Html(
@ -231,7 +231,7 @@ class _BrandPage extends State<BrandPage>
children: [ children: [
ClipOval( ClipOval(
child: MImage( child: MImage(
brandData == null ? "" : brandData.originAvatar, brandData == null ? "" : brandData!.originAvatar!,
fit: BoxFit.cover, fit: BoxFit.cover,
width: 60, width: 60,
height: 60, height: 60,
@ -252,7 +252,7 @@ class _BrandPage extends State<BrandPage>
TextSpan(children: [ TextSpan(children: [
TextSpan( TextSpan(
text: text:
brandData == null ? "" : brandData.originator, brandData == null ? "" : brandData!.originator,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 14.sp, fontSize: 14.sp,
@ -270,7 +270,7 @@ class _BrandPage extends State<BrandPage>
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
), ),
Text( Text(
brandData == null ? "" : brandData.originDesc, brandData == null ? "" : brandData!.originDesc!,
overflow: isShowMore overflow: isShowMore
? TextOverflow.visible ? TextOverflow.visible
: TextOverflow.ellipsis, : TextOverflow.ellipsis,
@ -325,7 +325,7 @@ class _BrandPage extends State<BrandPage>
Navigator.of(context).pushNamed('/router/founder_story_page'); Navigator.of(context).pushNamed('/router/founder_story_page');
}, },
child: Text( child: Text(
brandData == null ? "" : brandData.company, brandData == null ? "" : brandData!.company!,
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -341,7 +341,7 @@ class _BrandPage extends State<BrandPage>
Navigator.of(context).pushNamed('/router/founder_story_page'); Navigator.of(context).pushNamed('/router/founder_story_page');
}, },
child: Text( child: Text(
brandData == null ? "" : brandData.companyDesc, brandData == null ? "" : brandData!.companyDesc!,
textAlign: TextAlign.justify, textAlign: TextAlign.justify,
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
@ -483,7 +483,7 @@ class _BrandPage extends State<BrandPage>
}, },
child: MImage( child: MImage(
(bannerData != null && position < bannerData.length) (bannerData != null && position < bannerData.length)
? bannerData[position].imgUrl ? bannerData[position]!.imgUrl!
: "", : "",
fit: BoxFit.cover, fit: BoxFit.cover,
radius: BorderRadius.circular(8), radius: BorderRadius.circular(8),
@ -500,8 +500,8 @@ class _BrandPage extends State<BrandPage>
} }
/// contentType 0123 /// contentType 0123
bannerClick(BannerData bannerData) async { bannerClick(BannerData? bannerData) async {
switch (bannerData.contentType) { switch (bannerData!.contentType) {
case 1: case 1:
Navigator.of(context).pushNamed('/router/integral_store_page', Navigator.of(context).pushNamed('/router/integral_store_page',
arguments: {"goodsId": bannerData.content}); arguments: {"goodsId": bannerData.content});

4
lib/home/main_home_page.dart

@ -18,8 +18,8 @@ class MainHomePage extends StatefulWidget {
class _MainHomePage extends State<MainHomePage> class _MainHomePage extends State<MainHomePage>
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin { with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
TabController tabcontroller; late TabController tabcontroller;
List<Widget> _widgetOptions; late List<Widget> _widgetOptions;
@override @override
void initState() { void initState() {

64
lib/home/points_mall_page.dart

@ -37,7 +37,7 @@ class _PointsMallPage extends State<PointsMallPage>
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin { with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
var _itemText = S.current.morenpaixu; var _itemText = S.current.morenpaixu;
ApiService client; late ApiService client;
RefreshController _refreshController = RefreshController( RefreshController _refreshController = RefreshController(
initialRefresh: false, initialLoadStatus: LoadStatus.canLoading); initialRefresh: false, initialLoadStatus: LoadStatus.canLoading);
List<String> sortString = [ List<String> sortString = [
@ -90,10 +90,10 @@ class _PointsMallPage extends State<PointsMallPage>
// //
bool orderDesc = true; bool orderDesc = true;
List<Goods> goods = []; List<Goods?> goods = [];
List<GoodsCategory> gooodsCategorys = []; List<GoodsCategory?> gooodsCategorys = [];
UserInfo userinfo; UserInfo? userinfo;
List<BannerData> bannerData = []; List<BannerData?> bannerData = [];
queryUser() async { queryUser() async {
BaseData<PageInfo<BannerData>> banner = await client.queryBanner({ BaseData<PageInfo<BannerData>> banner = await client.queryBanner({
@ -102,12 +102,12 @@ class _PointsMallPage extends State<PointsMallPage>
if (banner != null) { if (banner != null) {
bannerData.clear(); bannerData.clear();
bannerData.addAll(banner.data.records); bannerData.addAll(banner.data!.records!);
setState(() {}); setState(() {});
} }
BaseData<UserInfo> baseData = await client.queryInfo(); BaseData<UserInfo> baseData = await client.queryInfo();
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
userinfo = baseData.data; userinfo = baseData.data;
SharedPreferences.getInstance().then((value) => { SharedPreferences.getInstance().then((value) => {
value.setString('user', jsonEncode(baseData.data)), value.setString('user', jsonEncode(baseData.data)),
@ -129,10 +129,10 @@ class _PointsMallPage extends State<PointsMallPage>
_refreshController.refreshFailed(); _refreshController.refreshFailed();
}); });
if (dataCategory != null && dataCategory.isSuccess) { if (dataCategory != null && dataCategory.isSuccess!) {
gooodsCategorys.clear(); gooodsCategorys.clear();
gooodsCategorys.add(GoodsCategory(name: S.of(context).quanbu)); gooodsCategorys.add(GoodsCategory(name: S.of(context).quanbu));
gooodsCategorys.addAll(dataCategory.data.records); gooodsCategorys.addAll(dataCategory!.data!.records!);
} }
var param = { var param = {
@ -148,15 +148,15 @@ class _PointsMallPage extends State<PointsMallPage>
_refreshController.refreshFailed(); _refreshController.refreshFailed();
}); });
SmartDialog.dismiss(); SmartDialog.dismiss();
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
if (pageNum == 1) { if (pageNum == 1) {
goods.clear(); goods.clear();
} }
goods.addAll(baseData.data.list); goods.addAll(baseData.data!.list!);
setState(() { setState(() {
_refreshController.refreshCompleted(); _refreshController.refreshCompleted();
_refreshController.loadComplete(); _refreshController.loadComplete();
if (baseData.data.pageNum == baseData.data.pages) { if (baseData.data!.pageNum == baseData.data!.pages) {
_refreshController.loadNoData(); _refreshController.loadNoData();
} else { } else {
pageNum += 1; pageNum += 1;
@ -168,7 +168,7 @@ class _PointsMallPage extends State<PointsMallPage>
} }
} }
String categoryId; String? categoryId;
_refresh() { _refresh() {
pageNum = 1; pageNum = 1;
@ -199,7 +199,7 @@ class _PointsMallPage extends State<PointsMallPage>
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
footer: CustomFooter( footer: CustomFooter(
loadStyle: LoadStyle.ShowWhenLoading, loadStyle: LoadStyle.ShowWhenLoading,
builder: (BuildContext context, LoadStatus mode) { builder: (BuildContext context, LoadStatus? mode) {
return MyFooter(mode); return MyFooter(mode);
}, },
), ),
@ -247,10 +247,10 @@ class _PointsMallPage extends State<PointsMallPage>
tabs: gooodsCategorys == null tabs: gooodsCategorys == null
? [] ? []
: gooodsCategorys : gooodsCategorys
.map((e) => Tab(text: e.name)) .map((e) => Tab(text: e!.name))
.toList(), .toList(),
onTap: (index) { onTap: (index) {
categoryId = gooodsCategorys[index].id; categoryId = gooodsCategorys[index]!.id;
pageNum = 1; pageNum = 1;
creditGoods(categoryId); creditGoods(categoryId);
}, },
@ -291,9 +291,9 @@ class _PointsMallPage extends State<PointsMallPage>
_toDetails(index) async { _toDetails(index) async {
await Navigator.of(context).pushNamed('/router/integral_store_page', await Navigator.of(context).pushNamed('/router/integral_store_page',
arguments: {"goodsId": goods[index].id}); arguments: {"goodsId": goods[index]!.id});
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
String token = sharedPreferences.getString("token"); String? token = sharedPreferences.getString("token");
if (token != null && token != "") queryUser(); if (token != null && token != "") queryUser();
} }
@ -328,7 +328,7 @@ class _PointsMallPage extends State<PointsMallPage>
}); });
} }
Widget buildItem(Goods goods) { Widget buildItem(Goods? goods) {
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
@ -350,7 +350,7 @@ class _PointsMallPage extends State<PointsMallPage>
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
MImage( MImage(
goods.mainImgPath, goods!.mainImgPath!,
aspectRatio: 1, aspectRatio: 1,
radius: BorderRadius.only( radius: BorderRadius.only(
topLeft: Radius.circular(4), topLeft: Radius.circular(4),
@ -372,7 +372,7 @@ class _PointsMallPage extends State<PointsMallPage>
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
goods.name, goods!.name!,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: Color(0xff353535), color: Color(0xff353535),
@ -386,7 +386,7 @@ class _PointsMallPage extends State<PointsMallPage>
Container( Container(
height: 35.h * AppUtils.textScale(context), height: 35.h * AppUtils.textScale(context),
child: Text( child: Text(
goods.description, goods!.description!,
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -405,7 +405,7 @@ class _PointsMallPage extends State<PointsMallPage>
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
S.of(context).yuan_(goods.worth), S.of(context).yuan_(goods!.worth!),
style: TextStyle( style: TextStyle(
color: Color(0xFF585858), color: Color(0xFF585858),
decoration: TextDecoration.lineThrough, decoration: TextDecoration.lineThrough,
@ -417,7 +417,7 @@ class _PointsMallPage extends State<PointsMallPage>
flex: 1, flex: 1,
), ),
Text( Text(
S.of(context).jifen_(goods.price), S.of(context).jifen_(goods!.price!),
style: TextStyle( style: TextStyle(
color: Color(0xFF32A060), color: Color(0xFF32A060),
fontSize: 14.sp, fontSize: 14.sp,
@ -437,7 +437,7 @@ class _PointsMallPage extends State<PointsMallPage>
], ],
), ),
Visibility( Visibility(
visible: goods.isHot, visible: goods!.isHot!,
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.only(topRight: Radius.circular(4)), borderRadius: BorderRadius.only(topRight: Radius.circular(4)),
child: Image.asset( child: Image.asset(
@ -469,7 +469,7 @@ class _PointsMallPage extends State<PointsMallPage>
child: Row( child: Row(
children: [ children: [
MImage( MImage(
userinfo != null ? userinfo.headimg : "", userinfo != null ? userinfo!.headimg! : "",
width: 50, width: 50,
height: 50, height: 50,
isCircle: true, isCircle: true,
@ -496,7 +496,7 @@ class _PointsMallPage extends State<PointsMallPage>
: Row( : Row(
children: [ children: [
Text( Text(
userinfo.nickname, userinfo!.nickname!,
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -525,7 +525,7 @@ class _PointsMallPage extends State<PointsMallPage>
), ),
) )
: Text( : Text(
userinfo == null ? "" : "NO.${userinfo.vipNo}", userinfo == null ? "" : "NO.${userinfo!.vipNo}",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@ -562,7 +562,7 @@ class _PointsMallPage extends State<PointsMallPage>
height: 4.h, height: 4.h,
), ),
Text( Text(
(userinfo != null) ? "${userinfo.points}" : "", (userinfo != null) ? "${userinfo!.points}" : "",
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
color: Color(0xFFF8BA61), color: Color(0xFFF8BA61),
@ -609,7 +609,7 @@ class _PointsMallPage extends State<PointsMallPage>
), ),
child: MImage( child: MImage(
bannerData != null && position < bannerData.length bannerData != null && position < bannerData.length
? bannerData[position].imgUrl ? bannerData[position]!.imgUrl!
: "", : "",
radius: BorderRadius.circular(8), radius: BorderRadius.circular(8),
fit: BoxFit.cover, fit: BoxFit.cover,
@ -626,8 +626,8 @@ class _PointsMallPage extends State<PointsMallPage>
} }
/// contentType 0123 /// contentType 0123
bannerClick(BannerData bannerData) async { bannerClick(BannerData? bannerData) async {
switch (bannerData.contentType) { switch (bannerData!.contentType) {
case 1: case 1:
Navigator.of(context).pushNamed('/router/integral_store_page', Navigator.of(context).pushNamed('/router/integral_store_page',
arguments: {"goodsId": bannerData.content}); arguments: {"goodsId": bannerData.content});

28
lib/integral/integral_detailed_page.dart

@ -24,8 +24,8 @@ class IntegralDetailedPage extends StatefulWidget {
class _IntegralDetailedPage extends State<IntegralDetailedPage> class _IntegralDetailedPage extends State<IntegralDetailedPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
List<Widget> _tabs; List<Widget>? _tabs;
TabController tabController; late TabController tabController;
@override @override
void didChangeDependencies() { void didChangeDependencies() {
@ -49,8 +49,8 @@ class _IntegralDetailedPage extends State<IntegralDetailedPage>
}); });
} }
ApiService apiService; late ApiService apiService;
UserInfo userInfo; UserInfo? userInfo;
@override @override
void dispose() { void dispose() {
@ -63,13 +63,13 @@ class _IntegralDetailedPage extends State<IntegralDetailedPage>
super.initState(); super.initState();
SharedPreferences.getInstance().then((value) => { SharedPreferences.getInstance().then((value) => {
apiService = ApiService(Dio(), token: value.getString("token")), apiService = ApiService(Dio(), token: value.getString("token")),
userInfo = UserInfo.fromJson(jsonDecode(value.getString('user'))), userInfo = UserInfo.fromJson(jsonDecode(value.getString('user')!)),
queryDetail("bill_cate_point_get"), queryDetail("bill_cate_point_get"),
}); });
} }
int current = 1; int current = 1;
List<UserBill> userBill = []; List<UserBill?> userBill = [];
queryDetail(category) async { queryDetail(category) async {
BaseData<PageInfo<UserBill>> baseData = await apiService.queryBillInfo({ BaseData<PageInfo<UserBill>> baseData = await apiService.queryBillInfo({
@ -83,11 +83,11 @@ class _IntegralDetailedPage extends State<IntegralDetailedPage>
refreshController.refreshFailed(); refreshController.refreshFailed();
}); });
if (current == 1) userBill.clear(); if (current == 1) userBill.clear();
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
userBill.addAll(baseData.data.records); userBill.addAll(baseData.data!.records!);
refreshController.loadComplete(); refreshController.loadComplete();
refreshController.refreshCompleted(); refreshController.refreshCompleted();
if (current * 10 > int.tryParse(baseData.data.total)) { if (current * 10 > int.tryParse(baseData.data!.total!)!) {
refreshController.loadNoData(); refreshController.loadNoData();
} else { } else {
current += 1; current += 1;
@ -159,7 +159,7 @@ class _IntegralDetailedPage extends State<IntegralDetailedPage>
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( Text(
userInfo != null ? userInfo.points : "0", userInfo != null ? userInfo!.points! : "0",
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -178,7 +178,7 @@ class _IntegralDetailedPage extends State<IntegralDetailedPage>
bottom: PreferredSize( bottom: PreferredSize(
preferredSize: Size(double.infinity, 38), preferredSize: Size(double.infinity, 38),
child: TabBar( child: TabBar(
tabs: _tabs, tabs: _tabs!,
controller: tabController, controller: tabController,
isScrollable: false, isScrollable: false,
indicatorSize: TabBarIndicatorSize.label, indicatorSize: TabBarIndicatorSize.label,
@ -247,13 +247,13 @@ class _IntegralDetailedPage extends State<IntegralDetailedPage>
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
userBill[position].name ?? "", userBill![position]!.name ?? "",
// S.of(context).qiandao, // S.of(context).qiandao,
style: TextStyle( style: TextStyle(
color: Colors.black, fontSize: 12), color: Colors.black, fontSize: 12),
), ),
Text( Text(
userBill[position].createTime ?? "", userBill![position]!.createTime ?? "",
style: TextStyle( style: TextStyle(
color: Color(0xFF727272), fontSize: 10), color: Color(0xFF727272), fontSize: 10),
) )
@ -263,7 +263,7 @@ class _IntegralDetailedPage extends State<IntegralDetailedPage>
Container( Container(
margin: EdgeInsets.only(top: 2), margin: EdgeInsets.only(top: 2),
child: Text( child: Text(
"${tabController.index == 0 ? "+" : "-"}${double.tryParse(userBill[position].number ?? "0").toInt().toString()}", "${tabController.index == 0 ? "+" : "-"}${double.tryParse(userBill[position]!.number ?? "0")!.toInt().toString()}",
style: TextStyle( style: TextStyle(
color: Color(0xFF727272), fontSize: 12), color: Color(0xFF727272), fontSize: 12),
), ),

92
lib/integral/integral_page.dart

@ -26,11 +26,11 @@ class IntegralPage extends StatefulWidget {
} }
class _IntegralPage extends State<IntegralPage> { class _IntegralPage extends State<IntegralPage> {
ApiService apiService; late ApiService apiService;
SignInfo signInfo; SignInfo? signInfo;
UserInfo userinfo; UserInfo? userinfo;
List<Rank> ranks = []; List<Rank?> ranks = [];
int rankLevel = 1; int rankLevel = 1;
@override @override
@ -42,7 +42,7 @@ class _IntegralPage extends State<IntegralPage> {
context: context, context: context,
token: value.getString("token"), token: value.getString("token"),
showLoading: false); showLoading: false);
userinfo = UserInfo.fromJson(jsonDecode(value.getString("user"))); userinfo = UserInfo.fromJson(jsonDecode(value.getString("user")!));
SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai, animationDurationTemp: Duration(seconds: 1)); SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai, animationDurationTemp: Duration(seconds: 1));
querySignInfo(); querySignInfo();
}); });
@ -52,21 +52,21 @@ class _IntegralPage extends State<IntegralPage> {
BaseData<SignInfo> baseData = await apiService.signInInfo(); BaseData<SignInfo> baseData = await apiService.signInInfo();
BaseData<List<Rank>> rankData = await apiService.rankList(); BaseData<List<Rank>> rankData = await apiService.rankList();
if (rankData != null && rankData.isSuccess) { if (rankData != null && rankData.isSuccess!) {
ranks.clear(); ranks.clear();
ranks.addAll(rankData.data); ranks.addAll(rankData.data!);
} }
if (userinfo != null && if (userinfo != null &&
userinfo.memberRankVo != null && userinfo!.memberRankVo != null &&
ranks != null && ranks != null &&
ranks.length > 0) { ranks.length > 0) {
rankLevel = (ranks rankLevel = (ranks
.indexWhere((element) => element.id == userinfo.memberRankVo.id) + .indexWhere((element) => element?.id == userinfo!.memberRankVo?.id) +
1); 1);
} }
SmartDialog.dismiss(closeType: 3); SmartDialog.dismiss(closeType: 3);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
signInfo = baseData.data; signInfo = baseData.data;
setState(() {}); setState(() {});
} }
@ -178,12 +178,12 @@ class _IntegralPage extends State<IntegralPage> {
return taskPage(position); return taskPage(position);
}, },
itemCount: (signInfo != null && itemCount: (signInfo != null &&
signInfo.taskList != null && signInfo!.taskList != null &&
signInfo.taskList.length > 0) signInfo!.taskList!.length > 0)
? (signInfo.taskList.length < 3 ? (signInfo!.taskList!.length < 3
? 1 ? 1
: (signInfo.taskList.length ~/ 3 + : (signInfo!.taskList!.length ~/ 3 +
(signInfo.taskList.length % 3 > 0 ? 1 : 0))) (signInfo!.taskList!.length % 3 > 0 ? 1 : 0)))
: 1), : 1),
), ),
), ),
@ -193,22 +193,22 @@ class _IntegralPage extends State<IntegralPage> {
} }
Widget taskPage(position) { Widget taskPage(position) {
if (signInfo == null || signInfo.taskList == null) return Container(); if (signInfo == null || signInfo!.taskList == null) return Container();
return Container( return Container(
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 16.h), margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 16.h),
child: Column( child: Column(
children: [ children: [
tashItem(signInfo.taskList[position * 3 + 0]), tashItem(signInfo!.taskList![position * 3 + 0]),
if (signInfo.taskList.length > (position * 3 + 1)) if (signInfo!.taskList!.length > (position * 3 + 1))
tashItem(signInfo.taskList[position * 3 + 1]), tashItem(signInfo!.taskList![position * 3 + 1]),
if (signInfo.taskList.length > (position * 3 + 2)) if (signInfo!.taskList!.length > (position * 3 + 2))
tashItem(signInfo.taskList[position * 3 + 2]), tashItem(signInfo!.taskList![position * 3 + 2]),
], ],
), ),
); );
} }
taskImg(String taskType) { taskImg(String? taskType) {
switch (taskType) { switch (taskType) {
case "bill_type_point_login": case "bill_type_point_login":
return "assets/image/icon_integral_share.png"; return "assets/image/icon_integral_share.png";
@ -223,14 +223,14 @@ class _IntegralPage extends State<IntegralPage> {
return "assets/image/icon_integral_share.png"; return "assets/image/icon_integral_share.png";
} }
Widget tashItem(Task task) { Widget tashItem(Task? task) {
return Container( return Container(
margin: EdgeInsets.only(top: 8.h, bottom: 8.h), margin: EdgeInsets.only(top: 8.h, bottom: 8.h),
alignment: Alignment.center, alignment: Alignment.center,
child: Row( child: Row(
children: [ children: [
Image.asset( Image.asset(
taskImg(task.type), taskImg(task!.type),
width: 24.w, width: 24.w,
height: 24.h, height: 24.h,
), ),
@ -244,7 +244,7 @@ class _IntegralPage extends State<IntegralPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
task.name, task!.name!,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@ -257,7 +257,7 @@ class _IntegralPage extends State<IntegralPage> {
Row( Row(
children: [ children: [
Text( Text(
"+${double.tryParse(task.rewardValue).toInt()}", "+${double.tryParse(task!.rewardValue!)!.toInt()}",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
color: Color(0xFF727272), color: Color(0xFF727272),
@ -356,8 +356,8 @@ class _IntegralPage extends State<IntegralPage> {
padding: EdgeInsets.all(4), padding: EdgeInsets.all(4),
decoration: BoxDecoration( decoration: BoxDecoration(
color: (signInfo != null && color: (signInfo != null &&
signInfo.signInList != null && signInfo!.signInList != null &&
signInfo.signInList.length > position) signInfo!.signInList!.length > position)
? Color(0xFF32A060) ? Color(0xFF32A060)
: Color(0xFFF0F0F2), : Color(0xFFF0F0F2),
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
@ -370,8 +370,8 @@ class _IntegralPage extends State<IntegralPage> {
"0${position + 1}", "0${position + 1}",
style: TextStyle( style: TextStyle(
color: (signInfo != null && color: (signInfo != null &&
signInfo.signInList != null && signInfo!.signInList != null &&
signInfo.signInList.length > position) signInfo!.signInList!.length > position)
? Colors.white ? Colors.white
: Color(0xFF353535), : Color(0xFF353535),
fontSize: 14.sp, fontSize: 14.sp,
@ -393,14 +393,14 @@ class _IntegralPage extends State<IntegralPage> {
), ),
child: Text( child: Text(
(signInfo != null && (signInfo != null &&
signInfo.rewardList != null && signInfo!.rewardList != null &&
signInfo.rewardList.length > position) signInfo!.rewardList!.length > position)
? "+${signInfo.rewardList[position]}" ? "+${signInfo!.rewardList![position]}"
: "+10", : "+10",
style: TextStyle( style: TextStyle(
color: (signInfo != null && color: (signInfo != null &&
signInfo.signInList != null && signInfo!.signInList != null &&
signInfo.signInList.length > position) signInfo!.signInList!.length > position)
? Colors.white ? Colors.white
: Color(0xFF727272), : Color(0xFF727272),
fontSize: 12.sp, fontSize: 12.sp,
@ -477,11 +477,11 @@ class _IntegralPage extends State<IntegralPage> {
child: RoundButton( child: RoundButton(
width: 106, width: 106,
height: 34, height: 34,
text: (signInfo != null && signInfo.todayHasSignin) text: (signInfo != null && signInfo!.todayHasSignin!)
? S.of(context).yiqiandao ? S.of(context).yiqiandao
: S.of(context).lijiqiandao, : S.of(context).lijiqiandao,
textColor: Colors.white, textColor: Colors.white,
backgroup: (signInfo != null && signInfo.todayHasSignin) backgroup: (signInfo != null && signInfo!.todayHasSignin!)
? Colors.grey ? Colors.grey
: Color(0xFF32A060), : Color(0xFF32A060),
fontSize: 16.sp, fontSize: 16.sp,
@ -498,17 +498,17 @@ class _IntegralPage extends State<IntegralPage> {
/// ///
signIn() async { signIn() async {
if ((signInfo != null && signInfo.todayHasSignin)) { if ((signInfo != null && signInfo!.todayHasSignin!)) {
SmartDialog.showToast("今日已签到了", alignment: Alignment.center); SmartDialog.showToast("今日已签到了", alignment: Alignment.center);
return; return;
} }
SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai); SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai);
BaseData baseData = await apiService.signIn(); BaseData baseData = await apiService.signIn();
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
querySignInfo(); querySignInfo();
SmartDialog.show( SmartDialog.show(
widget: SignInWidget("${signInfo.signInList.length + 1}", widget: SignInWidget("${signInfo!.signInList!.length + 1}",
"${signInfo.rewardList[signInfo.signInList.length]}")); "${signInfo!.rewardList![signInfo!.signInList!.length]}"));
} else { } else {
SmartDialog.dismiss(); SmartDialog.dismiss();
} }
@ -528,7 +528,7 @@ class _IntegralPage extends State<IntegralPage> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( Text(
signInfo != null ? "${signInfo.point}" : "0", signInfo != null ? "${signInfo!.point}" : "0",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontSize: 21.sp, fontSize: 21.sp,
@ -563,9 +563,9 @@ class _IntegralPage extends State<IntegralPage> {
.pushNamed('/router/mine_vip_level_page', arguments: { .pushNamed('/router/mine_vip_level_page', arguments: {
"rankLevel": rankLevel, "rankLevel": rankLevel,
"createTime": "createTime":
(userinfo != null) ? "${userinfo.createTime}" : "", (userinfo != null) ? "${userinfo!.createTime}" : "",
"points": "points":
(userinfo != null) ? int.tryParse(userinfo.points) : 0, (userinfo != null) ? int.tryParse(userinfo!.points!) : 0,
}); });
} else { } else {
@ -577,8 +577,8 @@ class _IntegralPage extends State<IntegralPage> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( Text(
(signInfo != null && signInfo.rank != null) (signInfo != null && signInfo!.rank != null)
? "${signInfo.rank.rankName.replaceAll("会员", "")}" ? "${signInfo!.rank!.rankName!.replaceAll("会员", "")}"
: "", : "",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,

62
lib/integral_store/integral_store_details_page.dart

@ -15,23 +15,20 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
class IntegralStoreDetailsPage extends StatefulWidget { class IntegralStoreDetailsPage extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic>? arguments;
IntegralStoreDetailsPage({this.arguments}); IntegralStoreDetailsPage({this.arguments});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _IntegralStoreDetailsPage(this.arguments); return _IntegralStoreDetailsPage();
} }
} }
class _IntegralStoreDetailsPage extends State { class _IntegralStoreDetailsPage extends State<IntegralStoreDetailsPage> {
ApiService apiService; late ApiService apiService;
String points; String? points;
final Map<String, dynamic> arguments;
_IntegralStoreDetailsPage(this.arguments);
@override @override
void initState() { void initState() {
@ -42,16 +39,16 @@ class _IntegralStoreDetailsPage extends State {
ApiService(Dio(), context: context, token: value.getString("token")); ApiService(Dio(), context: context, token: value.getString("token"));
queryGoodsById(); queryGoodsById();
if (value.getString('user') != null) { if (value.getString('user') != null) {
points = UserInfo.fromJson(jsonDecode(value.getString('user'))).points; points = UserInfo.fromJson(jsonDecode(value.getString('user')!)).points;
} }
}); });
} }
Goods goods; Goods? goods;
queryGoodsById() async { queryGoodsById() async {
BaseData<Goods> baseData = await apiService.creditGoodsById(arguments["goodsId"]); BaseData<Goods> baseData = await apiService.creditGoodsById(widget.arguments!["goodsId"]);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
setState(() { setState(() {
goods = baseData.data; goods = baseData.data;
}); });
@ -91,12 +88,12 @@ class _IntegralStoreDetailsPage extends State {
), ),
), ),
if (goods != null && if (goods != null &&
goods.detail != null && goods!.detail != null &&
goods.detail != "") goods!.detail != "")
Container( Container(
color: Colors.white, color: Colors.white,
child: Html( child: Html(
data: goods != null ? goods.detail : "", data: goods != null ? goods!.detail : "",
customImageRenders: { customImageRenders: {
base64DataUriMatcher(): base64ImageRender(), base64DataUriMatcher(): base64ImageRender(),
assetUriMatcher(): assetImageRender(), assetUriMatcher(): assetImageRender(),
@ -124,7 +121,7 @@ class _IntegralStoreDetailsPage extends State {
onTap: () { onTap: () {
if (goods != null && if (goods != null &&
points != null && points != null &&
int.tryParse(goods.price) < int.tryParse(points)) { int.tryParse(goods!.price!)! < int.tryParse(points!)!) {
toExchangeOrder(); toExchangeOrder();
} }
}, },
@ -133,7 +130,7 @@ class _IntegralStoreDetailsPage extends State {
decoration: BoxDecoration( decoration: BoxDecoration(
color: (goods != null && color: (goods != null &&
points != null && points != null &&
int.tryParse(goods.price) < int.tryParse(points)) int.tryParse(goods!.price!)! < int.tryParse(points!)!)
? Color(0xFF32A060) ? Color(0xFF32A060)
: Color(0xFFD8D8D8), : Color(0xFFD8D8D8),
borderRadius: BorderRadius.vertical( borderRadius: BorderRadius.vertical(
@ -144,7 +141,7 @@ class _IntegralStoreDetailsPage extends State {
child: Text( child: Text(
(goods != null && (goods != null &&
points != null && points != null &&
int.tryParse(goods.price) < int.tryParse(points)) int.tryParse(goods!.price!)! < int.tryParse(points!)!)
? S.of(context).duihuan ? S.of(context).duihuan
: S.of(context).jifenbuzu, : S.of(context).jifenbuzu,
style: TextStyle( style: TextStyle(
@ -165,18 +162,18 @@ class _IntegralStoreDetailsPage extends State {
toExchangeOrder() async { toExchangeOrder() async {
await Navigator.of(context) await Navigator.of(context)
.pushNamed('/router/exchange_order_page', arguments: { .pushNamed('/router/exchange_order_page', arguments: {
"goodsId": goods.id, "goodsId": goods!.id,
"name": goods.name, "name": goods!.name,
"price": goods.price, "price": goods!.price,
"image": goods.mainImgPath, "image": goods!.mainImgPath,
"useTyped": goods.canPick "useTyped": goods!.canPick!
? 1 ? 1
: goods.canDelivery : goods!.canDelivery!
? 2 ? 2
: 3, : 3,
}); });
var shared = await SharedPreferences.getInstance(); var shared = await SharedPreferences.getInstance();
points = UserInfo.fromJson(jsonDecode(shared.getString('user'))).points; points = UserInfo.fromJson(jsonDecode(shared.getString('user')!)).points;
setState(() {}); setState(() {});
} }
@ -208,7 +205,7 @@ class _IntegralStoreDetailsPage extends State {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
goods == null ? "" : goods.name, goods == null ? "" : goods!.name!,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -221,7 +218,7 @@ class _IntegralStoreDetailsPage extends State {
Text( Text(
goods == null goods == null
? "" ? ""
: S.of(context).yiduihuanjian("${goods.sales}"), : S.of(context).yiduihuanjian("${goods!.sales}"),
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@ -239,7 +236,7 @@ class _IntegralStoreDetailsPage extends State {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
goods == null ? "" : goods.description, goods == null ? "" : goods!.description!,
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@ -249,7 +246,7 @@ class _IntegralStoreDetailsPage extends State {
flex: 1, flex: 1,
), ),
Text( Text(
goods == null ? "" : S.of(context).jifen_(goods.price), goods == null ? "" : S.of(context).jifen_(goods!.price!),
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 16.sp, fontSize: 16.sp,
@ -285,13 +282,12 @@ class _IntegralStoreDetailsPage extends State {
return goods == null return goods == null
? Container() ? Container()
: Image.network( : Image.network(
goods.viceImgPaths.elementAt(position), goods!.viceImgPaths!.elementAt(position),
fit: BoxFit.cover, fit: BoxFit.cover,
); );
}, },
itemCount: (goods == null || goods.viceImgPaths == null) itemCount: (goods == null || goods!.viceImgPaths == null)
? 1 ? 1 : goods!.viceImgPaths!.length,
: goods.viceImgPaths.length,
), ),
), ),
); );

55
lib/login/login_page.dart

@ -23,7 +23,7 @@ import 'package:sharesdk_plugin/sharesdk_interface.dart';
import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
class LoginPage extends StatefulWidget { class LoginPage extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic>? arguments;
LoginPage({this.arguments}); LoginPage({this.arguments});
@ -46,20 +46,20 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
var _sendCodeStatus = 0; var _sendCodeStatus = 0;
GlobalKey loginKey = GlobalKey(); GlobalKey loginKey = GlobalKey();
ApiService client; late ApiService client;
ScrollController scrollController; late ScrollController scrollController;
final int initAlpha = 89; final int initAlpha = 89;
int alpha = 89; int alpha = 89;
int changeAlpha = 0; int changeAlpha = 0;
Animation<Alignment> animation; Animation<Alignment>? animation;
Animation<double> doubleAnimation; Animation<double>? doubleAnimation;
isLogin() async { isLogin() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (sharedPreferences.getBool("isShowPrivacyPolicy") == null || if (sharedPreferences.getBool("isShowPrivacyPolicy") == null ||
!sharedPreferences.getBool("isShowPrivacyPolicy")) { !sharedPreferences.getBool("isShowPrivacyPolicy")!) {
showAlertDialog(); showAlertDialog();
} }
@ -94,8 +94,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
animationStart(); animationStart();
scrollController.addListener(() { scrollController.addListener(() {
RenderBox renderBox = loginKey.currentContext.findRenderObject(); RenderBox renderBox = loginKey.currentContext!.findRenderObject() as RenderBox;
offsetBtn = scrollController.offset; offsetBtn = scrollController.offset;
var screenHeight = MediaQuery.of(context).size.height; var screenHeight = MediaQuery.of(context).size.height;
var scrollHeight = screenHeight * 1.47; var scrollHeight = screenHeight * 1.47;
@ -162,7 +161,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
_sendCode() async { _sendCode() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (!sharedPreferences.containsKey("isShowPrivacyPolicy") || if (!sharedPreferences.containsKey("isShowPrivacyPolicy") ||
!sharedPreferences.getBool("isShowPrivacyPolicy")) { !sharedPreferences.getBool("isShowPrivacyPolicy")!) {
showAlertDialog(); showAlertDialog();
return; return;
} }
@ -182,7 +181,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
client client
.sendVerify(mobile) .sendVerify(mobile)
.then((value) => { .then((value) => {
if (value.isSuccess) if (value.isSuccess!)
{_sendCodeStatus = 1, countdown()} {_sendCodeStatus = 1, countdown()}
else else
{ {
@ -199,17 +198,17 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
} }
} }
Timer _timer; Timer? _timer;
countdown() { countdown() {
if (_timer != null && _timer.isActive) return; if (_timer != null && _timer!.isActive) return;
int countdown = 60; int countdown = 60;
_timer = Timer.periodic(Duration(seconds: 1), (timer) { _timer = Timer.periodic(Duration(seconds: 1), (timer) {
countdown--; countdown--;
if (countdown == 0) { if (countdown == 0) {
btnText = S.of(context).send_code; btnText = S.of(context).send_code;
_sendCodeStatus = 0; _sendCodeStatus = 0;
_timer.cancel(); _timer!.cancel();
} else { } else {
btnText = S.of(context).resend_in_seconds(countdown); btnText = S.of(context).resend_in_seconds(countdown);
} }
@ -223,7 +222,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
@override @override
void dispose() { void dispose() {
if (_timer != null) _timer.cancel(); if (_timer != null) _timer!.cancel();
if (animatedContainer != null) animatedContainer.dispose(); if (animatedContainer != null) animatedContainer.dispose();
super.dispose(); super.dispose();
} }
@ -235,7 +234,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
} }
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (!sharedPreferences.containsKey("isShowPrivacyPolicy") || if (!sharedPreferences.containsKey("isShowPrivacyPolicy") ||
!sharedPreferences.getBool("isShowPrivacyPolicy")) { !sharedPreferences.getBool("isShowPrivacyPolicy")!) {
showAlertDialog(); showAlertDialog();
return; return;
} }
@ -281,7 +280,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
}); });
Future.delayed(Duration(seconds: 2), () { Future.delayed(Duration(seconds: 2), () {
SmartDialog.dismiss(); SmartDialog.dismiss();
if (value.isSuccess) { if (value.isSuccess!) {
saveUserJson(value.data); saveUserJson(value.data);
eventBus.fire(EventType(3)); eventBus.fire(EventType(3));
@ -301,21 +300,21 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
var userEntity = UserEntity.fromJson(userJson); var userEntity = UserEntity.fromJson(userJson);
SharedPreferences.getInstance().then((value) => { SharedPreferences.getInstance().then((value) => {
value.setString('userJson', jsonEncode(userJson)), value.setString('userJson', jsonEncode(userJson)),
value.setString('token', userEntity.token), value.setString('token', userEntity.token!),
value.setString('userId', userEntity.userId), value.setString('userId', userEntity.userId!),
value.setString('nick', userEntity.name), value.setString('nick', userEntity.name!),
value.setString('mobile', userEntity.mobile), value.setString('mobile', userEntity.mobile!),
}); });
} }
AnimationController animatedContainer; late AnimationController animatedContainer;
Alignment alignmentBegin; late Alignment alignmentBegin;
Alignment alignmentEnd; late Alignment alignmentEnd;
Alignment alignmentProgress; late Alignment alignmentProgress;
listener() { listener() {
alignmentProgress = animation.value; alignmentProgress = animation!.value;
setState(() {}); setState(() {});
} }
@ -351,8 +350,8 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
animation = AlignmentTween(begin: alignmentBegin, end: alignmentEnd) animation = AlignmentTween(begin: alignmentBegin, end: alignmentEnd)
.animate(animatedContainer); .animate(animatedContainer);
animation.removeListener(listener); animation!.removeListener(listener);
animation.addListener(listener); animation!.addListener(listener);
animatedContainer.removeStatusListener(statusListener); animatedContainer.removeStatusListener(statusListener);
animatedContainer.addStatusListener(statusListener); animatedContainer.addStatusListener(statusListener);
@ -897,7 +896,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
} }
scrollToTop() { scrollToTop() {
RenderBox renderBox = loginKey.currentContext.findRenderObject(); RenderBox renderBox = loginKey.currentContext!.findRenderObject() as RenderBox;
var screenHeight = MediaQuery.of(context).size.height; var screenHeight = MediaQuery.of(context).size.height;
var scrollHeight = screenHeight * 1.47; var scrollHeight = screenHeight * 1.47;
var height = scrollHeight - renderBox.size.height; var height = scrollHeight - renderBox.size.height;

16
lib/main.dart

@ -84,7 +84,7 @@ void main() async {
locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW'); locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW');
} }
initSdk(); initSdk();
bool isFirst = sharedPreferences.getBool("isFirst"); bool? isFirst = sharedPreferences.getBool("isFirst");
print("isFirst:$isFirst"); print("isFirst:$isFirst");
runApp(MyApp(locale, isFirst)); runApp(MyApp(locale, isFirst));
} }
@ -127,8 +127,8 @@ initSdk() async {
EventBus eventBus = EventBus(sync: true); EventBus eventBus = EventBus(sync: true);
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
final Locale appLocale; final Locale? appLocale;
final bool isFirst; final bool? isFirst;
MyApp(this.appLocale, this.isFirst); MyApp(this.appLocale, this.isFirst);
@ -160,9 +160,9 @@ class MyApp extends StatelessWidget {
S.delegate S.delegate
], ],
localeListResolutionCallback: localeListResolutionCallback:
(List<Locale> locales, Iterable<Locale> supportedLocales) { (List<Locale>? locales, Iterable<Locale> supportedLocales) {
print("locale: ${locales[0]}"); print("locale: ${locales![0]}");
return appLocale ?? locales[0]; return appLocale ?? locales![0];
}, },
supportedLocales: S.delegate.supportedLocales, supportedLocales: S.delegate.supportedLocales,
home: (isFirst ?? true) ? GuidePage() : LoginPage(), home: (isFirst ?? true) ? GuidePage() : LoginPage(),
@ -176,8 +176,8 @@ class MyApp extends StatelessWidget {
); );
}, },
onGenerateRoute: (settings) { onGenerateRoute: (settings) {
final String name = settings.name; final String? name = settings.name;
final Function pageContentBuilder = routers[name]; final Function? pageContentBuilder = routers[name];
if (pageContentBuilder != null) { if (pageContentBuilder != null) {
final Route route = CupertinoPageRoute( final Route route = CupertinoPageRoute(
builder: (context) { builder: (context) {

14
lib/main_page.dart

@ -25,15 +25,15 @@ class MainPage extends StatefulWidget {
} }
class _MainPage extends State<MainPage> with WidgetsBindingObserver { class _MainPage extends State<MainPage> with WidgetsBindingObserver {
List<Widget> _widgetOptions; late List<Widget> _widgetOptions;
List<String> icons; late List<String> icons;
List<String> iconn; late List<String> iconn;
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
WidgetsBinding.instance.removeObserver(this); WidgetsBinding.instance!.removeObserver(this);
} }
@override @override
@ -55,7 +55,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance!.addObserver(this);
pushRoute(); pushRoute();
@ -109,7 +109,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
value.setString("pushData", event[Platform.isAndroid ? "customMessage" : "custom"]); value.setString("pushData", event[Platform.isAndroid ? "customMessage" : "custom"]);
}); });
if (ModalRoute.of(context).isActive && ModalRoute.of(context).isCurrent) { if (ModalRoute.of(context)!.isActive && ModalRoute.of(context)!.isCurrent) {
pushRoute(); pushRoute();
} else { } else {
Navigator.of(context).pushNamedAndRemoveUntil('/router/main_page', (route) => false); Navigator.of(context).pushNamedAndRemoveUntil('/router/main_page', (route) => false);
@ -131,7 +131,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
sharedPreferences.getString("token") == "") return; sharedPreferences.getString("token") == "") return;
String startIntent = await Bridge.getStartIntent(); String startIntent = await Bridge.getStartIntent();
print("intent:$startIntent"); print("intent:$startIntent");
String pushData = ""; String? pushData = "";
if (startIntent != null && startIntent != "") { if (startIntent != null && startIntent != "") {
pushData = startIntent; pushData = startIntent;
// pushData = """{"typed":1,"info":"1420304936817655808"}"""; // pushData = """{"typed":1,"info":"1420304936817655808"}""";

33
lib/message/system_message.dart

@ -22,21 +22,20 @@ class SystemMessagePage extends StatefulWidget {
} }
class _SystemMessagePage extends State<SystemMessagePage> { class _SystemMessagePage extends State<SystemMessagePage> {
ApiService apiService; late ApiService apiService;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
apiService = apiService = ApiService(Dio(), token: value.getString("token"), context: context);
ApiService(Dio(), token: value.getString("token"), context: context);
queryMessage(); queryMessage();
}); });
} }
int pageNum = 1; int pageNum = 1;
List<Message> messages = []; List<Message?> messages = [];
_refresh() { _refresh() {
pageNum = 1; pageNum = 1;
@ -55,15 +54,15 @@ class _SystemMessagePage extends State<SystemMessagePage> {
_refreshController.refreshFailed(); _refreshController.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
if (pageNum == 1) { if (pageNum == 1) {
messages.clear(); messages.clear();
} }
messages.addAll(baseData.data.list); messages.addAll(baseData.data!.list!);
_refreshController.loadComplete(); _refreshController.loadComplete();
_refreshController.refreshCompleted(); _refreshController.refreshCompleted();
if (mounted) setState(() {}); if (mounted) setState(() {});
if (pageNum * 10 > int.tryParse(baseData.data.total)) { if (pageNum * 10 > int.tryParse(baseData.data!.total!)!) {
_refreshController.loadNoData(); _refreshController.loadNoData();
} else { } else {
pageNum += 1; pageNum += 1;
@ -93,7 +92,7 @@ class _SystemMessagePage extends State<SystemMessagePage> {
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
footer: CustomFooter( footer: CustomFooter(
loadStyle: LoadStyle.ShowWhenLoading, loadStyle: LoadStyle.ShowWhenLoading,
builder: (BuildContext context, LoadStatus mode) { builder: (BuildContext context, LoadStatus? mode) {
return MyFooter(mode); return MyFooter(mode);
}, },
), ),
@ -116,19 +115,19 @@ class _SystemMessagePage extends State<SystemMessagePage> {
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
if (messages[position].typed == 2) { if (messages[position]!.typed == 2) {
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/exchange_order_details'); .pushNamed('/router/exchange_order_details');
} }
}, },
child: buildMessageItem(messages[position]), child: buildMessageItem(messages![position]),
); );
}), }),
), ),
); );
} }
Widget buildMessageItem(Message message) { Widget buildMessageItem(Message? message) {
return Container( return Container(
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 8.h, bottom: 8.h), margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 8.h, bottom: 8.h),
padding: EdgeInsets.all(20.w), padding: EdgeInsets.all(20.w),
@ -155,7 +154,7 @@ class _SystemMessagePage extends State<SystemMessagePage> {
Row( Row(
children: [ children: [
Image.asset( Image.asset(
(message.typed == 1) (message!.typed == 1)
? "assets/image/icon_system_notices.png" ? "assets/image/icon_system_notices.png"
: (message.typed == 2) : (message.typed == 2)
? "assets/image/icon_system_order.png" ? "assets/image/icon_system_order.png"
@ -167,7 +166,7 @@ class _SystemMessagePage extends State<SystemMessagePage> {
width: 4.w, width: 4.w,
), ),
Text( Text(
(message.typed == 1) (message!.typed == 1)
? S.of(context).xitongtongzhi ? S.of(context).xitongtongzhi
: (message.typed == 2) : (message.typed == 2)
? S.of(context).dingdanxiaoxi ? S.of(context).dingdanxiaoxi
@ -181,7 +180,7 @@ class _SystemMessagePage extends State<SystemMessagePage> {
], ],
), ),
Text( Text(
message.updateTime, message!.updateTime!,
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
color: Color(0xFFA29E9E), color: Color(0xFFA29E9E),
@ -189,7 +188,7 @@ class _SystemMessagePage extends State<SystemMessagePage> {
), ),
], ],
), ),
if (message.typed != 3) if (message!.typed != 3)
Container( Container(
margin: EdgeInsets.only(left: 28.w, top: 12.h), margin: EdgeInsets.only(left: 28.w, top: 12.h),
child: Text( child: Text(
@ -204,7 +203,7 @@ class _SystemMessagePage extends State<SystemMessagePage> {
Container( Container(
margin: EdgeInsets.only(left: 28.w, top: 18.h), margin: EdgeInsets.only(left: 28.w, top: 18.h),
child: Text( child: Text(
message.title, message!.title!,
style: TextStyle( style: TextStyle(
fontSize: 20.sp, fontSize: 20.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
@ -238,7 +237,7 @@ class _SystemMessagePage extends State<SystemMessagePage> {
Container( Container(
margin: EdgeInsets.only(left: 28.w, top: 22.h), margin: EdgeInsets.only(left: 28.w, top: 22.h),
child: Text( child: Text(
message.content, message!.content!,
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
color: Color(0xFF353535), color: Color(0xFF353535),

46
lib/mine/coupons_page.dart

@ -24,13 +24,13 @@ class CouponsPage extends StatefulWidget {
} }
class _CouponsPage extends State<CouponsPage> { class _CouponsPage extends State<CouponsPage> {
ApiService apiService; late ApiService apiService;
RefreshController _refreshController; RefreshController? _refreshController;
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
_refreshController.dispose(); _refreshController?.dispose();
} }
@override @override
@ -44,7 +44,7 @@ class _CouponsPage extends State<CouponsPage> {
_refreshController = RefreshController(initialRefresh: false); _refreshController = RefreshController(initialRefresh: false);
} }
List<Coupon> coupons = []; List<Coupon?> coupons = [];
int pageNum = 1; int pageNum = 1;
int state = 1; int state = 1;
@ -61,26 +61,26 @@ class _CouponsPage extends State<CouponsPage> {
"searchKey": "", "searchKey": "",
"state": state "state": state
}).catchError((error) { }).catchError((error) {
_refreshController.loadFailed(); _refreshController?.loadFailed();
_refreshController.refreshFailed(); _refreshController?.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
if (pageNum == 1) { if (pageNum == 1) {
coupons.clear(); coupons.clear();
} }
coupons.addAll(baseData.data.list); coupons.addAll(baseData.data!.list!);
setState(() { setState(() {
_refreshController.refreshCompleted(); _refreshController?.refreshCompleted();
_refreshController.loadComplete(); _refreshController?.loadComplete();
if (baseData.data.pageNum == baseData.data.pages) { if (baseData.data!.pageNum == baseData.data!.pages) {
_refreshController.loadNoData(); _refreshController?.loadNoData();
} else { } else {
pageNum += 1; pageNum += 1;
} }
}); });
} else { } else {
_refreshController.loadFailed(); _refreshController?.loadFailed();
_refreshController.refreshFailed(); _refreshController?.refreshFailed();
} }
} }
@ -150,7 +150,7 @@ class _CouponsPage extends State<CouponsPage> {
), ),
Expanded( Expanded(
child: SmartRefresher( child: SmartRefresher(
controller: _refreshController, controller: _refreshController!,
enablePullDown: true, enablePullDown: true,
enablePullUp: true, enablePullUp: true,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
@ -170,25 +170,25 @@ class _CouponsPage extends State<CouponsPage> {
coupons[position], coupons[position],
(type) { (type) {
if (type == 1) { if (type == 1) {
receiveCoupon(coupons[position].id); receiveCoupon(coupons[position]!.id);
} else { } else {
if (coupons[position].bizType == 5) { if (coupons[position]!.bizType == 5) {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/write_off_page', '/router/write_off_page',
arguments: { arguments: {
"couponId": coupons[position].id, "couponId": coupons[position]!.id,
"coupon": coupons[position].toJson(), "coupon": coupons[position]!.toJson(),
}); });
} else { } else {
showStoreSelector( showStoreSelector(
coupons[position].storeList); coupons[position]!.storeList);
} }
} }
}, },
() { () {
setState(() { setState(() {
coupons[position].isEx = coupons[position]!.isEx =
!coupons[position].isEx; !coupons[position]!.isEx!;
}); });
}, },
type: 0, type: 0,
@ -212,7 +212,7 @@ class _CouponsPage extends State<CouponsPage> {
receiveCoupon(couponId) async { receiveCoupon(couponId) async {
BaseData baseData = await apiService.receiveCoupon(couponId); BaseData baseData = await apiService.receiveCoupon(couponId);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
_onRefresh(); _onRefresh();
showAlertDialog(); showAlertDialog();
} }

4
lib/mine/edit_name.dart

@ -5,7 +5,7 @@ import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
class EditName extends StatefulWidget { class EditName extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic>? arguments;
EditName({this.arguments}); EditName({this.arguments});
@ -64,7 +64,7 @@ class _EditName extends State<EditName> {
errorBorder: InputBorder.none, errorBorder: InputBorder.none,
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none, enabledBorder: InputBorder.none,
hintText: widget.arguments['nick'], hintText: widget.arguments!['nick'],
// contentPadding: EdgeInsets.only(top: 12, bottom: 12, left: 12), // contentPadding: EdgeInsets.only(top: 12, bottom: 12, left: 12),
hintStyle: TextStyle( hintStyle: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,

43
lib/mine/manage_address_page.dart

@ -14,7 +14,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
class ManageAddressPage extends StatefulWidget { class ManageAddressPage extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic>? arguments;
ManageAddressPage({this.arguments}); ManageAddressPage({this.arguments});
@ -25,7 +25,7 @@ class ManageAddressPage extends StatefulWidget {
} }
class _ManageAddressPage extends State<ManageAddressPage> { class _ManageAddressPage extends State<ManageAddressPage> {
ApiService apiService; late ApiService apiService;
@override @override
void initState() { void initState() {
@ -38,11 +38,11 @@ class _ManageAddressPage extends State<ManageAddressPage> {
}); });
} }
List<Address> addressList; List<Address>? addressList;
queryMemberAddress() async { queryMemberAddress() async {
BaseData<List<Address>> baseData = await apiService.queryMemberAddress(); BaseData<List<Address>> baseData = await apiService.queryMemberAddress();
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
checkIndex = 0; checkIndex = 0;
addressList = baseData.data; addressList = baseData.data;
setState(() {}); setState(() {});
@ -62,7 +62,7 @@ class _ManageAddressPage extends State<ManageAddressPage> {
body: Column( body: Column(
children: [ children: [
Expanded( Expanded(
child: (addressList == null || addressList.length == 0) child: (addressList == null || addressList!.length == 0)
? NoDataView( ? NoDataView(
isShowBtn: false, isShowBtn: false,
text: "目前暂无送货地址,请添加", text: "目前暂无送货地址,请添加",
@ -70,20 +70,20 @@ class _ManageAddressPage extends State<ManageAddressPage> {
margin: EdgeInsets.only(top: 120), margin: EdgeInsets.only(top: 120),
) )
: ListView.builder( : ListView.builder(
itemCount: addressList == null ? 0 : addressList.length, itemCount: addressList == null ? 0 : addressList!.length,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return InkWell( return InkWell(
onTap: () { onTap: () {
if (widget.arguments["isSelector"]) { if (widget.arguments!["isSelector"]) {
Navigator.of(context).pop({ Navigator.of(context).pop({
"id": "${addressList[position].id}", "id": "${addressList![position].id}",
"address": "${addressList[position].address}", "address": "${addressList![position].address}",
}); });
} }
}, },
child: child:
buildAddressItem(addressList[position], position), buildAddressItem(addressList![position], position),
); );
}, },
), ),
@ -113,7 +113,7 @@ class _ManageAddressPage extends State<ManageAddressPage> {
); );
} }
addAddress({Address address}) async { addAddress({Address? address}) async {
if (address != null) { if (address != null) {
await Navigator.of(context) await Navigator.of(context)
.pushNamed('/router/address_edit_page', arguments: address.toJson()); .pushNamed('/router/address_edit_page', arguments: address.toJson());
@ -123,7 +123,7 @@ class _ManageAddressPage extends State<ManageAddressPage> {
queryMemberAddress(); queryMemberAddress();
} }
Widget buildAddressItem(Address address, position) { Widget buildAddressItem(Address? address, position) {
return Container( return Container(
margin: EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 8), margin: EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 8),
padding: EdgeInsets.only(left: 6, right: 16, top: 16, bottom: 8), padding: EdgeInsets.only(left: 6, right: 16, top: 16, bottom: 8),
@ -149,7 +149,7 @@ class _ManageAddressPage extends State<ManageAddressPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
address.username, address!.username!,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -165,7 +165,7 @@ class _ManageAddressPage extends State<ManageAddressPage> {
children: [ children: [
Expanded( Expanded(
child: IconText( child: IconText(
address.phone, address!.phone!,
leftImage: "assets/image/icon_address_call.png", leftImage: "assets/image/icon_address_call.png",
iconSize: 16, iconSize: 16,
), ),
@ -229,7 +229,7 @@ class _ManageAddressPage extends State<ManageAddressPage> {
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: address.isDefault color: address!.isDefault!
? Color(0xFF39B54A) ? Color(0xFF39B54A)
: Color(0xFFA29E9E), : Color(0xFFA29E9E),
), ),
@ -338,20 +338,19 @@ class _ManageAddressPage extends State<ManageAddressPage> {
deleteAddress(position) async { deleteAddress(position) async {
BaseData baseData = BaseData baseData =
await apiService.deleteAddress(addressList[position].toJson()); await apiService.deleteAddress(addressList![position].toJson());
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
queryMemberAddress(); queryMemberAddress();
} }
} }
changeCheck(value, position) async { changeCheck(value, position) async {
if (value) { if (value) {
addressList[checkIndex].isDefault = false; addressList![checkIndex].isDefault = false;
checkIndex = position; checkIndex = position;
addressList[position].isDefault = true; addressList![position].isDefault = true;
BaseData baseData = BaseData baseData = await apiService.updateAddress(addressList![position].toJson());
await apiService.updateAddress(addressList[position].toJson()); if (baseData != null && baseData.isSuccess!) {}
if (baseData != null && baseData.isSuccess) {}
setState(() {}); setState(() {});
} }
} }

30
lib/mine/mine_card_invalid_page.dart

@ -21,14 +21,14 @@ class MineCardInvalidPage extends StatefulWidget {
} }
class _MineCardInvalidPage extends State<MineCardInvalidPage> { class _MineCardInvalidPage extends State<MineCardInvalidPage> {
RefreshController _refreshController; RefreshController? _refreshController;
ApiService apiService; late ApiService apiService;
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
_refreshController.dispose(); _refreshController?.dispose();
} }
@override @override
@ -44,7 +44,7 @@ class _MineCardInvalidPage extends State<MineCardInvalidPage> {
} }
int pageNum = 1; int pageNum = 1;
List<Coupon> coupons = []; List<Coupon?> coupons = [];
void _onRefresh() async { void _onRefresh() async {
pageNum = 1; pageNum = 1;
@ -59,26 +59,26 @@ class _MineCardInvalidPage extends State<MineCardInvalidPage> {
"searchKey": "", "searchKey": "",
"state": 3 "state": 3
}).catchError((error) { }).catchError((error) {
_refreshController.loadFailed(); _refreshController?.loadFailed();
_refreshController.refreshFailed(); _refreshController?.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
if (pageNum == 1) { if (pageNum == 1) {
coupons.clear(); coupons.clear();
} }
coupons.addAll(baseData.data.list); coupons.addAll(baseData.data!.list!);
setState(() { setState(() {
_refreshController.refreshCompleted(); _refreshController?.refreshCompleted();
_refreshController.loadComplete(); _refreshController?.loadComplete();
if (baseData.data.pageNum == baseData.data.pages) { if (baseData.data!.pageNum == baseData.data!.pages) {
_refreshController.loadNoData(); _refreshController?.loadNoData();
} else { } else {
pageNum += 1; pageNum += 1;
} }
}); });
} else { } else {
_refreshController.loadFailed(); _refreshController?.loadFailed();
_refreshController.refreshFailed(); _refreshController?.refreshFailed();
} }
} }
@ -102,7 +102,7 @@ class _MineCardInvalidPage extends State<MineCardInvalidPage> {
return MyFooter(mode); return MyFooter(mode);
}, },
), ),
controller: _refreshController, controller: _refreshController!,
onRefresh: _onRefresh, onRefresh: _onRefresh,
onLoading: queryCard, onLoading: queryCard,
child: ListView.builder( child: ListView.builder(

36
lib/mine/mine_page.dart

@ -27,7 +27,7 @@ class MinePage extends StatefulWidget {
} }
class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin { class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
ApiService apiService; late ApiService apiService;
_toUserInfo() async { _toUserInfo() async {
SharedPreferences shared = await SharedPreferences.getInstance(); SharedPreferences shared = await SharedPreferences.getInstance();
@ -87,34 +87,34 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
value.getString('user') != null && value.getString('user') != null &&
value.getString('user') != "") value.getString('user') != "")
{ {
userinfo = UserInfo.fromJson(jsonDecode(value.getString('user'))), userinfo = UserInfo.fromJson(jsonDecode(value.getString('user')!)),
}, },
queryUserInfo() queryUserInfo()
}, },
); );
} }
UserInfo userinfo; UserInfo? userinfo;
int rankLevel = 1; int rankLevel = 1;
List<Rank> ranks = []; List<Rank?> ranks = [];
queryUserInfo() async { queryUserInfo() async {
SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai, animationDurationTemp: Duration(seconds: 1)); SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai, animationDurationTemp: Duration(seconds: 1));
BaseData<List<Rank>> rankData = await apiService.rankList(); BaseData<List<Rank>> rankData = await apiService.rankList();
if (rankData != null && rankData.isSuccess) { if (rankData != null && rankData.isSuccess!) {
ranks.clear(); ranks.clear();
ranks.addAll(rankData.data); ranks.addAll(rankData.data!);
} }
BaseData<UserInfo> baseDate = await apiService.queryInfo(); BaseData<UserInfo> baseDate = await apiService.queryInfo();
if (baseDate != null && baseDate.isSuccess) { if (baseDate != null && baseDate.isSuccess!) {
userinfo = baseDate.data; userinfo = baseDate.data;
if (userinfo != null && if (userinfo != null &&
userinfo.memberRankVo != null && userinfo!.memberRankVo != null &&
ranks != null && ranks != null &&
ranks.length > 0) { ranks.length > 0) {
rankLevel = (ranks.indexWhere( rankLevel = (ranks.indexWhere(
(element) => element.id == userinfo.memberRankVo.id) + (element) => element?.id == userinfo!.memberRankVo?.id) +
1); 1);
} }
SharedPreferences.getInstance().then( SharedPreferences.getInstance().then(
@ -202,10 +202,10 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
arguments: { arguments: {
"rankLevel": rankLevel, "rankLevel": rankLevel,
"createTime": (userinfo != null) "createTime": (userinfo != null)
? "${userinfo.createTime}" ? "${userinfo!.createTime}"
: "", : "",
"points": (userinfo != null) "points": (userinfo != null)
? int.tryParse(userinfo.points) ? int.tryParse(userinfo!.points!)
: 0, : 0,
}); });
}); });
@ -214,14 +214,14 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
rankLevel, rankLevel,
curLevel: rankLevel, curLevel: rankLevel,
rank: (userinfo != null) rank: (userinfo != null)
? int.tryParse(userinfo.points) ? int.tryParse(userinfo!.points!)!
: 0, : 0,
rankMax: (userinfo != null && rankMax: (userinfo != null &&
userinfo.memberRankVo != null) userinfo!.memberRankVo != null)
? userinfo.memberRankVo.rankOrigin ? userinfo!.memberRankVo!.rankOrigin!
: 0, : 0,
createTime: createTime:
(userinfo != null) ? userinfo.createTime : "", (userinfo != null) ? userinfo!.createTime! : "",
), ),
), ),
orderOrCard(), orderOrCard(),
@ -564,7 +564,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
MImage( MImage(
userinfo == null ? "" : userinfo.headimg, userinfo == null ? "" : userinfo!.headimg!,
isCircle: true, isCircle: true,
width: 50, width: 50,
height: 50, height: 50,
@ -614,7 +614,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
child: Text( child: Text(
userinfo == null userinfo == null
? S.of(context).denglu ? S.of(context).denglu
: "${userinfo.nickname}", : "${userinfo!.nickname}",
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -639,7 +639,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
), ),
) )
: Text( : Text(
userinfo == null ? "" : "NO.${userinfo.vipNo}", userinfo == null ? "" : "NO.${userinfo!.vipNo}",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,

30
lib/mine/mine_vip_level_page.dart

@ -13,7 +13,7 @@ import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
class MineVipLevelPage extends StatefulWidget { class MineVipLevelPage extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic>? arguments;
MineVipLevelPage({this.arguments}); MineVipLevelPage({this.arguments});
@ -24,8 +24,8 @@ class MineVipLevelPage extends StatefulWidget {
} }
class _MineVipLevelPage extends State<MineVipLevelPage> { class _MineVipLevelPage extends State<MineVipLevelPage> {
ApiService apiService; late ApiService apiService;
List<Rank> ranks = []; List<Rank?> ranks = [];
SwiperController controller = SwiperController(); SwiperController controller = SwiperController();
@ -42,14 +42,14 @@ class _MineVipLevelPage extends State<MineVipLevelPage> {
queryVipLevel() async { queryVipLevel() async {
BaseData<List<Rank>> rankData = await apiService.rankList(); BaseData<List<Rank>> rankData = await apiService.rankList();
if (rankData != null && rankData.isSuccess) { if (rankData != null && rankData.isSuccess!) {
ranks.clear(); ranks.clear();
ranks.addAll(rankData.data); ranks.addAll(rankData.data!);
setState(() { setState(() {
controller.move((widget.arguments["rankLevel"] - 1), animation: false); controller.move((widget.arguments!["rankLevel"] - 1), animation: false);
}); });
} else { } else {
SmartDialog.showToast(rankData.msg, alignment: Alignment.center); SmartDialog.showToast(rankData.msg!, alignment: Alignment.center);
} }
} }
@ -77,11 +77,11 @@ class _MineVipLevelPage extends State<MineVipLevelPage> {
itemBuilder: (context, position) { itemBuilder: (context, position) {
return MineVipView( return MineVipView(
position + 1, position + 1,
curLevel: widget.arguments["rankLevel"], curLevel: widget.arguments!["rankLevel"],
padding: 6.w, padding: 6.w,
rank: widget.arguments["points"], rank: widget.arguments!["points"],
rankMax: (position < (ranks.length - 1)) ? ranks[position + 1].rankOrigin : ranks[position].rankOrigin, rankMax: (position < (ranks.length - 1)) ? ranks[position + 1]!.rankOrigin! : ranks[position]!.rankOrigin!,
createTime: widget.arguments["createTime"], createTime: widget.arguments!["createTime"],
); );
}, },
itemCount: (ranks != null && ranks.isNotEmpty) ? ranks.length : 0, itemCount: (ranks != null && ranks.isNotEmpty) ? ranks.length : 0,
@ -181,9 +181,9 @@ class _MineVipLevelPage extends State<MineVipLevelPage> {
children: ranks != null children: ranks != null
? ranks.map((e) { ? ranks.map((e) {
return levelItem( return levelItem(
e, ranks[ranks.indexOf(e)].rankOrigin, e, ranks[ranks.indexOf(e)]!.rankOrigin!,
ranks.indexOf(e) == (ranks.length - 1) ranks.indexOf(e) == (ranks.length - 1)
? 0 : ranks[ranks.indexOf(e) + 1].rankOrigin); ? 0 : ranks[ranks.indexOf(e) + 1]!.rankOrigin!);
}).toList() }).toList()
: [], : [],
), ),
@ -264,7 +264,7 @@ class _MineVipLevelPage extends State<MineVipLevelPage> {
); );
} }
Widget levelItem(Rank rank, rankOrigin, rankOriginMax) { Widget levelItem(Rank? rank, rankOrigin, rankOriginMax) {
return Container( return Container(
margin: EdgeInsets.symmetric(vertical: 8.h), margin: EdgeInsets.symmetric(vertical: 8.h),
child: Row( child: Row(
@ -273,7 +273,7 @@ class _MineVipLevelPage extends State<MineVipLevelPage> {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
rank.rankName, rank!.rankName!,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,

34
lib/mine/mine_wallet_page.dart

@ -34,19 +34,19 @@ class _MineWalletPage extends State<MineWalletPage> {
loadBalance(); loadBalance();
} }
UserInfo userInfo; UserInfo? userInfo;
ApiService apiService; late ApiService apiService;
int current = 1; int current = 1;
List<UserBill> userBills = []; List<UserBill?> userBills = [];
loadBalance() async { loadBalance() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
userInfo = userInfo =
UserInfo.fromJson(jsonDecode(sharedPreferences.getString('user'))); UserInfo.fromJson(jsonDecode(sharedPreferences.getString('user')!));
mBalance = double.tryParse(userInfo.money); mBalance = double.tryParse(userInfo!.money!);
if (mounted) setState(() {}); if (mounted) setState(() {});
String token = sharedPreferences.getString("token"); String token = sharedPreferences.getString("token")!;
apiService = ApiService(Dio(), context: context, token: token); apiService = ApiService(Dio(), context: context, token: token);
loadBillInfo(); loadBillInfo();
} }
@ -58,9 +58,9 @@ class _MineWalletPage extends State<MineWalletPage> {
queryUserBalance() async { queryUserBalance() async {
BaseData<UserInfo> baseData = await apiService.queryInfo(); BaseData<UserInfo> baseData = await apiService.queryInfo();
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
userInfo = baseData.data; userInfo = baseData.data;
mBalance = double.tryParse(userInfo.money); mBalance = double.tryParse(userInfo!.money!);
if (mounted) setState(() {}); if (mounted) setState(() {});
} }
} }
@ -77,14 +77,14 @@ class _MineWalletPage extends State<MineWalletPage> {
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
if (current == 1) { if (current == 1) {
userBills.clear(); userBills.clear();
} }
userBills.addAll(baseData.data.records); userBills.addAll(baseData.data!.records!);
refreshController.refreshCompleted(); refreshController.refreshCompleted();
refreshController.loadComplete(); refreshController.loadComplete();
if (current * 10 > int.tryParse(baseData.data.total)) { if (current * 10 > int.tryParse(baseData.data!.total!)!) {
refreshController.loadNoData(); refreshController.loadNoData();
} else { } else {
current += 1; current += 1;
@ -193,7 +193,7 @@ class _MineWalletPage extends State<MineWalletPage> {
padding: EdgeInsets.only(bottom: 20.h), padding: EdgeInsets.only(bottom: 20.h),
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return historyItem(userBills[position], position); return historyItem(userBills![position], position);
}), }),
), ),
], ],
@ -201,13 +201,13 @@ class _MineWalletPage extends State<MineWalletPage> {
); );
} }
Widget historyItem(UserBill userBill, position) { Widget historyItem(UserBill? userBill, position) {
return Container( return Container(
margin: EdgeInsets.only(top: 10.h, bottom: 10.h), margin: EdgeInsets.only(top: 10.h, bottom: 10.h),
child: Row( child: Row(
children: [ children: [
Image.asset( Image.asset(
userBill.pm == 0 userBill!.pm == 0
? "assets/image/icon_wallet_withdrawal.png" ? "assets/image/icon_wallet_withdrawal.png"
: "assets/image/icon_wallet_recharge.png", : "assets/image/icon_wallet_recharge.png",
width: 34.w, width: 34.w,
@ -225,14 +225,14 @@ class _MineWalletPage extends State<MineWalletPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
userBill.name, userBill.name ?? "",
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 12.sp, fontSize: 12.sp,
), ),
), ),
Text( Text(
userBill.createTime, userBill.createTime ?? "",
style: TextStyle( style: TextStyle(
color: Color(0xFF727272), color: Color(0xFF727272),
fontSize: 10.sp, fontSize: 10.sp,
@ -258,7 +258,7 @@ class _MineWalletPage extends State<MineWalletPage> {
), ),
), ),
Text( Text(
S.of(context).yue_(userBill.balance), S.of(context).yue_(userBill.balance!),
style: TextStyle( style: TextStyle(
color: Color(0xFF727272), color: Color(0xFF727272),
fontSize: 10.sp, fontSize: 10.sp,

26
lib/mine/recharge_page.dart

@ -22,7 +22,7 @@ class RechargePage extends StatefulWidget {
} }
class _RechargePage extends State<RechargePage> { class _RechargePage extends State<RechargePage> {
ApiService apiService; late ApiService apiService;
TextEditingController controller = TextEditingController(); TextEditingController controller = TextEditingController();
@ -73,7 +73,7 @@ class _RechargePage extends State<RechargePage> {
onChanged: (value) { onChanged: (value) {
if (value != null && if (value != null &&
value != "" && value != "" &&
double.tryParse(value) < 10) { double.tryParse(value)! < 10) {
color = Colors.red; color = Colors.red;
} else { } else {
color = Colors.black; color = Colors.black;
@ -207,7 +207,7 @@ class _RechargePage extends State<RechargePage> {
alignment: Alignment.center); alignment: Alignment.center);
return; return;
} }
int amount = int.tryParse(money); int amount = int.tryParse(money)!;
if (checkIndex == 1) { if (checkIndex == 1) {
if (!(await Min.isInitialize())) { if (!(await Min.isInitialize())) {
// app的充值支付使用同一个WXPayEntryActivity回调 // app的充值支付使用同一个WXPayEntryActivity回调
@ -217,20 +217,20 @@ class _RechargePage extends State<RechargePage> {
} }
BaseData<WxPay> baseData = await apiService.recharge({"amount": amount, "rechargeType": 2}); BaseData<WxPay> baseData = await apiService.recharge({"amount": amount, "rechargeType": 2});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
WxPay wxPay = baseData.data; WxPay? wxPay = baseData.data;
await registerWxApi( await registerWxApi(
appId: wxPay.appId, appId: wxPay!.appId!,
doOnAndroid: true, doOnAndroid: true,
universalLink: "https://hx.lotus-wallet.com/app/"); universalLink: "https://hx.lotus-wallet.com/app/");
payWithWeChat( payWithWeChat(
appId: wxPay.appId, appId: wxPay!.appId!,
partnerId: wxPay.partnerId, partnerId: wxPay!.partnerId!,
prepayId: wxPay.prepayId, prepayId: wxPay!.prepayId!,
packageValue: wxPay.packageValue, packageValue: wxPay!.packageValue!,
nonceStr: wxPay.nonceStr, nonceStr: wxPay!.nonceStr!,
timeStamp: int.tryParse(wxPay.timeStamp), timeStamp: int.tryParse(wxPay!.timeStamp!)!,
sign: wxPay.sign); sign: wxPay!.sign!);
weChatResponseEventHandler.listen((event) async { weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}"); print("payCallback: ${event.errCode}");
}); });

44
lib/mine/roll_center_page.dart

@ -25,9 +25,9 @@ class RollCenterPage extends StatefulWidget {
} }
class _RollCenterPage extends State<RollCenterPage> { class _RollCenterPage extends State<RollCenterPage> {
RefreshController _refreshController; RefreshController? _refreshController;
ApiService apiService; late ApiService apiService;
@override @override
void initState() { void initState() {
@ -42,7 +42,7 @@ class _RollCenterPage extends State<RollCenterPage> {
} }
int pageNum = 1; int pageNum = 1;
List<Coupon> coupons = []; List<Coupon?> coupons = [];
queryCoupon() async { queryCoupon() async {
BaseData<PageInfo<Coupon>> baseData = await apiService.queryCoupon({ BaseData<PageInfo<Coupon>> baseData = await apiService.queryCoupon({
@ -52,23 +52,23 @@ class _RollCenterPage extends State<RollCenterPage> {
"searchKey": "", "searchKey": "",
"state": 0 "state": 0
}).catchError((onError) { }).catchError((onError) {
_refreshController.refreshFailed(); _refreshController?.refreshFailed();
_refreshController.loadFailed(); _refreshController?.loadFailed();
}); });
if (pageNum == 1) coupons.clear(); if (pageNum == 1) coupons.clear();
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
coupons.addAll(baseData.data.list); coupons.addAll(baseData.data!.list!);
_refreshController.refreshCompleted(); _refreshController?.refreshCompleted();
_refreshController.loadComplete(); _refreshController?.loadComplete();
if (baseData.data.pageNum == baseData.data.pages) { if (baseData.data!.pageNum == baseData.data!.pages) {
_refreshController.loadNoData(); _refreshController?.loadNoData();
} else { } else {
pageNum += 1; pageNum += 1;
} }
setState(() {}); setState(() {});
} else { } else {
_refreshController.refreshFailed(); _refreshController?.refreshFailed();
_refreshController.loadFailed(); _refreshController?.loadFailed();
} }
} }
@ -106,11 +106,11 @@ class _RollCenterPage extends State<RollCenterPage> {
enablePullUp: true, enablePullUp: true,
header: MyHeader(), header: MyHeader(),
footer: CustomFooter( footer: CustomFooter(
builder: (BuildContext context, LoadStatus mode) { builder: (BuildContext context, LoadStatus? mode) {
return MyFooter(mode); return MyFooter(mode);
}, },
), ),
controller: _refreshController, controller: _refreshController!,
onRefresh: refreshCoupon, onRefresh: refreshCoupon,
onLoading: queryCoupon, onLoading: queryCoupon,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
@ -121,23 +121,23 @@ class _RollCenterPage extends State<RollCenterPage> {
coupons[position], coupons[position],
(type) { (type) {
if (type == 1) { if (type == 1) {
receiveCoupon(coupons[position].id); receiveCoupon(coupons[position]!.id);
} else { } else {
if (coupons[position].bizType == 5) { if (coupons[position]!.bizType == 5) {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/write_off_page', '/router/write_off_page',
arguments: { arguments: {
"couponId": coupons[position].id, "couponId": coupons[position]!.id,
"coupon": coupons[position].toJson() "coupon": coupons[position]!.toJson()
}); });
} else { } else {
showStoreSelector(coupons[position].storeList); showStoreSelector(coupons[position]!.storeList);
} }
} }
}, },
() { () {
setState(() { setState(() {
coupons[position].isEx = !coupons[position].isEx; coupons[position]!.isEx = !coupons[position]!.isEx!;
}); });
}, },
type: 1, type: 1,
@ -156,7 +156,7 @@ class _RollCenterPage extends State<RollCenterPage> {
receiveCoupon(couponId) async { receiveCoupon(couponId) async {
BaseData baseData = await apiService.receiveCoupon(couponId); BaseData baseData = await apiService.receiveCoupon(couponId);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
refreshCoupon(); refreshCoupon();
showAlertDialog(); showAlertDialog();
} }

44
lib/mine/user_info_page.dart

@ -27,7 +27,7 @@ class UserInfoPage extends StatefulWidget {
} }
class _UserInfoPage extends State<UserInfoPage> { class _UserInfoPage extends State<UserInfoPage> {
ApiService apiService; late ApiService apiService;
Map<String, dynamic> modifyInfo = { Map<String, dynamic> modifyInfo = {
"birth": "", "birth": "",
@ -41,22 +41,22 @@ class _UserInfoPage extends State<UserInfoPage> {
super.initState(); super.initState();
SharedPreferences.getInstance().then((value) => { SharedPreferences.getInstance().then((value) => {
print(value.getString('user')), print(value.getString('user')),
user = UserInfo.fromJson(jsonDecode(value.getString('user'))), user = UserInfo.fromJson(jsonDecode(value.getString('user')!)),
mobile = value.getString('mobile'), mobile = value.getString('mobile')!,
modifyInfo["nickname"] = user.nickname, modifyInfo["nickname"] = user!.nickname,
modifyInfo["birth"] = user.birth, modifyInfo["birth"] = user!.birth,
modifyInfo["headimg"] = user.headimg, modifyInfo["headimg"] = user!.headimg,
modifyInfo["sex"] = user.sex, modifyInfo["sex"] = user!.sex,
age = AppUtils.getAgeByString(user.birth), age = AppUtils.getAgeByString(user!.birth!),
refresh(), refresh(),
apiService = ApiService(Dio(), context: context, token: value.getString('token')), apiService = ApiService(Dio(), context: context, token: value.getString('token')),
}); });
} }
String age; String? age;
String mobile = ""; String mobile = "";
String locale = "zh"; String locale = "zh";
UserInfo user; UserInfo? user;
refresh() async { refresh() async {
setState(() {}); setState(() {});
@ -186,7 +186,7 @@ class _UserInfoPage extends State<UserInfoPage> {
4, 4,
(age == null || age == "") (age == null || age == "")
? S.of(context).wanshanshengrixinxi_nl ? S.of(context).wanshanshengrixinxi_nl
: S.of(context).sui(age)), : S.of(context).sui(age!)),
], ],
), ),
); );
@ -219,7 +219,7 @@ class _UserInfoPage extends State<UserInfoPage> {
}); });
if (dateTime != null ) { if (dateTime != null ) {
modifyInfo["birth"] = DateFormat("yyyy-MM-dd").format(dateTime); modifyInfo["birth"] = DateFormat("yyyy-MM-dd").format(dateTime);
user.birth = modifyInfo["birth"]; user!.birth = modifyInfo["birth"];
age = AppUtils.getAge(dateTime); age = AppUtils.getAge(dateTime);
modifyInfos(); modifyInfos();
setState(() {}); setState(() {});
@ -280,7 +280,7 @@ class _UserInfoPage extends State<UserInfoPage> {
} }
} }
String filePath; String? filePath;
/// ///
openStorage() async { openStorage() async {
@ -298,8 +298,8 @@ class _UserInfoPage extends State<UserInfoPage> {
} }
} }
Future<File> cropImage(imagePath) async { Future<File?> cropImage(imagePath) async {
File croppedFile = await ImageCropper.cropImage( File? croppedFile = await ImageCropper.cropImage(
sourcePath: imagePath, sourcePath: imagePath,
aspectRatioPresets: [ aspectRatioPresets: [
CropAspectRatioPreset.square, CropAspectRatioPreset.square,
@ -330,7 +330,7 @@ class _UserInfoPage extends State<UserInfoPage> {
/// ///
modifyInfos() async { modifyInfos() async {
var info = await apiService.editInfo(modifyInfo); var info = await apiService.editInfo(modifyInfo);
if (info.isSuccess) { if (info.isSuccess!) {
setState(() { setState(() {
SmartDialog.showToast("用户信息修改成功", alignment: Alignment.center); SmartDialog.showToast("用户信息修改成功", alignment: Alignment.center);
}); });
@ -339,11 +339,11 @@ class _UserInfoPage extends State<UserInfoPage> {
/// ///
fileUpload() async { fileUpload() async {
if (filePath != null && filePath != "" && await File(filePath).exists()) { if (filePath != null && filePath != "" && await File(filePath!).exists()) {
BaseData<UploadResult> baseData = await apiService.upload(File(filePath), 123123123); BaseData<UploadResult> baseData = await apiService.upload(File(filePath!), 123123123);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
UploadResult uploadResult = baseData.data; UploadResult? uploadResult = baseData.data;
modifyInfo["headimg"] = uploadResult.url; modifyInfo["headimg"] = uploadResult!.url;
modifyInfos(); modifyInfos();
} }
} }
@ -407,7 +407,7 @@ class _UserInfoPage extends State<UserInfoPage> {
fit: BoxFit.cover, fit: BoxFit.cover,
)) ))
: Image.file( : Image.file(
File(filePath), File(filePath!),
width: 42, width: 42,
height: 42, height: 42,
fit: BoxFit.cover, fit: BoxFit.cover,

38
lib/mine/vip_balance_page.dart

@ -24,9 +24,9 @@ class VipBalancePage extends StatefulWidget {
} }
class _VipBalancePage extends State<VipBalancePage> { class _VipBalancePage extends State<VipBalancePage> {
RefreshController _refreshController; RefreshController? _refreshController;
ApiService apiService; late ApiService apiService;
@override @override
void initState() { void initState() {
@ -42,7 +42,7 @@ class _VipBalancePage extends State<VipBalancePage> {
} }
int current = 1; int current = 1;
List<UserBill> userBills = []; List<UserBill?> userBills = [];
queryBillInfo() async { queryBillInfo() async {
BaseData<PageInfo<UserBill>> baseData = await apiService.queryBillInfo({ BaseData<PageInfo<UserBill>> baseData = await apiService.queryBillInfo({
@ -57,26 +57,26 @@ class _VipBalancePage extends State<VipBalancePage> {
"size": 10, "size": 10,
"sort": "id" "sort": "id"
}).catchError((error) { }).catchError((error) {
_refreshController.loadFailed(); _refreshController?.loadFailed();
_refreshController.refreshFailed(); _refreshController?.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
if (current == 1) { if (current == 1) {
userBills.clear(); userBills.clear();
} }
userBills.addAll(baseData.data.records); userBills.addAll(baseData.data!.records!);
setState(() { setState(() {
_refreshController.refreshCompleted(); _refreshController?.refreshCompleted();
_refreshController.loadComplete(); _refreshController?.loadComplete();
if (baseData.data.pageNum == baseData.data.pages) { if (baseData.data!.pageNum == baseData.data!.pages) {
_refreshController.loadNoData(); _refreshController?.loadNoData();
} else { } else {
current += 1; current += 1;
} }
}); });
} else { } else {
_refreshController.loadFailed(); _refreshController?.loadFailed();
_refreshController.refreshFailed(); _refreshController?.refreshFailed();
} }
} }
@ -99,7 +99,7 @@ class _VipBalancePage extends State<VipBalancePage> {
) )
: ListView.builder( : ListView.builder(
itemBuilder: (context, position) { itemBuilder: (context, position) {
return balanceItem(userBills[position]); return balanceItem(userBills![position]);
}, },
itemCount: userBills.length, itemCount: userBills.length,
), ),
@ -107,7 +107,7 @@ class _VipBalancePage extends State<VipBalancePage> {
); );
} }
Widget balanceItem(UserBill userBill) { Widget balanceItem(UserBill? userBill) {
return Container( return Container(
margin: EdgeInsets.only(left: 16.w, right: 16.w), margin: EdgeInsets.only(left: 16.w, right: 16.w),
child: Column( child: Column(
@ -122,7 +122,7 @@ class _VipBalancePage extends State<VipBalancePage> {
margin: EdgeInsets.only(left: 12.w, top: 12.h), margin: EdgeInsets.only(left: 12.w, top: 12.h),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.asset( child: Image.asset(
userBill.pm == 0 userBill?.pm == 0
? "assets/image/icon_store_c.png" ? "assets/image/icon_store_c.png"
: "assets/image/icon_wallet_recharge.png", : "assets/image/icon_wallet_recharge.png",
), ),
@ -133,7 +133,7 @@ class _VipBalancePage extends State<VipBalancePage> {
margin: EdgeInsets.only(left: 6.w, top: 12.h), margin: EdgeInsets.only(left: 6.w, top: 12.h),
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text( child: Text(
userBill.name, userBill!.name!,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 16.sp, fontSize: 16.sp,
@ -145,7 +145,7 @@ class _VipBalancePage extends State<VipBalancePage> {
), ),
Padding( Padding(
padding: EdgeInsets.only(top: 12.h), padding: EdgeInsets.only(top: 12.h),
child: Text("${userBill.pm == 0 ? "-" : "+"}${userBill.number}", child: Text("${userBill!.pm == 0 ? "-" : "+"}${userBill!.number}",
style: TextStyle(fontSize: 16, color: Color(0xffF68034))), style: TextStyle(fontSize: 16, color: Color(0xffF68034))),
), ),
], ],
@ -173,7 +173,7 @@ class _VipBalancePage extends State<VipBalancePage> {
Text.rich( Text.rich(
TextSpan(children: [ TextSpan(children: [
TextSpan( TextSpan(
text: S.of(context).yue_(userBill.balance), text: S.of(context).yue_(userBill.balance!),
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,

28
lib/mine/vip_card_page.dart

@ -21,9 +21,9 @@ class VipCardPage extends StatefulWidget {
} }
class _VipCardPage extends State<VipCardPage> { class _VipCardPage extends State<VipCardPage> {
RefreshController _refreshController; RefreshController? _refreshController;
ApiService apiService; late ApiService apiService;
@override @override
void initState() { void initState() {
@ -36,20 +36,20 @@ class _VipCardPage extends State<VipCardPage> {
}); });
} }
List<VipCard> coupons = []; List<VipCard?> coupons = [];
queryVipCard() async { queryVipCard() async {
BaseData<List<VipCard>> baseData = await apiService.vipList({}).catchError((error) { BaseData<List<VipCard>> baseData = await apiService.vipList({}).catchError((error) {
_refreshController.refreshFailed(); _refreshController?.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
coupons.clear(); coupons.clear();
coupons.addAll(baseData.data); coupons.addAll(baseData.data!);
setState(() { setState(() {
_refreshController.refreshCompleted(); _refreshController?.refreshCompleted();
}); });
} else { } else {
_refreshController.refreshFailed(); _refreshController?.refreshFailed();
} }
} }
@ -66,7 +66,7 @@ class _VipCardPage extends State<VipCardPage> {
return MyFooter(mode); return MyFooter(mode);
}, },
), ),
controller: _refreshController, controller: _refreshController!,
onRefresh: queryVipCard, onRefresh: queryVipCard,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
child: (coupons != null && coupons.length > 0) ? ListView.builder( child: (coupons != null && coupons.length > 0) ? ListView.builder(
@ -75,9 +75,9 @@ class _VipCardPage extends State<VipCardPage> {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/vip_details_page', Navigator.of(context).pushNamed('/router/vip_details_page',
arguments: {"id": coupons[position].id}); arguments: {"id": coupons![position]!.id!});
}, },
child: vipCardItem(coupons[position]), child: vipCardItem(coupons![position]),
); );
}, },
itemCount: coupons != null ? coupons.length : 0, itemCount: coupons != null ? coupons.length : 0,
@ -104,7 +104,7 @@ class _VipCardPage extends State<VipCardPage> {
return "assets/image/icon_vip_bj.png"; return "assets/image/icon_vip_bj.png";
} }
Widget vipCardItem(VipCard vipCard) { Widget vipCardItem(VipCard? vipCard) {
return Container( return Container(
margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h), margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -124,7 +124,7 @@ class _VipCardPage extends State<VipCardPage> {
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
child: Image.asset( child: Image.asset(
assetsByName(vipCard.tenantName), assetsByName(vipCard!.tenantName!),
fit: BoxFit.cover, // fit: BoxFit.cover, //
height: 170.h, height: 170.h,
), ),
@ -143,7 +143,7 @@ class _VipCardPage extends State<VipCardPage> {
Row( Row(
children: [ children: [
MImage( MImage(
(vipCard?.storeList?.length ?? 0) > 0 ? vipCard.storeList[0].logo : "", (vipCard?.storeList?.length ?? 0) > 0 ? vipCard.storeList![0]!.logo! : "",
width: 54.w, width: 54.w,
height: 54.h, height: 54.h,
fit: BoxFit.cover, fit: BoxFit.cover,

60
lib/mine/vip_detail_page.dart

@ -16,7 +16,7 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
class VipDetailPage extends StatefulWidget { class VipDetailPage extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic>? arguments;
VipDetailPage({this.arguments}); VipDetailPage({this.arguments});
@ -27,7 +27,7 @@ class VipDetailPage extends StatefulWidget {
} }
class _VipDetailPage extends State<VipDetailPage> { class _VipDetailPage extends State<VipDetailPage> {
ApiService apiService; late ApiService apiService;
@override @override
void dispose() { void dispose() {
@ -60,17 +60,17 @@ class _VipDetailPage extends State<VipDetailPage> {
Location.getInstance().startLocation(context); Location.getInstance().startLocation(context);
} }
VipCard vipCard; VipCard? vipCard;
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
int current = 1; int current = 1;
vipDetail(latitude, longitude) async { vipDetail(latitude, longitude) async {
BaseData<VipCard> baseData = await apiService.vipDetail({ BaseData<VipCard> baseData = await apiService.vipDetail({
"id": widget.arguments["id"], "id": widget.arguments!["id"],
"latitude": "$latitude", "latitude": "$latitude",
"longitude": "$longitude", "longitude": "$longitude",
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
vipCard = baseData.data; vipCard = baseData.data;
refreshController.loadComplete(); refreshController.loadComplete();
setState(() {}); setState(() {});
@ -142,12 +142,12 @@ class _VipDetailPage extends State<VipDetailPage> {
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: () {}, onTap: () {},
child: shopItem(vipCard.storeList[position]), child: shopItem(vipCard!.storeList![position]),
); );
}, },
padding: EdgeInsets.symmetric(vertical: 1), padding: EdgeInsets.symmetric(vertical: 1),
itemCount: (vipCard != null && vipCard.storeList != null) itemCount: (vipCard != null && vipCard!.storeList != null)
? vipCard.storeList.length : 0, ? vipCard!.storeList!.length : 0,
), ),
), ),
), ),
@ -190,7 +190,7 @@ class _VipDetailPage extends State<VipDetailPage> {
children: [ children: [
MImage( MImage(
(vipCard?.storeList?.length ?? 0) > 0 (vipCard?.storeList?.length ?? 0) > 0
? vipCard.storeList[0].logo ? vipCard!.storeList![0]!.logo!
: "", : "",
width: 40.w, width: 40.w,
height: 40.h, height: 40.h,
@ -215,7 +215,7 @@ class _VipDetailPage extends State<VipDetailPage> {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
vipCard != null ? vipCard.tenantName : "", vipCard != null ? vipCard!.tenantName! : "",
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
@ -269,7 +269,7 @@ class _VipDetailPage extends State<VipDetailPage> {
children: [ children: [
TextSpan( TextSpan(
text: text:
"¥ ${vipCard != null ? vipCard.balance : ""}", "¥ ${vipCard != null ? vipCard!.balance : ""}",
style: TextStyle( style: TextStyle(
fontSize: 24.sp, fontSize: 24.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -283,7 +283,7 @@ class _VipDetailPage extends State<VipDetailPage> {
onTap: () { onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/vip_balance', '/router/vip_balance',
arguments: {"storeId": vipCard.id}); arguments: {"storeId": vipCard!.id});
}, },
child: Row( child: Row(
children: [ children: [
@ -355,11 +355,11 @@ class _VipDetailPage extends State<VipDetailPage> {
padding: EdgeInsets.only(top: 5.h, bottom: 5.h), padding: EdgeInsets.only(top: 5.h, bottom: 5.h),
child: Text( child: Text(
vipCard != null vipCard != null
? "${vipCard.id.substring(0, 4)} " ? "${vipCard!.id!.substring(0, 4)} "
"${vipCard.id.substring(4, 8)} " "${vipCard!.id!.substring(4, 8)} "
"${vipCard.id.substring(8, 12)} " "${vipCard!.id!.substring(8, 12)} "
"${vipCard.id.substring(12, 16)} " "${vipCard!.id!.substring(12, 16)} "
"${vipCard.id.substring(16, vipCard.id.length)}" "${vipCard!.id!.substring(16, vipCard!.id!.length)}"
: "", : "",
maxLines: 1, maxLines: 1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -369,17 +369,17 @@ class _VipDetailPage extends State<VipDetailPage> {
wordSpacing: vipCard == null wordSpacing: vipCard == null
? 10 ? 10
: (MediaQuery.of(context).size.width - 64.w) / : (MediaQuery.of(context).size.width - 64.w) /
(((vipCard.id.length) * 4)), (((vipCard!.id!.length) * 4)),
letterSpacing: vipCard == null letterSpacing: vipCard == null
? 8 ? 8
: (MediaQuery.of(context).size.width - 64.w) / : (MediaQuery.of(context).size.width - 64.w) /
(((vipCard.id.length) * 4)), (((vipCard!.id!.length) * 4)),
), ),
), ),
), ),
BarcodeWidget( BarcodeWidget(
barcode: Barcode.code128(), barcode: Barcode.code128(),
data: vipCard == null ? "" : vipCard.id, data: vipCard == null ? "" : vipCard!.id!,
height: 30.h, height: 30.h,
color: Colors.black, color: Colors.black,
drawText: false, drawText: false,
@ -394,7 +394,7 @@ class _VipDetailPage extends State<VipDetailPage> {
); );
} }
Widget shopItem(StoreListBean store) { Widget shopItem(StoreListBean? store) {
return Container( return Container(
margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h), margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h),
child: Column( child: Column(
@ -407,7 +407,7 @@ class _VipDetailPage extends State<VipDetailPage> {
Expanded( Expanded(
flex: 1, flex: 1,
child: Text( child: Text(
(store != null) ? store.storeName : "", (store != null) ? store!.storeName! : "",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -418,7 +418,7 @@ class _VipDetailPage extends State<VipDetailPage> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/union_detail_page', Navigator.of(context).pushNamed('/router/union_detail_page',
arguments: {"id": store.id}); arguments: {"id": store!.id!});
}, },
child: Text( child: Text(
S.of(context).chakan, S.of(context).chakan,
@ -451,7 +451,7 @@ class _VipDetailPage extends State<VipDetailPage> {
), ),
Expanded( Expanded(
child: Text( child: Text(
store.address, store!.address!,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
@ -476,7 +476,7 @@ class _VipDetailPage extends State<VipDetailPage> {
S.of(context).yingyeshijian((store.openStartTime == null && S.of(context).yingyeshijian((store.openStartTime == null &&
store.openEndTime == null) store.openEndTime == null)
? S.of(context).quantian ? S.of(context).quantian
: "${store.openStartTime.substring(0, store.openStartTime.lastIndexOf(":"))} - ${store.openEndTime.substring(0, store.openEndTime.lastIndexOf(":"))}"), : "${store.openStartTime!.substring(0, store.openStartTime!.lastIndexOf(":"))} - ${store.openEndTime!.substring(0, store.openEndTime!.lastIndexOf(":"))}"),
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@ -505,14 +505,14 @@ class _VipDetailPage extends State<VipDetailPage> {
String totalPrice(orderInfo) { String totalPrice(orderInfo) {
if (orderInfo == null) return ""; if (orderInfo == null) return "";
double totalPrice = (double.tryParse(orderInfo.orderSum) + double.tryParse(orderInfo.postFee)); double totalPrice = (double.tryParse(orderInfo.orderSum)! + double.tryParse(orderInfo.postFee)!);
if (orderInfo.orderDetail != null && orderInfo.orderDetail.couponDTO != null) { if (orderInfo.orderDetail != null && orderInfo.orderDetail.couponDTO != null) {
totalPrice -= double.tryParse(orderInfo.orderDetail.couponDTO.money); totalPrice -= double.tryParse(orderInfo.orderDetail.couponDTO.money)!;
} }
return "$totalPrice"; return "$totalPrice";
} }
List<Widget> goodsItem(List<ProductList> products) { List<Widget> goodsItem(List<ProductList?> products) {
if (products == null) return []; if (products == null) return [];
if (products.length > 3) { if (products.length > 3) {
products = products.sublist(0, 3); products = products.sublist(0, 3);
@ -524,7 +524,7 @@ class _VipDetailPage extends State<VipDetailPage> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
MImage( MImage(
e.skuImg, e!.skuImg!,
width: 75.w, width: 75.w,
height: 75.h, height: 75.h,
fit: BoxFit.contain, fit: BoxFit.contain,
@ -538,7 +538,7 @@ class _VipDetailPage extends State<VipDetailPage> {
Container( Container(
width: 75.w, width: 75.w,
child: Text( child: Text(
e.productName, e!.productName!,
maxLines: 1, maxLines: 1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,

42
lib/order/exchange_history_page.dart

@ -26,9 +26,9 @@ class ExchangeHistoryPage extends StatefulWidget {
class _ExchangeHistoryPage extends State<ExchangeHistoryPage> class _ExchangeHistoryPage extends State<ExchangeHistoryPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
List<Widget> tabs; List<Widget>? tabs;
List<Widget> _pages; List<Widget>? _pages;
TabController tabcontroller; TabController? tabcontroller;
@override @override
void initState() { void initState() {
@ -91,12 +91,12 @@ class _ExchangeHistoryPage extends State<ExchangeHistoryPage>
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
labelColor: Colors.black, labelColor: Colors.black,
tabs: tabs, tabs: tabs!,
), ),
), ),
), ),
body: TabBarView( body: TabBarView(
children: _pages, children: _pages!,
controller: tabcontroller, controller: tabcontroller,
), ),
), ),
@ -116,7 +116,7 @@ class ExchangeHistoryList extends StatefulWidget {
} }
class _ExchangeHistoryList extends State<ExchangeHistoryList> { class _ExchangeHistoryList extends State<ExchangeHistoryList> {
ApiService apiService; late ApiService apiService;
RefreshController _refreshController = RefreshController _refreshController =
RefreshController(initialRefresh: false); RefreshController(initialRefresh: false);
@ -132,7 +132,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
} }
int pageNum = 1; int pageNum = 1;
List<ExchangeOrder> orders = []; List<ExchangeOrder?> orders = [];
queryHistory() async { queryHistory() async {
var map = { var map = {
@ -148,15 +148,15 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
_refreshController.loadFailed(); _refreshController.loadFailed();
_refreshController.refreshFailed(); _refreshController.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
if (pageNum == 1) { if (pageNum == 1) {
orders.clear(); orders.clear();
} }
orders.addAll(baseData.data.list); orders.addAll(baseData.data!.list!);
setState(() { setState(() {
_refreshController.loadComplete(); _refreshController.loadComplete();
_refreshController.refreshCompleted(); _refreshController.refreshCompleted();
if (baseData.data.pages == baseData.data.pageNum) { if (baseData.data!.pages == baseData.data!.pageNum) {
_refreshController.loadNoData(); _refreshController.loadNoData();
} else { } else {
pageNum += 1; pageNum += 1;
@ -180,7 +180,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
enablePullUp: true, enablePullUp: true,
header: MyHeader(), header: MyHeader(),
footer: CustomFooter( footer: CustomFooter(
builder: (BuildContext context, LoadStatus mode) { builder: (BuildContext context, LoadStatus? mode) {
return MyFooter(mode); return MyFooter(mode);
}, },
), ),
@ -197,7 +197,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
: ListView.builder( : ListView.builder(
itemCount: orders == null ? 0 : orders.length, itemCount: orders == null ? 0 : orders.length,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return buildOrder(orders[position]); return buildOrder(orders![position]);
}, },
), ),
); );
@ -219,7 +219,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
return orderStatus; return orderStatus;
} }
Widget buildOrder(ExchangeOrder exchangeOrder) { Widget buildOrder(ExchangeOrder? exchangeOrder) {
return Container( return Container(
margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h), margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h),
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
@ -241,7 +241,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( Text(
S.of(context).chuangjianshijian(exchangeOrder.createTime), S.of(context).chuangjianshijian(exchangeOrder!.createTime!),
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -249,7 +249,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
), ),
), ),
Text( Text(
orderStatus(exchangeOrder.state), orderStatus(exchangeOrder!.state),
style: TextStyle( style: TextStyle(
color: Color(0xFFFE951E), color: Color(0xFFFE951E),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -326,7 +326,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
Image.network( Image.network(
(exchangeOrder != null && (exchangeOrder != null &&
exchangeOrder.creditOrderDetailList != null) exchangeOrder.creditOrderDetailList != null)
? exchangeOrder.creditOrderDetailList[0].goodsMainImg ? exchangeOrder.creditOrderDetailList![0]!.goodsMainImg!
: "", : "",
errorBuilder: (context, error, stackTrace) { errorBuilder: (context, error, stackTrace) {
return Image.asset("assets/image/default_1.png", return Image.asset("assets/image/default_1.png",
@ -347,7 +347,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
exchangeOrder.creditOrderDetailList[0].name, exchangeOrder.creditOrderDetailList![0]!.name!,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
@ -361,7 +361,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
exchangeOrder.useTyped == 3 exchangeOrder.useTyped == 3
? S.of(context).feishiwuduihuanma ? S.of(context).feishiwuduihuanma
: exchangeOrder : exchangeOrder
.creditOrderDetailList[0].description, .creditOrderDetailList![0]!.description!,
maxLines: 2, maxLines: 2,
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
@ -399,7 +399,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
// width: 4, // width: 4,
// ), // ),
Text( Text(
S.of(context).shifujifen(exchangeOrder.amount), S.of(context).shifujifen(exchangeOrder!.amount!),
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -416,7 +416,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
IconText( IconText(
S.of(context).youxiaoqizhi(exchangeOrder.updateTime), S.of(context).youxiaoqizhi(exchangeOrder!.updateTime!),
leftImage: "assets/image/icon_order_time.png", leftImage: "assets/image/icon_order_time.png",
iconSize: 16, iconSize: 16,
textStyle: TextStyle( textStyle: TextStyle(
@ -445,7 +445,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
receive2Card(id) async { receive2Card(id) async {
BaseData baseData = await apiService.creditOrderReceive(id); BaseData baseData = await apiService.creditOrderReceive(id);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
queryHistory(); queryHistory();
} }
} }

72
lib/order/exchange_order_page.dart

@ -14,7 +14,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
class ExchangeOrderPage extends StatefulWidget { class ExchangeOrderPage extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic>? arguments;
/// ///
ExchangeOrderPage({this.arguments}); ExchangeOrderPage({this.arguments});
@ -26,7 +26,7 @@ class ExchangeOrderPage extends StatefulWidget {
} }
class _ExchangeOrderPage extends State<ExchangeOrderPage> { class _ExchangeOrderPage extends State<ExchangeOrderPage> {
ApiService apiService; late ApiService apiService;
@override @override
void initState() { void initState() {
@ -34,12 +34,11 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
SharedPreferences.getInstance().then((value) => { SharedPreferences.getInstance().then((value) => {
apiService = ApiService(Dio(), context: context, token: value.getString("token")), apiService = ApiService(Dio(), context: context, token: value.getString("token")),
points = points = UserInfo.fromJson(jsonDecode(value.getString('user')!)).points,
UserInfo.fromJson(jsonDecode(value.getString('user'))).points,
}); });
} }
String points; String? points;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -107,9 +106,9 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
width: 12, width: 12,
), ),
Text( Text(
widget.arguments["useTyped"] == 1 widget.arguments!["useTyped"] == 1
? S.of(context).ziti ? S.of(context).ziti
: widget.arguments["useTyped"] == 2 : widget.arguments!["useTyped"] == 2
? S.of(context).peisong ? S.of(context).peisong
: S.of(context).xianshangfafang, : S.of(context).xianshangfafang,
style: TextStyle( style: TextStyle(
@ -123,7 +122,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
child: SizedBox( child: SizedBox(
height: 13, height: 13,
), ),
visible: widget.arguments["useTyped"] != 3, visible: widget.arguments!["useTyped"] != 3,
), ),
Visibility( Visibility(
child: Row( child: Row(
@ -151,13 +150,12 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
Expanded( Expanded(
child: Text( child: Text(
(address != null && address != "") (address != null && address != "")
? address ? address!
: widget.arguments["useTyped"] == 1 : widget.arguments!["useTyped"] == 1
? S.of(context).qingxuanzhemendian ? S.of(context).qingxuanzhemendian
: widget.arguments["useTyped"] == : widget.arguments!["useTyped"] ==
2 2
? S ? S.of(context)
.of(context)
.qingxuanzeshouhuodizhi .qingxuanzeshouhuodizhi
: S.of(context).xuni, : S.of(context).xuni,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@ -180,7 +178,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
), ),
], ],
), ),
visible: widget.arguments["useTyped"] != 3, visible: widget.arguments!["useTyped"] != 3,
), ),
SizedBox( SizedBox(
height: 12, height: 12,
@ -188,7 +186,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
Row( Row(
children: [ children: [
Visibility( Visibility(
visible: widget.arguments["useTyped"] != 3, visible: widget.arguments!["useTyped"] != 3,
child: Text( child: Text(
S.of(context).zitishijian, S.of(context).zitishijian,
style: TextStyle( style: TextStyle(
@ -196,20 +194,20 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
), ),
), ),
Visibility( Visibility(
visible: widget.arguments["useTyped"] != 3, visible: widget.arguments!["useTyped"] != 3,
child: SizedBox( child: SizedBox(
width: 12, width: 12,
), ),
), ),
Text( Text(
widget.arguments["useTyped"] == 1 widget.arguments!["useTyped"] == 1
? S.of(context).duihuanhouwugegongzuori ? S.of(context).duihuanhouwugegongzuori
: widget.arguments["useTyped"] == 2 : widget.arguments!["useTyped"] == 2
? S.of(context).duihuanhoufahuo ? S.of(context).duihuanhoufahuo
: S.of(context).feishiwushangpin, : S.of(context).feishiwushangpin,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: widget.arguments["useTyped"] == 3 color: widget.arguments!["useTyped"] == 3
? Color(0xFF32A060) ? Color(0xFF32A060)
: Color(0xFF353535)), : Color(0xFF353535)),
), ),
@ -263,7 +261,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Image.network( Image.network(
widget.arguments["image"], widget.arguments!["image"],
fit: BoxFit.cover, fit: BoxFit.cover,
width: 80.w, width: 80.w,
height: 80.h, height: 80.h,
@ -277,7 +275,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
Text( Text(
widget.arguments["name"], widget.arguments!["name"],
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -338,7 +336,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
width: 12, width: 12,
), ),
Text( Text(
S.of(context).jifen_(widget.arguments["price"]), S.of(context).jifen_(widget.arguments!["price"]),
style: style:
TextStyle(fontSize: 12, color: Color(0xFF32A060)), TextStyle(fontSize: 12, color: Color(0xFF32A060)),
), ),
@ -379,18 +377,18 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
} }
var storeIsSelected = true; var storeIsSelected = true;
String storeId; String? storeId;
String address; String? address;
String userAddressId; String? userAddressId;
toAddressPicker() async { toAddressPicker() async {
if (widget.arguments["useTyped"] == 1) { if (widget.arguments?["useTyped"] == 1) {
dynamic result = dynamic result =
await Navigator.of(context).pushNamed('/router/store_selector_page'); await Navigator.of(context).pushNamed('/router/store_selector_page');
if (result == null) return; if (result == null) return;
storeId = result["id"]; storeId = result["id"];
address = result["address"]; address = result["address"];
} else if (widget.arguments["useTyped"] == 2) { } else if (widget.arguments?["useTyped"] == 2) {
dynamic result = await Navigator.of(context).pushNamed( dynamic result = await Navigator.of(context).pushNamed(
'/router/manage_address_page', '/router/manage_address_page',
arguments: {"isSelector": true}); arguments: {"isSelector": true});
@ -402,32 +400,32 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
} }
creditOrder() async { creditOrder() async {
if (widget.arguments["useTyped"] == 1 && if (widget.arguments?["useTyped"] == 1 &&
(storeId == null || storeId == "")) { (storeId == null || storeId == "")) {
SmartDialog.showToast("请选择一个门店", alignment: Alignment.center); SmartDialog.showToast("请选择一个门店", alignment: Alignment.center);
return; return;
} }
if (widget.arguments["useTyped"] == 2 && if (widget.arguments?["useTyped"] == 2 &&
(userAddressId == null || userAddressId == "")) { (userAddressId == null || userAddressId == "")) {
SmartDialog.showToast("请选择一个收货地址", alignment: Alignment.center); SmartDialog.showToast("请选择一个收货地址", alignment: Alignment.center);
return; return;
} }
BaseData baseDate = await apiService.creditOrder({ BaseData baseDate = await apiService.creditOrder({
"goodsId": widget.arguments["goodsId"], "goodsId": widget.arguments?["goodsId"],
"number": 1, "number": 1,
"useTyped": widget.arguments["useTyped"], "useTyped": widget.arguments?["useTyped"],
if (widget.arguments["useTyped"] == 1) "storeId": storeId, if (widget.arguments?["useTyped"] == 1) "storeId": storeId,
if (widget.arguments["useTyped"] == 2) "userAddressId": userAddressId, if (widget.arguments?["useTyped"] == 2) "userAddressId": userAddressId,
}); });
if (baseDate.isSuccess) { if (baseDate.isSuccess!) {
await Navigator.of(context).pushNamed( await Navigator.of(context).pushNamed(
'/router/exchange_order_success_page', '/router/exchange_order_success_page',
arguments: {"price": widget.arguments["price"], "points": points, "id": baseDate.data}); arguments: {"price": widget.arguments?["price"], "points": points, "id": baseDate.data});
points = points =
"${int.tryParse(points) - int.tryParse(widget.arguments["price"])}"; "${int.tryParse(points!)! - int.tryParse(widget.arguments?["price"])!}";
Navigator.of(context).pop(); Navigator.of(context).pop();
} else { } else {
SmartDialog.showToast(baseDate.msg, alignment: Alignment.center); SmartDialog.showToast(baseDate.msg!, alignment: Alignment.center);
} }
} }
} }

16
lib/order/exchange_order_success_page.dart

@ -13,7 +13,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
class ExchangeOrderSuccessPage extends StatefulWidget { class ExchangeOrderSuccessPage extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic>? arguments;
ExchangeOrderSuccessPage({this.arguments}); ExchangeOrderSuccessPage({this.arguments});
@ -25,17 +25,17 @@ class ExchangeOrderSuccessPage extends StatefulWidget {
class _ExchangeOrderSuccessPage extends State<ExchangeOrderSuccessPage> { class _ExchangeOrderSuccessPage extends State<ExchangeOrderSuccessPage> {
int price = 0; int price = 0;
ApiService apiService; late ApiService apiService;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
price = int.tryParse(widget.arguments["points"]) - price = int.tryParse(widget.arguments?["points"])! -
int.tryParse(widget.arguments["price"]); int.tryParse(widget.arguments?["price"])!;
UserInfo userInfo; UserInfo userInfo;
SharedPreferences.getInstance().then((value){ SharedPreferences.getInstance().then((value){
apiService = ApiService(Dio(), context: context, token: value.getString("token")); apiService = ApiService(Dio(), context: context, token: value.getString("token"));
userInfo = UserInfo.fromJson(jsonDecode(value.getString('user'))); userInfo = UserInfo.fromJson(jsonDecode(value.getString('user')!));
userInfo.points = "$price"; userInfo.points = "$price";
value.setString('user', jsonEncode(userInfo.toJson())); value.setString('user', jsonEncode(userInfo.toJson()));
}); });
@ -87,7 +87,7 @@ class _ExchangeOrderSuccessPage extends State<ExchangeOrderSuccessPage> {
child: Column( child: Column(
children: [ children: [
Text( Text(
widget.arguments["price"], widget.arguments?["price"],
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 21.sp, fontSize: 21.sp,
@ -200,8 +200,8 @@ class _ExchangeOrderSuccessPage extends State<ExchangeOrderSuccessPage> {
} }
receiveToCard() async { receiveToCard() async {
BaseData baseData = await apiService.receiveToCard(widget.arguments["id"]); BaseData baseData = await apiService.receiveToCard(widget.arguments?["id"]);
if(baseData != null && baseData.isSuccess) { if(baseData != null && baseData.isSuccess!) {
await Navigator.of(context).pushNamed('/router/mine_card'); await Navigator.of(context).pushNamed('/router/mine_card');
Navigator.of(context).pop(); Navigator.of(context).pop();
} }

38
lib/order/logistics_information_page.dart

@ -23,8 +23,8 @@ class LogisticsInformationPage extends StatefulWidget {
} }
class _LogisticsInformationPage extends State<LogisticsInformationPage> { class _LogisticsInformationPage extends State<LogisticsInformationPage> {
ApiService apiService; late ApiService apiService;
RefreshController _refreshController; RefreshController? _refreshController;
@override @override
void initState() { void initState() {
@ -39,26 +39,28 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
}); });
} }
List<TracesBean> logistics = []; List<TracesBean?> logistics = [];
String shipStatus = ""; String shipStatus = "";
getShippingTrace(String shipperCode, String logisticCode) async { getShippingTrace(String shipperCode, String logisticCode) async {
BaseData<Logistics> baseData = await apiService BaseData<Logistics> baseData = await apiService
.shippingTrace(shipperCode, logisticCode) .shippingTrace(shipperCode, logisticCode)
.catchError((error) { .catchError((error) {
_refreshController.refreshFailed(); _refreshController?.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
Logistics lgs = baseData.data; Logistics? lgs = baseData.data;
logistics.clear(); logistics.clear();
logistics.addAll(lgs.traces.reversed); logistics.addAll(lgs!.traces!.reversed);
setState(() { setState(() {
shipStatus = logisticsStatus(lgs.state); shipStatus = logisticsStatus(lgs.state);
if (logistics.length > 0) logistics[0].acceptStation += shipStatus; if (logistics.length > 0) {
_refreshController.refreshCompleted(); logistics![0]!.acceptStation = logistics![0]!.acceptStation! + shipStatus;
}
_refreshController?.refreshCompleted();
}); });
} else { } else {
_refreshController.refreshFailed(); _refreshController?.refreshFailed();
} }
} }
@ -121,7 +123,7 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
itemCount: itemCount:
logistics != null ? logistics.length : 0, logistics != null ? logistics.length : 0,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return orderTrackItem(logistics[position], return orderTrackItem(logistics![position],
position, logistics.length); position, logistics.length);
}) })
: NoDataView( : NoDataView(
@ -299,7 +301,7 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
); );
} }
Widget orderTrackItem(TracesBean logistics, var position, var size) { Widget orderTrackItem(TracesBean? logistics, var position, var size) {
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -309,7 +311,7 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
// crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
logistics.acceptTime.split(" ")[0], logistics!.acceptTime!.split(" ")[0],
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -319,7 +321,7 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
height: 5.h, height: 5.h,
), ),
Text( Text(
logistics.acceptTime.split(" ")[1], logistics!.acceptTime!.split(" ")[1],
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -333,7 +335,7 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
Column( Column(
children: [ children: [
Image.asset( Image.asset(
tripStatus(logistics.acceptStation), tripStatus(logistics!.acceptStation!),
width: 24.w, width: 24.w,
height: 24.h, height: 24.h,
), ),
@ -355,9 +357,9 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (logisticsTripStatus(logistics.acceptStation) != "") if (logisticsTripStatus(logistics!.acceptStation!) != "")
Text( Text(
logisticsTripStatus(logistics.acceptStation), logisticsTripStatus(logistics!.acceptStation!),
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -367,7 +369,7 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
height: 10.h, height: 10.h,
), ),
Text( Text(
logistics.acceptStation, logistics!.acceptStation!,
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,

95
lib/order/order_detail_page.dart

@ -9,10 +9,7 @@ import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/view_widget/border_text.dart'; import 'package:huixiang/view_widget/border_text.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/icon_text.dart'; import 'package:huixiang/view_widget/icon_text.dart';
import 'package:huixiang/view_widget/login_tips.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/pay_input_view.dart';
import 'package:huixiang/view_widget/request_permission.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
import 'package:huixiang/view_widget/separator.dart'; import 'package:huixiang/view_widget/separator.dart';
import 'package:huixiang/view_widget/text_image_dialog.dart'; import 'package:huixiang/view_widget/text_image_dialog.dart';
@ -32,7 +29,7 @@ class OrderDetailPage extends StatefulWidget {
} }
class _OrderDetailPage extends State<OrderDetailPage> { class _OrderDetailPage extends State<OrderDetailPage> {
ApiService apiService; late ApiService apiService;
@override @override
void initState() { void initState() {
@ -45,7 +42,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
}); });
} }
OrderInfo orderInfo; OrderInfo? orderInfo;
int payStatus = 0; int payStatus = 0;
int orderStatus = 0; int orderStatus = 0;
int sendStatus = 0; int sendStatus = 0;
@ -56,13 +53,13 @@ class _OrderDetailPage extends State<OrderDetailPage> {
queryDetails() async { queryDetails() async {
BaseData<OrderInfo> baseData = await apiService.orderDetail(widget.arguments["id"]); BaseData<OrderInfo> baseData = await apiService.orderDetail(widget.arguments["id"]);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
orderInfo = baseData.data; orderInfo = baseData.data;
payStatus = orderInfo.payStatus; payStatus = orderInfo!.payStatus!;
orderStatus = orderInfo.orderStatus; orderStatus = orderInfo!.orderStatus!;
sendStatus = orderInfo.sendStatus; sendStatus = orderInfo!.sendStatus!;
isTakeOut = orderInfo.isTakeOut; isTakeOut = orderInfo!.isTakeOut!;
refundStatus = orderInfo.refundStatus; refundStatus = orderInfo!.refundStatus!;
// storeType = orderInfo.storeVO.posType.code; // storeType = orderInfo.storeVO.posType.code;
print("refund_status: $refundStatus"); print("refund_status: $refundStatus");
print("payStatus: $payStatus"); print("payStatus: $payStatus");
@ -223,7 +220,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
String minute = ""; String minute = "";
if (payStatus == 0) { if (payStatus == 0) {
String hourMinute = AppUtils.getHourMinuteAfter30mByString( String hourMinute = AppUtils.getHourMinuteAfter30mByString(
(orderInfo != null) ? orderInfo.createTime : ""); (orderInfo != null) ? orderInfo!.createTime! : "");
var hourMinutes = hourMinute.split(":"); var hourMinutes = hourMinute.split(":");
hour = hourMinutes[0]; hour = hourMinutes[0];
minute = hourMinutes[1]; minute = hourMinutes[1];
@ -232,8 +229,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
} else if (isTakeOut == 1) { } else if (isTakeOut == 1) {
if (sendStatus == 2 || sendStatus == 3) { if (sendStatus == 2 || sendStatus == 3) {
String hourMinute = AppUtils.getHourMinuteByString( String hourMinute = AppUtils.getHourMinuteByString(
(orderInfo != null && orderInfo.orderDetail != null) (orderInfo != null && orderInfo!.orderDetail != null)
? orderInfo.orderDetail.predictTime ? orderInfo!.orderDetail!.predictTime!
: ""); : "");
var hourMinutes = hourMinute.split(":"); var hourMinutes = hourMinute.split(":");
hour = hourMinutes[0]; hour = hourMinutes[0];
@ -307,7 +304,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
break; break;
case 3: case 3:
title = S.of(context).dengdaiyonghuqucan; title = S.of(context).dengdaiyonghuqucan;
center = S.of(context).qudanhao(orderInfo.dayFlowCode); center = S.of(context).qudanhao(orderInfo!.dayFlowCode!);
break; break;
case 4: case 4:
title = S.of(context).dingdanyiwancheng; title = S.of(context).dingdanyiwancheng;
@ -430,7 +427,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
Text( Text(
S S
.of(context) .of(context)
.yuan_(orderInfo != null ? orderInfo.finalPayPrice : "0"), .yuan_(orderInfo != null ? orderInfo!.finalPayPrice! : "0"),
style: TextStyle( style: TextStyle(
fontSize: 20.sp, fontSize: 20.sp,
color: Color(0xFF32A060), color: Color(0xFF32A060),
@ -656,8 +653,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
height: 28.h, height: 28.h,
), ),
Text( Text(
(orderInfo != null && orderInfo.addressExt != null) (orderInfo != null && orderInfo!.addressExt != null)
? (orderInfo.addressExt.recName ?? "") ? (orderInfo!.addressExt!.recName! ?? "")
: "", : "",
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -670,8 +667,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
), ),
Expanded( Expanded(
child: Text( child: Text(
(orderInfo != null && orderInfo.addressExt != null) (orderInfo != null && orderInfo!.addressExt != null)
? (orderInfo.addressExt.recMobile ?? "") ? (orderInfo!.addressExt!.recMobile! ?? "")
: "", : "",
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -690,8 +687,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
Container( Container(
margin: EdgeInsets.only(left: 28.w), margin: EdgeInsets.only(left: 28.w),
child: Text( child: Text(
(orderInfo != null && orderInfo.addressExt != null) (orderInfo != null && orderInfo!.addressExt != null)
? (orderInfo.addressExt.address ?? "") ? (orderInfo!.addressExt!.address ?? "")
: "", : "",
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -736,8 +733,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
(open) { (open) {
if (open) { if (open) {
String mobile = (orderInfo != null && String mobile = (orderInfo != null &&
orderInfo.storeVO != null) orderInfo!.storeVO != null)
? (orderInfo.storeVO.mobile ?? "") ? (orderInfo!.storeVO!.mobile ?? "")
: ""; : "";
if (mobile != "") { if (mobile != "") {
callMobile(mobile); callMobile(mobile);
@ -870,34 +867,34 @@ class _OrderDetailPage extends State<OrderDetailPage> {
List<Widget> commodityList() { List<Widget> commodityList() {
if (orderInfo == null) return []; if (orderInfo == null) return [];
List<Widget> widgets = []; List<Widget> widgets = [];
if (orderInfo.productList != null) { if (orderInfo!.productList != null) {
widgets widgets
.addAll(orderInfo.productList.map((e) => commodityItem(e)).toList()); .addAll(orderInfo!.productList!.map((e) => commodityItem(e)).toList());
} }
widgets.add(SizedBox(height: 20.h)); widgets.add(SizedBox(height: 20.h));
if (orderInfo.isTakeOut != 0) { if (orderInfo!.isTakeOut != 0) {
// //
widgets.add(discountItem( widgets.add(discountItem(
Color(0xFFFF7A1A), Color(0xFFFF7A1A),
orderInfo.isTakeOut == 1 orderInfo!.isTakeOut == 1
? S.of(context).peisongfei ? S.of(context).peisongfei
: S.of(context).yunfei, : S.of(context).yunfei,
"", "",
"+${orderInfo.postFee}")); "+${orderInfo!.postFee}"));
} }
if (orderInfo.orderDetail != null && if (orderInfo!.orderDetail != null &&
orderInfo.orderDetail.couponDTO != null) { orderInfo!.orderDetail!.couponDTO != null) {
// //
widgets.add(discountItem( widgets.add(discountItem(
Color(0xFF32A060), Color(0xFF32A060),
"优惠券", "优惠券",
orderInfo.orderDetail.couponDTO.name, orderInfo!.orderDetail!.couponDTO!.name,
orderInfo.orderDetail.couponDTO.money)); orderInfo!.orderDetail!.couponDTO!.money));
} }
if (orderInfo.storeVO != null && orderInfo.storeVO.couponVO != null) { if (orderInfo!.storeVO != null && orderInfo!.storeVO!.couponVO != null) {
// widgets.add(discountItem(Color(0xFF32A060), // widgets.add(discountItem(Color(0xFF32A060),
// orderInfo.storeVO.couponVO.storeName, // orderInfo.storeVO.couponVO.storeName,
// S.of(context).huodongjianmianpeisongfei(orderInfo.storeVO.couponVO.discountAmount), // S.of(context).huodongjianmianpeisongfei(orderInfo.storeVO.couponVO.discountAmount),
@ -1010,14 +1007,14 @@ class _OrderDetailPage extends State<OrderDetailPage> {
child: Column( child: Column(
children: [ children: [
orderInfoItem( orderInfoItem(
S.of(context).dingdanhao, orderInfo != null ? orderInfo.id : ""), S.of(context).dingdanhao, orderInfo != null ? orderInfo!.id : ""),
orderInfoItem(S.of(context).xiadanshijian, orderInfoItem(S.of(context).xiadanshijian,
orderInfo != null ? orderInfo.createTime : ""), orderInfo != null ? orderInfo!.createTime : ""),
// orderInfoItem(S.of(context).peisongfangshi, orderInfo != null ? orderInfo.createTime : ""), // orderInfoItem(S.of(context).peisongfangshi, orderInfo != null ? orderInfo.createTime : ""),
orderInfoItem( orderInfoItem(
S.of(context).beizhu, S.of(context).beizhu,
orderInfo != null orderInfo != null
? orderInfo.notes ?? S.of(context).qingshurubeizhuyaoqiu ? orderInfo!.notes ?? S.of(context).qingshurubeizhuyaoqiu
: S.of(context).qingshurubeizhuyaoqiu), : S.of(context).qingshurubeizhuyaoqiu),
orderInfoItem(S.of(context).zhifufangshi, orderInfoItem(S.of(context).zhifufangshi,
orderInfo != null ? payChannel() : S.of(context).yue), orderInfo != null ? payChannel() : S.of(context).yue),
@ -1027,7 +1024,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
} }
String payChannel() { String payChannel() {
switch (orderInfo.payChannel) { switch (orderInfo!.payChannel) {
case 0: case 0:
return "现金支付"; return "现金支付";
case 1: case 1:
@ -1091,13 +1088,13 @@ class _OrderDetailPage extends State<OrderDetailPage> {
); );
} }
Widget commodityItem(ProductList productList) { Widget commodityItem(ProductList? productList) {
return Container( return Container(
margin: EdgeInsets.only(top: 8.h, bottom: 8.h), margin: EdgeInsets.only(top: 8.h, bottom: 8.h),
child: Row( child: Row(
children: [ children: [
MImage( MImage(
productList.skuImg, productList!.skuImg!,
width: 44.w, width: 44.w,
height: 44.w, height: 44.w,
fit: BoxFit.cover, fit: BoxFit.cover,
@ -1120,7 +1117,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( Text(
productList.productName, productList!.productName!,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 14.sp, fontSize: 14.sp,
@ -1154,7 +1151,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
), ),
), ),
Text( Text(
S.of(context).yuan_(productList.sellPrice), S.of(context).yuan_(productList!.sellPrice!),
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 12.sp, fontSize: 12.sp,
@ -1231,8 +1228,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
Expanded( Expanded(
child: Text( child: Text(
S.of(context).gongjijianshangpin( S.of(context).gongjijianshangpin(
(orderInfo != null && orderInfo.productList != null) (orderInfo != null && orderInfo!.productList != null)
? orderInfo.productList.length ? orderInfo!.productList!.length
: "0"), : "0"),
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
@ -1268,11 +1265,11 @@ class _OrderDetailPage extends State<OrderDetailPage> {
String totalPrice() { String totalPrice() {
if (orderInfo == null) return ""; if (orderInfo == null) return "";
double totalPrice = (double.tryParse(orderInfo.orderSum) + double totalPrice = (double.tryParse(orderInfo!.orderSum!)! +
double.tryParse(orderInfo.postFee)); double.tryParse(orderInfo!.postFee!)!)!;
if (orderInfo.orderDetail != null && if (orderInfo!.orderDetail != null &&
orderInfo.orderDetail.couponDTO != null) { orderInfo!.orderDetail!.couponDTO != null) {
totalPrice -= double.tryParse(orderInfo.orderDetail.couponDTO.money); totalPrice -= double.tryParse(orderInfo!.orderDetail!.couponDTO!.money!)!;
} }
return "$totalPrice"; return "$totalPrice";
} }

52
lib/order/order_history_page.dart

@ -25,8 +25,8 @@ class OrderHistoryPage extends StatefulWidget {
class _OrderHistoryPage extends State<OrderHistoryPage> class _OrderHistoryPage extends State<OrderHistoryPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
List<Widget> _pages; List<Widget>? _pages;
TabController tabcontroller; TabController? tabcontroller;
@override @override
void didChangeDependencies() { void didChangeDependencies() {
@ -91,7 +91,7 @@ class _OrderHistoryPage extends State<OrderHistoryPage>
), ),
), ),
body: TabBarView( body: TabBarView(
children: _pages, children: _pages!,
controller: tabcontroller, controller: tabcontroller,
), ),
), ),
@ -137,9 +137,9 @@ class _OrderHistoryList extends State<OrderHistoryList>
return InkWell( return InkWell(
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/order_details', Navigator.of(context).pushNamed('/router/order_details',
arguments: {"id": orderInfos[position].id}); arguments: {"id": orderInfos[position]!.id!});
}, },
child: orderItem(orderInfos[position]), child: orderItem(orderInfos[position]!),
); );
}) })
: NoDataView( : NoDataView(
@ -153,7 +153,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
bool isRemake = true; bool isRemake = true;
ApiService apiService; late ApiService apiService;
int current = 1; int current = 1;
_onRefresh() { _onRefresh() {
@ -161,7 +161,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
queryOrder(); queryOrder();
} }
List<OrderInfo> orderInfos = []; List<OrderInfo?> orderInfos = [];
queryOrder() async { queryOrder() async {
BaseData<PageInfo<OrderInfo>> baseData = await apiService.orderList({ BaseData<PageInfo<OrderInfo>> baseData = await apiService.orderList({
@ -175,14 +175,14 @@ class _OrderHistoryList extends State<OrderHistoryList>
refreshController.loadFailed(); refreshController.loadFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
if (current == 1) { if (current == 1) {
orderInfos.clear(); orderInfos.clear();
} }
orderInfos.addAll(baseData.data.records); orderInfos.addAll(baseData.data!.records!);
refreshController.refreshCompleted(); refreshController.refreshCompleted();
refreshController.loadComplete(); refreshController.loadComplete();
if (current * 10 > int.tryParse(baseData.data.total)) { if (current * 10 > int.tryParse(baseData.data!.total!)!) {
refreshController.loadNoData(); refreshController.loadNoData();
} else { } else {
current += 1; current += 1;
@ -250,7 +250,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
margin: EdgeInsets.only(left: 6.w, top: 12.h), margin: EdgeInsets.only(left: 6.w, top: 12.h),
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text( child: Text(
(orderInfo != null) ? orderInfo.storeName : "", (orderInfo != null) ? orderInfo.storeName! : "",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 14.sp, fontSize: 14.sp,
@ -265,7 +265,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
child: Text( child: Text(
(orderInfo != null && (orderInfo != null &&
orderInfo.storeVO != null && orderInfo.storeVO != null &&
orderInfo.storeVO.posType != null) orderInfo.storeVO!.posType != null)
? StatusUtils.statusText( ? StatusUtils.statusText(
context, context,
orderInfo.refundStatus, orderInfo.refundStatus,
@ -280,7 +280,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
color: (orderInfo == null) color: (orderInfo == null)
? Color(0xFF32A060) ? Color(0xFF32A060)
: (orderInfo.refundStatus == 1 || : (orderInfo.refundStatus == 1 ||
orderInfo.orderStatus >= 5) orderInfo.orderStatus! >= 5)
? Colors.grey ? Colors.grey
: (orderInfo.orderStatus == 4) : (orderInfo.orderStatus == 4)
? Color(0xFF32A060) ? Color(0xFF32A060)
@ -298,7 +298,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
children: [ children: [
Text( Text(
S.of(context).xiadanshijian_( S.of(context).xiadanshijian_(
(orderInfo != null) ? orderInfo.createTime : ""), (orderInfo != null) ? orderInfo.createTime! : ""),
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 10.sp,
color: Color(0xFF727272), color: Color(0xFF727272),
@ -317,8 +317,8 @@ class _OrderHistoryList extends State<OrderHistoryList>
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: goodsItem((orderInfo != null && children: goodsItem((orderInfo != null &&
orderInfo.productList != null) orderInfo!.productList != null)
? orderInfo.productList ? orderInfo!.productList
: null), : null),
), ),
), ),
@ -363,7 +363,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
TextSpan( TextSpan(
text: (orderInfo != null && text: (orderInfo != null &&
orderInfo.productList != null) orderInfo.productList != null)
? "${orderInfo.productList.length}" ? "${orderInfo.productList!.length}"
: "0", : "0",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
@ -430,9 +430,9 @@ class _OrderHistoryList extends State<OrderHistoryList>
orderInfo.logisticsName, orderInfo.logisticsName,
orderInfo.logisticsNum, orderInfo.logisticsNum,
orderInfo.shipperCode, orderInfo.shipperCode,
orderInfo.productList.length, orderInfo.productList!.length,
orderInfo.productList.length > 0 orderInfo.productList!.length > 0
? orderInfo.productList[0].skuImg ? orderInfo.productList![0]!.skuImg
: "") : "")
: [], : [],
), ),
@ -447,16 +447,16 @@ class _OrderHistoryList extends State<OrderHistoryList>
String totalPrice(orderInfo) { String totalPrice(orderInfo) {
if (orderInfo == null) return ""; if (orderInfo == null) return "";
double totalPrice = (double.tryParse(orderInfo.orderSum) + double totalPrice = (double.tryParse(orderInfo.orderSum)! +
double.tryParse(orderInfo.postFee)); double.tryParse(orderInfo.postFee)!);
if (orderInfo.orderDetail != null && if (orderInfo.orderDetail != null &&
orderInfo.orderDetail.couponDTO != null) { orderInfo.orderDetail.couponDTO != null) {
totalPrice -= double.tryParse(orderInfo.orderDetail.couponDTO.money); totalPrice -= double.tryParse(orderInfo.orderDetail.couponDTO.money)!;
} }
return "$totalPrice"; return "$totalPrice";
} }
List<Widget> goodsItem(List<ProductList> products) { List<Widget> goodsItem(List<ProductList?>? products) {
if (products == null) return []; if (products == null) return [];
if (products.length > 3) { if (products.length > 3) {
products = products.sublist(0, 3); products = products.sublist(0, 3);
@ -470,7 +470,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
MImage( MImage(
e.skuImg, e!.skuImg!,
width: 75.w, width: 75.w,
height: 75.w, height: 75.w,
fit: BoxFit.cover, fit: BoxFit.cover,
@ -484,7 +484,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
Container( Container(
width: 75.w, width: 75.w,
child: Text( child: Text(
e.productName, e!.productName!,
maxLines: 1, maxLines: 1,
textAlign: TextAlign.center, textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,

48
lib/order/store_selector_page.dart

@ -13,7 +13,6 @@ import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/store.dart'; import 'package:huixiang/retrofit/data/store.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/view_widget/icon_text.dart'; import 'package:huixiang/view_widget/icon_text.dart';
import 'package:huixiang/view_widget/loading_view.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/request_permission.dart'; import 'package:huixiang/view_widget/request_permission.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
@ -28,14 +27,14 @@ class StoreSelectorPage extends StatefulWidget {
} }
class _StoreSelectorPage extends State<StoreSelectorPage> { class _StoreSelectorPage extends State<StoreSelectorPage> {
ApiService apiService; late ApiService apiService;
LocationFlutterPlugin aMapFlutterLocation; LocationFlutterPlugin? aMapFlutterLocation;
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
aMapFlutterLocation.stopLocation(); aMapFlutterLocation?.stopLocation();
} }
@override @override
@ -49,17 +48,17 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
if (aMapFlutterLocation == null) { if (aMapFlutterLocation == null) {
aMapFlutterLocation = LocationFlutterPlugin(); aMapFlutterLocation = LocationFlutterPlugin();
aMapFlutterLocation.onResultCallback().listen((event) { aMapFlutterLocation!.onResultCallback().listen((event) {
if (event != null && if (event != null &&
event["latitude"] != null && event["latitude"] != null &&
event["longitude"] != null) { event["longitude"] != null) {
print("location: $event"); print("location: $event");
aMapFlutterLocation.stopLocation(); aMapFlutterLocation!.stopLocation();
if (event["latitude"] is String && event["longitude"] is String) { if (event["latitude"] is String && event["longitude"] is String) {
latLng = BMFCoordinate(double.tryParse(event["latitude"]), latLng = BMFCoordinate(double.tryParse(event["latitude"] as String),
double.tryParse(event["longitude"])); double.tryParse(event["longitude"] as String));
} else { } else {
latLng = BMFCoordinate(event["latitude"], event["longitude"]); latLng = BMFCoordinate(event["latitude"] as double, event["longitude"] as double);
} }
BMFCalculateUtils.coordConvert( BMFCalculateUtils.coordConvert(
coordinate: latLng, coordinate: latLng,
@ -75,7 +74,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
}); });
} }
aMapFlutterLocation.prepareLoc({ aMapFlutterLocation?.prepareLoc({
"coorType": "bd09ll", "coorType": "bd09ll",
"isNeedAddres": false, "isNeedAddres": false,
"isNeedAltitude": false, "isNeedAltitude": false,
@ -91,7 +90,6 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
"reGeocodeTimeout": 10, "reGeocodeTimeout": 10,
"activityType": "CLActivityTypeAutomotiveNavigation", "activityType": "CLActivityTypeAutomotiveNavigation",
"BMKLocationCoordinateType": "BMKLocationCoordinateTypeBMK09LL", "BMKLocationCoordinateType": "BMKLocationCoordinateTypeBMK09LL",
"BMKLocationCoordinateType": "BMKLocationCoordinateTypeBMK09LL",
"isNeedNewVersionRgc": false, "isNeedNewVersionRgc": false,
}); });
@ -107,8 +105,8 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
await prefs.setString("district", district ?? ""); await prefs.setString("district", district ?? "");
} }
List<Store> storeList; List<Store>? storeList;
BMFCoordinate latLng; BMFCoordinate? latLng;
startLocation() async { startLocation() async {
if (!(await Permission.locationWhenInUse.serviceStatus.isEnabled)) { if (!(await Permission.locationWhenInUse.serviceStatus.isEnabled)) {
@ -120,7 +118,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
requestDialog(); requestDialog();
} else if (await Permission.location.isGranted) { } else if (await Permission.location.isGranted) {
SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai, animationDurationTemp: Duration(seconds: 1)); SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai, animationDurationTemp: Duration(seconds: 1));
aMapFlutterLocation.startLocation(); aMapFlutterLocation?.startLocation();
Future.delayed(Duration(seconds: 6), () { Future.delayed(Duration(seconds: 6), () {
SmartDialog.dismiss(); SmartDialog.dismiss();
}); });
@ -191,8 +189,8 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
value.containsKey("city") && value.containsKey("city") &&
value.containsKey("district")) value.containsKey("district"))
{ {
latLng = BMFCoordinate(double.tryParse(value.getString("latitude")), latLng = BMFCoordinate(double.tryParse(value.getString("latitude")!),
double.tryParse(value.getString("longitude"))), double.tryParse(value.getString("longitude")!)),
queryStore( queryStore(
value.getString("latitude"), value.getString("latitude"),
value.getString("longitude"), value.getString("longitude"),
@ -218,7 +216,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
"province": "", "province": "",
"searchKey": "" "searchKey": ""
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
storeList = baseData.data; storeList = baseData.data;
if (mounted) setState(() {}); if (mounted) setState(() {});
} }
@ -240,7 +238,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
children: [ children: [
Expanded( Expanded(
child: ListView.builder( child: ListView.builder(
itemCount: storeList != null ? storeList.length : 0, itemCount: storeList != null ? storeList!.length : 0,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
@ -249,7 +247,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
groupValue = position; groupValue = position;
}); });
}, },
child: buildStoreItem(storeList[position], position), child: buildStoreItem(storeList![position], position),
); );
}), }),
), ),
@ -259,7 +257,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
SmartDialog.showToast(S.of(context).qingxuanzeyigemendian, alignment: Alignment.center); SmartDialog.showToast(S.of(context).qingxuanzeyigemendian, alignment: Alignment.center);
return; return;
} }
Store store = storeList[groupValue]; Store store = storeList![groupValue];
Navigator.of(context).pop({ Navigator.of(context).pop({
"id": store.id, "id": store.id,
"address": store.address, "address": store.address,
@ -291,7 +289,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
); );
} }
Widget buildStoreItem(Store store, position) { Widget buildStoreItem(Store store, int position) {
return Container( return Container(
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 8.h, bottom: 8.h), margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 8.h, bottom: 8.h),
padding: EdgeInsets.all(16), padding: EdgeInsets.all(16),
@ -315,7 +313,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
store.storeName, store.storeName!,
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -326,7 +324,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
height: 12.h, height: 12.h,
), ),
IconText( IconText(
store.address, store.address!,
isMax: true, isMax: true,
textAxisAlignment: CrossAxisAlignment.start, textAxisAlignment: CrossAxisAlignment.start,
textStyle: TextStyle( textStyle: TextStyle(
@ -359,9 +357,9 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
value: position, value: position,
groupValue: groupValue, groupValue: groupValue,
activeColor: Colors.green, activeColor: Colors.green,
onChanged: (value) { onChanged: (int? value) {
setState(() { setState(() {
groupValue = value; groupValue = value!;
}); });
}, },
) )

24
lib/order/write_off_page.dart

@ -19,7 +19,7 @@ class WriteOffPage extends StatefulWidget {
} }
class _WriteOffPage extends State<WriteOffPage> { class _WriteOffPage extends State<WriteOffPage> {
Coupon coupon; Coupon? coupon;
@override @override
void initState() { void initState() {
@ -60,7 +60,7 @@ class _WriteOffPage extends State<WriteOffPage> {
child: Column( child: Column(
children: [ children: [
Text( Text(
coupon != null ? coupon.couponName : "", coupon != null ? coupon!.couponName! : "",
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -71,7 +71,7 @@ class _WriteOffPage extends State<WriteOffPage> {
), ),
Text( Text(
S.of(context).youxiaoqi( S.of(context).youxiaoqi(
"${coupon.useStartTime.replaceAll("-", ".").split(" ")[0]}-${coupon.useEndTime.replaceAll("-", ".").split(" ")[0]}"), "${coupon!.useStartTime!.replaceAll("-", ".").split(" ")[0]}-${coupon!.useEndTime!.replaceAll("-", ".").split(" ")[0]}"),
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
color: Color(0xFF353535), color: Color(0xFF353535),
@ -102,11 +102,11 @@ class _WriteOffPage extends State<WriteOffPage> {
children: [ children: [
Text( Text(
coupon != null coupon != null
? "${coupon.id.substring(0, 4)} " ? "${coupon!.id!.substring(0, 4)} "
"${coupon.id.substring(4, 8)} " "${coupon!.id!.substring(4, 8)} "
"${coupon.id.substring(8, 12)} " "${coupon!.id!.substring(8, 12)} "
"${coupon.id.substring(12, 16)} " "${coupon!.id!.substring(12, 16)} "
"${coupon.id.substring(16, coupon.id.length)}" "${coupon!.id!.substring(16, coupon!.id!.length)}"
: "", : "",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
@ -114,12 +114,12 @@ class _WriteOffPage extends State<WriteOffPage> {
? 10 ? 10
: (MediaQuery.of(context).size.width - : (MediaQuery.of(context).size.width -
64.w) / 64.w) /
(((coupon.id.length) * 4)), (((coupon!.id!.length) * 4)),
letterSpacing: coupon == null letterSpacing: coupon == null
? 8 ? 8
: (MediaQuery.of(context).size.width - : (MediaQuery.of(context).size.width -
64.w) / 64.w) /
(((coupon.id.length) * 4)), (((coupon!.id!.length) * 4)),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Color(0xFF353535), color: Color(0xFF353535),
), ),
@ -129,7 +129,7 @@ class _WriteOffPage extends State<WriteOffPage> {
), ),
BarcodeWidget( BarcodeWidget(
barcode: Barcode.code128(useCode128C: true), barcode: Barcode.code128(useCode128C: true),
data: coupon != null ? coupon.id : "", data: coupon != null ? coupon!.id! : "",
height: 72.h, height: 72.h,
color: Colors.black, color: Colors.black,
drawText: false, drawText: false,
@ -138,7 +138,7 @@ class _WriteOffPage extends State<WriteOffPage> {
height: 16.h, height: 16.h,
), ),
QrImage( QrImage(
data: coupon != null ? coupon.id : "", data: coupon != null ? coupon!.id! : "",
version: QrVersions.auto, version: QrVersions.auto,
size: 200.w, size: 200.w,
gapless: true, gapless: true,

36
lib/retrofit/data/activity.dart

@ -1,24 +1,24 @@
class Activity { class Activity {
Activity(); Activity();
String id; String? id;
String createTime; String? createTime;
dynamic createUser; dynamic? createUser;
String updateTime; String? updateTime;
dynamic updateUser; dynamic? updateUser;
String storeId; String? storeId;
String mainTitle; String? mainTitle;
String viceTitle; String? viceTitle;
String content; String? content;
String coverImg; String? coverImg;
String startTime; String? startTime;
String endTime; String? endTime;
int state; int? state;
int isDelete; int? isDelete;
int likes; int? likes;
bool liked; bool? liked;
int viewers; int? viewers;
String storeName; String? storeName;
factory Activity.fromJson(Map<String, dynamic> json) => Activity() factory Activity.fromJson(Map<String, dynamic> json) => Activity()
..id = json['id'] ..id = json['id']

26
lib/retrofit/data/address.dart

@ -3,19 +3,19 @@
class Address { class Address {
Address(); Address();
String address; String? address;
String area; String? area;
String city; String? city;
String cityInfo; String? cityInfo;
String id; String? id;
bool isDefault; bool? isDefault;
String latitude; String? latitude;
String longitude; String? longitude;
String mid; String? mid;
String phone; String? phone;
String province; String? province;
String tag; String? tag;
String username; String? username;
factory Address.fromJson(Map<String, dynamic> json) => Address() factory Address.fromJson(Map<String, dynamic> json) => Address()
..address = json['address'] as String ..address = json['address'] as String

204
lib/retrofit/data/article.dart

@ -4,153 +4,77 @@ import 'package:huixiang/retrofit/data/author.dart';
class Article { class Article {
String _id; String? id;
String _createTime; String? createTime;
dynamic _createUser; dynamic? createUser;
String _updateTime; String? updateTime;
dynamic _updateUser; dynamic? updateUser;
String _storeId; String? storeId;
String _mainTitle; String? mainTitle;
dynamic _viceTitle; dynamic? viceTitle;
String _content; String? content;
String _coverImg; String? coverImg;
Author _author; Author? author;
int _type; int? type;
String _startTime; String? startTime;
String _endTime; String? endTime;
int _state; int? state;
int _isDelete; int? isDelete;
int _likes; int? likes;
bool _isHot; bool? isHot;
bool _liked; bool? liked;
int _viewers; int? viewers;
dynamic _storeName; dynamic? storeName;
String get id => _id; Article();
String get createTime => _createTime;
dynamic get createUser => _createUser;
String get updateTime => _updateTime;
dynamic get updateUser => _updateUser;
String get storeId => _storeId;
String get mainTitle => _mainTitle;
dynamic get viceTitle => _viceTitle;
String get content => _content;
String get coverImg => _coverImg;
Author get author => _author;
int get type => _type;
String get startTime => _startTime;
String get endTime => _endTime;
int get state => _state;
int get isDelete => _isDelete;
int get likes => _likes;
bool get isHot => _isHot;
bool get liked => _liked;
int get viewers => _viewers;
dynamic get storeName => _storeName;
set likes(int value) {
_likes = value;
}
set liked(bool value) {
_liked = value;
}
set viewers(int value) {
_viewers = value;
}
Article({
String id,
String createTime,
dynamic createUser,
String updateTime,
dynamic updateUser,
String storeId,
String mainTitle,
dynamic viceTitle,
String content,
String coverImg,
Author author,
int type,
String startTime,
String endTime,
int state,
int isDelete,
int likes,
bool isHot,
int viewers,
dynamic storeName}){
_id = id;
_createTime = createTime;
_createUser = createUser;
_updateTime = updateTime;
_updateUser = updateUser;
_storeId = storeId;
_mainTitle = mainTitle;
_viceTitle = viceTitle;
_content = content;
_coverImg = coverImg;
_author = author;
_type = type;
_startTime = startTime;
_endTime = endTime;
_state = state;
_isDelete = isDelete;
_likes = likes;
_isHot = isHot;
_liked = liked;
_viewers = viewers;
_storeName = storeName;
}
Article.fromJson(dynamic json) { Article.fromJson(dynamic json) {
_id = json["id"]; this.id = json["id"];
_createTime = json["createTime"]; this.createTime = json["createTime"];
_createUser = json["createUser"]; this.createUser = json["createUser"];
_updateTime = json["updateTime"]; this.updateTime = json["updateTime"];
_updateUser = json["updateUser"]; this.updateUser = json["updateUser"];
_storeId = json["storeId"]; this.storeId = json["storeId"];
_mainTitle = json["mainTitle"]; this.mainTitle = json["mainTitle"];
_viceTitle = json["viceTitle"]; this.viceTitle = json["viceTitle"];
_content = json["content"]; this.content = json["content"];
_coverImg = json["coverImg"]; this.coverImg = json["coverImg"];
_author = json["author"] == null ? null : Author.fromJson(jsonDecode(json["author"])); this.author = json["author"] == null ? null : Author.fromJson(jsonDecode(json["author"]));
_type = json["type"]; this.type = json["type"];
_startTime = json["startTime"]; this.startTime = json["startTime"];
_endTime = json["endTime"]; this.endTime = json["endTime"];
_state = json["state"]; this.state = json["state"];
_isDelete = json["isDelete"]; this.isDelete = json["isDelete"];
_likes = json["likes"]; this.likes = json["likes"];
_isHot = json["isHot"]; this.isHot = json["isHot"];
_liked = json["liked"]; this.liked = json["liked"];
_viewers = json["viewers"]; this.viewers = json["viewers"];
_storeName = json["storeName"]; this.storeName = json["storeName"];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
var map = <String, dynamic>{}; var map = <String, dynamic>{};
map["id"] = _id; map["id"] = this.id;
map["createTime"] = _createTime; map["createTime"] = this.createTime;
map["createUser"] = _createUser; map["createUser"] = this.createUser;
map["updateTime"] = _updateTime; map["updateTime"] = this.updateTime;
map["updateUser"] = _updateUser; map["updateUser"] = this.updateUser;
map["storeId"] = _storeId; map["storeId"] = this.storeId;
map["mainTitle"] = _mainTitle; map["mainTitle"] = this.mainTitle;
map["viceTitle"] = _viceTitle; map["viceTitle"] = this.viceTitle;
map["content"] = _content; map["content"] = this.content;
map["coverImg"] = _coverImg; map["coverImg"] = this.coverImg;
map["author"] = _author.toJson(); map["author"] = this.author?.toJson();
map["type"] = _type; map["type"] = this.type;
map["startTime"] = _startTime; map["startTime"] = this.startTime;
map["endTime"] = _endTime; map["endTime"] = this.endTime;
map["state"] = _state; map["state"] = this.state;
map["isDelete"] = _isDelete; map["isDelete"] = this.isDelete;
map["likes"] = _likes; map["likes"] = this.likes;
map["isHot"] = _isHot; map["isHot"] = this.isHot;
map["liked"] = _liked; map["liked"] = this.liked;
map["viewers"] = _viewers; map["viewers"] = this.viewers;
map["storeName"] = _storeName; map["storeName"] = this.storeName;
return map; return map;
} }

22
lib/retrofit/data/author.dart

@ -2,28 +2,20 @@
/// avatar : "https://pos.upload.gznl.top/MDAwMA==/2021/06/6a3586dc-a340-470f-b645-1e3155d5f558.jpg" /// avatar : "https://pos.upload.gznl.top/MDAwMA==/2021/06/6a3586dc-a340-470f-b645-1e3155d5f558.jpg"
class Author { class Author {
String _name; String? name;
String _avatar; String? avatar;
String get name => _name; Author();
String get avatar => _avatar;
Author({
String name,
String avatar}){
_name = name;
_avatar = avatar;
}
Author.fromJson(dynamic json) { Author.fromJson(dynamic json) {
_name = json["name"]; this.name = json["name"];
_avatar = json["avatar"]; this.avatar = json["avatar"];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
var map = <String, dynamic>{}; var map = <String, dynamic>{};
map["name"] = _name; map["name"] = this.name;
map["avatar"] = _avatar; map["avatar"] = this.avatar;
return map; return map;
} }

24
lib/retrofit/data/banner.dart

@ -1,17 +1,17 @@
class BannerData { class BannerData {
String content; String? content;
String createTime; String? createTime;
int contentType; int? contentType;
String createUser; String? createUser;
String id; String? id;
String imgUrl; String? imgUrl;
bool isDelete; bool? isDelete;
String storeId; String? storeId;
String tenantCode; String? tenantCode;
String type; String? type;
String updateTime; String? updateTime;
String updateUser; String? updateUser;
BannerData({this.content, this.createTime, this.contentType, this.createUser, this.id, this.imgUrl, this.isDelete, this.storeId, this.tenantCode, this.type, this.updateTime, this.updateUser}); BannerData({this.content, this.createTime, this.contentType, this.createUser, this.id, this.imgUrl, this.isDelete, this.storeId, this.tenantCode, this.type, this.updateTime, this.updateUser});

16
lib/retrofit/data/base_data.dart

@ -9,14 +9,14 @@ part 'base_data.g.dart';
class BaseData<T> { class BaseData<T> {
BaseData(); BaseData();
int code; int? code;
T data; T? data;
dynamic extra; dynamic? extra;
bool isError; bool? isError;
bool isSuccess; bool? isSuccess;
String msg; String? msg;
String path; String? path;
String timestamp; String? timestamp;
factory BaseData.fromJson(Map<String, dynamic> json, T Function(dynamic json) fromJsonT) => _$BaseDataFromJson(json, fromJsonT); factory BaseData.fromJson(Map<String, dynamic> json, T Function(dynamic json) fromJsonT) => _$BaseDataFromJson(json, fromJsonT);

73
lib/retrofit/data/brand.dart

@ -7,62 +7,37 @@
/// storeId : "0" /// storeId : "0"
class Brand { class Brand {
String _name; String? name;
String _image; String? image;
String _video; String? video;
String _desc; String? desc;
String _content; String? content;
String _icon; String? icon;
int _sort; int? sort;
String _storeId; String? storeId;
String get name => _name; Brand();
String get image => _image;
String get video => _video;
String get desc => _desc;
String get content => _content;
String get icon => _icon;
int get sort => _sort;
String get storeId => _storeId;
Brand({
String name,
String image,
String video,
String desc,
String content,
int sort,
String storeId}){
_name = name;
_image = image;
_video = video;
_desc = desc;
_content = content;
_icon = icon;
_sort = sort;
_storeId = storeId;
}
Brand.fromJson(dynamic json) { Brand.fromJson(dynamic json) {
_name = json["name"]; this.name = json["name"];
_image = json["image"]; this.image = json["image"];
_video = json["video"]; this.video = json["video"];
_desc = json["desc"]; this.desc = json["desc"];
_content = json["content"]; this.content = json["content"];
_icon = json["icon"]; this.icon = json["icon"];
_sort = json["sort"]; this.sort = json["sort"];
_storeId = json["storeId"]; this.storeId = json["storeId"];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
var map = <String, dynamic>{}; var map = <String, dynamic>{};
map["name"] = _name; map["name"] = this.name;
map["image"] = _image; map["image"] = this.image;
map["video"] = _video; map["video"] = this.video;
map["desc"] = _desc; map["desc"] = this.desc;
map["content"] = _content; map["content"] = this.content;
map["sort"] = _sort; map["sort"] = this.sort;
map["storeId"] = _storeId; map["storeId"] = this.storeId;
return map; return map;
} }

18
lib/retrofit/data/brand_data.dart

@ -5,15 +5,15 @@ class BrandData {
BrandData(); BrandData();
List<BannerData> bannerList; List<BannerData?>? bannerList;
String company; String? company;
String companyDesc; String? companyDesc;
String originAvatar; String? originAvatar;
String originDesc; String? originDesc;
String originator; String? originator;
dynamic contents; dynamic? contents;
dynamic ideals; dynamic? ideals;
factory BrandData.fromJson(Map<String, dynamic> json) => BrandData() factory BrandData.fromJson(Map<String, dynamic> json) => BrandData()
@ -28,7 +28,7 @@ class BrandData {
..ideals = json['ideals']; ..ideals = json['ideals'];
Map<String, dynamic> toJson() => <String, dynamic>{ Map<String, dynamic> toJson() => <String, dynamic>{
'bannerList': this.bannerList.map((e) => e.toJson()).toList(), 'bannerList': this.bannerList?.map((e) => e?.toJson()).toList(),
'company': this.company, 'company': this.company,
'companyDesc': this.companyDesc, 'companyDesc': this.companyDesc,
'originAvatar': this.originAvatar, 'originAvatar': this.originAvatar,

58
lib/retrofit/data/coupon.dart

@ -3,35 +3,33 @@ import 'package:huixiang/retrofit/data/store.dart';
class Coupon { class Coupon {
Coupon(); Coupon();
Coupon.test(this.couponName, this.status, this.isEx); String? id;
String? createTime;
String id; String? createUser;
String createTime; String? updateTime;
String createUser; String? updateUser;
String updateTime; int? bizType;
String updateUser; String? fullAmount;
int bizType; String? discountAmount;
String fullAmount; int? discountPercent;
String discountAmount; String? bizId;
int discountPercent; String? publishStartTime;
String bizId; String? publishEndTime;
String publishStartTime; String? useStartTime;
String publishEndTime; String? useEndTime;
String useStartTime; String? promotionId;
String useEndTime; bool? centreDisplay;
String promotionId; String? tenantCode;
bool centreDisplay; int? isDelete;
String tenantCode; String? couponName;
int isDelete; String? couponImg;
String couponName; String? couponDescription;
String couponImg; String? memberCouponId;
String couponDescription; String? receiveTime;
String memberCouponId; dynamic? useTime;
String receiveTime; int? status;
dynamic useTime; List<Store?>? storeList;
int status; bool? isEx = false;
List<Store> storeList;
bool isEx = false;
factory Coupon.fromJson(Map<String, dynamic> json) => Coupon() factory Coupon.fromJson(Map<String, dynamic> json) => Coupon()
..id = json['id'] as String ..id = json['id'] as String
@ -89,6 +87,6 @@ class Coupon {
'receiveTime': this.receiveTime, 'receiveTime': this.receiveTime,
'useTime': this.useTime, 'useTime': this.useTime,
'status': this.status, 'status': this.status,
'storeList': this.storeList.map((e) => e.toJson()).toList() 'storeList': this.storeList?.map((e) => e?.toJson()).toList()
}; };
} }

52
lib/retrofit/data/coupon_vo.dart

@ -1,31 +1,31 @@
class CouponVo { class CouponVo {
String bizId; String? bizId;
num bizType; num? bizType;
bool centreDisplay; bool? centreDisplay;
String couponDescription; String? couponDescription;
String couponImg; String? couponImg;
String couponName; String? couponName;
String createTime; String? createTime;
String createUser; String? createUser;
String discountAmount; String? discountAmount;
num discountPercent; num? discountPercent;
String fullAmount; String? fullAmount;
String id; String? id;
num isDelete; num? isDelete;
String memberCouponId; String? memberCouponId;
String promotionId; String? promotionId;
String publishEndTime; String? publishEndTime;
String publishStartTime; String? publishStartTime;
String receiveTime; String? receiveTime;
bool received; bool? received;
num status; num? status;
String tenantCode; String? tenantCode;
String updateTime; String? updateTime;
String updateUser; String? updateUser;
String useEndTime; String? useEndTime;
String useStartTime; String? useStartTime;
String useTime; String? useTime;
CouponVo({this.bizId, this.bizType, this.centreDisplay, this.couponDescription, this.couponImg, this.couponName, this.createTime, this.createUser, this.discountAmount, this.discountPercent, this.fullAmount, this.id, this.isDelete, this.memberCouponId, this.promotionId, this.publishEndTime, this.publishStartTime, this.receiveTime, this.received, this.status, this.tenantCode, this.updateTime, this.updateUser, this.useEndTime, this.useStartTime, this.useTime}); CouponVo({this.bizId, this.bizType, this.centreDisplay, this.couponDescription, this.couponImg, this.couponName, this.createTime, this.createUser, this.discountAmount, this.discountPercent, this.fullAmount, this.id, this.isDelete, this.memberCouponId, this.promotionId, this.publishEndTime, this.publishStartTime, this.receiveTime, this.received, this.status, this.tenantCode, this.updateTime, this.updateUser, this.useEndTime, this.useStartTime, this.useTime});

4
lib/retrofit/data/data_type.dart

@ -2,8 +2,8 @@
class DataType { class DataType {
DataType(); DataType();
String desc; String? desc;
String code; String? code;
factory DataType.fromJson(Map<String, dynamic> json) => DataType() factory DataType.fromJson(Map<String, dynamic> json) => DataType()
..desc = json['desc'] as String ..desc = json['desc'] as String

33
lib/retrofit/data/delivery_info.dart

@ -1,24 +1,23 @@
class DeliveryInfo { class DeliveryInfo {
bool dadaRegStatus; bool? dadaRegStatus;
String dadaSourceId; String? dadaSourceId;
bool dadaStatus; bool? dadaStatus;
bool dianwodaRegStatus; bool? dianwodaRegStatus;
bool dianwodaStatus; bool? dianwodaStatus;
bool meituanRegStatus; bool? meituanRegStatus;
bool meituanStatus; bool? meituanStatus;
DeliveryInfo({this.dadaRegStatus, this.dadaSourceId, this.dadaStatus, this.dianwodaRegStatus, this.dianwodaStatus, this.meituanRegStatus, this.meituanStatus}); DeliveryInfo();
factory DeliveryInfo.fromJson(Map<String, dynamic> json) => DeliveryInfo( factory DeliveryInfo.fromJson(Map<String, dynamic> json) => DeliveryInfo()
dadaRegStatus: json['dadaRegStatus'] as bool, ..dadaRegStatus= json['dadaRegStatus'] as bool
dadaSourceId: json['dadaSourceId'] as String, ..dadaSourceId= json['dadaSourceId'] as String
dadaStatus: json['dadaStatus'] as bool, ..dadaStatus= json['dadaStatus'] as bool
dianwodaRegStatus: json['dianwodaRegStatus'] as bool, ..dianwodaRegStatus= json['dianwodaRegStatus'] as bool
dianwodaStatus: json['dianwodaStatus'] as bool, ..dianwodaStatus= json['dianwodaStatus'] as bool
meituanRegStatus: json['meituanRegStatus'] as bool, ..meituanRegStatus= json['meituanRegStatus'] as bool
meituanStatus: json['meituanStatus'] as bool, ..meituanStatus= json['meituanStatus'] as bool;
);
Map<String, dynamic> toJson() => <String, dynamic>{ Map<String, dynamic> toJson() => <String, dynamic>{
'dadaRegStatus': this.dadaRegStatus, 'dadaRegStatus': this.dadaRegStatus,

30
lib/retrofit/data/exchange_order.dart

@ -3,20 +3,20 @@ import 'package:huixiang/retrofit/data/exchange_order_goods.dart';
class ExchangeOrder { class ExchangeOrder {
ExchangeOrder(); ExchangeOrder();
String id; String? id;
String createTime; String? createTime;
String createUser; String? createUser;
String updateTime; String? updateTime;
String updateUser; String? updateUser;
String storeId; String? storeId;
String mid; String? mid;
String orderCode; String? orderCode;
String amount; String? amount;
String address; String? address;
int state; int? state;
int useTyped; int? useTyped;
int isDelete; int? isDelete;
List<ExchangeOrderGoods> creditOrderDetailList; List<ExchangeOrderGoods?>? creditOrderDetailList;
factory ExchangeOrder.fromJson(Map<String, dynamic> json) => ExchangeOrder() factory ExchangeOrder.fromJson(Map<String, dynamic> json) => ExchangeOrder()
..id = json['id'] as String ..id = json['id'] as String
@ -52,6 +52,6 @@ class ExchangeOrder {
'state': this.state, 'state': this.state,
'useTyped': this.useTyped, 'useTyped': this.useTyped,
'isDelete': this.isDelete, 'isDelete': this.isDelete,
'creditOrderDetailList': this.creditOrderDetailList.map((e) => e.toJson()).toList(), 'creditOrderDetailList': this.creditOrderDetailList?.map((e) => e?.toJson()).toList(),
}; };
} }

38
lib/retrofit/data/exchange_order_goods.dart

@ -2,25 +2,25 @@
class ExchangeOrderGoods { class ExchangeOrderGoods {
ExchangeOrderGoods(); ExchangeOrderGoods();
String id; String? id;
String createTime; String? createTime;
String createUser; String? createUser;
String updateTime; String? updateTime;
String updateUser; String? updateUser;
String orderId; String? orderId;
String goodsId; String? goodsId;
String categoryId; String? categoryId;
String name; String? name;
String description; String? description;
String worth; String? worth;
String price; String? price;
String couponId; String? couponId;
bool canPick; bool? canPick;
bool canDelivery; bool? canDelivery;
String goodsMainImg; String? goodsMainImg;
String goodsViceImg; String? goodsViceImg;
int goodsNumber; int? goodsNumber;
int isDelete; int? isDelete;
factory ExchangeOrderGoods.fromJson(Map<String, dynamic> json) => factory ExchangeOrderGoods.fromJson(Map<String, dynamic> json) =>
ExchangeOrderGoods() ExchangeOrderGoods()

49
lib/retrofit/data/founder.dart

@ -5,46 +5,29 @@
/// profile : "<p><img class=\"wscnph\" src=\"https://pos.upload.gznl.top/MDAwMA==/2021/07/bdc0705d-7aa0-4677-a282-81d1b8a56e4b.png\" /></p>" /// profile : "<p><img class=\"wscnph\" src=\"https://pos.upload.gznl.top/MDAwMA==/2021/07/bdc0705d-7aa0-4677-a282-81d1b8a56e4b.png\" /></p>"
class Founder { class Founder {
String _name; String? name;
String _position; String? position;
String _description; String? description;
String _imgUrl; String? imgUrl;
String _profile; String? profile;
String get name => _name; Founder();
String get position => _position;
String get description => _description;
String get imgUrl => _imgUrl;
String get profile => _profile;
Founder({
String name,
String position,
String description,
String imgUrl,
String profile}){
_name = name;
_position = position;
_description = description;
_imgUrl = imgUrl;
_profile = profile;
}
Founder.fromJson(dynamic json) { Founder.fromJson(dynamic json) {
_name = json["name"]; this.name = json["name"];
_position = json["position"]; this.position = json["position"];
_description = json["description"]; this.description = json["description"];
_imgUrl = json["imgUrl"]; this.imgUrl = json["imgUrl"];
_profile = json["profile"]; this.profile = json["profile"];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
var map = <String, dynamic>{}; var map = <String, dynamic>{};
map["name"] = _name; map["name"] = this.name;
map["position"] = _position; map["position"] = this.position;
map["description"] = _description; map["description"] = this.description;
map["imgUrl"] = _imgUrl; map["imgUrl"] = this.imgUrl;
map["profile"] = _profile; map["profile"] = this.profile;
return map; return map;
} }

211
lib/retrofit/data/goods.dart

@ -1,153 +1,82 @@
class Goods { class Goods {
String _id; String? id;
String _createTime; String? createTime;
String _createUser; String? createUser;
String _updateTime; String? updateTime;
String _updateUser; String? updateUser;
String _categoryId; String? categoryId;
String _storeId; String? storeId;
String _name; String? name;
String _description; String? description;
String _worth; String? worth;
String _price; String? price;
String _detail; String? detail;
int _stock; int? stock;
int _sales; int? sales;
bool _isHot; bool? isHot;
int _sortOrder; int? sortOrder;
int _state; int? state;
bool _canPick; bool? canPick;
bool _canDelivery; bool? canDelivery;
int _isDelete; int? isDelete;
dynamic _categoryName; dynamic? categoryName;
String _mainImgPath; String? mainImgPath;
List<String> _viceImgPaths; List<String>? viceImgPaths;
String get id => _id; Goods();
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get categoryId => _categoryId;
String get storeId => _storeId;
String get name => _name;
String get description => _description;
String get worth => _worth;
String get price => _price;
String get detail => _detail;
int get stock => _stock;
int get sales => _sales;
bool get isHot => _isHot;
int get sortOrder => _sortOrder;
int get state => _state;
bool get canPick => _canPick;
bool get canDelivery => _canDelivery;
int get isDelete => _isDelete;
dynamic get categoryName => _categoryName;
String get mainImgPath => _mainImgPath;
List<String> get viceImgPaths => _viceImgPaths;
Goods({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String categoryId,
String storeId,
String name,
String description,
String worth,
String price,
String detail,
int stock,
int sales,
bool isHot,
int sortOrder,
int state,
bool canPick,
bool canDelivery,
int isDelete,
dynamic categoryName,
String mainImgPath,
List<String> viceImgPaths}){
_id = id;
_createTime = createTime;
_createUser = createUser;
_updateTime = updateTime;
_updateUser = updateUser;
_categoryId = categoryId;
_storeId = storeId;
_name = name;
_description = description;
_worth = worth;
_price = price;
_detail = detail;
_stock = stock;
_sales = sales;
_isHot = isHot;
_sortOrder = sortOrder;
_state = state;
_canPick = canPick;
_canDelivery = canDelivery;
_isDelete = isDelete;
_categoryName = categoryName;
_mainImgPath = mainImgPath;
_viceImgPaths = viceImgPaths;
}
Goods.fromJson(dynamic json) { Goods.fromJson(dynamic json) {
_id = json["id"]; this.id = json["id"];
_createTime = json["createTime"]; this.createTime = json["createTime"];
_createUser = json["createUser"]; this.createUser = json["createUser"];
_updateTime = json["updateTime"]; this.updateTime = json["updateTime"];
_updateUser = json["updateUser"]; this.updateUser = json["updateUser"];
_categoryId = json["categoryId"]; this.categoryId = json["categoryId"];
_storeId = json["storeId"]; this.storeId = json["storeId"];
_name = json["name"]; this.name = json["name"];
_description = json["description"]; this.description = json["description"];
_worth = json["worth"]; this.worth = json["worth"];
_price = json["price"]; this.price = json["price"];
_detail = json["detail"]; this.detail = json["detail"];
_stock = json["stock"]; this.stock = json["stock"];
_sales = json["sales"]; this.sales = json["sales"];
_isHot = json["isHot"]; this.isHot = json["isHot"];
_sortOrder = json["sortOrder"]; this.sortOrder = json["sortOrder"];
_state = json["state"]; this.state = json["state"];
_canPick = json["canPick"]; this.canPick = json["canPick"];
_canDelivery = json["canDelivery"]; this.canDelivery = json["canDelivery"];
_isDelete = json["isDelete"]; this.isDelete = json["isDelete"];
_categoryName = json["categoryName"]; this.categoryName = json["categoryName"];
_mainImgPath = json["mainImgPath"]; this.mainImgPath = json["mainImgPath"];
_viceImgPaths = json["viceImgPaths"] != null ? json["viceImgPaths"].cast<String>() : []; this.viceImgPaths = json["viceImgPaths"] != null ? json["viceImgPaths"].cast<String>() : [];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
var map = <String, dynamic>{}; var map = <String, dynamic>{};
map["id"] = _id; map["id"] = this.id;
map["createTime"] = _createTime; map["createTime"] = this.createTime;
map["createUser"] = _createUser; map["createUser"] = this.createUser;
map["updateTime"] = _updateTime; map["updateTime"] = this.updateTime;
map["updateUser"] = _updateUser; map["updateUser"] = this.updateUser;
map["categoryId"] = _categoryId; map["categoryId"] = this.categoryId;
map["storeId"] = _storeId; map["storeId"] = this.storeId;
map["name"] = _name; map["name"] = this.name;
map["description"] = _description; map["description"] = this.description;
map["worth"] = _worth; map["worth"] = this.worth;
map["price"] = _price; map["price"] = this.price;
map["detail"] = _detail; map["detail"] = this.detail;
map["stock"] = _stock; map["stock"] = this.stock;
map["sales"] = _sales; map["sales"] = this.sales;
map["isHot"] = _isHot; map["isHot"] = this.isHot;
map["sortOrder"] = _sortOrder; map["sortOrder"] = this.sortOrder;
map["state"] = _state; map["state"] = this.state;
map["canPick"] = _canPick; map["canPick"] = this.canPick;
map["canDelivery"] = _canDelivery; map["canDelivery"] = this.canDelivery;
map["isDelete"] = _isDelete; map["isDelete"] = this.isDelete;
map["categoryName"] = _categoryName; map["categoryName"] = this.categoryName;
map["mainImgPath"] = _mainImgPath; map["mainImgPath"] = this.mainImgPath;
map["viceImgPaths"] = _viceImgPaths; map["viceImgPaths"] = this.viceImgPaths;
return map; return map;
} }

94
lib/retrofit/data/goods_category.dart

@ -10,76 +10,44 @@
/// isDelete : 0 /// isDelete : 0
class GoodsCategory { class GoodsCategory {
String _id; String? id;
String _createTime; String? createTime;
String _createUser; String? createUser;
String _updateTime; String? updateTime;
String _updateUser; String? updateUser;
String _parentId; String? parentId;
String _name; String? name;
int _miniShow; int? miniShow;
int _sortOrder; int? sortOrder;
int _isDelete; int? isDelete;
String get id => _id; GoodsCategory({name});
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get parentId => _parentId;
String get name => _name;
int get miniShow => _miniShow;
int get sortOrder => _sortOrder;
int get isDelete => _isDelete;
GoodsCategory({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String parentId,
String name,
int miniShow,
int sortOrder,
int isDelete}){
_id = id;
_createTime = createTime;
_createUser = createUser;
_updateTime = updateTime;
_updateUser = updateUser;
_parentId = parentId;
_name = name;
_miniShow = miniShow;
_sortOrder = sortOrder;
_isDelete = isDelete;
}
GoodsCategory.fromJson(dynamic json) { GoodsCategory.fromJson(dynamic json) {
_id = json["id"]; this.id = json["id"];
_createTime = json["createTime"]; this.createTime = json["createTime"];
_createUser = json["createUser"]; this.createUser = json["createUser"];
_updateTime = json["updateTime"]; this.updateTime = json["updateTime"];
_updateUser = json["updateUser"]; this.updateUser = json["updateUser"];
_parentId = json["parentId"]; this.parentId = json["parentId"];
_name = json["name"]; this.name = json["name"];
_miniShow = json["miniShow"]; this.miniShow = json["miniShow"];
_sortOrder = json["sortOrder"]; this.sortOrder = json["sortOrder"];
_isDelete = json["isDelete"]; this.isDelete = json["isDelete"];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
var map = <String, dynamic>{}; var map = <String, dynamic>{};
map["id"] = _id; map["id"] = this.id;
map["createTime"] = _createTime; map["createTime"] = this.createTime;
map["createUser"] = _createUser; map["createUser"] = this.createUser;
map["updateTime"] = _updateTime; map["updateTime"] = this.updateTime;
map["updateUser"] = _updateUser; map["updateUser"] = this.updateUser;
map["parentId"] = _parentId; map["parentId"] = this.parentId;
map["name"] = _name; map["name"] = this.name;
map["miniShow"] = _miniShow; map["miniShow"] = this.miniShow;
map["sortOrder"] = _sortOrder; map["sortOrder"] = this.sortOrder;
map["isDelete"] = _isDelete; map["isDelete"] = this.isDelete;
return map; return map;
} }

22
lib/retrofit/data/logistics.dart

@ -5,21 +5,21 @@
/// traces : [{"acceptStation":"","acceptTime":""}] /// traces : [{"acceptStation":"","acceptTime":""}]
class Logistics { class Logistics {
String logisticCode; String? logisticCode;
String shipperCode; String? shipperCode;
int state; int? state;
bool success; bool? success;
List<TracesBean> traces; List<TracesBean?>? traces;
static Logistics fromJson(Map<String, dynamic> map) { static Logistics? fromJson(Map<String, dynamic>? map) {
if (map == null) return null; if (map == null) return null;
Logistics logisticsBean = Logistics(); Logistics logisticsBean = Logistics();
logisticsBean.logisticCode = map['logisticCode']; logisticsBean.logisticCode = map['logisticCode'];
logisticsBean.shipperCode = map['shipperCode']; logisticsBean.shipperCode = map['shipperCode'];
logisticsBean.state = map['state']; logisticsBean.state = map['state'];
logisticsBean.success = map['success']; logisticsBean.success = map['success'];
logisticsBean.traces = List()..addAll( logisticsBean.traces = []..addAll(
(map['traces'] as List ?? []).map((o) => TracesBean.fromMap(o)) (map['traces'] as List).map((o) => TracesBean.fromMap(o))
); );
return logisticsBean; return logisticsBean;
} }
@ -37,10 +37,10 @@ class Logistics {
/// acceptTime : "" /// acceptTime : ""
class TracesBean { class TracesBean {
String acceptStation; String? acceptStation;
String acceptTime; String? acceptTime;
static TracesBean fromMap(Map<String, dynamic> map) { static TracesBean? fromMap(Map<String, dynamic>? map) {
if (map == null) return null; if (map == null) return null;
TracesBean tracesBean = TracesBean(); TracesBean tracesBean = TracesBean();
tracesBean.acceptStation = map['acceptStation']; tracesBean.acceptStation = map['acceptStation'];

63
lib/retrofit/data/member_comment_list.dart

@ -1,47 +1,28 @@
/// content : ""
/// createTime : ""
/// createUser : "0"
/// hidden : true
/// id : "0"
/// isDelete : 0
/// likes : 0
/// mid : "0"
/// parentContent : ""
/// parentId : "0"
/// parentMid : "0"
/// parentUserAvatarUrl : ""
/// parentUserName : ""
/// relationalId : "0"
/// relationalType : 0
/// updateTime : ""
/// updateUser : "0"
/// userAvatarUrl : ""
/// username : ""
class MemberCommentList { class MemberCommentList {
String content; String? content;
String createTime; String? createTime;
String createUser; String? createUser;
bool hidden; bool? hidden;
String id; String? id;
int isDelete; int? isDelete;
int likes; int? likes;
String mid; String? mid;
String parentContent; String? parentContent;
String parentId; String? parentId;
String parentMid; String? parentMid;
String parentUserAvatarUrl; String? parentUserAvatarUrl;
String parentUserName; String? parentUserName;
String relationalId; String? relationalId;
int relationalType; int? relationalType;
String updateTime; String? updateTime;
String updateUser; String? updateUser;
String userAvatarUrl; String? userAvatarUrl;
String username; String? username;
bool liked; bool? liked;
static MemberCommentList fromJson(Map<String, dynamic> map) { static MemberCommentList? fromJson(Map<String, dynamic>? map) {
if (map == null) return null; if (map == null) return null;
MemberCommentList listBean = MemberCommentList(); MemberCommentList listBean = MemberCommentList();
listBean.content = map['content']; listBean.content = map['content'];

18
lib/retrofit/data/member_rank.dart

@ -2,15 +2,15 @@
class MemberRank { class MemberRank {
MemberRank(); MemberRank();
String id; String? id;
String nextId; String? nextId;
String nextName; String? nextName;
int nextOrigin; int? nextOrigin;
String rankContent; String? rankContent;
String rankImg; String? rankImg;
String rankName; String? rankName;
int rankOrigin; int? rankOrigin;
bool status; bool? status;
factory MemberRank.fromJson(Map<String, dynamic> json) => MemberRank() factory MemberRank.fromJson(Map<String, dynamic> json) => MemberRank()
..id = json['id'] as String ..id = json['id'] as String

238
lib/retrofit/data/member_source.dart

@ -26,172 +26,92 @@
/// vipRegStore : null /// vipRegStore : null
class MemberSource { class MemberSource {
String _id; String? id;
String _createTime; String? createTime;
String _createUser; String? createUser;
String _updateTime; String? updateTime;
String _updateUser; String? updateUser;
String _mid; String? mid;
String _openid; String? openid;
String _nickname; String? nickname;
String _headimg; String? headimg;
String _balance; String? balance;
String _realRecharge; String? realRecharge;
String _sex; String? sex;
bool _status; bool? status;
bool _onCredit; bool? onCredit;
String _loginTime; String? loginTime;
int _loginNum; int? loginNum;
String _tenantCode; String? tenantCode;
int _source; int? source;
String _expendAmount; String? expendAmount;
int _buyTimes; int? buyTimes;
String _lastBuyTime; String? lastBuyTime;
dynamic _vipNo; dynamic? vipNo;
dynamic _expireTime; dynamic? expireTime;
int _integral; int? integral;
int _level; int? level;
dynamic _vipRegStore; dynamic? vipRegStore;
String get id => _id; MemberSource();
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get mid => _mid;
String get openid => _openid;
String get nickname => _nickname;
String get headimg => _headimg;
String get balance => _balance;
String get realRecharge => _realRecharge;
String get sex => _sex;
bool get status => _status;
bool get onCredit => _onCredit;
String get loginTime => _loginTime;
int get loginNum => _loginNum;
String get tenantCode => _tenantCode;
int get source => _source;
String get expendAmount => _expendAmount;
int get buyTimes => _buyTimes;
String get lastBuyTime => _lastBuyTime;
dynamic get vipNo => _vipNo;
dynamic get expireTime => _expireTime;
int get integral => _integral;
int get level => _level;
dynamic get vipRegStore => _vipRegStore;
MemberSource({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String mid,
String openid,
String nickname,
String headimg,
String balance,
String realRecharge,
String sex,
bool status,
bool onCredit,
String loginTime,
int loginNum,
String tenantCode,
int source,
String expendAmount,
int buyTimes,
String lastBuyTime,
dynamic vipNo,
dynamic expireTime,
int integral,
int level,
dynamic vipRegStore}){
_id = id;
_createTime = createTime;
_createUser = createUser;
_updateTime = updateTime;
_updateUser = updateUser;
_mid = mid;
_openid = openid;
_nickname = nickname;
_headimg = headimg;
_balance = balance;
_realRecharge = realRecharge;
_sex = sex;
_status = status;
_onCredit = onCredit;
_loginTime = loginTime;
_loginNum = loginNum;
_tenantCode = tenantCode;
_source = source;
_expendAmount = expendAmount;
_buyTimes = buyTimes;
_lastBuyTime = lastBuyTime;
_vipNo = vipNo;
_expireTime = expireTime;
_integral = integral;
_level = level;
_vipRegStore = vipRegStore;
}
MemberSource.fromJson(dynamic json) { MemberSource.fromJson(dynamic json) {
_id = json["id"]; this.id = json["id"];
_createTime = json["createTime"]; this.createTime = json["createTime"];
_createUser = json["createUser"]; this.createUser = json["createUser"];
_updateTime = json["updateTime"]; this.updateTime = json["updateTime"];
_updateUser = json["updateUser"]; this.updateUser = json["updateUser"];
_mid = json["mid"]; this.mid = json["mid"];
_openid = json["openid"]; this.openid = json["openid"];
_nickname = json["nickname"]; this.nickname = json["nickname"];
_headimg = json["headimg"]; this.headimg = json["headimg"];
_balance = json["balance"]; this.balance = json["balance"];
_realRecharge = json["realRecharge"]; this.realRecharge = json["realRecharge"];
_sex = json["sex"]; this.sex = json["sex"];
_status = json["status"]; this.status = json["status"];
_onCredit = json["onCredit"]; this.onCredit = json["onCredit"];
_loginTime = json["loginTime"]; this.loginTime = json["loginTime"];
_loginNum = json["loginNum"]; this.loginNum = json["loginNum"];
_tenantCode = json["tenantCode"]; this.tenantCode = json["tenantCode"];
_source = json["source"]; this.source = json["source"];
_expendAmount = json["expendAmount"]; this.expendAmount = json["expendAmount"];
_buyTimes = json["buyTimes"]; this.buyTimes = json["buyTimes"];
_lastBuyTime = json["lastBuyTime"]; this.lastBuyTime = json["lastBuyTime"];
_vipNo = json["vip_no"]; this.vipNo = json["vipthis.no"];
_expireTime = json["expireTime"]; this.expireTime = json["expireTime"];
_integral = json["integral"]; this.integral = json["integral"];
_level = json["level"]; this.level = json["level"];
_vipRegStore = json["vipRegStore"]; this.vipRegStore = json["vipRegStore"];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
var map = <String, dynamic>{}; var map = <String, dynamic>{};
map["id"] = _id; map["id"] = this.id;
map["createTime"] = _createTime; map["createTime"] = this.createTime;
map["createUser"] = _createUser; map["createUser"] = this.createUser;
map["updateTime"] = _updateTime; map["updateTime"] = this.updateTime;
map["updateUser"] = _updateUser; map["updateUser"] = this.updateUser;
map["mid"] = _mid; map["mid"] = this.mid;
map["openid"] = _openid; map["openid"] = this.openid;
map["nickname"] = _nickname; map["nickname"] = this.nickname;
map["headimg"] = _headimg; map["headimg"] = this.headimg;
map["balance"] = _balance; map["balance"] = this.balance;
map["realRecharge"] = _realRecharge; map["realRecharge"] = this.realRecharge;
map["sex"] = _sex; map["sex"] = this.sex;
map["status"] = _status; map["status"] = this.status;
map["onCredit"] = _onCredit; map["onCredit"] = this.onCredit;
map["loginTime"] = _loginTime; map["loginTime"] = this.loginTime;
map["loginNum"] = _loginNum; map["loginNum"] = this.loginNum;
map["tenantCode"] = _tenantCode; map["tenantCode"] = this.tenantCode;
map["source"] = _source; map["source"] = this.source;
map["expendAmount"] = _expendAmount; map["expendAmount"] = this.expendAmount;
map["buyTimes"] = _buyTimes; map["buyTimes"] = this.buyTimes;
map["lastBuyTime"] = _lastBuyTime; map["lastBuyTime"] = this.lastBuyTime;
map["vip_no"] = _vipNo; map["vip_no"] = this.vipNo;
map["expireTime"] = _expireTime; map["expireTime"] = this.expireTime;
map["integral"] = _integral; map["integral"] = this.integral;
map["level"] = _level; map["level"] = this.level;
map["vipRegStore"] = _vipRegStore; map["vipRegStore"] = this.vipRegStore;
return map; return map;
} }

111
lib/retrofit/data/message.dart

@ -13,88 +13,51 @@
class Message { class Message {
String _id; String? id;
String _createTime; String? createTime;
String _createUser; String? createUser;
String _updateTime; String? updateTime;
String _updateUser; String? updateUser;
String _mid; String? mid;
String _title; String? title;
String _content; String? content;
int _typed; int? typed;
String _relational; String? relational;
int _state; int? state;
int _isDelete; int? isDelete;
String get id => _id;
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get mid => _mid;
String get title => _title;
String get content => _content;
int get typed => _typed;
String get relational => _relational;
int get state => _state;
int get isDelete => _isDelete;
Message({ Message();
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String mid,
String title,
String content,
int typed,
String relational,
int state,
int isDelete}){
_id = id;
_createTime = createTime;
_createUser = createUser;
_updateTime = updateTime;
_updateUser = updateUser;
_mid = mid;
_title = title;
_content = content;
_typed = typed;
_relational = relational;
_state = state;
_isDelete = isDelete;
}
Message.fromJson(dynamic json) { Message.fromJson(dynamic json) {
_id = json["id"]; this.id = json["id"];
_createTime = json["createTime"]; this.createTime = json["createTime"];
_createUser = json["createUser"]; this.createUser = json["createUser"];
_updateTime = json["updateTime"]; this.updateTime = json["updateTime"];
_updateUser = json["updateUser"]; this.updateUser = json["updateUser"];
_mid = json["mid"]; this.mid = json["mid"];
_title = json["title"]; this.title = json["title"];
_content = json["content"]; this.content = json["content"];
_typed = json["typed"]; this.typed = json["typed"];
_relational = json["relational"]; this.relational = json["relational"];
_state = json["state"]; this.state = json["state"];
_isDelete = json["isDelete"]; this.isDelete = json["isDelete"];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
var map = <String, dynamic>{}; var map = <String, dynamic>{};
map["id"] = _id; map["id"] = this.id;
map["createTime"] = _createTime; map["createTime"] = this.createTime;
map["createUser"] = _createUser; map["createUser"] = this.createUser;
map["updateTime"] = _updateTime; map["updateTime"] = this.updateTime;
map["updateUser"] = _updateUser; map["updateUser"] = this.updateUser;
map["mid"] = _mid; map["mid"] = this.mid;
map["title"] = _title; map["title"] = this.title;
map["content"] = _content; map["content"] = this.content;
map["typed"] = _typed; map["typed"] = this.typed;
map["relational"] = _relational; map["relational"] = this.relational;
map["state"] = _state; map["state"] = this.state;
map["isDelete"] = _isDelete; map["isDelete"] = this.isDelete;
return map; return map;
} }

31
lib/retrofit/data/mini.dart

@ -3,34 +3,23 @@
/// miniAppId : "wx7eeaa89de16f3180" /// miniAppId : "wx7eeaa89de16f3180"
class Mini { class Mini {
String _miniDownloadUrl; String? miniDownloadUrl;
String _miniVersion; String? miniVersion;
String _miniAppId; String? miniAppId;
String get miniDownloadUrl => _miniDownloadUrl; Mini();
String get miniVersion => _miniVersion;
String get miniAppId => _miniAppId;
Mini({
String miniDownloadUrl,
String miniVersion,
String miniAppId}){
_miniDownloadUrl = miniDownloadUrl;
_miniVersion = miniVersion;
_miniAppId = miniAppId;
}
Mini.fromJson(dynamic json) { Mini.fromJson(dynamic json) {
_miniDownloadUrl = json["miniDownloadUrl"]; this.miniDownloadUrl = json["miniDownloadUrl"];
_miniVersion = json["miniVersion"]; this.miniVersion = json["miniVersion"];
_miniAppId = json["miniAppId"]; this.miniAppId = json["miniAppId"];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
var map = <String, dynamic>{}; var map = <String, dynamic>{};
map["miniDownloadUrl"] = _miniDownloadUrl; map["miniDownloadUrl"] = this.miniDownloadUrl;
map["miniVersion"] = _miniVersion; map["miniVersion"] = this.miniVersion;
map["miniAppId"] = _miniAppId; map["miniAppId"] = this.miniAppId;
return map; return map;
} }

1635
lib/retrofit/data/order_info.dart

File diff suppressed because it is too large Load Diff

14
lib/retrofit/data/page.dart

@ -11,16 +11,16 @@ part 'page.g.dart';
class PageInfo<D> { class PageInfo<D> {
PageInfo(); PageInfo();
int pageNum; int? pageNum;
dynamic current; dynamic current;
int pageSize; int? pageSize;
dynamic size; dynamic size;
dynamic pages; dynamic pages;
bool hasPreviousPage; bool? hasPreviousPage;
bool hasNextPage; bool? hasNextPage;
String total; String? total;
List<D> list; List<D?>? list;
List<D> records; List<D?>? records;
factory PageInfo.fromJson(Map<String, dynamic> json, D Function(dynamic d) fromJsonD) => _$PageInfoFromJson(json, fromJsonD); factory PageInfo.fromJson(Map<String, dynamic> json, D Function(dynamic d) fromJsonD) => _$PageInfoFromJson(json, fromJsonD);

40
lib/retrofit/data/promotion.dart

@ -1,25 +1,25 @@
class Promotion { class Promotion {
String activityEndTime; String? activityEndTime;
String activityStartTime; String? activityStartTime;
String applyEndTime; String? applyEndTime;
String applyStartTime; String? applyStartTime;
String createTime; String? createTime;
String createUser; String? createUser;
String description; String? description;
String id; String? id;
String image; String? image;
num isDelete; num? isDelete;
num isNeedSecurityDeposit; num? isNeedSecurityDeposit;
String name; String? name;
List<PromotionDetailBean> promotionDetail; List<PromotionDetailBean?>? promotionDetail;
num promotionPlan; num? promotionPlan;
num promotionType; num? promotionType;
String securityDeposit; String? securityDeposit;
num status; num? status;
String tag; String? tag;
String updateTime; String? updateTime;
String updateUser; String? updateUser;
Promotion({this.activityEndTime, this.activityStartTime, this.applyEndTime, this.applyStartTime, this.createTime, this.createUser, this.description, this.id, this.image, this.isDelete, this.isNeedSecurityDeposit, this.name, this.promotionDetail, this.promotionPlan, this.promotionType, this.securityDeposit, this.status, this.tag, this.updateTime, this.updateUser}); Promotion({this.activityEndTime, this.activityStartTime, this.applyEndTime, this.applyStartTime, this.createTime, this.createUser, this.description, this.id, this.image, this.isDelete, this.isNeedSecurityDeposit, this.name, this.promotionDetail, this.promotionPlan, this.promotionType, this.securityDeposit, this.status, this.tag, this.updateTime, this.updateUser});

94
lib/retrofit/data/rank.dart

@ -10,76 +10,44 @@
/// updateUser : 0 /// updateUser : 0
class Rank { class Rank {
String _createTime; String? createTime;
String _createUser; String? createUser;
String _id; String? id;
String _rankContent; String? rankContent;
String _rankImg; String? rankImg;
String _rankName; String? rankName;
int _rankOrigin; int? rankOrigin;
bool _status; bool? status;
String _updateTime; String? updateTime;
String _updateUser; String? updateUser;
String get createTime => _createTime; Rank();
String get createUser => _createUser;
String get id => _id;
String get rankContent => _rankContent;
String get rankImg => _rankImg;
String get rankName => _rankName;
int get rankOrigin => _rankOrigin;
bool get status => _status;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
Rank({
String createTime,
String createUser,
String id,
String rankContent,
String rankImg,
String rankName,
int rankOrigin,
bool status,
String updateTime,
String updateUser}){
_createTime = createTime;
_createUser = createUser;
_id = id;
_rankContent = rankContent;
_rankImg = rankImg;
_rankName = rankName;
_rankOrigin = rankOrigin;
_status = status;
_updateTime = updateTime;
_updateUser = updateUser;
}
Rank.fromJson(dynamic json) { Rank.fromJson(dynamic json) {
_createTime = json["createTime"]; this.createTime = json["createTime"];
_createUser = json["createUser"]; this.createUser = json["createUser"];
_id = json["id"]; this.id = json["id"];
_rankContent = json["rankContent"]; this.rankContent = json["rankContent"];
_rankImg = json["rankImg"]; this.rankImg = json["rankImg"];
_rankName = json["rankName"]; this.rankName = json["rankName"];
_rankOrigin = json["rankOrigin"]; this.rankOrigin = json["rankOrigin"];
_status = json["status"]; this.status = json["status"];
_updateTime = json["updateTime"]; this.updateTime = json["updateTime"];
_updateUser = json["updateUser"]; this.updateUser = json["updateUser"];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
var map = <String, dynamic>{}; var map = <String, dynamic>{};
map["createTime"] = _createTime; map["createTime"] = this.createTime;
map["createUser"] = _createUser; map["createUser"] = this.createUser;
map["id"] = _id; map["id"] = this.id;
map["rankContent"] = _rankContent; map["rankContent"] = this.rankContent;
map["rankImg"] = _rankImg; map["rankImg"] = this.rankImg;
map["rankName"] = _rankName; map["rankName"] = this.rankName;
map["rankOrigin"] = _rankOrigin; map["rankOrigin"] = this.rankOrigin;
map["status"] = _status; map["status"] = this.status;
map["updateTime"] = _updateTime; map["updateTime"] = this.updateTime;
map["updateUser"] = _updateUser; map["updateUser"] = this.updateUser;
return map; return map;
} }

32
lib/retrofit/data/sign_in.dart

@ -1,22 +1,22 @@
class SignIn { class SignIn {
SignIn(); SignIn();
String balance; String? balance;
String category; String? category;
String createTime; String? createTime;
String createUser; String? createUser;
String id; String? id;
bool isDeleted; bool? isDeleted;
String linkId; String? linkId;
String mark; String? mark;
String mid; String? mid;
String number; String? number;
int pm; int? pm;
bool status; bool? status;
String title; String? title;
String type; String? type;
String updateTime; String? updateTime;
String updateUser; String? updateUser;
factory SignIn.fromJson(Map<String, dynamic> json) => SignIn() factory SignIn.fromJson(Map<String, dynamic> json) => SignIn()
..balance = json['balance'] as String ..balance = json['balance'] as String

12
lib/retrofit/data/sign_info.dart

@ -4,12 +4,12 @@ import 'package:huixiang/retrofit/data/task.dart';
class SignInfo { class SignInfo {
SignInfo(); SignInfo();
String point; String? point;
bool todayHasSignin; bool? todayHasSignin;
MemberRank rank; MemberRank? rank;
List<SignIn> signInList; List<SignIn?>? signInList;
List<Task> taskList; List<Task?>? taskList;
List<int> rewardList; List<int?>? rewardList;
factory SignInfo.fromJson(Map<String, dynamic> json) => SignInfo() factory SignInfo.fromJson(Map<String, dynamic> json) => SignInfo()
..point = json['point'] as String ..point = json['point'] as String

56
lib/retrofit/data/store.dart

@ -6,38 +6,38 @@ import 'package:huixiang/retrofit/data/store_type.dart';
class Store { class Store {
Store(); Store();
String id; String? id;
String createTime; String? createTime;
String createUser; String? createUser;
String updateTime; String? updateTime;
String updateUser; String? updateUser;
String tenantCode; String? tenantCode;
bool useErp; bool? useErp;
String openStartTime; String? openStartTime;
String openEndTime; String? openEndTime;
String perCapitaConsumption; String? perCapitaConsumption;
String storeName; String? storeName;
double distance; double? distance;
String logo; String? logo;
String shipAddress; String? shipAddress;
dynamic remark; dynamic remark;
String mobile; String? mobile;
String longitude; String? longitude;
String latitude; String? latitude;
dynamic refundAddress; dynamic refundAddress;
dynamic refundTel; dynamic refundTel;
dynamic refundContact; dynamic refundContact;
int isAutoSendRefundAddress; int? isAutoSendRefundAddress;
String province; String? province;
String city; String? city;
String district; String? district;
String address; String? address;
String headName; String? headName;
String headMobile; String? headMobile;
CouponVo couponVO; CouponVo? couponVO;
dynamic deliveryInfo; dynamic deliveryInfo;
String businessType; String? businessType;
StoreType posType; StoreType? posType;
factory Store.fromJson(Map<String, dynamic> json) => Store() factory Store.fromJson(Map<String, dynamic> json) => Store()
..id = json['id'] as String ..id = json['id'] as String
@ -106,7 +106,7 @@ class Store {
'headMobile': this.headMobile, 'headMobile': this.headMobile,
'deliveryInfo': this.deliveryInfo, 'deliveryInfo': this.deliveryInfo,
'businessType': this.businessType, 'businessType': this.businessType,
'couponVO': this.couponVO.toJson(), 'couponVO': this.couponVO != null ? this.couponVO!.toJson() : null,
'posType': this.posType, 'posType': this.posType,
}; };

90
lib/retrofit/data/store_info.dart

@ -8,45 +8,45 @@ import 'package:huixiang/retrofit/data/store_type.dart';
import 'package:huixiang/retrofit/data/mini.dart'; import 'package:huixiang/retrofit/data/mini.dart';
class StoreInfo { class StoreInfo {
String address; String? address;
List<BannerData> bannerList; List<BannerData?>? bannerList;
String city; String? city;
List<CouponVo> couponVOList; List<CouponVo?>? couponVOList;
String createTime; String? createTime;
String createUser; String? createUser;
DeliveryInfo deliveryInfo; DeliveryInfo? deliveryInfo;
String district; String? district;
String headMobile; String? headMobile;
String headName; String? headName;
String id; String? id;
num isAutoSendRefundAddress; num? isAutoSendRefundAddress;
String latitude; String? latitude;
String logo; String? logo;
bool isVip; bool? isVip;
String longitude; String? longitude;
String mobile; String? mobile;
String openEndTime; String? openEndTime;
String openStartTime; String? openStartTime;
String perCapitaConsumption; String? perCapitaConsumption;
StoreType posType; StoreType? posType;
List<Promotion> promotionList; List<Promotion?>? promotionList;
String province; String? province;
String refundAddress; String? refundAddress;
String refundContact; String? refundContact;
String refundTel; String? refundTel;
String remark; String? remark;
String shipAddress; String? shipAddress;
String storeName; String? storeName;
String tenantCode; String? tenantCode;
String updateTime; String? updateTime;
String updateUser; String? updateUser;
String businessService; String? businessService;
Mini mini; Mini? mini;
bool useErp; bool? useErp;
String expireTime; String? expireTime;
String vipFee; String? vipFee;
MemberSource memberSource; MemberSource? memberSource;
PageInfo informationVOPageVO; PageInfo? informationVOPageVO;
StoreInfo(); StoreInfo();
factory StoreInfo.fromJson(Map<String, dynamic> json) => StoreInfo() factory StoreInfo.fromJson(Map<String, dynamic> json) => StoreInfo()
@ -107,12 +107,12 @@ class StoreInfo {
Map<String, dynamic> toJson() => <String, dynamic>{ Map<String, dynamic> toJson() => <String, dynamic>{
'address': this.address, 'address': this.address,
'bannerList': this.bannerList.map((e) => e.toJson()).toList(), 'bannerList': this.bannerList == null ? null : this.bannerList!.map((e) => e?.toJson()).toList(),
'city': this.city, 'city': this.city,
'couponVOList': this.couponVOList, 'couponVOList': this.couponVOList,
'createTime': this.createTime, 'createTime': this.createTime,
'createUser': this.createUser, 'createUser': this.createUser,
'deliveryInfo': this.deliveryInfo.toJson(), 'deliveryInfo': this.deliveryInfo != null ? this.deliveryInfo!.toJson() : null,
'district': this.district, 'district': this.district,
'headMobile': this.headMobile, 'headMobile': this.headMobile,
'headName': this.headName, 'headName': this.headName,
@ -126,8 +126,8 @@ class StoreInfo {
'openEndTime': this.openEndTime, 'openEndTime': this.openEndTime,
'openStartTime': this.openStartTime, 'openStartTime': this.openStartTime,
'perCapitaConsumption': this.perCapitaConsumption, 'perCapitaConsumption': this.perCapitaConsumption,
'posType': this.posType.toJson(), 'posType': this.posType != null ? this.posType!.toJson() : null,
'promotionList': this.promotionList.map((e) => e.toJson()).toList(), 'promotionList': this.promotionList != null ? this.promotionList!.map((e) => e?.toJson()).toList() : null,
'province': this.province, 'province': this.province,
'refundAddress': this.refundAddress, 'refundAddress': this.refundAddress,
'refundContact': this.refundContact, 'refundContact': this.refundContact,
@ -139,11 +139,11 @@ class StoreInfo {
'updateTime': this.updateTime, 'updateTime': this.updateTime,
'updateUser': this.updateUser, 'updateUser': this.updateUser,
'businessService': this.businessService, 'businessService': this.businessService,
'mini': this.mini.toJson(), 'mini': this.mini != null ? this.mini!.toJson() : "",
'useErp': this.useErp, 'useErp': this.useErp,
'expireTime': this.expireTime, 'expireTime': this.expireTime,
'vipFee': this.vipFee, 'vipFee': this.vipFee,
'memberSource': this.memberSource.toJson(), 'memberSource': this.memberSource != null ? this.memberSource!.toJson() : null,
'informationVOPageVO': this.informationVOPageVO, 'informationVOPageVO': this.informationVOPageVO,
}; };

4
lib/retrofit/data/store_type.dart

@ -2,8 +2,8 @@
class StoreType { class StoreType {
StoreType(); StoreType();
String desc; String? desc;
String code; String? code;
factory StoreType.fromJson(Map<String, dynamic> json) => StoreType() factory StoreType.fromJson(Map<String, dynamic> json) => StoreType()
..desc = json['desc'] as String ..desc = json['desc'] as String

28
lib/retrofit/data/task.dart

@ -1,20 +1,20 @@
class Task { class Task {
Task(); Task();
String aspects; String? aspects;
int complateNum; int? complateNum;
int conplateNum; int? conplateNum;
String createTime; String? createTime;
String createUser; String? createUser;
String id; String? id;
int limitDay; int? limitDay;
String name; String? name;
int rewardType; int? rewardType;
String rewardValue; String? rewardValue;
bool status; bool? status;
String type; String? type;
String updateTime; String? updateTime;
String updateUser; String? updateUser;
factory Task.fromJson(Map<String, dynamic> json) => Task() factory Task.fromJson(Map<String, dynamic> json) => Task()
..aspects = json['aspects'] as String ..aspects = json['aspects'] as String

48
lib/retrofit/data/upload_result.dart

@ -2,31 +2,31 @@ import 'package:huixiang/retrofit/data/data_type.dart';
class UploadResult { class UploadResult {
UploadResult(); UploadResult();
String id; String? id;
String createTime; String? createTime;
String createUser; String? createUser;
String updateTime; String? updateTime;
String updateUser; String? updateUser;
DataType dataType; DataType? dataType;
String submittedFileName; String? submittedFileName;
String treePath; String? treePath;
int grade; int? grade;
bool isDelete; bool? isDelete;
String folderId; String? folderId;
String url; String? url;
String size; String? size;
String folderName; String? folderName;
dynamic group; dynamic group;
String path; String? path;
String relativePath; String? relativePath;
dynamic fileMd5; dynamic fileMd5;
String contextType; String? contextType;
String filename; String? filename;
String ext; String? ext;
String icon; String? icon;
String createMonth; String? createMonth;
String createWeek; String? createWeek;
String createDay; String? createDay;
factory UploadResult.fromJson(Map<String, dynamic> json) => UploadResult() factory UploadResult.fromJson(Map<String, dynamic> json) => UploadResult()
..id = json['id'] as String ..id = json['id'] as String
@ -62,7 +62,7 @@ class UploadResult {
'createUser': this.createUser, 'createUser': this.createUser,
'updateTime': this.updateTime, 'updateTime': this.updateTime,
'updateUser': this.updateUser, 'updateUser': this.updateUser,
'dataType': this.dataType.toJson(), 'dataType': this.dataType == null ? "" : this.dataType!.toJson(),
'submittedFileName': this.submittedFileName, 'submittedFileName': this.submittedFileName,
'treePath': this.treePath, 'treePath': this.treePath,
'grade': this.grade, 'grade': this.grade,

155
lib/retrofit/data/user_bill.dart

@ -17,118 +17,65 @@
/// name : "签到" /// name : "签到"
class UserBill { class UserBill {
String _id;
String _createTime;
String _createUser;
String _updateTime;
String _updateUser;
String _mid;
String _linkId;
int _pm;
String _title;
String _category;
String _type;
String _number;
String _balance;
String _mark;
bool _status;
bool _isDeleted;
String _name;
String get id => _id; String? id;
String get createTime => _createTime; String? createTime;
String get createUser => _createUser; String? createUser;
String get updateTime => _updateTime; String? updateTime;
String get updateUser => _updateUser; String? updateUser;
String get mid => _mid; String? mid;
String get linkId => _linkId; String? linkId;
int get pm => _pm; int pm = 0;
String get title => _title; String? title;
String get category => _category; String? category;
String get type => _type; String? type;
String get number => _number; String? number;
String get balance => _balance; String? balance;
String get mark => _mark; String? mark;
bool get status => _status; bool? status;
bool get isDeleted => _isDeleted; bool? isDeleted;
String get name => _name; String? name;
UserBill({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String mid,
String linkId,
int pm,
String title,
String category,
String type,
String number,
String balance,
String mark,
bool status,
bool isDeleted,
String name}){
_id = id;
_createTime = createTime;
_createUser = createUser;
_updateTime = updateTime;
_updateUser = updateUser;
_mid = mid;
_linkId = linkId;
_pm = pm;
_title = title;
_category = category;
_type = type;
_number = number;
_balance = balance;
_mark = mark;
_status = status;
_isDeleted = isDeleted;
_name = name;
}
UserBill.fromJson(dynamic json) { UserBill.fromJson(dynamic json) {
_id = json["id"]; id = json["id"];
_createTime = json["createTime"]; createTime = json["createTime"];
_createUser = json["createUser"]; createUser = json["createUser"];
_updateTime = json["updateTime"]; updateTime = json["updateTime"];
_updateUser = json["updateUser"]; updateUser = json["updateUser"];
_mid = json["mid"]; mid = json["mid"];
_linkId = json["linkId"]; linkId = json["linkId"];
_pm = json["pm"]; pm = json["pm"];
_title = json["title"]; title = json["title"];
_category = json["category"]; category = json["category"];
_type = json["type"]; type = json["type"];
_number = json["number"]; number = json["number"];
_balance = json["balance"]; balance = json["balance"];
_mark = json["mark"]; mark = json["mark"];
_status = json["status"]; status = json["status"];
_isDeleted = json["isDeleted"]; isDeleted = json["isDeleted"];
_name = json["name"]; name = json["name"];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
var map = <String, dynamic>{}; var map = <String, dynamic>{};
map["id"] = _id; map["id"] = id;
map["createTime"] = _createTime; map["createTime"] = createTime;
map["createUser"] = _createUser; map["createUser"] = createUser;
map["updateTime"] = _updateTime; map["updateTime"] = updateTime;
map["updateUser"] = _updateUser; map["updateUser"] = updateUser;
map["mid"] = _mid; map["mid"] = mid;
map["linkId"] = _linkId; map["linkId"] = linkId;
map["pm"] = _pm; map["pm"] = pm;
map["title"] = _title; map["title"] = title;
map["category"] = _category; map["category"] = category;
map["type"] = _type; map["type"] = type;
map["number"] = _number; map["number"] = number;
map["balance"] = _balance; map["balance"] = balance;
map["mark"] = _mark; map["mark"] = mark;
map["status"] = _status; map["status"] = status;
map["isDeleted"] = _isDeleted; map["isDeleted"] = isDeleted;
map["name"] = _name; map["name"] = name;
return map; return map;
} }

24
lib/retrofit/data/user_entity.dart

@ -2,18 +2,18 @@
class UserEntity { class UserEntity {
UserEntity(); UserEntity();
String account; String? account;
String avatar; String? avatar;
String expiration; String? expiration;
String expire; String? expire;
String mobile; String? mobile;
String name; String? name;
String refreshToken; String? refreshToken;
String token; String? token;
String tokenType; String? tokenType;
String userId; String? userId;
String userType; String? userType;
String workDescribe; String? workDescribe;
factory UserEntity.fromJson(Map<String, dynamic> json) => UserEntity() factory UserEntity.fromJson(Map<String, dynamic> json) => UserEntity()

32
lib/retrofit/data/user_info.dart

@ -19,22 +19,22 @@ import 'package:huixiang/retrofit/data/member_rank.dart';
class UserInfo { class UserInfo {
UserInfo(); UserInfo();
String vipNo; String? vipNo;
String nickname; String? nickname;
String headimg; String? headimg;
bool userType; bool? userType;
String sex; String? sex;
int level; int? level;
String addressId; String? addressId;
String remark; String? remark;
String phone; String? phone;
String createTime; String? createTime;
String birth; String? birth;
dynamic balance; dynamic balance;
String money; String? money;
String points; String? points;
bool isBind; bool? isBind;
MemberRank memberRankVo; MemberRank? memberRankVo;
factory UserInfo.fromJson(Map<String, dynamic> json) => factory UserInfo.fromJson(Map<String, dynamic> json) =>
UserInfo() UserInfo()
@ -73,6 +73,6 @@ class UserInfo {
'money': this.money, 'money': this.money,
'points': this.points, 'points': this.points,
'isBind': this.isBind, 'isBind': this.isBind,
'memberRankVo': this.memberRankVo == null ? "" : this.memberRankVo.toJson(), 'memberRankVo': this.memberRankVo == null ? "" : this.memberRankVo!.toJson(),
}; };
} }

16
lib/retrofit/data/verify_code.dart

@ -1,14 +1,14 @@
class VerifyCode { class VerifyCode {
VerifyCode(); VerifyCode();
int code; int? code;
Map<String, dynamic> data; Map<String, dynamic>? data;
BaseDataExtra extra; BaseDataExtra? extra;
bool isError; bool? isError;
bool isSuccess; bool? isSuccess;
String msg; String? msg;
String path; String? path;
String timestamp; String? timestamp;
factory VerifyCode.fromJson(Map<String, dynamic> json) => VerifyCode() factory VerifyCode.fromJson(Map<String, dynamic> json) => VerifyCode()
..code = json['code'] as int ..code = json['code'] as int

182
lib/retrofit/data/vip_card.dart

@ -1,66 +1,36 @@
/// id : "1393457755217461248"
/// createTime : "2021-05-15 14:46:33"
/// createUser : null
/// updateTime : "2021-05-15 14:46:33"
/// updateUser : "1393457755217461248"
/// mid : "1394132265126068224"
/// openid : "o3DjK5P66kDzkeW3biAx1LQSMLn4"
/// nickname : "斯基仔"
/// headimg : "https://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83erTf2Lbo2ztbicMtreEdr7xtrnvtTL5Qr31cicZVoKicdN3EEej13sRMLxLlq3qHThI4V8Pmau5Rps8A/132"
/// balance : "0.00"
/// realRecharge : "0.00"
/// sex : "0"
/// status : true
/// onCredit : false
/// loginTime : "2021-05-20 13:48:03"
/// loginNum : 9
/// tenantCode : "1180"
/// source : 1
/// expendAmount : "0.00"
/// buyTimes : 0
/// lastBuyTime : null
/// vip_no : null
/// expireTime : null
/// integral : 0
/// level : 1
/// vipRegStore : null
/// tenantName : "稻田里的书店"
/// tenantLogo : ""
/// storeList : [{"id":"1381798825072525312","createTime":"2021-04-13 10:38:07","createUser":"1","updateTime":"2021-06-12 21:20:22","updateUser":"1381798824988639232","tenantCode":"1\nI/flutter ( 6658): 180","useErp":false,"openStartTime":"09:30:00","openEndTime":"18:30:00","storeName":"稻田里的书店","nickName":"","logo":"https://pos.upload.gznl.top/1180/2021/07/574aaeff-df3c-451a-b34f-67f9b3552427.png","shipAddress":"上海市崇明区东风农场东风公路833弄1-22号C2-C3","remark":"","mobile":"13554204268","longitude":"121.4789730000","latitude":"31.7092220000","refundAddress":null,"refundTel":null,"refundContact":null,"isAutoSendRefundAddress":1,"province":"上海市","city":"上海市","district":"崇明区","address":"上海市崇明区稻田里的书店咖啡茶饮区东平镇东风公路833号东风农场C2","headName":"","headMobile":"18672789329","businessService":"WIFI,免费停车","businessType":"","deliveryInfo":null,"miniParam":null,"is_delete":0,"posType":{"desc":"快消餐饮","code":"FASTSTORE"}}]
class VipCard { class VipCard {
String id; String? id;
String createTime; String? createTime;
dynamic createUser; dynamic createUser;
String updateTime; String? updateTime;
String updateUser; String? updateUser;
String mid; String? mid;
String openid; String? openid;
String nickname; String? nickname;
String headimg; String? headimg;
String balance; String? balance;
String realRecharge; String? realRecharge;
String sex; String? sex;
bool status; bool? status;
bool onCredit; bool? onCredit;
String loginTime; String? loginTime;
int loginNum; int? loginNum;
String tenantCode; String? tenantCode;
int source; int? source;
String expendAmount; String? expendAmount;
int buyTimes; int? buyTimes;
dynamic lastBuyTime; dynamic lastBuyTime;
dynamic vipNo; dynamic vipNo;
dynamic expireTime; dynamic expireTime;
int integral; int integral = 0;
int level; int level = 0;
dynamic vipRegStore; dynamic vipRegStore;
String tenantName; String? tenantName;
String tenantLogo; String? tenantLogo;
List<StoreListBean> storeList; List<StoreListBean?>? storeList;
static VipCard fromJson(Map<String, dynamic> map) { static VipCard? fromJson(Map<String, dynamic>? map) {
if (map == null) return null; if (map == null) return null;
VipCard vipCardBean = VipCard(); VipCard vipCardBean = VipCard();
vipCardBean.id = map['id']; vipCardBean.id = map['id'];
@ -91,8 +61,8 @@ class VipCard {
vipCardBean.vipRegStore = map['vipRegStore']; vipCardBean.vipRegStore = map['vipRegStore'];
vipCardBean.tenantName = map['tenantName']; vipCardBean.tenantName = map['tenantName'];
vipCardBean.tenantLogo = map['tenantLogo']; vipCardBean.tenantLogo = map['tenantLogo'];
vipCardBean.storeList = List()..addAll( vipCardBean.storeList = []..addAll(
(map['storeList'] as List ?? []).map((o) => StoreListBean.fromMap(o)) (map['storeList'] as List).map((o) => StoreListBean.fromMap(o))
); );
return vipCardBean; return vipCardBean;
} }
@ -130,77 +100,43 @@ class VipCard {
}; };
} }
/// id : "1381798825072525312"
/// createTime : "2021-04-13 10:38:07"
/// createUser : "1"
/// updateTime : "2021-06-12 21:20:22"
/// updateUser : "1381798824988639232"
/// tenantCode : "1\nI/flutter ( 6658): 180"
/// useErp : false
/// openStartTime : "09:30:00"
/// openEndTime : "18:30:00"
/// storeName : "稻田里的书店"
/// nickName : ""
/// logo : "https://pos.upload.gznl.top/1180/2021/07/574aaeff-df3c-451a-b34f-67f9b3552427.png"
/// shipAddress : "上海市崇明区东风农场东风公路833弄1-22号C2-C3"
/// remark : ""
/// mobile : "13554204268"
/// longitude : "121.4789730000"
/// latitude : "31.7092220000"
/// refundAddress : null
/// refundTel : null
/// refundContact : null
/// isAutoSendRefundAddress : 1
/// province : "上海市"
/// city : "上海市"
/// district : "崇明区"
/// address : "上海市崇明区稻田里的书店咖啡茶饮区东平镇东风公路833号东风农场C2"
/// headName : ""
/// headMobile : "18672789329"
/// businessService : "WIFI,免费停车"
/// businessType : ""
/// deliveryInfo : null
/// miniParam : null
/// is_delete : 0
/// posType : {"desc":"快消餐饮","code":"FASTSTORE"}
class StoreListBean { class StoreListBean {
String id; String? id;
String createTime; String? createTime;
String createUser; String? createUser;
String updateTime; String? updateTime;
String updateUser; String? updateUser;
String tenantCode; String? tenantCode;
bool useErp; bool? useErp;
String openStartTime; String? openStartTime;
String openEndTime; String? openEndTime;
String storeName; String? storeName;
String nickName; String? nickName;
String logo; String? logo;
String shipAddress; String? shipAddress;
String remark; String? remark;
String mobile; String? mobile;
String longitude; String? longitude;
String latitude; String? latitude;
dynamic refundAddress; dynamic refundAddress;
dynamic refundTel; dynamic refundTel;
dynamic refundContact; dynamic refundContact;
int isAutoSendRefundAddress; int? isAutoSendRefundAddress;
String province; String? province;
String city; String? city;
String district; String? district;
String address; String? address;
String headName; String? headName;
String headMobile; String? headMobile;
String businessService; String? businessService;
String businessType; String? businessType;
dynamic deliveryInfo; dynamic deliveryInfo;
dynamic miniParam; dynamic miniParam;
dynamic distance; dynamic distance;
int isDelete; int? isDelete;
PosTypeBean posType; PosTypeBean? posType;
static StoreListBean fromMap(Map<String, dynamic> map) { static StoreListBean? fromMap(Map<String?, dynamic>? map) {
if (map == null) return null; if (map == null) return null;
StoreListBean storeListBean = StoreListBean(); StoreListBean storeListBean = StoreListBean();
storeListBean.id = map['id']; storeListBean.id = map['id'];
@ -283,10 +219,10 @@ class StoreListBean {
/// desc : "" /// desc : ""
class PosTypeBean { class PosTypeBean {
String code; String? code;
String desc; String? desc;
static PosTypeBean fromMap(Map<String, dynamic> map) { static PosTypeBean? fromMap(Map<String, dynamic>? map) {
if (map == null) return null; if (map == null) return null;
PosTypeBean posTypeBean = PosTypeBean(); PosTypeBean posTypeBean = PosTypeBean();
posTypeBean.code = map['code']; posTypeBean.code = map['code'];

66
lib/retrofit/data/wx_pay.dart

@ -7,58 +7,34 @@
/// timeStamp : "" /// timeStamp : ""
class WxPay { class WxPay {
String _appId;
String _nonceStr;
String _packageValue;
String _partnerId;
String _prepayId;
String _sign;
String _timeStamp;
String get appId => _appId; String? appId;
String get nonceStr => _nonceStr; String? nonceStr;
String get packageValue => _packageValue; String? packageValue;
String get partnerId => _partnerId; String? partnerId;
String get prepayId => _prepayId; String? prepayId;
String get sign => _sign; String? sign;
String get timeStamp => _timeStamp; String? timeStamp;
WxPay({
String appId,
String nonceStr,
String packageValue,
String partnerId,
String prepayId,
String sign,
String timeStamp}){
_appId = appId;
_nonceStr = nonceStr;
_packageValue = packageValue;
_partnerId = partnerId;
_prepayId = prepayId;
_sign = sign;
_timeStamp = timeStamp;
}
WxPay.fromJson(dynamic json) { WxPay.fromJson(dynamic json) {
_appId = json["appId"]; this.appId = json["appId"];
_nonceStr = json["nonceStr"]; this.nonceStr = json["nonceStr"];
_packageValue = json["packageValue"]; this.packageValue = json["packageValue"];
_partnerId = json["partnerId"]; this.partnerId = json["partnerId"];
_prepayId = json["prepayId"]; this.prepayId = json["prepayId"];
_sign = json["sign"]; this.sign = json["sign"];
_timeStamp = json["timeStamp"]; this.timeStamp = json["timeStamp"];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
var map = <String, dynamic>{}; var map = <String, dynamic>{};
map["appId"] = _appId; map["appId"] = this.appId;
map["nonceStr"] = _nonceStr; map["nonceStr"] = this.nonceStr;
map["packageValue"] = _packageValue; map["packageValue"] = this.packageValue;
map["partnerId"] = _partnerId; map["partnerId"] = this.partnerId;
map["prepayId"] = _prepayId; map["prepayId"] = this.prepayId;
map["sign"] = _sign; map["sign"] = this.sign;
map["timeStamp"] = _timeStamp; map["timeStamp"] = this.timeStamp;
return map; return map;
} }

15
lib/retrofit/retrofit_api.dart

@ -18,7 +18,6 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'data/address.dart'; import 'data/address.dart';
import 'data/banner.dart'; import 'data/banner.dart';
import 'data/brand.dart';
import 'data/brand_data.dart'; import 'data/brand_data.dart';
import 'data/exchange_order.dart'; import 'data/exchange_order.dart';
import 'data/goods.dart'; import 'data/goods.dart';
@ -30,10 +29,8 @@ import 'data/page.dart';
import 'data/rank.dart'; import 'data/rank.dart';
import 'data/sign_info.dart'; import 'data/sign_info.dart';
import 'data/store.dart'; import 'data/store.dart';
import 'data/store_info.dart';
import 'data/upload_result.dart'; import 'data/upload_result.dart';
import 'data/user_bill.dart'; import 'data/user_bill.dart';
import 'data/user_entity.dart';
import 'data/user_info.dart'; import 'data/user_info.dart';
import 'data/vip_card.dart'; import 'data/vip_card.dart';
import 'data/wx_pay.dart'; import 'data/wx_pay.dart';
@ -51,9 +48,9 @@ const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式
@RestApi(baseUrl: baseUrl) @RestApi(baseUrl: baseUrl)
abstract class ApiService { abstract class ApiService {
factory ApiService(Dio dio, factory ApiService(Dio dio,
{String baseUrl, {String? baseUrl,
BuildContext context, BuildContext? context,
String token, String? token,
bool showLoading = true, bool showLoading = true,
bool pay = false}) { bool pay = false}) {
Map<String, dynamic> headers = Map<String, dynamic> headers =
@ -90,7 +87,7 @@ abstract class ApiService {
debugPrint("code = ${response.statusCode}"); debugPrint("code = ${response.statusCode}");
p(jsonEncode(response.data)); p(jsonEncode(response.data));
Map map = response.data; Map map = response.data;
if (map["code"] == 40005 || map["code"] == 40001) { if ((map["code"] == 40005 || map["code"] == 40001) && context != null) {
SmartDialog.show( SmartDialog.show(
widget: LoginTips( widget: LoginTips(
click: () { click: () {
@ -102,7 +99,7 @@ abstract class ApiService {
value.setString("mobile", ""); value.setString("mobile", "");
value.setString("nick", ""); value.setString("nick", "");
}); });
Navigator.of(context).pushNamed('/router/login_page', Navigator.of(context!).pushNamed('/router/login_page',
arguments: {"login": "login"}); arguments: {"login": "login"});
}, },
), ),
@ -127,7 +124,7 @@ abstract class ApiService {
if (kReleaseMode) { if (kReleaseMode) {
baseUrl = base_url; baseUrl = base_url;
} }
return _ApiService(dio, baseUrl: baseUrl); return _ApiService(dio, baseUrl: baseUrl ?? "");
} }
static showDialog(context) async { static showDialog(context) async {

6
lib/setting/permission_setting_page.dart

@ -75,7 +75,7 @@ class _PermissionSettingPage extends State<PermissionSettingPage> {
]; ];
queryPermission() async { queryPermission() async {
await permissions.forEach((element) async { permissions.forEach((element) async {
if (await element.isGranted) { if (await element.isGranted) {
permissionSwitch[element] = true; permissionSwitch[element] = true;
} }
@ -111,7 +111,7 @@ class _PermissionSettingPage extends State<PermissionSettingPage> {
openPermission(Permission permission, int position) async { openPermission(Permission permission, int position) async {
if ((permissionSwitch.containsKey(permission) && if ((permissionSwitch.containsKey(permission) &&
permissionSwitch[permission])) { permissionSwitch![permission]!)) {
openAppSettings(); openAppSettings();
return; return;
} }
@ -219,7 +219,7 @@ class _PermissionSettingPage extends State<PermissionSettingPage> {
), ),
CupertinoSwitch( CupertinoSwitch(
value: (permissionSwitch.containsKey(permission) && value: (permissionSwitch.containsKey(permission) &&
permissionSwitch[permission]), permissionSwitch[permission]!),
onChanged: (boo) { onChanged: (boo) {
if (boo) { if (boo) {
requestDialog(position); requestDialog(position);

5
lib/setting/setting_page.dart

@ -3,7 +3,6 @@ import 'dart:io';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/login/login_page.dart';
import 'package:huixiang/main.dart'; import 'package:huixiang/main.dart';
import 'package:huixiang/utils/event_type.dart'; import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/flutter_utils.dart';
@ -22,7 +21,7 @@ class SettingPage extends StatefulWidget {
} }
class _SettingPage extends State<SettingPage> { class _SettingPage extends State<SettingPage> {
String locale = "tw"; String? locale = "tw";
String cacheTotal = "0B"; String cacheTotal = "0B";
@ -186,7 +185,7 @@ class _SettingPage extends State<SettingPage> {
} }
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
List<String> miniAppids = sharedPreferences.getStringList("miniAppid"); List<String>? miniAppids = sharedPreferences.getStringList("miniAppid");
if (miniAppids != null && miniAppids.length > 0) { if (miniAppids != null && miniAppids.length > 0) {
miniAppids.forEach((element) async { miniAppids.forEach((element) async {
print("appid: $element"); print("appid: $element");

43
lib/union/location_map_page.dart

@ -2,16 +2,13 @@ import 'dart:ui';
import 'package:flutter/material.dart'; 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_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart';
import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/location.dart'; import 'package:huixiang/utils/location.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
class LocationMap extends StatefulWidget { class LocationMap extends StatefulWidget {
final Map<String, String> arguments; final Map<String, String>? arguments;
LocationMap({this.arguments}); LocationMap({this.arguments});
@ -37,12 +34,12 @@ class _LocationMap extends State<LocationMap> {
event["longitude"] != null) { event["longitude"] != null) {
print("location: $event"); print("location: $event");
if (event["latitude"] is String && event["longitude"] is String) { if (event["latitude"] is String && event["longitude"] is String) {
myLatLng = BMFCoordinate(double.tryParse(event["latitude"]), myLatLng = BMFCoordinate(double.tryParse(event["latitude"] as String),
double.tryParse(event["longitude"])); double.tryParse(event["longitude"] as String));
} else { } else {
myLatLng = BMFCoordinate(event["latitude"], event["longitude"]); myLatLng = BMFCoordinate(event["latitude"] as double, event["longitude"] as double);
} }
AppUtils.coordConvert(myLatLng).then((value) { AppUtils.coordConvert(myLatLng!).then((value) {
this.myLatLng = value; this.myLatLng = value;
locationShow(); locationShow();
}); });
@ -65,7 +62,7 @@ class _LocationMap extends State<LocationMap> {
location: location, location: location,
); );
setState(() { setState(() {
_mapController.updateLocationData(userLocation); _mapController?.updateLocationData(userLocation);
}); });
} }
@ -80,7 +77,7 @@ class _LocationMap extends State<LocationMap> {
return Scaffold( return Scaffold(
appBar: MyAppBar( appBar: MyAppBar(
background: Color(0xFFF7F7F7), background: Color(0xFFF7F7F7),
title: widget.arguments["storeName"], title: widget.arguments!["storeName"],
titleColor: Colors.black87, titleColor: Colors.black87,
titleSize: 18.sp, titleSize: 18.sp,
leadingColor: Colors.black, leadingColor: Colors.black,
@ -89,8 +86,8 @@ class _LocationMap extends State<LocationMap> {
child: BMFMapWidget( child: BMFMapWidget(
mapOptions: BMFMapOptions( mapOptions: BMFMapOptions(
center: BMFCoordinate( center: BMFCoordinate(
double.tryParse(widget.arguments["lat"]), double.tryParse(widget.arguments!["lat"]!),
double.tryParse(widget.arguments["lng"]), double.tryParse(widget.arguments!["lng"]!),
), ),
showZoomControl: false, showZoomControl: false,
showMapScaleBar: false, showMapScaleBar: false,
@ -102,16 +99,16 @@ class _LocationMap extends State<LocationMap> {
); );
} }
BMFMapController _mapController; BMFMapController? _mapController;
BMFCoordinate latLng; BMFCoordinate? latLng;
BMFCoordinate myLatLng; BMFCoordinate? myLatLng;
BMFMarker bmfMarker; BMFMarker? bmfMarker;
onMapCreated(BMFMapController controller) { onMapCreated(BMFMapController controller) {
_mapController = controller; _mapController = controller;
setState(() { setState(() {
_mapController.showUserLocation(true); _mapController?.showUserLocation(true);
_mapController.setCustomMapStyle('assets/map_style/chatian.sty', 0); _mapController?.setCustomMapStyle('assets/map_style/chatian.sty', 0);
BMFUserLocationDisplayParam displayParam = BMFUserLocationDisplayParam( BMFUserLocationDisplayParam displayParam = BMFUserLocationDisplayParam(
locationViewOffsetX: 0, locationViewOffsetX: 0,
locationViewOffsetY: 0, locationViewOffsetY: 0,
@ -122,7 +119,7 @@ class _LocationMap extends State<LocationMap> {
locationViewHierarchy: locationViewHierarchy:
BMFLocationViewHierarchy.LOCATION_VIEW_HIERARCHY_BOTTOM, BMFLocationViewHierarchy.LOCATION_VIEW_HIERARCHY_BOTTOM,
); );
_mapController.updateLocationViewWithParam(displayParam); _mapController?.updateLocationViewWithParam(displayParam);
addMarker(); addMarker();
}); });
} }
@ -130,8 +127,8 @@ class _LocationMap extends State<LocationMap> {
addMarker() async { addMarker() async {
// latLng = await AppUtils.coordConvert(BMFCoordinate(double.tryParse(widget.arguments["lat"]), // latLng = await AppUtils.coordConvert(BMFCoordinate(double.tryParse(widget.arguments["lat"]),
// double.tryParse(widget.arguments["lng"]))); // double.tryParse(widget.arguments["lng"])));
latLng = BMFCoordinate(double.tryParse(widget.arguments["lat"]), latLng = BMFCoordinate(double.tryParse(widget.arguments!["lat"]!),
double.tryParse(widget.arguments["lng"])); double.tryParse(widget.arguments!["lng"]!));
if (bmfMarker == null && _mapController != null) { if (bmfMarker == null && _mapController != null) {
bmfMarker = BMFMarker( bmfMarker = BMFMarker(
@ -141,9 +138,9 @@ class _LocationMap extends State<LocationMap> {
icon: "assets/image/icon_map_marker.png", icon: "assets/image/icon_map_marker.png",
draggable: false, draggable: false,
); );
_mapController.addMarker(bmfMarker); _mapController?.addMarker(bmfMarker);
} }
_mapController.updateMapOptions( _mapController?.updateMapOptions(
BMFMapOptions( BMFMapOptions(
center: latLng, center: latLng,
zoomLevel: 15, zoomLevel: 15,

186
lib/union/store_details_page.dart

@ -35,7 +35,7 @@ import 'package:chewie/src/chewie_progress_colors.dart' as chewie;
import 'package:chewie/chewie.dart'; import 'package:chewie/chewie.dart';
class StoreDetailsPage extends StatefulWidget { class StoreDetailsPage extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic>? arguments;
/// ///
StoreDetailsPage({this.arguments}); StoreDetailsPage({this.arguments});
@ -48,8 +48,8 @@ class StoreDetailsPage extends StatefulWidget {
class _StoreDetailsPage extends State<StoreDetailsPage> class _StoreDetailsPage extends State<StoreDetailsPage>
with WidgetsBindingObserver { with WidgetsBindingObserver {
ApiService apiService; late ApiService apiService;
RefreshController _refreshController; RefreshController? _refreshController;
int commentTotal = 0; int commentTotal = 0;
var commentTextController = TextEditingController(); var commentTextController = TextEditingController();
var commentFocus = FocusNode(); var commentFocus = FocusNode();
@ -61,7 +61,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
@override @override
void didChangeMetrics() { void didChangeMetrics() {
super.didChangeMetrics(); super.didChangeMetrics();
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance!.addPostFrameCallback((_) {
setState(() { setState(() {
print("object: ${MediaQuery.of(context).viewInsets.bottom}"); print("object: ${MediaQuery.of(context).viewInsets.bottom}");
if (MediaQuery.of(context).viewInsets.bottom == 0) { if (MediaQuery.of(context).viewInsets.bottom == 0) {
@ -80,7 +80,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
@override @override
void initState() { void initState() {
super.initState(); super.initState();
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance!.addObserver(this);
_refreshController = RefreshController(); _refreshController = RefreshController();
@ -94,24 +94,24 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
}); });
} }
Activity activity; Activity? activity;
Article article; Article? article;
List<MemberCommentList> memberList = []; List<MemberCommentList?> memberList = [];
GlobalKey commentKey = GlobalKey(); GlobalKey commentKey = GlobalKey();
ScrollController scrollController = ScrollController(); ScrollController scrollController = ScrollController();
queryHtml() async { //activityInfo queryHtml() async { //activityInfo
if (widget.arguments["activityId"] != null) { if (widget.arguments!["activityId"] != null) {
BaseData<Activity> baseData = await apiService.activityInfo(widget.arguments["activityId"]); BaseData<Activity> baseData = await apiService.activityInfo(widget.arguments!["activityId"]);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
setState(() { setState(() {
activity = baseData.data; activity = baseData.data;
}); });
} }
} }
if (widget.arguments["articleId"] != null) { if (widget.arguments!["articleId"] != null) {
BaseData<Article> baseData = await apiService.informationInfo(widget.arguments["articleId"]); BaseData<Article> baseData = await apiService.informationInfo(widget.arguments!["articleId"]);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
setState(() { setState(() {
article = baseData.data; article = baseData.data;
}); });
@ -123,26 +123,26 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
SSDKMap params = SSDKMap() SSDKMap params = SSDKMap()
..setGeneral( ..setGeneral(
activity != null activity != null
? activity.mainTitle ? activity!.mainTitle!
: article != null : article != null
? article.mainTitle ? article!.mainTitle!
: "", : "",
activity != null activity != null
? activity.viceTitle ? activity!.viceTitle
: article != null : article != null
? article.viceTitle ? article!.viceTitle
: "", : "",
[ [
activity != null activity != null
? activity.coverImg ? activity!.coverImg
: article != null : article != null
? article.coverImg ? article!.coverImg
: "", : "",
], ],
activity != null activity != null
? activity.coverImg ? activity!.coverImg!
: article != null : article != null
? article.coverImg ? article!.coverImg!
: "", : "",
"", "",
buildShareUrl(), buildShareUrl(),
@ -154,9 +154,9 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
); );
debugPrint(activity != null debugPrint(activity != null
? activity.coverImg ? activity!.coverImg
: article != null : article != null
? article.coverImg ? article!.coverImg
: ""); : "");
showModalBottomSheet( showModalBottomSheet(
@ -167,7 +167,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
if (platform == ShareSDKPlatforms.line) { if (platform == ShareSDKPlatforms.line) {
params.map["type"] = SSDKContentTypes.text.value; params.map["type"] = SSDKContentTypes.text.value;
params.map["text"] = params.map["text"] =
"${activity != null ? activity.viceTitle : article != null ? article.viceTitle : ""} ${buildShareUrl()}"; "${activity != null ? activity!.viceTitle : article != null ? article!.viceTitle : ""} ${buildShareUrl()}";
} }
SharesdkPlugin.share(platform, params, SharesdkPlugin.share(platform, params,
(state, userData, contentEntity, error) { (state, userData, contentEntity, error) {
@ -178,25 +178,25 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
} }
String buildShareUrl() { String buildShareUrl() {
return "https://hx.lotus-wallet.com/index.html?id=${widget.arguments["activityId"] ?? widget.arguments["articleId"]}&type=${activity != null ? "activity" : article != null ? "article" : ""}"; return "https://hx.lotus-wallet.com/index.html?id=${widget.arguments!["activityId"] ?? widget.arguments!["articleId"]}&type=${activity != null ? "activity" : article != null ? "article" : ""}";
} }
// //
queryMemberCommentList() async { queryMemberCommentList() async {
BaseData<PageInfo<MemberCommentList>> baseData = await apiService.memberCommentList({ BaseData<PageInfo<MemberCommentList?>?> baseData = await apiService.memberCommentList({
"pageNum": 1, "pageNum": 1,
"pageSize": 100, "pageSize": 100,
"relationalId": "relationalId":
widget.arguments["activityId"] ?? widget.arguments["articleId"], widget.arguments!["activityId"] ?? widget.arguments!["articleId"],
"relationalType": 1, "relationalType": 1,
}).catchError((error) { }).catchError((error) {
_refreshController.refreshFailed(); _refreshController?.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
_refreshController.refreshCompleted(); _refreshController?.refreshCompleted();
setState(() { setState(() {
commentTotal = baseData.data.size; commentTotal = baseData.data!.size;
memberList = baseData.data.list; memberList = baseData.data!.list!;
}); });
} }
} }
@ -204,7 +204,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
// //
queryCommentLike(String id) async { queryCommentLike(String id) async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
String token = sharedPreferences.getString("token"); String? token = sharedPreferences.getString("token");
if (token == null || token == "") { if (token == null || token == "") {
SmartDialog.show( SmartDialog.show(
widget: LoginTips( widget: LoginTips(
@ -221,15 +221,15 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
} }
BaseData baseData = await apiService.commentLike(id).catchError((onError) {}); BaseData baseData = await apiService.commentLike(id).catchError((onError) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
setState(() { setState(() {
memberList.forEach((element) { memberList.forEach((element) {
if (element.id == id) { if (element!.id == id) {
if (element.liked) { if (element.liked!) {
element.likes -= 1; element.likes = element.likes! - 1;
element.liked = false; element.liked = false;
} else { } else {
element.likes += 1; element.likes = element.likes! + 1;
element.liked = true; element.liked = true;
} }
} }
@ -241,27 +241,27 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
/// ///
queryInformationLikes() async { queryInformationLikes() async {
BaseData baseData = await apiService.informationLikes( BaseData baseData = await apiService.informationLikes(
widget.arguments["activityId"] ?? widget.arguments["articleId"]); widget.arguments!["activityId"] ?? widget.arguments!["articleId"]);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
setState(() { setState(() {
if (article != null) { if (article != null) {
if (article.liked) { if (article!.liked!) {
article.likes -= 1; article!.likes = article!.likes! - 1;
} else { } else {
article.likes += 1; article!.likes = article!.likes! + 1;
} }
article.liked = !article.liked; article!.liked = !article!.liked!;
} else if (activity != null) { } else if (activity != null) {
if (activity.liked) { if (activity!.liked!) {
activity.likes -= 1; activity!.likes = activity!.likes! - 1;
} else { } else {
activity.likes += 1; activity!.likes = activity!.likes! + 1;
} }
activity.liked = !activity.liked; activity!.liked = !activity!.liked!;
} }
}); });
} else { } else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); SmartDialog.showToast(baseData.msg!, alignment: Alignment.center);
} }
} }
@ -271,12 +271,12 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
"content": content, "content": content,
"parentId": parenId, "parentId": parenId,
"relationalId": "relationalId":
widget.arguments["activityId"] ?? widget.arguments["articleId"], widget.arguments!["activityId"] ?? widget.arguments!["articleId"],
"relationalType": 1 "relationalType": 1
}).catchError((error) { }).catchError((error) {
_refreshController.refreshFailed(); _refreshController?.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
commentTextController.text = ""; commentTextController.text = "";
queryMemberCommentList(); queryMemberCommentList();
} }
@ -302,9 +302,9 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
background: Color(0xFFF7F7F7), background: Color(0xFFF7F7F7),
leadingColor: Colors.black, leadingColor: Colors.black,
title: activity != null title: activity != null
? activity.mainTitle ? activity!.mainTitle
: article != null : article != null
? article.mainTitle ? article!.mainTitle
: "", : "",
titleSize: 18.sp, titleSize: 18.sp,
titleColor: Colors.black, titleColor: Colors.black,
@ -332,9 +332,9 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text( child: Text(
activity != null activity != null
? activity.mainTitle ? activity!.mainTitle!
: article != null : article != null
? article.mainTitle ? article!.mainTitle!
: "", : "",
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
@ -349,7 +349,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
children: [ children: [
InkWell( InkWell(
child: Text( child: Text(
"${activity != null ? activity.storeName : (article != null && article.author != null) ? article.author.name : ""}", "${activity != null ? activity!.storeName : (article != null && article!.author != null) ? article!.author!.name : ""}",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontSize: 14.sp, fontSize: 14.sp,
@ -358,17 +358,17 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
), ),
onTap: () { onTap: () {
if (activity != null) { if (activity != null) {
if (widget.arguments["source"] != null && if (widget.arguments!["source"] != null &&
widget.arguments["source"] == widget.arguments!["source"] ==
activity.storeId) { activity!.storeId) {
Navigator.of(context).pop(); Navigator.of(context).pop();
} else { } else {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/union_detail_page', '/router/union_detail_page',
arguments: { arguments: {
"id": activity.storeId, "id": activity!.storeId,
"source": "source":
widget.arguments["activityId"] widget.arguments!["activityId"]
}); });
} }
} }
@ -379,9 +379,9 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
), ),
Text( Text(
activity != null activity != null
? activity.createTime ? activity!.createTime!
: article != null : article != null
? article.createTime ? article!.createTime!
: "", : "",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
@ -394,9 +394,9 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
), ),
Html( Html(
data: activity != null data: activity != null
? activity.content ? activity!.content
: article != null : article != null
? article.content ? article!.content
: "", : "",
customImageRenders: { customImageRenders: {
base64DataUriMatcher(): base64ImageRender(), base64DataUriMatcher(): base64ImageRender(),
@ -412,25 +412,25 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
customRender: { customRender: {
"video": (context, parsedChild, attributes, element) { "video": (context, parsedChild, attributes, element) {
return videoWidget( return videoWidget(
double.tryParse(attributes['width'] ?? ""), double.tryParse(attributes['width'] ?? "")!,
double.tryParse( double.tryParse(
element.attributes['height'] ?? ""), element.attributes['height'] ?? "")!,
element.children.first.attributes["src"], element.children.first.attributes["src"],
element.attributes["sandbox"]); element.attributes["sandbox"]);
}, },
"iframe": "iframe":
(context, parsedChild, attributes, element) { (context, parsedChild, attributes, element) {
return videoWidget( return videoWidget(
double.tryParse(attributes['width'] ?? ""), double.tryParse(attributes['width'] ?? "")!,
double.tryParse( double.tryParse(
element.attributes['height'] ?? ""), element.attributes['height'] ?? "")!,
element.children.first.attributes["src"], element.children.first.attributes["src"],
element.attributes["sandbox"]); element.attributes["sandbox"]);
}, },
"audio": (context, parsedChild, attributes, element) { "audio": (context, parsedChild, attributes, element) {
final sources = <String>[ final sources = <String>[
if (element.attributes['src'] != null) if (element.attributes['src'] != null)
element.attributes['src'], element.attributes['src']!,
]; ];
if (sources == null || if (sources == null ||
sources.isEmpty || sources.isEmpty ||
@ -505,10 +505,10 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
child: InkWell( child: InkWell(
onTap: () { onTap: () {
showPressMenu( showPressMenu(
memberList[position].createUser, memberList[position]!.createUser!,
memberList[position]); memberList[position]);
}, },
child: commentItem(memberList[position], child: commentItem(memberList![position]!,
position, memberList.length), position, memberList.length),
), ),
); );
@ -584,8 +584,8 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
delComment() async { delComment() async {
BaseData baseData = await apiService.delComment( BaseData baseData = await apiService.delComment(
widget.arguments["activityId"] ?? widget.arguments["articleId"]); widget.arguments!["activityId"] ?? widget.arguments!["articleId"]);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
queryMemberCommentList(); queryMemberCommentList();
} }
} }
@ -710,20 +710,20 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
); );
}, },
isLiked: (activity != null isLiked: (activity != null
? activity.liked ? activity!.liked
: article != null : article != null
? article.liked ? article!.liked
: false), : false),
onTap: (isLiked) async { onTap: (isLiked) async {
await queryInformationLikes(); await queryInformationLikes();
return (activity != null return (activity != null
? activity.liked ? activity!.liked!
: article != null : article != null
? article.liked ? article!.liked!
: false); : false);
}, },
// likeCount: memberList.likes, // likeCount: memberList.likes,
countBuilder: (int count, bool isLiked, String text) { countBuilder: (int? count, bool isLiked, String text) {
return Text( return Text(
text, text,
style: TextStyle( style: TextStyle(
@ -740,14 +740,14 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
toComment() { toComment() {
if (commentKey.currentContext == null) return; if (commentKey.currentContext == null) return;
RenderBox firstRenderBox = commentKey.currentContext.findRenderObject(); RenderBox firstRenderBox = commentKey.currentContext!.findRenderObject() as RenderBox;
Offset first = firstRenderBox.localToGlobal(Offset.zero); Offset first = firstRenderBox.localToGlobal(Offset.zero);
scrollController.animateTo(first.dy + scrollController.offset - (kToolbarHeight + MediaQuery.of(context).padding.top), duration: Duration(milliseconds: 100), curve: Curves.easeIn); scrollController.animateTo(first.dy + scrollController.offset - (kToolbarHeight + MediaQuery.of(context).padding.top), duration: Duration(milliseconds: 100), curve: Curves.easeIn);
} }
VideoPlayerController videoPlayerController; VideoPlayerController? videoPlayerController;
ChewieController chewieAudioController; ChewieController? chewieAudioController;
Chewie chewies; Chewie? chewies;
Widget videoWidget(double width, double height, src, sandboxMode) { Widget videoWidget(double width, double height, src, sandboxMode) {
print("src : $src"); print("src : $src");
@ -842,7 +842,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
), ),
Text( Text(
memberList.createTime, memberList.createTime!,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 2, maxLines: 2,
style: TextStyle( style: TextStyle(
@ -882,13 +882,13 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
}, },
isLiked: memberList.liked ?? false, isLiked: memberList.liked ?? false,
onTap: (isLiked) async { onTap: (isLiked) async {
await queryCommentLike(memberList.id); await queryCommentLike(memberList.id!);
return (memberList == null || memberList.liked == null) return (memberList == null || memberList.liked == null)
? false ? false
: memberList.liked; : memberList.liked!;
}, },
likeCount: memberList.likes, likeCount: memberList.likes,
countBuilder: (int count, bool isLiked, String text) { countBuilder: (int? count, bool isLiked, String text) {
return Text( return Text(
text, text,
style: TextStyle( style: TextStyle(
@ -908,7 +908,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
child: Align( child: Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text( child: Text(
memberList.content, memberList.content!,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xff1A1A1A), color: Color(0xff1A1A1A),
@ -981,10 +981,10 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
@override @override
void dispose() { void dispose() {
WidgetsBinding.instance.removeObserver(this); WidgetsBinding.instance!.removeObserver(this);
if (chewieAudioController != null) chewieAudioController.dispose(); if (chewieAudioController != null) chewieAudioController!.dispose();
if (videoPlayerController != null) videoPlayerController.dispose(); if (videoPlayerController != null) videoPlayerController!.dispose();
super.dispose(); super.dispose();
} }

236
lib/union/union_details_page.dart

@ -29,7 +29,7 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
class UnionDetailsPage extends StatefulWidget { class UnionDetailsPage extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic>? arguments;
UnionDetailsPage({this.arguments}); UnionDetailsPage({this.arguments});
@ -40,7 +40,7 @@ class UnionDetailsPage extends StatefulWidget {
} }
class _UnionDetailsPage extends State<UnionDetailsPage> { class _UnionDetailsPage extends State<UnionDetailsPage> {
ApiService apiService; late ApiService apiService;
@override @override
void dispose() { void dispose() {
@ -59,18 +59,18 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
}); });
} }
StoreInfo storeInfo; StoreInfo? storeInfo;
List<Activity> activitys; List<Activity>? activitys;
queryStoreInfo() async { queryStoreInfo() async {
BaseData baseData = await apiService.queryStoreInfo(widget.arguments["id"]) BaseData baseData = await apiService.queryStoreInfo(widget.arguments!["id"])
.catchError((error) { .catchError((error) {
refreshController.refreshFailed(); refreshController.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
refreshController.refreshCompleted(); refreshController.refreshCompleted();
storeInfo = StoreInfo.fromJson(baseData.data); storeInfo = StoreInfo.fromJson(baseData.data);
activitys = storeInfo.informationVOPageVO.list activitys = storeInfo!.informationVOPageVO!.list!
.map((e) => Activity.fromJson(e)) .map((e) => Activity.fromJson(e))
.toList(); .toList();
if (mounted) setState(() {}); if (mounted) setState(() {});
@ -86,7 +86,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
return Scaffold( return Scaffold(
appBar: MyAppBar( appBar: MyAppBar(
background: Color(0xFFF7F7F7), background: Color(0xFFF7F7F7),
title: storeInfo == null ? "" : storeInfo.storeName, title: storeInfo == null ? "" : storeInfo!.storeName,
titleColor: Colors.black87, titleColor: Colors.black87,
titleSize: 18.sp, titleSize: 18.sp,
leadingColor: Colors.black, leadingColor: Colors.black,
@ -149,7 +149,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
children: [ children: [
Text( Text(
storeInfo != null storeInfo != null
? storeInfo.storeName ? storeInfo!.storeName!
: "", : "",
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
@ -163,8 +163,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
child: Text( child: Text(
S.of(context).ren( S.of(context).ren(
storeInfo != null storeInfo != null
? storeInfo ? storeInfo!
.perCapitaConsumption .perCapitaConsumption!
: "", : "",
), ),
style: TextStyle( style: TextStyle(
@ -179,7 +179,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
), ),
Text( Text(
storeInfo != null storeInfo != null
? storeInfo.address ? storeInfo!.address!
: "", : "",
maxLines: 2, maxLines: 2,
textAlign: TextAlign.justify, textAlign: TextAlign.justify,
@ -192,7 +192,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
Row( Row(
children: itemServer( children: itemServer(
storeInfo != null storeInfo != null
? storeInfo.businessService ? storeInfo!.businessService!
: "", : "",
), ),
), ),
@ -205,12 +205,12 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
S.of(context).yingyeshijian(storeInfo == S.of(context).yingyeshijian(storeInfo ==
null null
? "" ? ""
: (storeInfo.openStartTime == : (storeInfo!.openStartTime ==
null && null &&
storeInfo.openEndTime == storeInfo!.openEndTime ==
null) null)
? S.of(context).quantian ? S.of(context).quantian
: "${storeInfo.openStartTime.substring(0, storeInfo.openStartTime.lastIndexOf(":"))} - ${storeInfo.openEndTime.substring(0, storeInfo.openEndTime.lastIndexOf(":"))}"), : "${storeInfo!.openStartTime!.substring(0, storeInfo!.openStartTime!.lastIndexOf(":"))} - ${storeInfo!.openEndTime!.substring(0, storeInfo!.openEndTime!.lastIndexOf(":"))}"),
style: TextStyle( style: TextStyle(
color: Color(0xFF353535), color: Color(0xFF353535),
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@ -223,18 +223,18 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
InkWell( InkWell(
onTap: () { onTap: () {
if (storeInfo == null || if (storeInfo == null ||
storeInfo.latitude == null || storeInfo!.latitude == null ||
storeInfo.longitude == null || storeInfo!.longitude == null ||
storeInfo.latitude == "" || storeInfo!.latitude == "" ||
storeInfo.longitude == "") storeInfo!.longitude == "")
return; return;
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/location_map', '/router/location_map',
arguments: { arguments: {
"lat": storeInfo.latitude, "lat": storeInfo!.latitude,
"lng": storeInfo.longitude, "lng": storeInfo!.longitude,
"storeName": "storeName":
storeInfo.storeName, storeInfo!.storeName,
}); });
}, },
child: Image.asset( child: Image.asset(
@ -276,7 +276,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
imgPath: "assets/image/icon_union_coupons.png", imgPath: "assets/image/icon_union_coupons.png",
), ),
), ),
(storeInfo != null && storeInfo.couponVOList != null) (storeInfo != null && storeInfo!.couponVOList != null)
? buildCoupon() ? buildCoupon()
: Container( : Container(
width: double.infinity, width: double.infinity,
@ -298,7 +298,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
imgPath: "assets/image/icon_union_start_store.png", imgPath: "assets/image/icon_union_start_store.png",
), ),
), ),
(activitys != null && activitys.length > 0) (activitys != null && activitys!.length > 0)
? Container( ? Container(
margin: EdgeInsets.only(bottom: 30.h), margin: EdgeInsets.only(bottom: 30.h),
child: AspectRatio( child: AspectRatio(
@ -357,14 +357,14 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
bool isEnable() { bool isEnable() {
if (storeInfo == null) return false; if (storeInfo == null) return false;
if (storeInfo.mini == null) return false; if (storeInfo!.mini == null) return false;
String miniAppId = storeInfo.mini.miniAppId; String miniAppId = storeInfo!.mini!.miniAppId!;
if (miniAppId == null || if (miniAppId == null ||
miniAppId == "" || miniAppId == "" ||
storeInfo.mini.miniVersion == null || storeInfo!.mini!.miniVersion! == null ||
storeInfo.mini.miniVersion == "" || storeInfo!.mini!.miniVersion! == "" ||
storeInfo.mini.miniDownloadUrl == null || storeInfo!.mini!.miniDownloadUrl! == null ||
storeInfo.mini.miniDownloadUrl == "") { storeInfo!.mini!.miniDownloadUrl! == "") {
return false; return false;
} else { } else {
return true; return true;
@ -374,7 +374,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
Widget buildVip() { Widget buildVip() {
return Container( return Container(
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
vertical: (storeInfo != null && storeInfo.isVip) ? 12.h : 20.h, vertical: (storeInfo != null && storeInfo!.isVip!) ? 12.h : 20.h,
horizontal: 16.w), horizontal: 16.w),
padding: EdgeInsets.all(16), padding: EdgeInsets.all(16),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -383,7 +383,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
image: AssetImage("assets/image/icon_vip_bg.png"), image: AssetImage("assets/image/icon_vip_bg.png"),
), ),
), ),
child: (storeInfo != null && storeInfo.isVip) child: (storeInfo != null && storeInfo!.isVip!)
? Column( ? Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -409,7 +409,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
width: 8.w, width: 8.w,
), ),
Text( Text(
"¥${(storeInfo != null && storeInfo.memberSource != null) ? storeInfo.memberSource.balance : ""}", "¥${(storeInfo != null && storeInfo!.memberSource != null) ? storeInfo!.memberSource!.balance! : ""}",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -440,8 +440,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
width: 8.w, width: 8.w,
), ),
Text( Text(
(storeInfo != null && storeInfo.memberSource != null) (storeInfo != null && storeInfo!.memberSource != null)
? "${storeInfo.memberSource.integral}" ? "${storeInfo!.memberSource!.integral!}"
: "", : "",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
@ -519,8 +519,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
return Container( return Container(
height: 109.h, height: 109.h,
child: ListView.builder( child: ListView.builder(
itemCount: (storeInfo != null && storeInfo.couponVOList != null) itemCount: (storeInfo != null && storeInfo!.couponVOList != null)
? storeInfo.couponVOList.length ? storeInfo!.couponVOList!.length
: 0, : 0,
physics: BouncingScrollPhysics(parent: PageScrollPhysics()), physics: BouncingScrollPhysics(parent: PageScrollPhysics()),
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
@ -554,9 +554,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
child: Text.rich(TextSpan(children: [ child: Text.rich(TextSpan(children: [
TextSpan( TextSpan(
text: (storeInfo != null && text: (storeInfo != null &&
storeInfo.couponVOList != null && storeInfo!.couponVOList != null &&
storeInfo storeInfo!.couponVOList![position]!.bizType! ==
.couponVOList[position].bizType ==
1) 1)
? "¥" ? "¥"
: "", : "",
@ -568,18 +567,17 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
), ),
TextSpan( TextSpan(
text: (storeInfo != null && text: (storeInfo != null &&
storeInfo.couponVOList != null && storeInfo!.couponVOList != null &&
storeInfo storeInfo!
.couponVOList[position].bizType == .couponVOList![position]!.bizType! ==
1) 1)
? "${double.tryParse(storeInfo.couponVOList[position].discountAmount).toInt()}" ? "${double.tryParse(storeInfo!.couponVOList![position]!.discountAmount!)!.toInt()}"
: (storeInfo != null && : (storeInfo != null &&
storeInfo.couponVOList != null && storeInfo!.couponVOList != null &&
storeInfo.couponVOList[position] storeInfo!.couponVOList![position]!.bizType ==
.bizType ==
5) 5)
? S.of(context).duihuanquan ? S.of(context).duihuanquan
: "${storeInfo.couponVOList[position].discountPercent / 10}", : "${storeInfo!.couponVOList![position]!.discountPercent! / 10}",
style: TextStyle( style: TextStyle(
fontSize: 36.sp, fontSize: 36.sp,
color: Color(0xFFFF7A1A), color: Color(0xFFFF7A1A),
@ -614,9 +612,9 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
children: [ children: [
Text( Text(
(storeInfo != null && (storeInfo != null &&
storeInfo.couponVOList != null) storeInfo!.couponVOList != null)
? storeInfo ? storeInfo!
.couponVOList[position].couponName .couponVOList![position]!.couponName!
: "", : "",
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@ -628,22 +626,22 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
), ),
Text( Text(
(storeInfo != null && (storeInfo != null &&
storeInfo.couponVOList != null) storeInfo!.couponVOList != null)
? (storeInfo.couponVOList[position] ? (storeInfo!.couponVOList![position]!
.bizType == .bizType ==
1 1
? S.of(context).manlijiandaijinquan( ? S.of(context).manlijiandaijinquan(
double.tryParse(storeInfo double.tryParse(storeInfo!
.couponVOList[position] .couponVOList![position]!
.fullAmount) .fullAmount!)!
.toInt(), .toInt(),
double.tryParse(storeInfo double.tryParse(storeInfo!
.couponVOList[position] .couponVOList![position]!
.discountAmount) .discountAmount!)!
.toInt()) .toInt())
: S.of(context).quanchangzhe(storeInfo : S.of(context).quanchangzhe(storeInfo!
.couponVOList[position] .couponVOList![position]!
.discountPercent)) .discountPercent!))
: "", : "",
// (storeInfo != null && storeInfo.couponVOList != null) ? storeInfo.couponVOList[position].couponImg : "", // (storeInfo != null && storeInfo.couponVOList != null) ? storeInfo.couponVOList[position].couponImg : "",
// S.of(context).manlijiandaijinquan(30, 5), // S.of(context).manlijiandaijinquan(30, 5),
@ -657,15 +655,15 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
Text( Text(
S.of(context).youxiaoqizhi( S.of(context).youxiaoqizhi(
(storeInfo != null && (storeInfo != null &&
storeInfo.couponVOList != storeInfo!.couponVOList !=
null && null &&
storeInfo.couponVOList[position] storeInfo!.couponVOList![position]!
.useStartTime != .useStartTime !=
null && null &&
storeInfo.couponVOList[position] storeInfo!.couponVOList![position]!
.useEndTime != .useEndTime !=
null) null)
? "${storeInfo.couponVOList[position].useStartTime.replaceAll("-", ".").split(" ")[0]}-${storeInfo.couponVOList[position].useEndTime.replaceAll("-", ".").split(" ")[0]}" ? "${storeInfo!.couponVOList![position]!.useStartTime!.replaceAll("-", ".").split(" ")[0]}-${storeInfo!.couponVOList![position]!.useEndTime!.replaceAll("-", ".").split(" ")[0]}"
: "", : "",
), ),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@ -682,25 +680,25 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
InkWell( InkWell(
onTap: () { onTap: () {
if (storeInfo != null && if (storeInfo != null &&
storeInfo.couponVOList != null && storeInfo!.couponVOList != null &&
storeInfo.couponVOList[position].status == 0) { storeInfo!.couponVOList![position]!.status == 0) {
receiveCoupon( receiveCoupon(
storeInfo.couponVOList[position].id); storeInfo!.couponVOList![position]!.id);
} }
}, },
child: Container( child: Container(
height: 25.h, height: 25.h,
child: RoundButton( child: RoundButton(
text: (storeInfo != null && text: (storeInfo != null &&
storeInfo.couponVOList != null && storeInfo!.couponVOList != null &&
storeInfo.couponVOList[position].status > storeInfo!.couponVOList![position]!.status! >
0) 0)
? S.of(context).yilingqu ? S.of(context).yilingqu
: S.of(context).lingqu, : S.of(context).lingqu,
textColor: Colors.white, textColor: Colors.white,
backgroup: (storeInfo != null && backgroup: (storeInfo != null &&
storeInfo.couponVOList != null && storeInfo!.couponVOList != null &&
storeInfo.couponVOList[position].status > storeInfo!.couponVOList![position]!.status! >
0) 0)
? Colors.grey ? Colors.grey
: Color(0xFF32A060), : Color(0xFF32A060),
@ -724,7 +722,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
/// ///
receiveCoupon(couponId) async { receiveCoupon(couponId) async {
BaseData baseData = await apiService.receiveCoupon(couponId); BaseData baseData = await apiService.receiveCoupon(couponId);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
queryStoreInfo(); queryStoreInfo();
showAlertDialog(); showAlertDialog();
} }
@ -743,8 +741,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
///VIP ///VIP
receiveVip() async { receiveVip() async {
BaseData baseData = await apiService.minLogin(storeInfo.id); BaseData baseData = await apiService.minLogin(storeInfo!.id!);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
SmartDialog.showToast(S.of(context).lingquchenggong, SmartDialog.showToast(S.of(context).lingquchenggong,
alignment: Alignment.center); alignment: Alignment.center);
setState(() { setState(() {
@ -761,14 +759,14 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
itemBuilder: (context, position) { itemBuilder: (context, position) {
return InkWell( return InkWell(
onTap: () { onTap: () {
if (widget.arguments["source"] != null && if (widget.arguments!["source"] != null &&
widget.arguments["source"] == activitys[position].id) { widget.arguments!["source"] == activitys![position].id) {
Navigator.of(context).pop(); Navigator.of(context).pop();
} else { } else {
Navigator.of(context).pushNamed('/router/store_detail_page', Navigator.of(context).pushNamed('/router/store_detail_page',
arguments: { arguments: {
"activityId": activitys[position].id, "activityId": activitys![position].id,
"source": widget.arguments["id"] "source": widget.arguments!["id"]
}); });
} }
}, },
@ -795,8 +793,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
MImage( MImage(
(activitys != null && activitys.length > position) (activitys != null && activitys!.length > position)
? activitys[position].coverImg ? activitys![position].coverImg!
: "", : "",
aspectRatio: 2.2, aspectRatio: 2.2,
radius: BorderRadius.only( radius: BorderRadius.only(
@ -815,8 +813,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
children: [ children: [
Text( Text(
(activitys != null && (activitys != null &&
activitys.length > position) activitys!.length > position)
? activitys[position].storeName ? activitys![position].storeName!
: "", : "",
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
@ -829,8 +827,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
), ),
Text( Text(
(activitys != null && (activitys != null &&
activitys.length > position) activitys!.length > position)
? activitys[position].mainTitle ? activitys![position].mainTitle!
: "", : "",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
@ -860,8 +858,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
), ),
), ),
child: Text( child: Text(
(activitys != null && activitys.length > position) (activitys != null && activitys!.length > position)
? activitys[position].startTime.split(" ")[0] ? activitys![position].startTime!.split(" ")[0]
: "", : "",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -877,7 +875,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
); );
}, },
itemCount: itemCount:
(activitys != null && activitys.length > 0) ? activitys.length : 0, (activitys != null && activitys!.length > 0) ? activitys!.length : 0,
), ),
); );
} }
@ -900,9 +898,9 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
margin: EdgeInsets.only(left: 10.w, right: 10.w), margin: EdgeInsets.only(left: 10.w, right: 10.w),
child: MImage( child: MImage(
(storeInfo != null && (storeInfo != null &&
storeInfo.bannerList != null && storeInfo!.bannerList != null &&
position < storeInfo.bannerList.length) position < storeInfo!.bannerList!.length)
? storeInfo.bannerList[position].imgUrl ? storeInfo!.bannerList![position]!.imgUrl!
: "", : "",
fit: BoxFit.cover, fit: BoxFit.cover,
radius: BorderRadius.circular(4), radius: BorderRadius.circular(4),
@ -911,8 +909,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
), ),
); );
}, },
itemCount: (storeInfo != null && storeInfo.bannerList != null) itemCount: (storeInfo != null && storeInfo!.bannerList != null)
? storeInfo.bannerList.length ? storeInfo!.bannerList!.length
: 1), : 1),
); );
} }
@ -931,7 +929,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
// "position":"30.554638,114.34394500000002", // "position":"30.554638,114.34394500000002",
// "token":"Bearer eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R5cGUiOiJNSU5JIiwibmFtZSI6IiIsInRva2VuX3R5cGUiOiJ0b2tlbiIsInVzZXJpZCI6IjE0MTI2ODc1MjI0NTgyMzg5NzYiLCJhY2NvdW50IjoiIiwiZXhwIjoxNjI2Nzk1Nzc0LCJuYmYiOjE2MjY3NjY5NzR9.cggcx_vqTozKS-z9uygjV4uA2yHQ4eWssMAngd2c-i0"} // "token":"Bearer eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R5cGUiOiJNSU5JIiwibmFtZSI6IiIsInRva2VuX3R5cGUiOiJ0b2tlbiIsInVzZXJpZCI6IjE0MTI2ODc1MjI0NTgyMzg5NzYiLCJhY2NvdW50IjoiIiwiZXhwIjoxNjI2Nzk1Nzc0LCJuYmYiOjE2MjY3NjY5NzR9.cggcx_vqTozKS-z9uygjV4uA2yHQ4eWssMAngd2c-i0"}
printMin() async { printMin() async {
String miniAppId = storeInfo.mini.miniAppId; String miniAppId = storeInfo!.mini!.miniAppId!;
print("print isExistsApp: ${await Min.isExistsApp(miniAppId)}"); print("print isExistsApp: ${await Min.isExistsApp(miniAppId)}");
print("print getAppBasePath: ${await Min.getAppBasePath(miniAppId)}"); print("print getAppBasePath: ${await Min.getAppBasePath(miniAppId)}");
print("print currentPageUrl: ${await Min.currentPageUrl()}"); print("print currentPageUrl: ${await Min.currentPageUrl()}");
@ -946,8 +944,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
alignment: Alignment.center); alignment: Alignment.center);
return; return;
} }
BaseData baseData = await apiService.minLogin(storeInfo.id); BaseData baseData = await apiService.minLogin(storeInfo!.id!);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
UserEntity userEntity = UserEntity.fromJson(baseData.data); UserEntity userEntity = UserEntity.fromJson(baseData.data);
startMin(userEntity.token, userEntity.userId); startMin(userEntity.token, userEntity.userId);
} }
@ -955,12 +953,12 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
startMin(token, userId) async { startMin(token, userId) async {
if (storeInfo == null) return; if (storeInfo == null) return;
if (storeInfo.mini == null) return; if (storeInfo!.mini == null) return;
if (!(await Min.isInitialize())) { if (!(await Min.isInitialize())) {
await Min.initialize(); await Min.initialize();
} }
printMin(); printMin();
String miniAppId = storeInfo.mini.miniAppId; String miniAppId = storeInfo!.mini!.miniAppId!;
String filePath = ""; String filePath = "";
if (Platform.isAndroid) { if (Platform.isAndroid) {
filePath = (await getExternalStorageDirectory()).path; filePath = (await getExternalStorageDirectory()).path;
@ -973,8 +971,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
await downloadWgt(miniAppId, filePath); await downloadWgt(miniAppId, filePath);
await Min.reloadWgt(miniAppId, filePath); await Min.reloadWgt(miniAppId, filePath);
} else { } else {
String version = await Min.getAppVersionInfo(storeInfo.mini.miniAppId); String version = await Min.getAppVersionInfo(storeInfo!.mini!.miniAppId!);
if (version != storeInfo.mini.miniVersion) { if (version != storeInfo!.mini!.miniVersion!) {
await downloadWgt(miniAppId, filePath); await downloadWgt(miniAppId, filePath);
await Min.reloadWgt(miniAppId, filePath); await Min.reloadWgt(miniAppId, filePath);
} }
@ -988,17 +986,17 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
// socketUrl : 'wss://pos.api.lotus-wallet.com:10015/cart', //线 // socketUrl : 'wss://pos.api.lotus-wallet.com:10015/cart', //线
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
String nickname = sharedPreferences.getString("nick"); String? nickname = sharedPreferences.getString("nick");
String mobile = sharedPreferences.getString("mobile"); String? mobile = sharedPreferences.getString("mobile");
String user = sharedPreferences.getString('user'); String? user = sharedPreferences.getString('user');
String latitude = sharedPreferences.getString("latitude"); String? latitude = sharedPreferences.getString("latitude");
String longitude = sharedPreferences.getString("longitude"); String? longitude = sharedPreferences.getString("longitude");
print(user); print(user);
UserInfo userInfo = UserInfo.fromJson(jsonDecode(user)); UserInfo userInfo = UserInfo.fromJson(jsonDecode(user!));
Min.startMin(miniAppId, { Min.startMin(miniAppId, {
"token": "Bearer $token", "token": "Bearer $token",
"shopId": widget.arguments["id"], "shopId": widget.arguments!["id"],
"tenantCode": storeInfo.tenantCode, "tenantCode": storeInfo!.tenantCode ?? "",
if (latitude != null && longitude != null) if (latitude != null && longitude != null)
"position": "$latitude,$longitude", "position": "$latitude,$longitude",
"baseURL": "https://pos.api.lotus-wallet.com/app/", "baseURL": "https://pos.api.lotus-wallet.com/app/",
@ -1014,7 +1012,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
}); });
} }
Function state; Function? state;
double progressValue = 0; double progressValue = 0;
String downText = "正在下载中..."; String downText = "正在下载中...";
@ -1067,11 +1065,11 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
}); });
Response response = await Dio() Response response = await Dio()
.download(storeInfo.mini.miniDownloadUrl, savePath, .download(storeInfo!.mini!.miniDownloadUrl, savePath,
onReceiveProgress: (progress, max) { onReceiveProgress: (progress, max) {
progressValue = progress.toDouble() / max.toDouble(); progressValue = progress.toDouble() / max.toDouble();
// print("print progressValue: $progressValue"); // print("print progressValue: $progressValue");
state(() {}); state!(() {});
}); });
if (response.statusCode == 200) { if (response.statusCode == 200) {
downText = "下载完成"; downText = "下载完成";
@ -1079,11 +1077,11 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
value.setStringList( value.setStringList(
"miniAppid", "miniAppid",
(value.getStringList("miniAppid") != null (value.getStringList("miniAppid") != null
? value.getStringList("miniAppid") ? value.getStringList("miniAppid")!
: []) : [])
..add(appid)); ..add(appid));
}); });
state(() {}); state!(() {});
Future.delayed(Duration(seconds: 1), () { Future.delayed(Duration(seconds: 1), () {
if (Navigator.canPop(context)) { if (Navigator.canPop(context)) {
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -1123,12 +1121,12 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
title: Text(S.of(context).bodadianhua), title: Text(S.of(context).bodadianhua),
actions: [ actions: [
if (storeInfo != null && if (storeInfo != null &&
storeInfo.headMobile != null && storeInfo!.headMobile != null &&
storeInfo.headMobile != "") storeInfo!.headMobile != "")
CupertinoActionSheetAction( CupertinoActionSheetAction(
child: Text(storeInfo.headMobile), child: Text(storeInfo!.headMobile!),
onPressed: () { onPressed: () {
callMobile(storeInfo.headMobile); callMobile(storeInfo!.headMobile);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
isDefaultAction: true, isDefaultAction: true,

62
lib/union/union_page.dart

@ -1,7 +1,4 @@
import 'dart:io';
import 'dart:ui'; import 'dart:ui';
import 'package:android_intent_plus/android_intent.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
@ -9,7 +6,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart';
import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart'; import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart';
import 'package:flutter_bmflocation/bdmap_location_flutter_plugin.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/main.dart'; import 'package:huixiang/main.dart';
@ -22,8 +18,6 @@ import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/icon_text.dart'; import 'package:huixiang/view_widget/icon_text.dart';
import 'package:huixiang/view_widget/item_title.dart'; import 'package:huixiang/view_widget/item_title.dart';
import 'package:huixiang/view_widget/request_permission.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
@ -45,7 +39,7 @@ class _UnionPage extends State<UnionPage>
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
WidgetsBinding.instance.removeObserver(this); WidgetsBinding.instance!.removeObserver(this);
Location.getInstance().aMapFlutterLocation.stopLocation(); Location.getInstance().aMapFlutterLocation.stopLocation();
refreshController.dispose(); refreshController.dispose();
@ -56,7 +50,7 @@ class _UnionPage extends State<UnionPage>
@override @override
void didChangeMetrics() { void didChangeMetrics() {
super.didChangeMetrics(); super.didChangeMetrics();
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance!.addPostFrameCallback((_) {
setState(() { setState(() {
print("object: ${MediaQuery.of(context).viewInsets.bottom}"); print("object: ${MediaQuery.of(context).viewInsets.bottom}");
if (MediaQuery.of(context).viewInsets.bottom == 0) { if (MediaQuery.of(context).viewInsets.bottom == 0) {
@ -72,12 +66,12 @@ class _UnionPage extends State<UnionPage>
}); });
} }
ApiService apiService; late ApiService apiService;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance!.addObserver(this);
Location.getInstance() Location.getInstance()
.aMapFlutterLocation .aMapFlutterLocation
@ -89,10 +83,10 @@ class _UnionPage extends State<UnionPage>
event["longitude"] != null) { event["longitude"] != null) {
print("location: $event"); print("location: $event");
if (event["latitude"] is String && event["longitude"] is String) { if (event["latitude"] is String && event["longitude"] is String) {
latLng = BMFCoordinate(double.tryParse(event["latitude"]), latLng = BMFCoordinate(double.tryParse(event["latitude"] as String),
double.tryParse(event["longitude"])); double.tryParse(event["longitude"] as String));
} else { } else {
latLng = BMFCoordinate(event["latitude"], event["longitude"]); latLng = BMFCoordinate(event["latitude"] as double, event["longitude"] as double);
} }
BMFCalculateUtils.coordConvert( BMFCalculateUtils.coordConvert(
coordinate: latLng, coordinate: latLng,
@ -114,7 +108,7 @@ class _UnionPage extends State<UnionPage>
event["district"], event["district"],
editingController.text); editingController.text);
if (_mapController != null) if (_mapController != null)
_mapController.updateMapOptions(BMFMapOptions( _mapController!.updateMapOptions(BMFMapOptions(
center: value, center: value,
zoomLevel: 15, zoomLevel: 15,
)); ));
@ -136,7 +130,7 @@ class _UnionPage extends State<UnionPage>
}); });
} }
BMFCoordinate latLng; BMFCoordinate? latLng;
saveLatLng(BMFCoordinate latLng, province, city, district) async { saveLatLng(BMFCoordinate latLng, province, city, district) async {
SharedPreferences prefs = await SharedPreferences.getInstance(); SharedPreferences prefs = await SharedPreferences.getInstance();
@ -160,8 +154,8 @@ class _UnionPage extends State<UnionPage>
value.containsKey("city") && value.containsKey("city") &&
value.containsKey("district")) value.containsKey("district"))
{ {
latLng = BMFCoordinate(double.tryParse(value.getString("latitude")), latLng = BMFCoordinate(double.tryParse(value.getString("latitude")!),
double.tryParse(value.getString("longitude"))), double.tryParse(value.getString("longitude")!)),
queryStore( queryStore(
value.getString("latitude"), value.getString("latitude"),
value.getString("longitude"), value.getString("longitude"),
@ -172,7 +166,7 @@ class _UnionPage extends State<UnionPage>
), ),
setState(() { setState(() {
if (_mapController != null) { if (_mapController != null) {
_mapController.updateMapOptions(BMFMapOptions( _mapController!.updateMapOptions(BMFMapOptions(
center: latLng, center: latLng,
zoomLevel: 15, zoomLevel: 15,
)); ));
@ -187,7 +181,7 @@ class _UnionPage extends State<UnionPage>
); );
} }
List<Store> storeList; List<Store>? storeList;
queryStore(latitude, longitude, province, city, district, searchKey) async { queryStore(latitude, longitude, province, city, district, searchKey) async {
BaseData<List<Store>> baseData = await apiService.queryStore({ BaseData<List<Store>> baseData = await apiService.queryStore({
@ -201,7 +195,7 @@ class _UnionPage extends State<UnionPage>
refreshController.refreshFailed(); refreshController.refreshFailed();
}); });
SmartDialog.dismiss(); SmartDialog.dismiss();
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess!) {
storeList = baseData.data; storeList = baseData.data;
refreshController.refreshCompleted(); refreshController.refreshCompleted();
if (mounted) setState(() {}); if (mounted) setState(() {});
@ -262,7 +256,7 @@ class _UnionPage extends State<UnionPage>
}); });
}, },
child: ListView.builder( child: ListView.builder(
itemCount: storeList == null ? 0 : storeList.length, itemCount: storeList == null ? 0 : storeList!.length,
// padding: EdgeInsets.only(top: 8.h, bottom: 84.h + (375.h - 88.h) + 4.h), // padding: EdgeInsets.only(top: 8.h, bottom: 84.h + (375.h - 88.h) + 4.h),
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 8.h, bottom: 84.h /* + (375.h - 88.h) + 4.h*/), top: 8.h, bottom: 84.h /* + (375.h - 88.h) + 4.h*/),
@ -271,16 +265,16 @@ class _UnionPage extends State<UnionPage>
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/union_detail_page', Navigator.of(context).pushNamed('/router/union_detail_page',
arguments: {"id": storeList[position].id}); arguments: {"id": storeList![position].id});
}, },
child: buildStoreItem(storeList[position], position), child: buildStoreItem(storeList![position], position),
); );
}), }),
), ),
); );
} }
BMFMapController _mapController; BMFMapController? _mapController;
TextEditingController editingController = TextEditingController(); TextEditingController editingController = TextEditingController();
void onMapCreated(BMFMapController controller) { void onMapCreated(BMFMapController controller) {
@ -428,7 +422,7 @@ class _UnionPage extends State<UnionPage>
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
MImage( MImage(
store.logo, store.logo!,
width: 100.h, width: 100.h,
height: 100.h, height: 100.h,
fit: BoxFit.cover, fit: BoxFit.cover,
@ -452,7 +446,7 @@ class _UnionPage extends State<UnionPage>
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
store.storeName, store.storeName!,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
@ -463,7 +457,7 @@ class _UnionPage extends State<UnionPage>
flex: 1, flex: 1,
), ),
Text( Text(
store.businessType, store.businessType!,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: TextStyle( style: TextStyle(
@ -483,16 +477,16 @@ class _UnionPage extends State<UnionPage>
child: Text( child: Text(
store.couponVO == null store.couponVO == null
? "" ? ""
: store.couponVO.bizType == 1 : store.couponVO!.bizType! == 1
? S.of(context).manlijiandaijinquan( ? S.of(context).manlijiandaijinquan(
double.tryParse( double.tryParse(
store.couponVO.fullAmount) store.couponVO!.fullAmount!)!
.toInt(), .toInt(),
double.tryParse( double.tryParse(
store.couponVO.discountAmount) store.couponVO!.discountAmount!)!
.toInt()) .toInt())
: S.of(context).quanchangzhe( : S.of(context).quanchangzhe(
store.couponVO.discountPercent), store.couponVO!.discountPercent!),
style: TextStyle( style: TextStyle(
color: Color(0xFFFF7A1A), color: Color(0xFFFF7A1A),
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -503,7 +497,7 @@ class _UnionPage extends State<UnionPage>
), ),
Text( Text(
S.of(context).ren( S.of(context).ren(
store == null ? "" : store.perCapitaConsumption), store == null ? "" : store.perCapitaConsumption!),
style: TextStyle( style: TextStyle(
color: Color(0xFF353535), color: Color(0xFF353535),
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@ -532,7 +526,7 @@ class _UnionPage extends State<UnionPage>
child: Container( child: Container(
padding: EdgeInsets.only(top: 2.h), padding: EdgeInsets.only(top: 2.h),
child: Text( child: Text(
store.address, store.address!,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 2, maxLines: 2,
style: TextStyle( style: TextStyle(
@ -553,7 +547,7 @@ class _UnionPage extends State<UnionPage>
IconText( IconText(
(store.openStartTime == null && store.openEndTime == null) (store.openStartTime == null && store.openEndTime == null)
? S.of(context).quantian ? S.of(context).quantian
: "${store.openStartTime.substring(0, store.openStartTime.lastIndexOf(":"))} - ${store.openEndTime.substring(0, store.openEndTime.lastIndexOf(":"))}", : "${store.openStartTime!.substring(0, store.openStartTime!.lastIndexOf(":"))} - ${store.openEndTime!.substring(0, store.openEndTime!.lastIndexOf(":"))}",
textStyle: TextStyle( textStyle: TextStyle(
color: Color(0xFF727272), color: Color(0xFF727272),
fontSize: 12.sp, fontSize: 12.sp,

24
lib/utils/MyPainter.dart

@ -7,13 +7,13 @@ import 'package:flutter/cupertino.dart';
class MyPainter extends CustomPainter { class MyPainter extends CustomPainter {
//线 //线
Color lineColor; Color? lineColor;
//线 //线
double width; double? width;
//线 //线
Color completeColor; Color? completeColor;
// //
double completePercent; double? completePercent;
//线 //线
double completeWidth; double completeWidth;
// 1, 2 3 4 // 1, 2 3 4
@ -25,7 +25,7 @@ class MyPainter extends CustomPainter {
// //
double endAngle; double endAngle;
//线 //线
List<Color> lineColors; List<Color>? lineColors;
// //
// Color shadowColor; // Color shadowColor;
// //
@ -57,11 +57,11 @@ class MyPainter extends CustomPainter {
if (isDividerRound) { if (isDividerRound) {
//线 //线
Paint line = Paint() Paint line = Paint()
..color = lineColor ..color = lineColor!
// ..strokeCap = StrokeCap.round // ..strokeCap = StrokeCap.round
..style = PaintingStyle.stroke ..style = PaintingStyle.stroke
..isAntiAlias = true ..isAntiAlias = true
..strokeWidth = width; ..strokeWidth = width!;
double i = 0.00; double i = 0.00;
while (i < pi * 2) { while (i < pi * 2) {
@ -72,10 +72,10 @@ class MyPainter extends CustomPainter {
} else { } else {
//线 线 //线 线
Paint line = Paint() Paint line = Paint()
..color = lineColor ..color = lineColor!
..strokeCap = StrokeCap.round ..strokeCap = StrokeCap.round
..style = PaintingStyle.stroke ..style = PaintingStyle.stroke
..strokeWidth = width; ..strokeWidth = width!;
canvas.drawCircle( canvas.drawCircle(
// //
@ -86,7 +86,7 @@ class MyPainter extends CustomPainter {
} }
// //
if (completeWidth > 0) { if (completeWidth > 0) {
double arcAngle = 2 * pi * (completePercent / 100); double arcAngle = 2 * pi * (completePercent! / 100);
// 1, 2 3 4 // 1, 2 3 4
double start = pi / 2; double start = pi / 2;
@ -118,7 +118,7 @@ class MyPainter extends CustomPainter {
paint.shader = SweepGradient( paint.shader = SweepGradient(
startAngle: 0.0, startAngle: 0.0,
endAngle: pi * 2, endAngle: pi * 2,
colors: lineColors, colors: lineColors!,
tileMode: TileMode.clamp, tileMode: TileMode.clamp,
transform: GradientRotation(transfrom), transform: GradientRotation(transfrom),
).createShader( ).createShader(
@ -129,7 +129,7 @@ class MyPainter extends CustomPainter {
arcAngle, false, paint); arcAngle, false, paint);
} else { } else {
/// ///
paint.color = completeColor; paint.color = completeColor!;
canvas.drawArc( canvas.drawArc(
Rect.fromCircle(center: center, radius: radius), Rect.fromCircle(center: center, radius: radius),
start, // -pi / 2, pi / 2, start, // -pi / 2, pi / 2,

2
lib/utils/flutter_utils.dart

@ -100,7 +100,7 @@ class AppUtils {
/// ///
static Future<void> clear() async { static Future<void> clear() async {
Directory tempDir = await getTemporaryDirectory(); Directory tempDir = await getTemporaryDirectory();
if (tempDir == null) return 0; if (tempDir == null) return null;
await _delete(tempDir); await _delete(tempDir);
} }

4
lib/utils/location.dart

@ -12,7 +12,7 @@ import 'package:permission_handler/permission_handler.dart';
class Location { class Location {
static Location _instance; static late Location _instance;
Location._internal() { Location._internal() {
aMapFlutterLocation = LocationFlutterPlugin(); aMapFlutterLocation = LocationFlutterPlugin();
@ -25,7 +25,7 @@ class Location {
return _instance; return _instance;
} }
LocationFlutterPlugin aMapFlutterLocation; late LocationFlutterPlugin aMapFlutterLocation;
prepareLoc() { prepareLoc() {
aMapFlutterLocation.prepareLoc({ aMapFlutterLocation.prepareLoc({

12
lib/view_widget/border_text.dart

@ -1,17 +1,18 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class BorderText extends StatelessWidget { class BorderText extends StatelessWidget {
final String text; final String? text;
final Color textColor; final Color textColor;
final Color borderColor; final Color borderColor;
final double fontSize; final double fontSize;
final double borderWidth; final double borderWidth;
final double radius; final double radius;
final FontWeight fontWeight; final FontWeight fontWeight;
final EdgeInsetsGeometry padding; final EdgeInsetsGeometry? padding;
BorderText( BorderText(
{Key key, this.text, {Key? key,
this.text,
this.textColor = Colors.black, this.textColor = Colors.black,
this.fontSize = 10, this.fontSize = 10,
this.borderWidth = 2, this.borderWidth = 2,
@ -27,9 +28,10 @@ class BorderText extends StatelessWidget {
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all(color: borderColor, width: borderWidth), border: Border.all(color: borderColor, width: borderWidth),
borderRadius: BorderRadius.all(Radius.circular(radius))), borderRadius: BorderRadius.circular(radius),
),
child: Text( child: Text(
text, text ?? "",
style: TextStyle( style: TextStyle(
color: textColor, color: textColor,
fontSize: fontSize, fontSize: fontSize,

36
lib/view_widget/classic_header.dart

@ -30,14 +30,14 @@ class MyHeader extends StatelessWidget {
} }
class MyClassicHeader extends RefreshIndicator { class MyClassicHeader extends RefreshIndicator {
final OuterBuilder outerBuilder; final OuterBuilder? outerBuilder;
final String releaseText, final String? releaseText,
idleText, idleText,
refreshingText, refreshingText,
completeText, completeText,
failedText, failedText,
canTwoLevelText; canTwoLevelText;
final Widget releaseIcon, final Widget? releaseIcon,
idleIcon, idleIcon,
refreshingIcon, refreshingIcon,
completeIcon, completeIcon,
@ -53,7 +53,7 @@ class MyClassicHeader extends RefreshIndicator {
final TextStyle completeTextStyle; final TextStyle completeTextStyle;
const MyClassicHeader({ const MyClassicHeader({
Key key, Key? key,
RefreshStyle refreshStyle: RefreshStyle.Follow, RefreshStyle refreshStyle: RefreshStyle.Follow,
double height: 60.0, double height: 60.0,
Duration completeDuration: const Duration(milliseconds: 600), Duration completeDuration: const Duration(milliseconds: 600),
@ -95,18 +95,18 @@ class _ClassicHeaderState extends RefreshIndicatorState<MyClassicHeader> {
EnRefreshString(); EnRefreshString();
return Text( return Text(
mode == RefreshStatus.canRefresh mode == RefreshStatus.canRefresh
? widget.releaseText ?? strings.canRefreshText ? widget.releaseText ?? strings.canRefreshText!
: mode == RefreshStatus.completed : mode == RefreshStatus.completed
? widget.completeText ?? strings.refreshCompleteText ? widget.completeText ?? strings.refreshCompleteText!
: mode == RefreshStatus.failed : mode == RefreshStatus.failed
? widget.failedText ?? strings.refreshFailedText ? widget.failedText ?? strings.refreshFailedText!
: mode == RefreshStatus.refreshing : mode == RefreshStatus.refreshing
? widget.refreshingText ?? strings.refreshingText ? widget.refreshingText ?? strings.refreshingText!
: mode == RefreshStatus.idle : mode == RefreshStatus.idle
? widget.idleText ?? strings.idleRefreshText ? widget.idleText ?? strings.idleRefreshText!
: mode == RefreshStatus.canTwoLevel : mode == RefreshStatus.canTwoLevel
? widget.canTwoLevelText ?? ? widget.canTwoLevelText ??
strings.canTwoLevelText strings.canTwoLevelText!
: "", : "",
style: mode == RefreshStatus.completed style: mode == RefreshStatus.completed
? widget.completeTextStyle ? widget.completeTextStyle
@ -115,17 +115,17 @@ class _ClassicHeaderState extends RefreshIndicatorState<MyClassicHeader> {
Widget _buildIcon(mode) { Widget _buildIcon(mode) {
Widget icon = mode == RefreshStatus.canRefresh Widget icon = mode == RefreshStatus.canRefresh
? widget.releaseIcon ? widget.releaseIcon!
: mode == RefreshStatus.idle : mode == RefreshStatus.idle
? widget.idleIcon ? widget.idleIcon!
: mode == RefreshStatus.completed : mode == RefreshStatus.completed
? widget.completeIcon ? widget.completeIcon!
: mode == RefreshStatus.failed : mode == RefreshStatus.failed
? widget.failedIcon ? widget.failedIcon!
: mode == RefreshStatus.canTwoLevel : mode == RefreshStatus.canTwoLevel
? widget.canTwoLevelIcon ? widget.canTwoLevelIcon!
: mode == RefreshStatus.canTwoLevel : mode == RefreshStatus.canTwoLevel
? widget.canTwoLevelIcon ? widget.canTwoLevelIcon!
: mode == RefreshStatus.refreshing : mode == RefreshStatus.refreshing
? widget.refreshingIcon ?? ? widget.refreshingIcon ??
SizedBox( SizedBox(
@ -137,7 +137,7 @@ class _ClassicHeaderState extends RefreshIndicatorState<MyClassicHeader> {
: const CircularProgressIndicator( : const CircularProgressIndicator(
strokeWidth: 2.0), strokeWidth: 2.0),
) )
: widget.twoLevelView; : widget.twoLevelView!;
return icon ?? Container(); return icon ?? Container();
} }
@ -168,7 +168,7 @@ class _ClassicHeaderState extends RefreshIndicatorState<MyClassicHeader> {
children: children, children: children,
); );
return widget.outerBuilder != null return widget.outerBuilder != null
? widget.outerBuilder(container) ? widget.outerBuilder!(container)
: Container( : Container(
child: Center(child: container), child: Center(child: container),
height: widget.height, height: widget.height,

1
lib/view_widget/comment_menu.dart

@ -2,7 +2,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/separator.dart';
class CommentMenu extends StatefulWidget { class CommentMenu extends StatefulWidget {
final bool isSelf; final bool isSelf;

35
lib/view_widget/coupon_widget.dart

@ -8,8 +8,8 @@ import 'package:huixiang/view_widget/round_button.dart';
import 'package:huixiang/view_widget/separator.dart'; import 'package:huixiang/view_widget/separator.dart';
class CouponWidget extends StatelessWidget { class CouponWidget extends StatelessWidget {
final GestureTapCallback callback; final GestureTapCallback? callback;
final Coupon coupon; final Coupon? coupon;
CouponWidget(this.coupon, this.callback); CouponWidget(this.coupon, this.callback);
@ -34,14 +34,14 @@ class CouponWidget extends StatelessWidget {
child: Stack( child: Stack(
children: [ children: [
Image.asset( Image.asset(
coupon.status != 3 coupon!.status != 3
? "assets/image/ic_coupon_bg.png" ? "assets/image/ic_coupon_bg.png"
: "assets/image/ic_coupon_invalid_bg.png", : "assets/image/ic_coupon_invalid_bg.png",
fit: BoxFit.cover, fit: BoxFit.cover,
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
), ),
if (coupon.status == 3) if (coupon!.status == 3)
Positioned( Positioned(
top: 10, top: 10,
right: 0, right: 0,
@ -57,7 +57,7 @@ class CouponWidget extends StatelessWidget {
), ),
), ),
Opacity( Opacity(
opacity: coupon.status != 3 ? 1 : 0.54, opacity: coupon!.status != 3 ? 1 : 0.54,
child: Container( child: Container(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -73,10 +73,10 @@ class CouponWidget extends StatelessWidget {
margin: EdgeInsets.only(left: 20), margin: EdgeInsets.only(left: 20),
child: MImage( child: MImage(
(coupon == null || (coupon == null ||
coupon.couponImg == null || coupon!.couponImg == null ||
coupon.couponImg == "") coupon!.couponImg! == "")
? "" ? ""
: coupon.couponImg, : coupon!.couponImg!,
) )
// Image.network( // Image.network(
@ -106,7 +106,7 @@ class CouponWidget extends StatelessWidget {
Expanded( Expanded(
flex: 1, flex: 1,
child: Text( child: Text(
coupon.couponName ?? "", coupon!.couponName ?? "",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 14, fontSize: 14,
@ -114,7 +114,7 @@ class CouponWidget extends StatelessWidget {
), ),
), ),
), ),
(coupon.status == 0) (coupon!.status == 0)
? Row( ? Row(
children: [ children: [
RoundButton( RoundButton(
@ -132,13 +132,12 @@ class CouponWidget extends StatelessWidget {
backgroup: backgroup:
Color(0xff32A060), Color(0xff32A060),
callback: () { callback: () {
showAlertDialog( showAlertDialog(context);
context);
}, },
), ),
], ],
) )
: (coupon.status == 1) : (coupon!.status == 1)
? Row( ? Row(
children: [ children: [
Text( Text(
@ -170,7 +169,7 @@ class CouponWidget extends StatelessWidget {
margin: EdgeInsets.only(right: 37), margin: EdgeInsets.only(right: 37),
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text( child: Text(
coupon.couponDescription ?? "", coupon!.couponDescription ?? "",
style: TextStyle( style: TextStyle(
fontSize: 10, fontSize: 10,
color: Color(0xFF4C4C4C), color: Color(0xFF4C4C4C),
@ -200,10 +199,10 @@ class CouponWidget extends StatelessWidget {
padding: EdgeInsets.only(left: 20), padding: EdgeInsets.only(left: 20),
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text( child: Text(
coupon.status == 0 coupon!.status == 0
? S.of(context).faxingshijian(coupon.publishStartTime) ? S.of(context).faxingshijian(coupon!.publishStartTime!)
: coupon.status == 1 : coupon!.status == 1
? S.of(context).lingqushijian(coupon.receiveTime) ? S.of(context).lingqushijian(coupon!.receiveTime!)
: S.of(context).shiyongriqi, : S.of(context).shiyongriqi,
style: TextStyle( style: TextStyle(
color: Color(0xFF727272), color: Color(0xFF727272),

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save