Browse Source

null_safety

null_safety
fmk 3 years ago
parent
commit
cadc7f0ce0
  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. 13
      lib/generated/intl/messages_all.dart
  7. 1088
      lib/generated/intl/messages_en.dart
  8. 1084
      lib/generated/intl/messages_zh_CN.dart
  9. 1084
      lib/generated/intl/messages_zh_Hans_CN.dart
  10. 1084
      lib/generated/intl/messages_zh_Hant_CN.dart
  11. 1084
      lib/generated/intl/messages_zh_TW.dart
  12. 55
      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. 14
      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_baidu_mapapi_base/flutter_baidu_mapapi_base.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_bmflocation/bdmap_location_flutter_plugin.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 keyWord = "";
@ -49,7 +48,7 @@ class _AddressMapPage extends State<AddressMapPage> {
aMapFlutterLocation.stopLocation();
}
ApiService apiService;
late ApiService apiService;
@override
void initState() {
@ -68,13 +67,13 @@ class _AddressMapPage extends State<AddressMapPage> {
if (event != null &&
event["latitude"] != null &&
event["longitude"] != null) {
city = event["city"];
city = event["city"] as String;
BMFCoordinate latLng;
if (event["latitude"] is String && event["longitude"] is String) {
latLng = BMFCoordinate(double.tryParse(event["latitude"]),
double.tryParse(event["longitude"]));
latLng = BMFCoordinate(double.tryParse(event["latitude"] as String),
double.tryParse(event["longitude"] as String));
} else {
latLng = BMFCoordinate(event["latitude"], event["longitude"]);
latLng = BMFCoordinate(event["latitude"] as double, event["longitude"] as double);
}
BMFCalculateUtils.coordConvert(
coordinate: latLng,
@ -138,11 +137,10 @@ class _AddressMapPage extends State<AddressMapPage> {
aMapFlutterLocation.prepareLoc(androidMap, iosMap);
}
List<Address> poiList;
late List<Address> poiList;
searchPoi(BMFCoordinate latLng) async {
keyWord = textEditingController.text;
print("keyWord: ${keyWord}");
var addressPoi = await apiService.searchPoi(
"${latLng.latitude}", "${latLng.longitude}", keyWord, 20, 1);
List<dynamic> poi = addressPoi['pois'];
@ -262,8 +260,10 @@ class _AddressMapPage extends State<AddressMapPage> {
});
}
BMFMapController _mapController;
BMFCoordinate bmfCoordinate;
late BMFMapController _mapController;
late BMFCoordinate bmfCoordinate;
late BMFCoordinate latLng;
late BMFMarker bmfMarker;
void onMapCreated(BMFMapController controller) {
controller.setMapRegionDidChangeCallback(callback: (status) {
@ -290,9 +290,6 @@ class _AddressMapPage extends State<AddressMapPage> {
});
}
BMFCoordinate latLng;
BMFMarker bmfMarker;
addMarker() {
if (latLng == null) return;
if (bmfMarker == null && _mapController != null) {
@ -343,8 +340,8 @@ class _AddressMapPage extends State<AddressMapPage> {
_mapController.updateMapOptions(
BMFMapOptions(
center: BMFCoordinate(
double.tryParse(value.getString("latitude")),
double.tryParse(value.getString("longitude")),
double.tryParse(value.getString("latitude")!),
double.tryParse(value.getString("longitude")!),
),
zoomLevel: 15,
),
@ -354,7 +351,7 @@ class _AddressMapPage extends State<AddressMapPage> {
});
}
BMFMapWidget map;
late BMFMapWidget map;
BMFCoordinate center = BMFCoordinate(30.553111, 114.342366);
@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';
class EditAddressPage extends StatefulWidget {
final Map<String, dynamic> arguments;
final Map<String, dynamic>? arguments;
EditAddressPage({this.arguments});
@ -26,7 +26,7 @@ class _EditAddressPage extends State<EditAddressPage> {
TextEditingController addressController = TextEditingController();
TextEditingController houseNumberController = TextEditingController();
ApiService apiService;
late ApiService apiService;
@override
void initState() {
@ -39,16 +39,16 @@ class _EditAddressPage extends State<EditAddressPage> {
});
}
Address preAddress;
Address? preAddress;
queryAddress() async {
if (widget.arguments == null) return;
preAddress = Address.fromJson(widget.arguments);
nameController.text = preAddress.username;
mobileController.text = preAddress.phone;
preAddress = Address.fromJson(widget.arguments!);
nameController.text = preAddress!.username!;
mobileController.text = preAddress!.phone!;
addressController.text =
"${preAddress.province}${preAddress.city}${preAddress.area}";
houseNumberController.text = preAddress.address;
"${preAddress!.province}${preAddress!.city}${preAddress!.area}";
houseNumberController.text = preAddress!.address!;
setState(() {});
}
@ -86,13 +86,13 @@ class _EditAddressPage extends State<EditAddressPage> {
children: [
editItem(
S.of(context).xingming,
preAddress != null ? preAddress.username : "",
preAddress != null ? preAddress!.username : "",
S.of(context).qingtianxiexingming,
nameController,
false),
editItem(
S.of(context).dianhua,
preAddress != null ? preAddress.phone : "",
preAddress != null ? preAddress!.phone : "",
S.of(context).qingtianxieshoujihao,
mobileController,
false),
@ -102,14 +102,14 @@ class _EditAddressPage extends State<EditAddressPage> {
},
child: editItem(
S.of(context).dizhi,
preAddress != null ? preAddress.address : "",
preAddress != null ? preAddress!.address : "",
S.of(context).shouhuodizhi,
addressController,
true),
),
editItem(
S.of(context).xiangxidizhi,
preAddress != null ? preAddress.address : "",
preAddress != null ? preAddress!.address : "",
S.of(context).menpaihao,
houseNumberController,
false),
@ -141,21 +141,21 @@ class _EditAddressPage extends State<EditAddressPage> {
);
}
Map addressMap;
Map? addressMap;
toMap() async {
Navigator.of(context).pushNamed('/router/address_map_page').then(
(value) => {
if (value != null)
{
addressMap = value,
addressMap = value as Map?,
addressController.text =
"${(value as Map)['province']}${(value as Map)['city']}${(value as Map)['area']}",
if (preAddress != null)
{
preAddress.province = addressMap['province'],
preAddress.city = addressMap['city'],
preAddress.area = addressMap['area'],
preAddress!.province = addressMap?['province'],
preAddress!.city = addressMap?['city'],
preAddress!.area = addressMap?['area'],
},
houseNumberController.text = "${(value as Map)['address']}",
}
@ -189,35 +189,35 @@ class _EditAddressPage extends State<EditAddressPage> {
if (preAddress == null) {
baseData = await apiService.addAddress({
"address": address,
"area": addressMap != null ? addressMap['area'] : "",
"city": addressMap != null ? addressMap['city'] : "",
"area": addressMap != null ? addressMap!['area'] : "",
"city": addressMap != null ? addressMap!['city'] : "",
"cityInfo": "",
"isDefault": true,
"latitude": addressMap != null ? addressMap['latitude'] : 0,
"longitude": addressMap != null ? addressMap['longitude'] : 0,
"latitude": addressMap != null ? addressMap!['latitude'] : 0,
"longitude": addressMap != null ? addressMap!['longitude'] : 0,
"phone": mobile,
"province": addressMap != null ? addressMap['province'] : "",
"province": addressMap != null ? addressMap!['province'] : "",
"tag": "",
"username": name
});
} else {
baseData = await apiService.updateAddress({
"address": address,
"area": preAddress != null ? preAddress.area : "",
"city": preAddress != null ? preAddress.city : "",
"province": preAddress != null ? preAddress.province : "",
"area": preAddress != null ? preAddress!.area : "",
"city": preAddress != null ? preAddress!.city : "",
"province": preAddress != null ? preAddress!.province : "",
"cityInfo": "",
"isDefault": true,
"latitude": preAddress != null ? preAddress.latitude : 0,
"longitude": preAddress != null ? preAddress.longitude : 0,
"latitude": preAddress != null ? preAddress!.latitude : 0,
"longitude": preAddress != null ? preAddress!.longitude : 0,
"phone": mobile,
"tag": "",
"id": preAddress != null ? preAddress.id : 0,
"id": preAddress != null ? preAddress!.id : 0,
"username": name
});
}
if (baseData != null && baseData.isSuccess) {
if (baseData != null && baseData.isSuccess!) {
SmartDialog.showToast(preAddress == null
? S.of(context).baocunchenggong
: 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> {
ApiService apiService;
late ApiService apiService;
@override
void dispose() {
@ -48,7 +48,7 @@ class _HotArticlePage extends State<HotArticlePage> {
queryArticle();
}
List<Article> articles = [];
List<Article?> articles = [];
queryArticle() async {
BaseData<PageInfo<Article>> baseData = await apiService.queryArticle({
@ -61,14 +61,14 @@ class _HotArticlePage extends State<HotArticlePage> {
refreshController.refreshFailed();
refreshController.loadFailed();
});
if (baseData != null && baseData.isSuccess) {
if (baseData != null && baseData.isSuccess!) {
refreshController.refreshCompleted();
refreshController.loadComplete();
if(pageNum == 1) {
articles.clear();
}
articles.addAll(baseData.data.list);
if (baseData.data.pageNum == baseData.data.pages) {
articles.addAll(baseData.data!.list!);
if (baseData.data!.pageNum == baseData.data!.pages) {
refreshController.loadNoData();
} else {
pageNum += 1;

4
lib/article/video_playback_page.dart

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

6
lib/base_state.dart

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

13
lib/generated/intl/messages_all.dart

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

1088
lib/generated/intl/messages_en.dart

File diff suppressed because it is too large Load Diff

1084
lib/generated/intl/messages_zh_CN.dart

File diff suppressed because it is too large Load Diff

1084
lib/generated/intl/messages_zh_Hans_CN.dart

File diff suppressed because it is too large Load Diff

1084
lib/generated/intl/messages_zh_Hant_CN.dart

File diff suppressed because it is too large Load Diff

1084
lib/generated/intl/messages_zh_TW.dart

File diff suppressed because it is too large Load Diff

55
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: 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 {
S();
static S current;
static const AppLocalizationDelegate delegate =
AppLocalizationDelegate();
static S? _current;
static S get current {
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) {
final name = (locale.countryCode?.isEmpty ?? false) ? locale.languageCode : locale.toString();
final localeName = Intl.canonicalizedLocale(name);
final name = (locale.countryCode?.isEmpty ?? false)
? locale.languageCode
: locale.toString();
final localeName = Intl.canonicalizedLocale(name);
return initializeMessages(localeName).then((_) {
Intl.defaultLocale = localeName;
S.current = S();
return S.current;
final instance = S();
S._current = instance;
return instance;
});
}
}
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);
}
@ -4743,8 +4758,10 @@ class AppLocalizationDelegate extends LocalizationsDelegate<S> {
return const <Locale>[
Locale.fromSubtags(languageCode: 'en'),
Locale.fromSubtags(languageCode: 'zh', countryCode: 'CN'),
Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans', countryCode: 'CN'),
Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant', countryCode: 'CN'),
Locale.fromSubtags(
languageCode: 'zh', scriptCode: 'Hans', countryCode: 'CN'),
Locale.fromSubtags(
languageCode: 'zh', scriptCode: 'Hant', countryCode: 'CN'),
Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW'),
];
}
@ -4757,13 +4774,11 @@ class AppLocalizationDelegate extends LocalizationsDelegate<S> {
bool shouldReload(AppLocalizationDelegate old) => false;
bool _isSupported(Locale locale) {
if (locale != null) {
for (var supportedLocale in supportedLocales) {
if (supportedLocale.languageCode == locale.languageCode) {
return true;
}
for (var supportedLocale in supportedLocales) {
if (supportedLocale.languageCode == locale.languageCode) {
return true;
}
}
return false;
}
}
}

22
lib/home/activity_list_page.dart

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

2
lib/home/guide_page.dart

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

61
lib/home/home_page.dart

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

44
lib/home/huixiang_brand_page.dart

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

4
lib/home/main_home_page.dart

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

64
lib/home/points_mall_page.dart

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

28
lib/integral/integral_detailed_page.dart

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

92
lib/integral/integral_page.dart

@ -26,11 +26,11 @@ class IntegralPage extends StatefulWidget {
}
class _IntegralPage extends State<IntegralPage> {
ApiService apiService;
SignInfo signInfo;
late ApiService apiService;
SignInfo? signInfo;
UserInfo userinfo;
List<Rank> ranks = [];
UserInfo? userinfo;
List<Rank?> ranks = [];
int rankLevel = 1;
@override
@ -42,7 +42,7 @@ class _IntegralPage extends State<IntegralPage> {
context: context,
token: value.getString("token"),
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));
querySignInfo();
});
@ -52,21 +52,21 @@ class _IntegralPage extends State<IntegralPage> {
BaseData<SignInfo> baseData = await apiService.signInInfo();
BaseData<List<Rank>> rankData = await apiService.rankList();
if (rankData != null && rankData.isSuccess) {
if (rankData != null && rankData.isSuccess!) {
ranks.clear();
ranks.addAll(rankData.data);
ranks.addAll(rankData.data!);
}
if (userinfo != null &&
userinfo.memberRankVo != null &&
userinfo!.memberRankVo != null &&
ranks != null &&
ranks.length > 0) {
rankLevel = (ranks
.indexWhere((element) => element.id == userinfo.memberRankVo.id) +
.indexWhere((element) => element?.id == userinfo!.memberRankVo?.id) +
1);
}
SmartDialog.dismiss(closeType: 3);
if (baseData != null && baseData.isSuccess) {
if (baseData != null && baseData.isSuccess!) {
signInfo = baseData.data;
setState(() {});
}
@ -178,12 +178,12 @@ class _IntegralPage extends State<IntegralPage> {
return taskPage(position);
},
itemCount: (signInfo != null &&
signInfo.taskList != null &&
signInfo.taskList.length > 0)
? (signInfo.taskList.length < 3
signInfo!.taskList != null &&
signInfo!.taskList!.length > 0)
? (signInfo!.taskList!.length < 3
? 1
: (signInfo.taskList.length ~/ 3 +
(signInfo.taskList.length % 3 > 0 ? 1 : 0)))
: (signInfo!.taskList!.length ~/ 3 +
(signInfo!.taskList!.length % 3 > 0 ? 1 : 0)))
: 1),
),
),
@ -193,22 +193,22 @@ class _IntegralPage extends State<IntegralPage> {
}
Widget taskPage(position) {
if (signInfo == null || signInfo.taskList == null) return Container();
if (signInfo == null || signInfo!.taskList == null) return Container();
return Container(
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 16.h),
child: Column(
children: [
tashItem(signInfo.taskList[position * 3 + 0]),
if (signInfo.taskList.length > (position * 3 + 1))
tashItem(signInfo.taskList[position * 3 + 1]),
if (signInfo.taskList.length > (position * 3 + 2))
tashItem(signInfo.taskList[position * 3 + 2]),
tashItem(signInfo!.taskList![position * 3 + 0]),
if (signInfo!.taskList!.length > (position * 3 + 1))
tashItem(signInfo!.taskList![position * 3 + 1]),
if (signInfo!.taskList!.length > (position * 3 + 2))
tashItem(signInfo!.taskList![position * 3 + 2]),
],
),
);
}
taskImg(String taskType) {
taskImg(String? taskType) {
switch (taskType) {
case "bill_type_point_login":
return "assets/image/icon_integral_share.png";
@ -223,14 +223,14 @@ class _IntegralPage extends State<IntegralPage> {
return "assets/image/icon_integral_share.png";
}
Widget tashItem(Task task) {
Widget tashItem(Task? task) {
return Container(
margin: EdgeInsets.only(top: 8.h, bottom: 8.h),
alignment: Alignment.center,
child: Row(
children: [
Image.asset(
taskImg(task.type),
taskImg(task!.type),
width: 24.w,
height: 24.h,
),
@ -244,7 +244,7 @@ class _IntegralPage extends State<IntegralPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
task.name,
task!.name!,
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w400,
@ -257,7 +257,7 @@ class _IntegralPage extends State<IntegralPage> {
Row(
children: [
Text(
"+${double.tryParse(task.rewardValue).toInt()}",
"+${double.tryParse(task!.rewardValue!)!.toInt()}",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF727272),
@ -356,8 +356,8 @@ class _IntegralPage extends State<IntegralPage> {
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: (signInfo != null &&
signInfo.signInList != null &&
signInfo.signInList.length > position)
signInfo!.signInList != null &&
signInfo!.signInList!.length > position)
? Color(0xFF32A060)
: Color(0xFFF0F0F2),
borderRadius: BorderRadius.circular(4),
@ -370,8 +370,8 @@ class _IntegralPage extends State<IntegralPage> {
"0${position + 1}",
style: TextStyle(
color: (signInfo != null &&
signInfo.signInList != null &&
signInfo.signInList.length > position)
signInfo!.signInList != null &&
signInfo!.signInList!.length > position)
? Colors.white
: Color(0xFF353535),
fontSize: 14.sp,
@ -393,14 +393,14 @@ class _IntegralPage extends State<IntegralPage> {
),
child: Text(
(signInfo != null &&
signInfo.rewardList != null &&
signInfo.rewardList.length > position)
? "+${signInfo.rewardList[position]}"
signInfo!.rewardList != null &&
signInfo!.rewardList!.length > position)
? "+${signInfo!.rewardList![position]}"
: "+10",
style: TextStyle(
color: (signInfo != null &&
signInfo.signInList != null &&
signInfo.signInList.length > position)
signInfo!.signInList != null &&
signInfo!.signInList!.length > position)
? Colors.white
: Color(0xFF727272),
fontSize: 12.sp,
@ -477,11 +477,11 @@ class _IntegralPage extends State<IntegralPage> {
child: RoundButton(
width: 106,
height: 34,
text: (signInfo != null && signInfo.todayHasSignin)
text: (signInfo != null && signInfo!.todayHasSignin!)
? S.of(context).yiqiandao
: S.of(context).lijiqiandao,
textColor: Colors.white,
backgroup: (signInfo != null && signInfo.todayHasSignin)
backgroup: (signInfo != null && signInfo!.todayHasSignin!)
? Colors.grey
: Color(0xFF32A060),
fontSize: 16.sp,
@ -498,17 +498,17 @@ class _IntegralPage extends State<IntegralPage> {
///
signIn() async {
if ((signInfo != null && signInfo.todayHasSignin)) {
if ((signInfo != null && signInfo!.todayHasSignin!)) {
SmartDialog.showToast("今日已签到了", alignment: Alignment.center);
return;
}
SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai);
BaseData baseData = await apiService.signIn();
if (baseData != null && baseData.isSuccess) {
if (baseData != null && baseData.isSuccess!) {
querySignInfo();
SmartDialog.show(
widget: SignInWidget("${signInfo.signInList.length + 1}",
"${signInfo.rewardList[signInfo.signInList.length]}"));
widget: SignInWidget("${signInfo!.signInList!.length + 1}",
"${signInfo!.rewardList![signInfo!.signInList!.length]}"));
} else {
SmartDialog.dismiss();
}
@ -528,7 +528,7 @@ class _IntegralPage extends State<IntegralPage> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
signInfo != null ? "${signInfo.point}" : "0",
signInfo != null ? "${signInfo!.point}" : "0",
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 21.sp,
@ -563,9 +563,9 @@ class _IntegralPage extends State<IntegralPage> {
.pushNamed('/router/mine_vip_level_page', arguments: {
"rankLevel": rankLevel,
"createTime":
(userinfo != null) ? "${userinfo.createTime}" : "",
(userinfo != null) ? "${userinfo!.createTime}" : "",
"points":
(userinfo != null) ? int.tryParse(userinfo.points) : 0,
(userinfo != null) ? int.tryParse(userinfo!.points!) : 0,
});
} else {
@ -577,8 +577,8 @@ class _IntegralPage extends State<IntegralPage> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
(signInfo != null && signInfo.rank != null)
? "${signInfo.rank.rankName.replaceAll("会员", "")}"
(signInfo != null && signInfo!.rank != null)
? "${signInfo!.rank!.rankName!.replaceAll("会员", "")}"
: "",
style: TextStyle(
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';
class IntegralStoreDetailsPage extends StatefulWidget {
final Map<String, dynamic> arguments;
final Map<String, dynamic>? arguments;
IntegralStoreDetailsPage({this.arguments});
@override
State<StatefulWidget> createState() {
return _IntegralStoreDetailsPage(this.arguments);
return _IntegralStoreDetailsPage();
}
}
class _IntegralStoreDetailsPage extends State {
ApiService apiService;
class _IntegralStoreDetailsPage extends State<IntegralStoreDetailsPage> {
late ApiService apiService;
String points;
final Map<String, dynamic> arguments;
_IntegralStoreDetailsPage(this.arguments);
String? points;
@override
void initState() {
@ -42,16 +39,16 @@ class _IntegralStoreDetailsPage extends State {
ApiService(Dio(), context: context, token: value.getString("token"));
queryGoodsById();
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 {
BaseData<Goods> baseData = await apiService.creditGoodsById(arguments["goodsId"]);
if (baseData != null && baseData.isSuccess) {
BaseData<Goods> baseData = await apiService.creditGoodsById(widget.arguments!["goodsId"]);
if (baseData != null && baseData.isSuccess!) {
setState(() {
goods = baseData.data;
});
@ -91,12 +88,12 @@ class _IntegralStoreDetailsPage extends State {
),
),
if (goods != null &&
goods.detail != null &&
goods.detail != "")
goods!.detail != null &&
goods!.detail != "")
Container(
color: Colors.white,
child: Html(
data: goods != null ? goods.detail : "",
data: goods != null ? goods!.detail : "",
customImageRenders: {
base64DataUriMatcher(): base64ImageRender(),
assetUriMatcher(): assetImageRender(),
@ -124,7 +121,7 @@ class _IntegralStoreDetailsPage extends State {
onTap: () {
if (goods != null &&
points != null &&
int.tryParse(goods.price) < int.tryParse(points)) {
int.tryParse(goods!.price!)! < int.tryParse(points!)!) {
toExchangeOrder();
}
},
@ -133,7 +130,7 @@ class _IntegralStoreDetailsPage extends State {
decoration: BoxDecoration(
color: (goods != null &&
points != null &&
int.tryParse(goods.price) < int.tryParse(points))
int.tryParse(goods!.price!)! < int.tryParse(points!)!)
? Color(0xFF32A060)
: Color(0xFFD8D8D8),
borderRadius: BorderRadius.vertical(
@ -144,7 +141,7 @@ class _IntegralStoreDetailsPage extends State {
child: Text(
(goods != null &&
points != null &&
int.tryParse(goods.price) < int.tryParse(points))
int.tryParse(goods!.price!)! < int.tryParse(points!)!)
? S.of(context).duihuan
: S.of(context).jifenbuzu,
style: TextStyle(
@ -165,18 +162,18 @@ class _IntegralStoreDetailsPage extends State {
toExchangeOrder() async {
await Navigator.of(context)
.pushNamed('/router/exchange_order_page', arguments: {
"goodsId": goods.id,
"name": goods.name,
"price": goods.price,
"image": goods.mainImgPath,
"useTyped": goods.canPick
"goodsId": goods!.id,
"name": goods!.name,
"price": goods!.price,
"image": goods!.mainImgPath,
"useTyped": goods!.canPick!
? 1
: goods.canDelivery
: goods!.canDelivery!
? 2
: 3,
});
var shared = await SharedPreferences.getInstance();
points = UserInfo.fromJson(jsonDecode(shared.getString('user'))).points;
points = UserInfo.fromJson(jsonDecode(shared.getString('user')!)).points;
setState(() {});
}
@ -208,7 +205,7 @@ class _IntegralStoreDetailsPage extends State {
children: [
Expanded(
child: Text(
goods == null ? "" : goods.name,
goods == null ? "" : goods!.name!,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.bold,
@ -221,7 +218,7 @@ class _IntegralStoreDetailsPage extends State {
Text(
goods == null
? ""
: S.of(context).yiduihuanjian("${goods.sales}"),
: S.of(context).yiduihuanjian("${goods!.sales}"),
style: TextStyle(
fontSize: 10.sp,
fontWeight: FontWeight.w400,
@ -239,7 +236,7 @@ class _IntegralStoreDetailsPage extends State {
children: [
Expanded(
child: Text(
goods == null ? "" : goods.description,
goods == null ? "" : goods!.description!,
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.w400,
@ -249,7 +246,7 @@ class _IntegralStoreDetailsPage extends State {
flex: 1,
),
Text(
goods == null ? "" : S.of(context).jifen_(goods.price),
goods == null ? "" : S.of(context).jifen_(goods!.price!),
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16.sp,
@ -285,13 +282,12 @@ class _IntegralStoreDetailsPage extends State {
return goods == null
? Container()
: Image.network(
goods.viceImgPaths.elementAt(position),
goods!.viceImgPaths!.elementAt(position),
fit: BoxFit.cover,
);
},
itemCount: (goods == null || goods.viceImgPaths == null)
? 1
: goods.viceImgPaths.length,
itemCount: (goods == null || goods!.viceImgPaths == null)
? 1 : 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';
class LoginPage extends StatefulWidget {
final Map<String, dynamic> arguments;
final Map<String, dynamic>? arguments;
LoginPage({this.arguments});
@ -46,20 +46,20 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
var _sendCodeStatus = 0;
GlobalKey loginKey = GlobalKey();
ApiService client;
late ApiService client;
ScrollController scrollController;
late ScrollController scrollController;
final int initAlpha = 89;
int alpha = 89;
int changeAlpha = 0;
Animation<Alignment> animation;
Animation<double> doubleAnimation;
Animation<Alignment>? animation;
Animation<double>? doubleAnimation;
isLogin() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (sharedPreferences.getBool("isShowPrivacyPolicy") == null ||
!sharedPreferences.getBool("isShowPrivacyPolicy")) {
!sharedPreferences.getBool("isShowPrivacyPolicy")!) {
showAlertDialog();
}
@ -94,8 +94,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
animationStart();
scrollController.addListener(() {
RenderBox renderBox = loginKey.currentContext.findRenderObject();
RenderBox renderBox = loginKey.currentContext!.findRenderObject() as RenderBox;
offsetBtn = scrollController.offset;
var screenHeight = MediaQuery.of(context).size.height;
var scrollHeight = screenHeight * 1.47;
@ -162,7 +161,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
_sendCode() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (!sharedPreferences.containsKey("isShowPrivacyPolicy") ||
!sharedPreferences.getBool("isShowPrivacyPolicy")) {
!sharedPreferences.getBool("isShowPrivacyPolicy")!) {
showAlertDialog();
return;
}
@ -182,7 +181,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
client
.sendVerify(mobile)
.then((value) => {
if (value.isSuccess)
if (value.isSuccess!)
{_sendCodeStatus = 1, countdown()}
else
{
@ -199,17 +198,17 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
}
}
Timer _timer;
Timer? _timer;
countdown() {
if (_timer != null && _timer.isActive) return;
if (_timer != null && _timer!.isActive) return;
int countdown = 60;
_timer = Timer.periodic(Duration(seconds: 1), (timer) {
countdown--;
if (countdown == 0) {
btnText = S.of(context).send_code;
_sendCodeStatus = 0;
_timer.cancel();
_timer!.cancel();
} else {
btnText = S.of(context).resend_in_seconds(countdown);
}
@ -223,7 +222,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
@override
void dispose() {
if (_timer != null) _timer.cancel();
if (_timer != null) _timer!.cancel();
if (animatedContainer != null) animatedContainer.dispose();
super.dispose();
}
@ -235,7 +234,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
}
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (!sharedPreferences.containsKey("isShowPrivacyPolicy") ||
!sharedPreferences.getBool("isShowPrivacyPolicy")) {
!sharedPreferences.getBool("isShowPrivacyPolicy")!) {
showAlertDialog();
return;
}
@ -281,7 +280,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
});
Future.delayed(Duration(seconds: 2), () {
SmartDialog.dismiss();
if (value.isSuccess) {
if (value.isSuccess!) {
saveUserJson(value.data);
eventBus.fire(EventType(3));
@ -301,21 +300,21 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
var userEntity = UserEntity.fromJson(userJson);
SharedPreferences.getInstance().then((value) => {
value.setString('userJson', jsonEncode(userJson)),
value.setString('token', userEntity.token),
value.setString('userId', userEntity.userId),
value.setString('nick', userEntity.name),
value.setString('mobile', userEntity.mobile),
value.setString('token', userEntity.token!),
value.setString('userId', userEntity.userId!),
value.setString('nick', userEntity.name!),
value.setString('mobile', userEntity.mobile!),
});
}
AnimationController animatedContainer;
late AnimationController animatedContainer;
Alignment alignmentBegin;
Alignment alignmentEnd;
Alignment alignmentProgress;
late Alignment alignmentBegin;
late Alignment alignmentEnd;
late Alignment alignmentProgress;
listener() {
alignmentProgress = animation.value;
alignmentProgress = animation!.value;
setState(() {});
}
@ -351,8 +350,8 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
animation = AlignmentTween(begin: alignmentBegin, end: alignmentEnd)
.animate(animatedContainer);
animation.removeListener(listener);
animation.addListener(listener);
animation!.removeListener(listener);
animation!.addListener(listener);
animatedContainer.removeStatusListener(statusListener);
animatedContainer.addStatusListener(statusListener);
@ -897,7 +896,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
}
scrollToTop() {
RenderBox renderBox = loginKey.currentContext.findRenderObject();
RenderBox renderBox = loginKey.currentContext!.findRenderObject() as RenderBox;
var screenHeight = MediaQuery.of(context).size.height;
var scrollHeight = screenHeight * 1.47;
var height = scrollHeight - renderBox.size.height;

16
lib/main.dart

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

14
lib/main_page.dart

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

33
lib/message/system_message.dart

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

46
lib/mine/coupons_page.dart

@ -24,13 +24,13 @@ class CouponsPage extends StatefulWidget {
}
class _CouponsPage extends State<CouponsPage> {
ApiService apiService;
RefreshController _refreshController;
late ApiService apiService;
RefreshController? _refreshController;
@override
void dispose() {
super.dispose();
_refreshController.dispose();
_refreshController?.dispose();
}
@override
@ -44,7 +44,7 @@ class _CouponsPage extends State<CouponsPage> {
_refreshController = RefreshController(initialRefresh: false);
}
List<Coupon> coupons = [];
List<Coupon?> coupons = [];
int pageNum = 1;
int state = 1;
@ -61,26 +61,26 @@ class _CouponsPage extends State<CouponsPage> {
"searchKey": "",
"state": state
}).catchError((error) {
_refreshController.loadFailed();
_refreshController.refreshFailed();
_refreshController?.loadFailed();
_refreshController?.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
if (baseData != null && baseData.isSuccess!) {
if (pageNum == 1) {
coupons.clear();
}
coupons.addAll(baseData.data.list);
coupons.addAll(baseData.data!.list!);
setState(() {
_refreshController.refreshCompleted();
_refreshController.loadComplete();
if (baseData.data.pageNum == baseData.data.pages) {
_refreshController.loadNoData();
_refreshController?.refreshCompleted();
_refreshController?.loadComplete();
if (baseData.data!.pageNum == baseData.data!.pages) {
_refreshController?.loadNoData();
} else {
pageNum += 1;
}
});
} else {
_refreshController.loadFailed();
_refreshController.refreshFailed();
_refreshController?.loadFailed();
_refreshController?.refreshFailed();
}
}
@ -150,7 +150,7 @@ class _CouponsPage extends State<CouponsPage> {
),
Expanded(
child: SmartRefresher(
controller: _refreshController,
controller: _refreshController!,
enablePullDown: true,
enablePullUp: true,
physics: BouncingScrollPhysics(),
@ -170,25 +170,25 @@ class _CouponsPage extends State<CouponsPage> {
coupons[position],
(type) {
if (type == 1) {
receiveCoupon(coupons[position].id);
receiveCoupon(coupons[position]!.id);
} else {
if (coupons[position].bizType == 5) {
if (coupons[position]!.bizType == 5) {
Navigator.of(context).pushNamed(
'/router/write_off_page',
arguments: {
"couponId": coupons[position].id,
"coupon": coupons[position].toJson(),
"couponId": coupons[position]!.id,
"coupon": coupons[position]!.toJson(),
});
} else {
showStoreSelector(
coupons[position].storeList);
coupons[position]!.storeList);
}
}
},
() {
setState(() {
coupons[position].isEx =
!coupons[position].isEx;
coupons[position]!.isEx =
!coupons[position]!.isEx!;
});
},
type: 0,
@ -212,7 +212,7 @@ class _CouponsPage extends State<CouponsPage> {
receiveCoupon(couponId) async {
BaseData baseData = await apiService.receiveCoupon(couponId);
if (baseData != null && baseData.isSuccess) {
if (baseData != null && baseData.isSuccess!) {
_onRefresh();
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';
class EditName extends StatefulWidget {
final Map<String, dynamic> arguments;
final Map<String, dynamic>? arguments;
EditName({this.arguments});
@ -64,7 +64,7 @@ class _EditName extends State<EditName> {
errorBorder: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
hintText: widget.arguments['nick'],
hintText: widget.arguments!['nick'],
// contentPadding: EdgeInsets.only(top: 12, bottom: 12, left: 12),
hintStyle: TextStyle(
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';
class ManageAddressPage extends StatefulWidget {
final Map<String, dynamic> arguments;
final Map<String, dynamic>? arguments;
ManageAddressPage({this.arguments});
@ -25,7 +25,7 @@ class ManageAddressPage extends StatefulWidget {
}
class _ManageAddressPage extends State<ManageAddressPage> {
ApiService apiService;
late ApiService apiService;
@override
void initState() {
@ -38,11 +38,11 @@ class _ManageAddressPage extends State<ManageAddressPage> {
});
}
List<Address> addressList;
List<Address>? addressList;
queryMemberAddress() async {
BaseData<List<Address>> baseData = await apiService.queryMemberAddress();
if (baseData != null && baseData.isSuccess) {
if (baseData != null && baseData.isSuccess!) {
checkIndex = 0;
addressList = baseData.data;
setState(() {});
@ -62,7 +62,7 @@ class _ManageAddressPage extends State<ManageAddressPage> {
body: Column(
children: [
Expanded(
child: (addressList == null || addressList.length == 0)
child: (addressList == null || addressList!.length == 0)
? NoDataView(
isShowBtn: false,
text: "目前暂无送货地址,请添加",
@ -70,20 +70,20 @@ class _ManageAddressPage extends State<ManageAddressPage> {
margin: EdgeInsets.only(top: 120),
)
: ListView.builder(
itemCount: addressList == null ? 0 : addressList.length,
itemCount: addressList == null ? 0 : addressList!.length,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return InkWell(
onTap: () {
if (widget.arguments["isSelector"]) {
if (widget.arguments!["isSelector"]) {
Navigator.of(context).pop({
"id": "${addressList[position].id}",
"address": "${addressList[position].address}",
"id": "${addressList![position].id}",
"address": "${addressList![position].address}",
});
}
},
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) {
await Navigator.of(context)
.pushNamed('/router/address_edit_page', arguments: address.toJson());
@ -123,7 +123,7 @@ class _ManageAddressPage extends State<ManageAddressPage> {
queryMemberAddress();
}
Widget buildAddressItem(Address address, position) {
Widget buildAddressItem(Address? address, position) {
return Container(
margin: EdgeInsets.only(left: 16, right: 16, top: 8, 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,
children: [
Text(
address.username,
address!.username!,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
@ -165,7 +165,7 @@ class _ManageAddressPage extends State<ManageAddressPage> {
children: [
Expanded(
child: IconText(
address.phone,
address!.phone!,
leftImage: "assets/image/icon_address_call.png",
iconSize: 16,
),
@ -229,7 +229,7 @@ class _ManageAddressPage extends State<ManageAddressPage> {
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
color: address.isDefault
color: address!.isDefault!
? Color(0xFF39B54A)
: Color(0xFFA29E9E),
),
@ -338,20 +338,19 @@ class _ManageAddressPage extends State<ManageAddressPage> {
deleteAddress(position) async {
BaseData baseData =
await apiService.deleteAddress(addressList[position].toJson());
if (baseData != null && baseData.isSuccess) {
await apiService.deleteAddress(addressList![position].toJson());
if (baseData != null && baseData.isSuccess!) {
queryMemberAddress();
}
}
changeCheck(value, position) async {
if (value) {
addressList[checkIndex].isDefault = false;
addressList![checkIndex].isDefault = false;
checkIndex = position;
addressList[position].isDefault = true;
BaseData baseData =
await apiService.updateAddress(addressList[position].toJson());
if (baseData != null && baseData.isSuccess) {}
addressList![position].isDefault = true;
BaseData baseData = await apiService.updateAddress(addressList![position].toJson());
if (baseData != null && baseData.isSuccess!) {}
setState(() {});
}
}

30
lib/mine/mine_card_invalid_page.dart

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

36
lib/mine/mine_page.dart

@ -27,7 +27,7 @@ class MinePage extends StatefulWidget {
}
class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
ApiService apiService;
late ApiService apiService;
_toUserInfo() async {
SharedPreferences shared = await SharedPreferences.getInstance();
@ -87,34 +87,34 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
value.getString('user') != null &&
value.getString('user') != "")
{
userinfo = UserInfo.fromJson(jsonDecode(value.getString('user'))),
userinfo = UserInfo.fromJson(jsonDecode(value.getString('user')!)),
},
queryUserInfo()
},
);
}
UserInfo userinfo;
UserInfo? userinfo;
int rankLevel = 1;
List<Rank> ranks = [];
List<Rank?> ranks = [];
queryUserInfo() async {
SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai, animationDurationTemp: Duration(seconds: 1));
BaseData<List<Rank>> rankData = await apiService.rankList();
if (rankData != null && rankData.isSuccess) {
if (rankData != null && rankData.isSuccess!) {
ranks.clear();
ranks.addAll(rankData.data);
ranks.addAll(rankData.data!);
}
BaseData<UserInfo> baseDate = await apiService.queryInfo();
if (baseDate != null && baseDate.isSuccess) {
if (baseDate != null && baseDate.isSuccess!) {
userinfo = baseDate.data;
if (userinfo != null &&
userinfo.memberRankVo != null &&
userinfo!.memberRankVo != null &&
ranks != null &&
ranks.length > 0) {
rankLevel = (ranks.indexWhere(
(element) => element.id == userinfo.memberRankVo.id) +
(element) => element?.id == userinfo!.memberRankVo?.id) +
1);
}
SharedPreferences.getInstance().then(
@ -202,10 +202,10 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
arguments: {
"rankLevel": rankLevel,
"createTime": (userinfo != null)
? "${userinfo.createTime}"
? "${userinfo!.createTime}"
: "",
"points": (userinfo != null)
? int.tryParse(userinfo.points)
? int.tryParse(userinfo!.points!)
: 0,
});
});
@ -214,14 +214,14 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
rankLevel,
curLevel: rankLevel,
rank: (userinfo != null)
? int.tryParse(userinfo.points)
? int.tryParse(userinfo!.points!)!
: 0,
rankMax: (userinfo != null &&
userinfo.memberRankVo != null)
? userinfo.memberRankVo.rankOrigin
userinfo!.memberRankVo != null)
? userinfo!.memberRankVo!.rankOrigin!
: 0,
createTime:
(userinfo != null) ? userinfo.createTime : "",
(userinfo != null) ? userinfo!.createTime! : "",
),
),
orderOrCard(),
@ -564,7 +564,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MImage(
userinfo == null ? "" : userinfo.headimg,
userinfo == null ? "" : userinfo!.headimg!,
isCircle: true,
width: 50,
height: 50,
@ -614,7 +614,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
child: Text(
userinfo == null
? S.of(context).denglu
: "${userinfo.nickname}",
: "${userinfo!.nickname}",
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.bold,
@ -639,7 +639,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
),
)
: Text(
userinfo == null ? "" : "NO.${userinfo.vipNo}",
userinfo == null ? "" : "NO.${userinfo!.vipNo}",
style: TextStyle(
fontSize: 12.sp,
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';
class MineVipLevelPage extends StatefulWidget {
final Map<String, dynamic> arguments;
final Map<String, dynamic>? arguments;
MineVipLevelPage({this.arguments});
@ -24,8 +24,8 @@ class MineVipLevelPage extends StatefulWidget {
}
class _MineVipLevelPage extends State<MineVipLevelPage> {
ApiService apiService;
List<Rank> ranks = [];
late ApiService apiService;
List<Rank?> ranks = [];
SwiperController controller = SwiperController();
@ -42,14 +42,14 @@ class _MineVipLevelPage extends State<MineVipLevelPage> {
queryVipLevel() async {
BaseData<List<Rank>> rankData = await apiService.rankList();
if (rankData != null && rankData.isSuccess) {
if (rankData != null && rankData.isSuccess!) {
ranks.clear();
ranks.addAll(rankData.data);
ranks.addAll(rankData.data!);
setState(() {
controller.move((widget.arguments["rankLevel"] - 1), animation: false);
controller.move((widget.arguments!["rankLevel"] - 1), animation: false);
});
} 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) {
return MineVipView(
position + 1,
curLevel: widget.arguments["rankLevel"],
curLevel: widget.arguments!["rankLevel"],
padding: 6.w,
rank: widget.arguments["points"],
rankMax: (position < (ranks.length - 1)) ? ranks[position + 1].rankOrigin : ranks[position].rankOrigin,
createTime: widget.arguments["createTime"],
rank: widget.arguments!["points"],
rankMax: (position < (ranks.length - 1)) ? ranks[position + 1]!.rankOrigin! : ranks[position]!.rankOrigin!,
createTime: widget.arguments!["createTime"],
);
},
itemCount: (ranks != null && ranks.isNotEmpty) ? ranks.length : 0,
@ -181,9 +181,9 @@ class _MineVipLevelPage extends State<MineVipLevelPage> {
children: ranks != null
? ranks.map((e) {
return levelItem(
e, ranks[ranks.indexOf(e)].rankOrigin,
e, ranks[ranks.indexOf(e)]!.rankOrigin!,
ranks.indexOf(e) == (ranks.length - 1)
? 0 : ranks[ranks.indexOf(e) + 1].rankOrigin);
? 0 : ranks[ranks.indexOf(e) + 1]!.rankOrigin!);
}).toList()
: [],
),
@ -264,7 +264,7 @@ class _MineVipLevelPage extends State<MineVipLevelPage> {
);
}
Widget levelItem(Rank rank, rankOrigin, rankOriginMax) {
Widget levelItem(Rank? rank, rankOrigin, rankOriginMax) {
return Container(
margin: EdgeInsets.symmetric(vertical: 8.h),
child: Row(
@ -273,7 +273,7 @@ class _MineVipLevelPage extends State<MineVipLevelPage> {
children: [
Expanded(
child: Text(
rank.rankName,
rank!.rankName!,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14.sp,

34
lib/mine/mine_wallet_page.dart

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

26
lib/mine/recharge_page.dart

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

44
lib/mine/roll_center_page.dart

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

44
lib/mine/user_info_page.dart

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

38
lib/mine/vip_balance_page.dart

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

28
lib/mine/vip_card_page.dart

@ -21,9 +21,9 @@ class VipCardPage extends StatefulWidget {
}
class _VipCardPage extends State<VipCardPage> {
RefreshController _refreshController;
RefreshController? _refreshController;
ApiService apiService;
late ApiService apiService;
@override
void initState() {
@ -36,20 +36,20 @@ class _VipCardPage extends State<VipCardPage> {
});
}
List<VipCard> coupons = [];
List<VipCard?> coupons = [];
queryVipCard() async {
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.addAll(baseData.data);
coupons.addAll(baseData.data!);
setState(() {
_refreshController.refreshCompleted();
_refreshController?.refreshCompleted();
});
} else {
_refreshController.refreshFailed();
_refreshController?.refreshFailed();
}
}
@ -66,7 +66,7 @@ class _VipCardPage extends State<VipCardPage> {
return MyFooter(mode);
},
),
controller: _refreshController,
controller: _refreshController!,
onRefresh: queryVipCard,
physics: BouncingScrollPhysics(),
child: (coupons != null && coupons.length > 0) ? ListView.builder(
@ -75,9 +75,9 @@ class _VipCardPage extends State<VipCardPage> {
return GestureDetector(
onTap: () {
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,
@ -104,7 +104,7 @@ class _VipCardPage extends State<VipCardPage> {
return "assets/image/icon_vip_bj.png";
}
Widget vipCardItem(VipCard vipCard) {
Widget vipCardItem(VipCard? vipCard) {
return Container(
margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h),
decoration: BoxDecoration(
@ -124,7 +124,7 @@ class _VipCardPage extends State<VipCardPage> {
child: ClipRRect(
borderRadius: BorderRadius.circular(8.w),
child: Image.asset(
assetsByName(vipCard.tenantName),
assetsByName(vipCard!.tenantName!),
fit: BoxFit.cover, //
height: 170.h,
),
@ -143,7 +143,7 @@ class _VipCardPage extends State<VipCardPage> {
Row(
children: [
MImage(
(vipCard?.storeList?.length ?? 0) > 0 ? vipCard.storeList[0].logo : "",
(vipCard?.storeList?.length ?? 0) > 0 ? vipCard.storeList![0]!.logo! : "",
width: 54.w,
height: 54.h,
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';
class VipDetailPage extends StatefulWidget {
final Map<String, dynamic> arguments;
final Map<String, dynamic>? arguments;
VipDetailPage({this.arguments});
@ -27,7 +27,7 @@ class VipDetailPage extends StatefulWidget {
}
class _VipDetailPage extends State<VipDetailPage> {
ApiService apiService;
late ApiService apiService;
@override
void dispose() {
@ -60,17 +60,17 @@ class _VipDetailPage extends State<VipDetailPage> {
Location.getInstance().startLocation(context);
}
VipCard vipCard;
VipCard? vipCard;
final RefreshController refreshController = RefreshController();
int current = 1;
vipDetail(latitude, longitude) async {
BaseData<VipCard> baseData = await apiService.vipDetail({
"id": widget.arguments["id"],
"id": widget.arguments!["id"],
"latitude": "$latitude",
"longitude": "$longitude",
});
if (baseData != null && baseData.isSuccess) {
if (baseData != null && baseData.isSuccess!) {
vipCard = baseData.data;
refreshController.loadComplete();
setState(() {});
@ -142,12 +142,12 @@ class _VipDetailPage extends State<VipDetailPage> {
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
child: shopItem(vipCard.storeList[position]),
child: shopItem(vipCard!.storeList![position]),
);
},
padding: EdgeInsets.symmetric(vertical: 1),
itemCount: (vipCard != null && vipCard.storeList != null)
? vipCard.storeList.length : 0,
itemCount: (vipCard != null && vipCard!.storeList != null)
? vipCard!.storeList!.length : 0,
),
),
),
@ -190,7 +190,7 @@ class _VipDetailPage extends State<VipDetailPage> {
children: [
MImage(
(vipCard?.storeList?.length ?? 0) > 0
? vipCard.storeList[0].logo
? vipCard!.storeList![0]!.logo!
: "",
width: 40.w,
height: 40.h,
@ -215,7 +215,7 @@ class _VipDetailPage extends State<VipDetailPage> {
children: [
Expanded(
child: Text(
vipCard != null ? vipCard.tenantName : "",
vipCard != null ? vipCard!.tenantName! : "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14.sp,
@ -269,7 +269,7 @@ class _VipDetailPage extends State<VipDetailPage> {
children: [
TextSpan(
text:
"¥ ${vipCard != null ? vipCard.balance : ""}",
"¥ ${vipCard != null ? vipCard!.balance : ""}",
style: TextStyle(
fontSize: 24.sp,
fontWeight: FontWeight.w500,
@ -283,7 +283,7 @@ class _VipDetailPage extends State<VipDetailPage> {
onTap: () {
Navigator.of(context).pushNamed(
'/router/vip_balance',
arguments: {"storeId": vipCard.id});
arguments: {"storeId": vipCard!.id});
},
child: Row(
children: [
@ -355,11 +355,11 @@ class _VipDetailPage extends State<VipDetailPage> {
padding: EdgeInsets.only(top: 5.h, bottom: 5.h),
child: Text(
vipCard != null
? "${vipCard.id.substring(0, 4)} "
"${vipCard.id.substring(4, 8)} "
"${vipCard.id.substring(8, 12)} "
"${vipCard.id.substring(12, 16)} "
"${vipCard.id.substring(16, vipCard.id.length)}"
? "${vipCard!.id!.substring(0, 4)} "
"${vipCard!.id!.substring(4, 8)} "
"${vipCard!.id!.substring(8, 12)} "
"${vipCard!.id!.substring(12, 16)} "
"${vipCard!.id!.substring(16, vipCard!.id!.length)}"
: "",
maxLines: 1,
textAlign: TextAlign.center,
@ -369,17 +369,17 @@ class _VipDetailPage extends State<VipDetailPage> {
wordSpacing: vipCard == null
? 10
: (MediaQuery.of(context).size.width - 64.w) /
(((vipCard.id.length) * 4)),
(((vipCard!.id!.length) * 4)),
letterSpacing: vipCard == null
? 8
: (MediaQuery.of(context).size.width - 64.w) /
(((vipCard.id.length) * 4)),
(((vipCard!.id!.length) * 4)),
),
),
),
BarcodeWidget(
barcode: Barcode.code128(),
data: vipCard == null ? "" : vipCard.id,
data: vipCard == null ? "" : vipCard!.id!,
height: 30.h,
color: Colors.black,
drawText: false,
@ -394,7 +394,7 @@ class _VipDetailPage extends State<VipDetailPage> {
);
}
Widget shopItem(StoreListBean store) {
Widget shopItem(StoreListBean? store) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h),
child: Column(
@ -407,7 +407,7 @@ class _VipDetailPage extends State<VipDetailPage> {
Expanded(
flex: 1,
child: Text(
(store != null) ? store.storeName : "",
(store != null) ? store!.storeName! : "",
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.bold,
@ -418,7 +418,7 @@ class _VipDetailPage extends State<VipDetailPage> {
GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('/router/union_detail_page',
arguments: {"id": store.id});
arguments: {"id": store!.id!});
},
child: Text(
S.of(context).chakan,
@ -451,7 +451,7 @@ class _VipDetailPage extends State<VipDetailPage> {
),
Expanded(
child: Text(
store.address,
store!.address!,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
@ -476,7 +476,7 @@ class _VipDetailPage extends State<VipDetailPage> {
S.of(context).yingyeshijian((store.openStartTime == null &&
store.openEndTime == null)
? 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(
fontSize: 12.sp,
fontWeight: FontWeight.w400,
@ -505,14 +505,14 @@ class _VipDetailPage extends State<VipDetailPage> {
String totalPrice(orderInfo) {
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) {
totalPrice -= double.tryParse(orderInfo.orderDetail.couponDTO.money);
totalPrice -= double.tryParse(orderInfo.orderDetail.couponDTO.money)!;
}
return "$totalPrice";
}
List<Widget> goodsItem(List<ProductList> products) {
List<Widget> goodsItem(List<ProductList?> products) {
if (products == null) return [];
if (products.length > 3) {
products = products.sublist(0, 3);
@ -524,7 +524,7 @@ class _VipDetailPage extends State<VipDetailPage> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
MImage(
e.skuImg,
e!.skuImg!,
width: 75.w,
height: 75.h,
fit: BoxFit.contain,
@ -538,7 +538,7 @@ class _VipDetailPage extends State<VipDetailPage> {
Container(
width: 75.w,
child: Text(
e.productName,
e!.productName!,
maxLines: 1,
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,

42
lib/order/exchange_history_page.dart

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

72
lib/order/exchange_order_page.dart

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

38
lib/order/logistics_information_page.dart

@ -23,8 +23,8 @@ class LogisticsInformationPage extends StatefulWidget {
}
class _LogisticsInformationPage extends State<LogisticsInformationPage> {
ApiService apiService;
RefreshController _refreshController;
late ApiService apiService;
RefreshController? _refreshController;
@override
void initState() {
@ -39,26 +39,28 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
});
}
List<TracesBean> logistics = [];
List<TracesBean?> logistics = [];
String shipStatus = "";
getShippingTrace(String shipperCode, String logisticCode) async {
BaseData<Logistics> baseData = await apiService
.shippingTrace(shipperCode, logisticCode)
.catchError((error) {
_refreshController.refreshFailed();
_refreshController?.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
Logistics lgs = baseData.data;
if (baseData != null && baseData.isSuccess!) {
Logistics? lgs = baseData.data;
logistics.clear();
logistics.addAll(lgs.traces.reversed);
logistics.addAll(lgs!.traces!.reversed);
setState(() {
shipStatus = logisticsStatus(lgs.state);
if (logistics.length > 0) logistics[0].acceptStation += shipStatus;
_refreshController.refreshCompleted();
if (logistics.length > 0) {
logistics![0]!.acceptStation = logistics![0]!.acceptStation! + shipStatus;
}
_refreshController?.refreshCompleted();
});
} else {
_refreshController.refreshFailed();
_refreshController?.refreshFailed();
}
}
@ -121,7 +123,7 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
itemCount:
logistics != null ? logistics.length : 0,
itemBuilder: (context, position) {
return orderTrackItem(logistics[position],
return orderTrackItem(logistics![position],
position, logistics.length);
})
: 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(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
@ -309,7 +311,7 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
logistics.acceptTime.split(" ")[0],
logistics!.acceptTime!.split(" ")[0],
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w500,
@ -319,7 +321,7 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
height: 5.h,
),
Text(
logistics.acceptTime.split(" ")[1],
logistics!.acceptTime!.split(" ")[1],
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.w500,
@ -333,7 +335,7 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
Column(
children: [
Image.asset(
tripStatus(logistics.acceptStation),
tripStatus(logistics!.acceptStation!),
width: 24.w,
height: 24.h,
),
@ -355,9 +357,9 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (logisticsTripStatus(logistics.acceptStation) != "")
if (logisticsTripStatus(logistics!.acceptStation!) != "")
Text(
logisticsTripStatus(logistics.acceptStation),
logisticsTripStatus(logistics!.acceptStation!),
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w500,
@ -367,7 +369,7 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
height: 10.h,
),
Text(
logistics.acceptStation,
logistics!.acceptStation!,
style: TextStyle(
fontSize: 12.sp,
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/custom_image.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/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/separator.dart';
import 'package:huixiang/view_widget/text_image_dialog.dart';
@ -32,7 +29,7 @@ class OrderDetailPage extends StatefulWidget {
}
class _OrderDetailPage extends State<OrderDetailPage> {
ApiService apiService;
late ApiService apiService;
@override
void initState() {
@ -45,7 +42,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
});
}
OrderInfo orderInfo;
OrderInfo? orderInfo;
int payStatus = 0;
int orderStatus = 0;
int sendStatus = 0;
@ -56,13 +53,13 @@ class _OrderDetailPage extends State<OrderDetailPage> {
queryDetails() async {
BaseData<OrderInfo> baseData = await apiService.orderDetail(widget.arguments["id"]);
if (baseData != null && baseData.isSuccess) {
if (baseData != null && baseData.isSuccess!) {
orderInfo = baseData.data;
payStatus = orderInfo.payStatus;
orderStatus = orderInfo.orderStatus;
sendStatus = orderInfo.sendStatus;
isTakeOut = orderInfo.isTakeOut;
refundStatus = orderInfo.refundStatus;
payStatus = orderInfo!.payStatus!;
orderStatus = orderInfo!.orderStatus!;
sendStatus = orderInfo!.sendStatus!;
isTakeOut = orderInfo!.isTakeOut!;
refundStatus = orderInfo!.refundStatus!;
// storeType = orderInfo.storeVO.posType.code;
print("refund_status: $refundStatus");
print("payStatus: $payStatus");
@ -223,7 +220,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
String minute = "";
if (payStatus == 0) {
String hourMinute = AppUtils.getHourMinuteAfter30mByString(
(orderInfo != null) ? orderInfo.createTime : "");
(orderInfo != null) ? orderInfo!.createTime! : "");
var hourMinutes = hourMinute.split(":");
hour = hourMinutes[0];
minute = hourMinutes[1];
@ -232,8 +229,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
} else if (isTakeOut == 1) {
if (sendStatus == 2 || sendStatus == 3) {
String hourMinute = AppUtils.getHourMinuteByString(
(orderInfo != null && orderInfo.orderDetail != null)
? orderInfo.orderDetail.predictTime
(orderInfo != null && orderInfo!.orderDetail != null)
? orderInfo!.orderDetail!.predictTime!
: "");
var hourMinutes = hourMinute.split(":");
hour = hourMinutes[0];
@ -307,7 +304,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
break;
case 3:
title = S.of(context).dengdaiyonghuqucan;
center = S.of(context).qudanhao(orderInfo.dayFlowCode);
center = S.of(context).qudanhao(orderInfo!.dayFlowCode!);
break;
case 4:
title = S.of(context).dingdanyiwancheng;
@ -430,7 +427,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
Text(
S
.of(context)
.yuan_(orderInfo != null ? orderInfo.finalPayPrice : "0"),
.yuan_(orderInfo != null ? orderInfo!.finalPayPrice! : "0"),
style: TextStyle(
fontSize: 20.sp,
color: Color(0xFF32A060),
@ -656,8 +653,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
height: 28.h,
),
Text(
(orderInfo != null && orderInfo.addressExt != null)
? (orderInfo.addressExt.recName ?? "")
(orderInfo != null && orderInfo!.addressExt != null)
? (orderInfo!.addressExt!.recName! ?? "")
: "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
@ -670,8 +667,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
),
Expanded(
child: Text(
(orderInfo != null && orderInfo.addressExt != null)
? (orderInfo.addressExt.recMobile ?? "")
(orderInfo != null && orderInfo!.addressExt != null)
? (orderInfo!.addressExt!.recMobile! ?? "")
: "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
@ -690,8 +687,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
Container(
margin: EdgeInsets.only(left: 28.w),
child: Text(
(orderInfo != null && orderInfo.addressExt != null)
? (orderInfo.addressExt.address ?? "")
(orderInfo != null && orderInfo!.addressExt != null)
? (orderInfo!.addressExt!.address ?? "")
: "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
@ -736,8 +733,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
(open) {
if (open) {
String mobile = (orderInfo != null &&
orderInfo.storeVO != null)
? (orderInfo.storeVO.mobile ?? "")
orderInfo!.storeVO != null)
? (orderInfo!.storeVO!.mobile ?? "")
: "";
if (mobile != "") {
callMobile(mobile);
@ -870,34 +867,34 @@ class _OrderDetailPage extends State<OrderDetailPage> {
List<Widget> commodityList() {
if (orderInfo == null) return [];
List<Widget> widgets = [];
if (orderInfo.productList != null) {
if (orderInfo!.productList != null) {
widgets
.addAll(orderInfo.productList.map((e) => commodityItem(e)).toList());
.addAll(orderInfo!.productList!.map((e) => commodityItem(e)).toList());
}
widgets.add(SizedBox(height: 20.h));
if (orderInfo.isTakeOut != 0) {
if (orderInfo!.isTakeOut != 0) {
//
widgets.add(discountItem(
Color(0xFFFF7A1A),
orderInfo.isTakeOut == 1
orderInfo!.isTakeOut == 1
? S.of(context).peisongfei
: S.of(context).yunfei,
"",
"+${orderInfo.postFee}"));
"+${orderInfo!.postFee}"));
}
if (orderInfo.orderDetail != null &&
orderInfo.orderDetail.couponDTO != null) {
if (orderInfo!.orderDetail != null &&
orderInfo!.orderDetail!.couponDTO != null) {
//
widgets.add(discountItem(
Color(0xFF32A060),
"优惠券",
orderInfo.orderDetail.couponDTO.name,
orderInfo.orderDetail.couponDTO.money));
orderInfo!.orderDetail!.couponDTO!.name,
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),
// orderInfo.storeVO.couponVO.storeName,
// S.of(context).huodongjianmianpeisongfei(orderInfo.storeVO.couponVO.discountAmount),
@ -1010,14 +1007,14 @@ class _OrderDetailPage extends State<OrderDetailPage> {
child: Column(
children: [
orderInfoItem(
S.of(context).dingdanhao, orderInfo != null ? orderInfo.id : ""),
S.of(context).dingdanhao, orderInfo != null ? orderInfo!.id : ""),
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).beizhu,
orderInfo != null
? orderInfo.notes ?? S.of(context).qingshurubeizhuyaoqiu
? orderInfo!.notes ?? S.of(context).qingshurubeizhuyaoqiu
: S.of(context).qingshurubeizhuyaoqiu),
orderInfoItem(S.of(context).zhifufangshi,
orderInfo != null ? payChannel() : S.of(context).yue),
@ -1027,7 +1024,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
}
String payChannel() {
switch (orderInfo.payChannel) {
switch (orderInfo!.payChannel) {
case 0:
return "现金支付";
case 1:
@ -1091,13 +1088,13 @@ class _OrderDetailPage extends State<OrderDetailPage> {
);
}
Widget commodityItem(ProductList productList) {
Widget commodityItem(ProductList? productList) {
return Container(
margin: EdgeInsets.only(top: 8.h, bottom: 8.h),
child: Row(
children: [
MImage(
productList.skuImg,
productList!.skuImg!,
width: 44.w,
height: 44.w,
fit: BoxFit.cover,
@ -1120,7 +1117,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
productList.productName,
productList!.productName!,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.sp,
@ -1154,7 +1151,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
),
),
Text(
S.of(context).yuan_(productList.sellPrice),
S.of(context).yuan_(productList!.sellPrice!),
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 12.sp,
@ -1231,8 +1228,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
Expanded(
child: Text(
S.of(context).gongjijianshangpin(
(orderInfo != null && orderInfo.productList != null)
? orderInfo.productList.length
(orderInfo != null && orderInfo!.productList != null)
? orderInfo!.productList!.length
: "0"),
style: TextStyle(
fontSize: 10.sp,
@ -1268,11 +1265,11 @@ class _OrderDetailPage extends State<OrderDetailPage> {
String totalPrice() {
if (orderInfo == null) return "";
double totalPrice = (double.tryParse(orderInfo.orderSum) +
double.tryParse(orderInfo.postFee));
if (orderInfo.orderDetail != null &&
orderInfo.orderDetail.couponDTO != null) {
totalPrice -= double.tryParse(orderInfo.orderDetail.couponDTO.money);
double totalPrice = (double.tryParse(orderInfo!.orderSum!)! +
double.tryParse(orderInfo!.postFee!)!)!;
if (orderInfo!.orderDetail != null &&
orderInfo!.orderDetail!.couponDTO != null) {
totalPrice -= double.tryParse(orderInfo!.orderDetail!.couponDTO!.money!)!;
}
return "$totalPrice";
}

52
lib/order/order_history_page.dart

@ -25,8 +25,8 @@ class OrderHistoryPage extends StatefulWidget {
class _OrderHistoryPage extends State<OrderHistoryPage>
with SingleTickerProviderStateMixin {
List<Widget> _pages;
TabController tabcontroller;
List<Widget>? _pages;
TabController? tabcontroller;
@override
void didChangeDependencies() {
@ -91,7 +91,7 @@ class _OrderHistoryPage extends State<OrderHistoryPage>
),
),
body: TabBarView(
children: _pages,
children: _pages!,
controller: tabcontroller,
),
),
@ -137,9 +137,9 @@ class _OrderHistoryList extends State<OrderHistoryList>
return InkWell(
onTap: () {
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(
@ -153,7 +153,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
bool isRemake = true;
ApiService apiService;
late ApiService apiService;
int current = 1;
_onRefresh() {
@ -161,7 +161,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
queryOrder();
}
List<OrderInfo> orderInfos = [];
List<OrderInfo?> orderInfos = [];
queryOrder() async {
BaseData<PageInfo<OrderInfo>> baseData = await apiService.orderList({
@ -175,14 +175,14 @@ class _OrderHistoryList extends State<OrderHistoryList>
refreshController.loadFailed();
});
if (baseData != null && baseData.isSuccess) {
if (baseData != null && baseData.isSuccess!) {
if (current == 1) {
orderInfos.clear();
}
orderInfos.addAll(baseData.data.records);
orderInfos.addAll(baseData.data!.records!);
refreshController.refreshCompleted();
refreshController.loadComplete();
if (current * 10 > int.tryParse(baseData.data.total)) {
if (current * 10 > int.tryParse(baseData.data!.total!)!) {
refreshController.loadNoData();
} else {
current += 1;
@ -250,7 +250,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
margin: EdgeInsets.only(left: 6.w, top: 12.h),
alignment: Alignment.centerLeft,
child: Text(
(orderInfo != null) ? orderInfo.storeName : "",
(orderInfo != null) ? orderInfo.storeName! : "",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.sp,
@ -265,7 +265,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
child: Text(
(orderInfo != null &&
orderInfo.storeVO != null &&
orderInfo.storeVO.posType != null)
orderInfo.storeVO!.posType != null)
? StatusUtils.statusText(
context,
orderInfo.refundStatus,
@ -280,7 +280,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
color: (orderInfo == null)
? Color(0xFF32A060)
: (orderInfo.refundStatus == 1 ||
orderInfo.orderStatus >= 5)
orderInfo.orderStatus! >= 5)
? Colors.grey
: (orderInfo.orderStatus == 4)
? Color(0xFF32A060)
@ -298,7 +298,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
children: [
Text(
S.of(context).xiadanshijian_(
(orderInfo != null) ? orderInfo.createTime : ""),
(orderInfo != null) ? orderInfo.createTime! : ""),
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFF727272),
@ -317,8 +317,8 @@ class _OrderHistoryList extends State<OrderHistoryList>
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: goodsItem((orderInfo != null &&
orderInfo.productList != null)
? orderInfo.productList
orderInfo!.productList != null)
? orderInfo!.productList
: null),
),
),
@ -363,7 +363,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
TextSpan(
text: (orderInfo != null &&
orderInfo.productList != null)
? "${orderInfo.productList.length}"
? "${orderInfo.productList!.length}"
: "0",
style: TextStyle(
fontSize: 12.sp,
@ -430,9 +430,9 @@ class _OrderHistoryList extends State<OrderHistoryList>
orderInfo.logisticsName,
orderInfo.logisticsNum,
orderInfo.shipperCode,
orderInfo.productList.length,
orderInfo.productList.length > 0
? orderInfo.productList[0].skuImg
orderInfo.productList!.length,
orderInfo.productList!.length > 0
? orderInfo.productList![0]!.skuImg
: "")
: [],
),
@ -447,16 +447,16 @@ class _OrderHistoryList extends State<OrderHistoryList>
String totalPrice(orderInfo) {
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) {
totalPrice -= double.tryParse(orderInfo.orderDetail.couponDTO.money);
totalPrice -= double.tryParse(orderInfo.orderDetail.couponDTO.money)!;
}
return "$totalPrice";
}
List<Widget> goodsItem(List<ProductList> products) {
List<Widget> goodsItem(List<ProductList?>? products) {
if (products == null) return [];
if (products.length > 3) {
products = products.sublist(0, 3);
@ -470,7 +470,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
crossAxisAlignment: CrossAxisAlignment.center,
children: [
MImage(
e.skuImg,
e!.skuImg!,
width: 75.w,
height: 75.w,
fit: BoxFit.cover,
@ -484,7 +484,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
Container(
width: 75.w,
child: Text(
e.productName,
e!.productName!,
maxLines: 1,
textAlign: TextAlign.center,
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/retrofit_api.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/request_permission.dart';
import 'package:permission_handler/permission_handler.dart';
@ -28,14 +27,14 @@ class StoreSelectorPage extends StatefulWidget {
}
class _StoreSelectorPage extends State<StoreSelectorPage> {
ApiService apiService;
late ApiService apiService;
LocationFlutterPlugin aMapFlutterLocation;
LocationFlutterPlugin? aMapFlutterLocation;
@override
void dispose() {
super.dispose();
aMapFlutterLocation.stopLocation();
aMapFlutterLocation?.stopLocation();
}
@override
@ -49,17 +48,17 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
if (aMapFlutterLocation == null) {
aMapFlutterLocation = LocationFlutterPlugin();
aMapFlutterLocation.onResultCallback().listen((event) {
aMapFlutterLocation!.onResultCallback().listen((event) {
if (event != null &&
event["latitude"] != null &&
event["longitude"] != null) {
print("location: $event");
aMapFlutterLocation.stopLocation();
aMapFlutterLocation!.stopLocation();
if (event["latitude"] is String && event["longitude"] is String) {
latLng = BMFCoordinate(double.tryParse(event["latitude"]),
double.tryParse(event["longitude"]));
latLng = BMFCoordinate(double.tryParse(event["latitude"] as String),
double.tryParse(event["longitude"] as String));
} else {
latLng = BMFCoordinate(event["latitude"], event["longitude"]);
latLng = BMFCoordinate(event["latitude"] as double, event["longitude"] as double);
}
BMFCalculateUtils.coordConvert(
coordinate: latLng,
@ -75,7 +74,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
});
}
aMapFlutterLocation.prepareLoc({
aMapFlutterLocation?.prepareLoc({
"coorType": "bd09ll",
"isNeedAddres": false,
"isNeedAltitude": false,
@ -91,7 +90,6 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
"reGeocodeTimeout": 10,
"activityType": "CLActivityTypeAutomotiveNavigation",
"BMKLocationCoordinateType": "BMKLocationCoordinateTypeBMK09LL",
"BMKLocationCoordinateType": "BMKLocationCoordinateTypeBMK09LL",
"isNeedNewVersionRgc": false,
});
@ -107,8 +105,8 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
await prefs.setString("district", district ?? "");
}
List<Store> storeList;
BMFCoordinate latLng;
List<Store>? storeList;
BMFCoordinate? latLng;
startLocation() async {
if (!(await Permission.locationWhenInUse.serviceStatus.isEnabled)) {
@ -120,7 +118,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
requestDialog();
} else if (await Permission.location.isGranted) {
SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai, animationDurationTemp: Duration(seconds: 1));
aMapFlutterLocation.startLocation();
aMapFlutterLocation?.startLocation();
Future.delayed(Duration(seconds: 6), () {
SmartDialog.dismiss();
});
@ -191,8 +189,8 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
value.containsKey("city") &&
value.containsKey("district"))
{
latLng = BMFCoordinate(double.tryParse(value.getString("latitude")),
double.tryParse(value.getString("longitude"))),
latLng = BMFCoordinate(double.tryParse(value.getString("latitude")!),
double.tryParse(value.getString("longitude")!)),
queryStore(
value.getString("latitude"),
value.getString("longitude"),
@ -218,7 +216,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
"province": "",
"searchKey": ""
});
if (baseData != null && baseData.isSuccess) {
if (baseData != null && baseData.isSuccess!) {
storeList = baseData.data;
if (mounted) setState(() {});
}
@ -240,7 +238,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
children: [
Expanded(
child: ListView.builder(
itemCount: storeList != null ? storeList.length : 0,
itemCount: storeList != null ? storeList!.length : 0,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
@ -249,7 +247,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
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);
return;
}
Store store = storeList[groupValue];
Store store = storeList![groupValue];
Navigator.of(context).pop({
"id": store.id,
"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(
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 8.h, bottom: 8.h),
padding: EdgeInsets.all(16),
@ -315,7 +313,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
store.storeName,
store.storeName!,
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.bold,
@ -326,7 +324,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
height: 12.h,
),
IconText(
store.address,
store.address!,
isMax: true,
textAxisAlignment: CrossAxisAlignment.start,
textStyle: TextStyle(
@ -359,9 +357,9 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
value: position,
groupValue: groupValue,
activeColor: Colors.green,
onChanged: (value) {
onChanged: (int? value) {
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> {
Coupon coupon;
Coupon? coupon;
@override
void initState() {
@ -60,7 +60,7 @@ class _WriteOffPage extends State<WriteOffPage> {
child: Column(
children: [
Text(
coupon != null ? coupon.couponName : "",
coupon != null ? coupon!.couponName! : "",
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.bold,
@ -71,7 +71,7 @@ class _WriteOffPage extends State<WriteOffPage> {
),
Text(
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(
fontSize: 12.sp,
color: Color(0xFF353535),
@ -102,11 +102,11 @@ class _WriteOffPage extends State<WriteOffPage> {
children: [
Text(
coupon != null
? "${coupon.id.substring(0, 4)} "
"${coupon.id.substring(4, 8)} "
"${coupon.id.substring(8, 12)} "
"${coupon.id.substring(12, 16)} "
"${coupon.id.substring(16, coupon.id.length)}"
? "${coupon!.id!.substring(0, 4)} "
"${coupon!.id!.substring(4, 8)} "
"${coupon!.id!.substring(8, 12)} "
"${coupon!.id!.substring(12, 16)} "
"${coupon!.id!.substring(16, coupon!.id!.length)}"
: "",
style: TextStyle(
fontSize: 14.sp,
@ -114,12 +114,12 @@ class _WriteOffPage extends State<WriteOffPage> {
? 10
: (MediaQuery.of(context).size.width -
64.w) /
(((coupon.id.length) * 4)),
(((coupon!.id!.length) * 4)),
letterSpacing: coupon == null
? 8
: (MediaQuery.of(context).size.width -
64.w) /
(((coupon.id.length) * 4)),
(((coupon!.id!.length) * 4)),
fontWeight: FontWeight.bold,
color: Color(0xFF353535),
),
@ -129,7 +129,7 @@ class _WriteOffPage extends State<WriteOffPage> {
),
BarcodeWidget(
barcode: Barcode.code128(useCode128C: true),
data: coupon != null ? coupon.id : "",
data: coupon != null ? coupon!.id! : "",
height: 72.h,
color: Colors.black,
drawText: false,
@ -138,7 +138,7 @@ class _WriteOffPage extends State<WriteOffPage> {
height: 16.h,
),
QrImage(
data: coupon != null ? coupon.id : "",
data: coupon != null ? coupon!.id! : "",
version: QrVersions.auto,
size: 200.w,
gapless: true,

36
lib/retrofit/data/activity.dart

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

26
lib/retrofit/data/address.dart

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

204
lib/retrofit/data/article.dart

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

24
lib/retrofit/data/banner.dart

@ -1,17 +1,17 @@
class BannerData {
String content;
String createTime;
int contentType;
String createUser;
String id;
String imgUrl;
bool isDelete;
String storeId;
String tenantCode;
String type;
String updateTime;
String updateUser;
String? content;
String? createTime;
int? contentType;
String? createUser;
String? id;
String? imgUrl;
bool? isDelete;
String? storeId;
String? tenantCode;
String? type;
String? updateTime;
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});

16
lib/retrofit/data/base_data.dart

@ -9,14 +9,14 @@ part 'base_data.g.dart';
class BaseData<T> {
BaseData();
int code;
T data;
dynamic extra;
bool isError;
bool isSuccess;
String msg;
String path;
String timestamp;
int? code;
T? data;
dynamic? extra;
bool? isError;
bool? isSuccess;
String? msg;
String? path;
String? timestamp;
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"
class Brand {
String _name;
String _image;
String _video;
String _desc;
String _content;
String _icon;
int _sort;
String _storeId;
String? name;
String? image;
String? video;
String? desc;
String? content;
String? icon;
int? sort;
String? storeId;
String get name => _name;
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();
Brand.fromJson(dynamic json) {
_name = json["name"];
_image = json["image"];
_video = json["video"];
_desc = json["desc"];
_content = json["content"];
_icon = json["icon"];
_sort = json["sort"];
_storeId = json["storeId"];
this.name = json["name"];
this.image = json["image"];
this.video = json["video"];
this.desc = json["desc"];
this.content = json["content"];
this.icon = json["icon"];
this.sort = json["sort"];
this.storeId = json["storeId"];
}
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
map["name"] = _name;
map["image"] = _image;
map["video"] = _video;
map["desc"] = _desc;
map["content"] = _content;
map["sort"] = _sort;
map["storeId"] = _storeId;
map["name"] = this.name;
map["image"] = this.image;
map["video"] = this.video;
map["desc"] = this.desc;
map["content"] = this.content;
map["sort"] = this.sort;
map["storeId"] = this.storeId;
return map;
}

18
lib/retrofit/data/brand_data.dart

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

58
lib/retrofit/data/coupon.dart

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

4
lib/retrofit/data/data_type.dart

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

33
lib/retrofit/data/delivery_info.dart

@ -1,24 +1,23 @@
class DeliveryInfo {
bool dadaRegStatus;
String dadaSourceId;
bool dadaStatus;
bool dianwodaRegStatus;
bool dianwodaStatus;
bool meituanRegStatus;
bool meituanStatus;
bool? dadaRegStatus;
String? dadaSourceId;
bool? dadaStatus;
bool? dianwodaRegStatus;
bool? dianwodaStatus;
bool? meituanRegStatus;
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(
dadaRegStatus: json['dadaRegStatus'] as bool,
dadaSourceId: json['dadaSourceId'] as String,
dadaStatus: json['dadaStatus'] as bool,
dianwodaRegStatus: json['dianwodaRegStatus'] as bool,
dianwodaStatus: json['dianwodaStatus'] as bool,
meituanRegStatus: json['meituanRegStatus'] as bool,
meituanStatus: json['meituanStatus'] as bool,
);
factory DeliveryInfo.fromJson(Map<String, dynamic> json) => DeliveryInfo()
..dadaRegStatus= json['dadaRegStatus'] as bool
..dadaSourceId= json['dadaSourceId'] as String
..dadaStatus= json['dadaStatus'] as bool
..dianwodaRegStatus= json['dianwodaRegStatus'] as bool
..dianwodaStatus= json['dianwodaStatus'] as bool
..meituanRegStatus= json['meituanRegStatus'] as bool
..meituanStatus= json['meituanStatus'] as bool;
Map<String, dynamic> toJson() => <String, dynamic>{
'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 {
ExchangeOrder();
String id;
String createTime;
String createUser;
String updateTime;
String updateUser;
String storeId;
String mid;
String orderCode;
String amount;
String address;
int state;
int useTyped;
int isDelete;
List<ExchangeOrderGoods> creditOrderDetailList;
String? id;
String? createTime;
String? createUser;
String? updateTime;
String? updateUser;
String? storeId;
String? mid;
String? orderCode;
String? amount;
String? address;
int? state;
int? useTyped;
int? isDelete;
List<ExchangeOrderGoods?>? creditOrderDetailList;
factory ExchangeOrder.fromJson(Map<String, dynamic> json) => ExchangeOrder()
..id = json['id'] as String
@ -52,6 +52,6 @@ class ExchangeOrder {
'state': this.state,
'useTyped': this.useTyped,
'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 {
ExchangeOrderGoods();
String id;
String createTime;
String createUser;
String updateTime;
String updateUser;
String orderId;
String goodsId;
String categoryId;
String name;
String description;
String worth;
String price;
String couponId;
bool canPick;
bool canDelivery;
String goodsMainImg;
String goodsViceImg;
int goodsNumber;
int isDelete;
String? id;
String? createTime;
String? createUser;
String? updateTime;
String? updateUser;
String? orderId;
String? goodsId;
String? categoryId;
String? name;
String? description;
String? worth;
String? price;
String? couponId;
bool? canPick;
bool? canDelivery;
String? goodsMainImg;
String? goodsViceImg;
int? goodsNumber;
int? isDelete;
factory ExchangeOrderGoods.fromJson(Map<String, dynamic> json) =>
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>"
class Founder {
String _name;
String _position;
String _description;
String _imgUrl;
String _profile;
String? name;
String? position;
String? description;
String? imgUrl;
String? profile;
String get name => _name;
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();
Founder.fromJson(dynamic json) {
_name = json["name"];
_position = json["position"];
_description = json["description"];
_imgUrl = json["imgUrl"];
_profile = json["profile"];
this.name = json["name"];
this.position = json["position"];
this.description = json["description"];
this.imgUrl = json["imgUrl"];
this.profile = json["profile"];
}
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
map["name"] = _name;
map["position"] = _position;
map["description"] = _description;
map["imgUrl"] = _imgUrl;
map["profile"] = _profile;
map["name"] = this.name;
map["position"] = this.position;
map["description"] = this.description;
map["imgUrl"] = this.imgUrl;
map["profile"] = this.profile;
return map;
}

211
lib/retrofit/data/goods.dart

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

94
lib/retrofit/data/goods_category.dart

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

22
lib/retrofit/data/logistics.dart

@ -5,21 +5,21 @@
/// traces : [{"acceptStation":"","acceptTime":""}]
class Logistics {
String logisticCode;
String shipperCode;
int state;
bool success;
List<TracesBean> traces;
String? logisticCode;
String? shipperCode;
int? state;
bool? success;
List<TracesBean?>? traces;
static Logistics fromJson(Map<String, dynamic> map) {
static Logistics? fromJson(Map<String, dynamic>? map) {
if (map == null) return null;
Logistics logisticsBean = Logistics();
logisticsBean.logisticCode = map['logisticCode'];
logisticsBean.shipperCode = map['shipperCode'];
logisticsBean.state = map['state'];
logisticsBean.success = map['success'];
logisticsBean.traces = List()..addAll(
(map['traces'] as List ?? []).map((o) => TracesBean.fromMap(o))
logisticsBean.traces = []..addAll(
(map['traces'] as List).map((o) => TracesBean.fromMap(o))
);
return logisticsBean;
}
@ -37,10 +37,10 @@ class Logistics {
/// acceptTime : ""
class TracesBean {
String acceptStation;
String acceptTime;
String? acceptStation;
String? acceptTime;
static TracesBean fromMap(Map<String, dynamic> map) {
static TracesBean? fromMap(Map<String, dynamic>? map) {
if (map == null) return null;
TracesBean tracesBean = TracesBean();
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 {
String content;
String createTime;
String createUser;
bool hidden;
String id;
int isDelete;
int likes;
String mid;
String parentContent;
String parentId;
String parentMid;
String parentUserAvatarUrl;
String parentUserName;
String relationalId;
int relationalType;
String updateTime;
String updateUser;
String userAvatarUrl;
String username;
bool liked;
String? content;
String? createTime;
String? createUser;
bool? hidden;
String? id;
int? isDelete;
int? likes;
String? mid;
String? parentContent;
String? parentId;
String? parentMid;
String? parentUserAvatarUrl;
String? parentUserName;
String? relationalId;
int? relationalType;
String? updateTime;
String? updateUser;
String? userAvatarUrl;
String? username;
bool? liked;
static MemberCommentList fromJson(Map<String, dynamic> map) {
static MemberCommentList? fromJson(Map<String, dynamic>? map) {
if (map == null) return null;
MemberCommentList listBean = MemberCommentList();
listBean.content = map['content'];

18
lib/retrofit/data/member_rank.dart

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

238
lib/retrofit/data/member_source.dart

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

111
lib/retrofit/data/message.dart

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

31
lib/retrofit/data/mini.dart

@ -3,34 +3,23 @@
/// miniAppId : "wx7eeaa89de16f3180"
class Mini {
String _miniDownloadUrl;
String _miniVersion;
String _miniAppId;
String? miniDownloadUrl;
String? miniVersion;
String? miniAppId;
String get miniDownloadUrl => _miniDownloadUrl;
String get miniVersion => _miniVersion;
String get miniAppId => _miniAppId;
Mini({
String miniDownloadUrl,
String miniVersion,
String miniAppId}){
_miniDownloadUrl = miniDownloadUrl;
_miniVersion = miniVersion;
_miniAppId = miniAppId;
}
Mini();
Mini.fromJson(dynamic json) {
_miniDownloadUrl = json["miniDownloadUrl"];
_miniVersion = json["miniVersion"];
_miniAppId = json["miniAppId"];
this.miniDownloadUrl = json["miniDownloadUrl"];
this.miniVersion = json["miniVersion"];
this.miniAppId = json["miniAppId"];
}
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
map["miniDownloadUrl"] = _miniDownloadUrl;
map["miniVersion"] = _miniVersion;
map["miniAppId"] = _miniAppId;
map["miniDownloadUrl"] = this.miniDownloadUrl;
map["miniVersion"] = this.miniVersion;
map["miniAppId"] = this.miniAppId;
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> {
PageInfo();
int pageNum;
int? pageNum;
dynamic current;
int pageSize;
int? pageSize;
dynamic size;
dynamic pages;
bool hasPreviousPage;
bool hasNextPage;
String total;
List<D> list;
List<D> records;
bool? hasPreviousPage;
bool? hasNextPage;
String? total;
List<D?>? list;
List<D?>? records;
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 {
String activityEndTime;
String activityStartTime;
String applyEndTime;
String applyStartTime;
String createTime;
String createUser;
String description;
String id;
String image;
num isDelete;
num isNeedSecurityDeposit;
String name;
List<PromotionDetailBean> promotionDetail;
num promotionPlan;
num promotionType;
String securityDeposit;
num status;
String tag;
String updateTime;
String updateUser;
String? activityEndTime;
String? activityStartTime;
String? applyEndTime;
String? applyStartTime;
String? createTime;
String? createUser;
String? description;
String? id;
String? image;
num? isDelete;
num? isNeedSecurityDeposit;
String? name;
List<PromotionDetailBean?>? promotionDetail;
num? promotionPlan;
num? promotionType;
String? securityDeposit;
num? status;
String? tag;
String? updateTime;
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});

94
lib/retrofit/data/rank.dart

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

32
lib/retrofit/data/sign_in.dart

@ -1,22 +1,22 @@
class SignIn {
SignIn();
String balance;
String category;
String createTime;
String createUser;
String id;
bool isDeleted;
String linkId;
String mark;
String mid;
String number;
int pm;
bool status;
String title;
String type;
String updateTime;
String updateUser;
String? balance;
String? category;
String? createTime;
String? createUser;
String? id;
bool? isDeleted;
String? linkId;
String? mark;
String? mid;
String? number;
int? pm;
bool? status;
String? title;
String? type;
String? updateTime;
String? updateUser;
factory SignIn.fromJson(Map<String, dynamic> json) => SignIn()
..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 {
SignInfo();
String point;
bool todayHasSignin;
MemberRank rank;
List<SignIn> signInList;
List<Task> taskList;
List<int> rewardList;
String? point;
bool? todayHasSignin;
MemberRank? rank;
List<SignIn?>? signInList;
List<Task?>? taskList;
List<int?>? rewardList;
factory SignInfo.fromJson(Map<String, dynamic> json) => SignInfo()
..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 {
Store();
String id;
String createTime;
String createUser;
String updateTime;
String updateUser;
String tenantCode;
bool useErp;
String openStartTime;
String openEndTime;
String perCapitaConsumption;
String storeName;
double distance;
String logo;
String shipAddress;
String? id;
String? createTime;
String? createUser;
String? updateTime;
String? updateUser;
String? tenantCode;
bool? useErp;
String? openStartTime;
String? openEndTime;
String? perCapitaConsumption;
String? storeName;
double? distance;
String? logo;
String? shipAddress;
dynamic remark;
String mobile;
String longitude;
String latitude;
String? mobile;
String? longitude;
String? latitude;
dynamic refundAddress;
dynamic refundTel;
dynamic refundContact;
int isAutoSendRefundAddress;
String province;
String city;
String district;
String address;
String headName;
String headMobile;
CouponVo couponVO;
int? isAutoSendRefundAddress;
String? province;
String? city;
String? district;
String? address;
String? headName;
String? headMobile;
CouponVo? couponVO;
dynamic deliveryInfo;
String businessType;
StoreType posType;
String? businessType;
StoreType? posType;
factory Store.fromJson(Map<String, dynamic> json) => Store()
..id = json['id'] as String
@ -106,7 +106,7 @@ class Store {
'headMobile': this.headMobile,
'deliveryInfo': this.deliveryInfo,
'businessType': this.businessType,
'couponVO': this.couponVO.toJson(),
'couponVO': this.couponVO != null ? this.couponVO!.toJson() : null,
'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';
class StoreInfo {
String address;
List<BannerData> bannerList;
String city;
List<CouponVo> couponVOList;
String createTime;
String createUser;
DeliveryInfo deliveryInfo;
String district;
String headMobile;
String headName;
String id;
num isAutoSendRefundAddress;
String latitude;
String logo;
bool isVip;
String longitude;
String mobile;
String openEndTime;
String openStartTime;
String perCapitaConsumption;
StoreType posType;
List<Promotion> promotionList;
String province;
String refundAddress;
String refundContact;
String refundTel;
String remark;
String shipAddress;
String storeName;
String tenantCode;
String updateTime;
String updateUser;
String businessService;
Mini mini;
bool useErp;
String expireTime;
String vipFee;
MemberSource memberSource;
PageInfo informationVOPageVO;
String? address;
List<BannerData?>? bannerList;
String? city;
List<CouponVo?>? couponVOList;
String? createTime;
String? createUser;
DeliveryInfo? deliveryInfo;
String? district;
String? headMobile;
String? headName;
String? id;
num? isAutoSendRefundAddress;
String? latitude;
String? logo;
bool? isVip;
String? longitude;
String? mobile;
String? openEndTime;
String? openStartTime;
String? perCapitaConsumption;
StoreType? posType;
List<Promotion?>? promotionList;
String? province;
String? refundAddress;
String? refundContact;
String? refundTel;
String? remark;
String? shipAddress;
String? storeName;
String? tenantCode;
String? updateTime;
String? updateUser;
String? businessService;
Mini? mini;
bool? useErp;
String? expireTime;
String? vipFee;
MemberSource? memberSource;
PageInfo? informationVOPageVO;
StoreInfo();
factory StoreInfo.fromJson(Map<String, dynamic> json) => StoreInfo()
@ -107,12 +107,12 @@ class StoreInfo {
Map<String, dynamic> toJson() => <String, dynamic>{
'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,
'couponVOList': this.couponVOList,
'createTime': this.createTime,
'createUser': this.createUser,
'deliveryInfo': this.deliveryInfo.toJson(),
'deliveryInfo': this.deliveryInfo != null ? this.deliveryInfo!.toJson() : null,
'district': this.district,
'headMobile': this.headMobile,
'headName': this.headName,
@ -126,8 +126,8 @@ class StoreInfo {
'openEndTime': this.openEndTime,
'openStartTime': this.openStartTime,
'perCapitaConsumption': this.perCapitaConsumption,
'posType': this.posType.toJson(),
'promotionList': this.promotionList.map((e) => e.toJson()).toList(),
'posType': this.posType != null ? this.posType!.toJson() : null,
'promotionList': this.promotionList != null ? this.promotionList!.map((e) => e?.toJson()).toList() : null,
'province': this.province,
'refundAddress': this.refundAddress,
'refundContact': this.refundContact,
@ -139,11 +139,11 @@ class StoreInfo {
'updateTime': this.updateTime,
'updateUser': this.updateUser,
'businessService': this.businessService,
'mini': this.mini.toJson(),
'mini': this.mini != null ? this.mini!.toJson() : "",
'useErp': this.useErp,
'expireTime': this.expireTime,
'vipFee': this.vipFee,
'memberSource': this.memberSource.toJson(),
'memberSource': this.memberSource != null ? this.memberSource!.toJson() : null,
'informationVOPageVO': this.informationVOPageVO,
};

4
lib/retrofit/data/store_type.dart

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

28
lib/retrofit/data/task.dart

@ -1,20 +1,20 @@
class Task {
Task();
String aspects;
int complateNum;
int conplateNum;
String createTime;
String createUser;
String id;
int limitDay;
String name;
int rewardType;
String rewardValue;
bool status;
String type;
String updateTime;
String updateUser;
String? aspects;
int? complateNum;
int? conplateNum;
String? createTime;
String? createUser;
String? id;
int? limitDay;
String? name;
int? rewardType;
String? rewardValue;
bool? status;
String? type;
String? updateTime;
String? updateUser;
factory Task.fromJson(Map<String, dynamic> json) => Task()
..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 {
UploadResult();
String id;
String createTime;
String createUser;
String updateTime;
String updateUser;
DataType dataType;
String submittedFileName;
String treePath;
int grade;
bool isDelete;
String folderId;
String url;
String size;
String folderName;
String? id;
String? createTime;
String? createUser;
String? updateTime;
String? updateUser;
DataType? dataType;
String? submittedFileName;
String? treePath;
int? grade;
bool? isDelete;
String? folderId;
String? url;
String? size;
String? folderName;
dynamic group;
String path;
String relativePath;
String? path;
String? relativePath;
dynamic fileMd5;
String contextType;
String filename;
String ext;
String icon;
String createMonth;
String createWeek;
String createDay;
String? contextType;
String? filename;
String? ext;
String? icon;
String? createMonth;
String? createWeek;
String? createDay;
factory UploadResult.fromJson(Map<String, dynamic> json) => UploadResult()
..id = json['id'] as String
@ -62,7 +62,7 @@ class UploadResult {
'createUser': this.createUser,
'updateTime': this.updateTime,
'updateUser': this.updateUser,
'dataType': this.dataType.toJson(),
'dataType': this.dataType == null ? "" : this.dataType!.toJson(),
'submittedFileName': this.submittedFileName,
'treePath': this.treePath,
'grade': this.grade,

155
lib/retrofit/data/user_bill.dart

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

24
lib/retrofit/data/user_entity.dart

@ -2,18 +2,18 @@
class UserEntity {
UserEntity();
String account;
String avatar;
String expiration;
String expire;
String mobile;
String name;
String refreshToken;
String token;
String tokenType;
String userId;
String userType;
String workDescribe;
String? account;
String? avatar;
String? expiration;
String? expire;
String? mobile;
String? name;
String? refreshToken;
String? token;
String? tokenType;
String? userId;
String? userType;
String? workDescribe;
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 {
UserInfo();
String vipNo;
String nickname;
String headimg;
bool userType;
String sex;
int level;
String addressId;
String remark;
String phone;
String createTime;
String birth;
String? vipNo;
String? nickname;
String? headimg;
bool? userType;
String? sex;
int? level;
String? addressId;
String? remark;
String? phone;
String? createTime;
String? birth;
dynamic balance;
String money;
String points;
bool isBind;
MemberRank memberRankVo;
String? money;
String? points;
bool? isBind;
MemberRank? memberRankVo;
factory UserInfo.fromJson(Map<String, dynamic> json) =>
UserInfo()
@ -73,6 +73,6 @@ class UserInfo {
'money': this.money,
'points': this.points,
'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 {
VerifyCode();
int code;
Map<String, dynamic> data;
BaseDataExtra extra;
bool isError;
bool isSuccess;
String msg;
String path;
String timestamp;
int? code;
Map<String, dynamic>? data;
BaseDataExtra? extra;
bool? isError;
bool? isSuccess;
String? msg;
String? path;
String? timestamp;
factory VerifyCode.fromJson(Map<String, dynamic> json) => VerifyCode()
..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 {
String id;
String createTime;
String? id;
String? createTime;
dynamic 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? 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;
dynamic lastBuyTime;
dynamic vipNo;
dynamic expireTime;
int integral;
int level;
int integral = 0;
int level = 0;
dynamic vipRegStore;
String tenantName;
String tenantLogo;
List<StoreListBean> storeList;
String? tenantName;
String? tenantLogo;
List<StoreListBean?>? storeList;
static VipCard fromJson(Map<String, dynamic> map) {
static VipCard? fromJson(Map<String, dynamic>? map) {
if (map == null) return null;
VipCard vipCardBean = VipCard();
vipCardBean.id = map['id'];
@ -91,8 +61,8 @@ class VipCard {
vipCardBean.vipRegStore = map['vipRegStore'];
vipCardBean.tenantName = map['tenantName'];
vipCardBean.tenantLogo = map['tenantLogo'];
vipCardBean.storeList = List()..addAll(
(map['storeList'] as List ?? []).map((o) => StoreListBean.fromMap(o))
vipCardBean.storeList = []..addAll(
(map['storeList'] as List).map((o) => StoreListBean.fromMap(o))
);
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 {
String id;
String createTime;
String createUser;
String updateTime;
String updateUser;
String tenantCode;
bool useErp;
String openStartTime;
String openEndTime;
String storeName;
String nickName;
String logo;
String shipAddress;
String remark;
String mobile;
String longitude;
String latitude;
String? id;
String? createTime;
String? createUser;
String? updateTime;
String? updateUser;
String? tenantCode;
bool? useErp;
String? openStartTime;
String? openEndTime;
String? storeName;
String? nickName;
String? logo;
String? shipAddress;
String? remark;
String? mobile;
String? longitude;
String? latitude;
dynamic refundAddress;
dynamic refundTel;
dynamic refundContact;
int isAutoSendRefundAddress;
String province;
String city;
String district;
String address;
String headName;
String headMobile;
String businessService;
String businessType;
int? isAutoSendRefundAddress;
String? province;
String? city;
String? district;
String? address;
String? headName;
String? headMobile;
String? businessService;
String? businessType;
dynamic deliveryInfo;
dynamic miniParam;
dynamic distance;
int isDelete;
PosTypeBean posType;
int? isDelete;
PosTypeBean? posType;
static StoreListBean fromMap(Map<String, dynamic> map) {
static StoreListBean? fromMap(Map<String?, dynamic>? map) {
if (map == null) return null;
StoreListBean storeListBean = StoreListBean();
storeListBean.id = map['id'];
@ -283,10 +219,10 @@ class StoreListBean {
/// desc : ""
class PosTypeBean {
String code;
String desc;
String? code;
String? desc;
static PosTypeBean fromMap(Map<String, dynamic> map) {
static PosTypeBean? fromMap(Map<String, dynamic>? map) {
if (map == null) return null;
PosTypeBean posTypeBean = PosTypeBean();
posTypeBean.code = map['code'];

66
lib/retrofit/data/wx_pay.dart

@ -7,58 +7,34 @@
/// timeStamp : ""
class WxPay {
String _appId;
String _nonceStr;
String _packageValue;
String _partnerId;
String _prepayId;
String _sign;
String _timeStamp;
String get appId => _appId;
String get nonceStr => _nonceStr;
String get packageValue => _packageValue;
String get partnerId => _partnerId;
String get prepayId => _prepayId;
String get sign => _sign;
String get timeStamp => _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;
}
String? appId;
String? nonceStr;
String? packageValue;
String? partnerId;
String? prepayId;
String? sign;
String? timeStamp;
WxPay.fromJson(dynamic json) {
_appId = json["appId"];
_nonceStr = json["nonceStr"];
_packageValue = json["packageValue"];
_partnerId = json["partnerId"];
_prepayId = json["prepayId"];
_sign = json["sign"];
_timeStamp = json["timeStamp"];
this.appId = json["appId"];
this.nonceStr = json["nonceStr"];
this.packageValue = json["packageValue"];
this.partnerId = json["partnerId"];
this.prepayId = json["prepayId"];
this.sign = json["sign"];
this.timeStamp = json["timeStamp"];
}
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
map["appId"] = _appId;
map["nonceStr"] = _nonceStr;
map["packageValue"] = _packageValue;
map["partnerId"] = _partnerId;
map["prepayId"] = _prepayId;
map["sign"] = _sign;
map["timeStamp"] = _timeStamp;
map["appId"] = this.appId;
map["nonceStr"] = this.nonceStr;
map["packageValue"] = this.packageValue;
map["partnerId"] = this.partnerId;
map["prepayId"] = this.prepayId;
map["sign"] = this.sign;
map["timeStamp"] = this.timeStamp;
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/banner.dart';
import 'data/brand.dart';
import 'data/brand_data.dart';
import 'data/exchange_order.dart';
import 'data/goods.dart';
@ -30,10 +29,8 @@ import 'data/page.dart';
import 'data/rank.dart';
import 'data/sign_info.dart';
import 'data/store.dart';
import 'data/store_info.dart';
import 'data/upload_result.dart';
import 'data/user_bill.dart';
import 'data/user_entity.dart';
import 'data/user_info.dart';
import 'data/vip_card.dart';
import 'data/wx_pay.dart';
@ -51,9 +48,9 @@ const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式
@RestApi(baseUrl: baseUrl)
abstract class ApiService {
factory ApiService(Dio dio,
{String baseUrl,
BuildContext context,
String token,
{String? baseUrl,
BuildContext? context,
String? token,
bool showLoading = true,
bool pay = false}) {
Map<String, dynamic> headers =
@ -90,7 +87,7 @@ abstract class ApiService {
debugPrint("code = ${response.statusCode}");
p(jsonEncode(response.data));
Map map = response.data;
if (map["code"] == 40005 || map["code"] == 40001) {
if ((map["code"] == 40005 || map["code"] == 40001) && context != null) {
SmartDialog.show(
widget: LoginTips(
click: () {
@ -102,7 +99,7 @@ abstract class ApiService {
value.setString("mobile", "");
value.setString("nick", "");
});
Navigator.of(context).pushNamed('/router/login_page',
Navigator.of(context!).pushNamed('/router/login_page',
arguments: {"login": "login"});
},
),
@ -127,7 +124,7 @@ abstract class ApiService {
if (kReleaseMode) {
baseUrl = base_url;
}
return _ApiService(dio, baseUrl: baseUrl);
return _ApiService(dio, baseUrl: baseUrl ?? "");
}
static showDialog(context) async {

6
lib/setting/permission_setting_page.dart

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

5
lib/setting/setting_page.dart

@ -3,7 +3,6 @@ import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/login/login_page.dart';
import 'package:huixiang/main.dart';
import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/utils/flutter_utils.dart';
@ -22,7 +21,7 @@ class SettingPage extends StatefulWidget {
}
class _SettingPage extends State<SettingPage> {
String locale = "tw";
String? locale = "tw";
String cacheTotal = "0B";
@ -186,7 +185,7 @@ class _SettingPage extends State<SettingPage> {
}
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
List<String> miniAppids = sharedPreferences.getStringList("miniAppid");
List<String>? miniAppids = sharedPreferences.getStringList("miniAppid");
if (miniAppids != null && miniAppids.length > 0) {
miniAppids.forEach((element) async {
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_baidu_mapapi_base/flutter_baidu_mapapi_base.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/location.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class LocationMap extends StatefulWidget {
final Map<String, String> arguments;
final Map<String, String>? arguments;
LocationMap({this.arguments});
@ -37,12 +34,12 @@ class _LocationMap extends State<LocationMap> {
event["longitude"] != null) {
print("location: $event");
if (event["latitude"] is String && event["longitude"] is String) {
myLatLng = BMFCoordinate(double.tryParse(event["latitude"]),
double.tryParse(event["longitude"]));
myLatLng = BMFCoordinate(double.tryParse(event["latitude"] as String),
double.tryParse(event["longitude"] as String));
} 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;
locationShow();
});
@ -65,7 +62,7 @@ class _LocationMap extends State<LocationMap> {
location: location,
);
setState(() {
_mapController.updateLocationData(userLocation);
_mapController?.updateLocationData(userLocation);
});
}
@ -80,7 +77,7 @@ class _LocationMap extends State<LocationMap> {
return Scaffold(
appBar: MyAppBar(
background: Color(0xFFF7F7F7),
title: widget.arguments["storeName"],
title: widget.arguments!["storeName"],
titleColor: Colors.black87,
titleSize: 18.sp,
leadingColor: Colors.black,
@ -89,8 +86,8 @@ class _LocationMap extends State<LocationMap> {
child: BMFMapWidget(
mapOptions: BMFMapOptions(
center: BMFCoordinate(
double.tryParse(widget.arguments["lat"]),
double.tryParse(widget.arguments["lng"]),
double.tryParse(widget.arguments!["lat"]!),
double.tryParse(widget.arguments!["lng"]!),
),
showZoomControl: false,
showMapScaleBar: false,
@ -102,16 +99,16 @@ class _LocationMap extends State<LocationMap> {
);
}
BMFMapController _mapController;
BMFCoordinate latLng;
BMFCoordinate myLatLng;
BMFMarker bmfMarker;
BMFMapController? _mapController;
BMFCoordinate? latLng;
BMFCoordinate? myLatLng;
BMFMarker? bmfMarker;
onMapCreated(BMFMapController controller) {
_mapController = controller;
setState(() {
_mapController.showUserLocation(true);
_mapController.setCustomMapStyle('assets/map_style/chatian.sty', 0);
_mapController?.showUserLocation(true);
_mapController?.setCustomMapStyle('assets/map_style/chatian.sty', 0);
BMFUserLocationDisplayParam displayParam = BMFUserLocationDisplayParam(
locationViewOffsetX: 0,
locationViewOffsetY: 0,
@ -122,7 +119,7 @@ class _LocationMap extends State<LocationMap> {
locationViewHierarchy:
BMFLocationViewHierarchy.LOCATION_VIEW_HIERARCHY_BOTTOM,
);
_mapController.updateLocationViewWithParam(displayParam);
_mapController?.updateLocationViewWithParam(displayParam);
addMarker();
});
}
@ -130,8 +127,8 @@ class _LocationMap extends State<LocationMap> {
addMarker() async {
// latLng = await AppUtils.coordConvert(BMFCoordinate(double.tryParse(widget.arguments["lat"]),
// double.tryParse(widget.arguments["lng"])));
latLng = BMFCoordinate(double.tryParse(widget.arguments["lat"]),
double.tryParse(widget.arguments["lng"]));
latLng = BMFCoordinate(double.tryParse(widget.arguments!["lat"]!),
double.tryParse(widget.arguments!["lng"]!));
if (bmfMarker == null && _mapController != null) {
bmfMarker = BMFMarker(
@ -141,9 +138,9 @@ class _LocationMap extends State<LocationMap> {
icon: "assets/image/icon_map_marker.png",
draggable: false,
);
_mapController.addMarker(bmfMarker);
_mapController?.addMarker(bmfMarker);
}
_mapController.updateMapOptions(
_mapController?.updateMapOptions(
BMFMapOptions(
center: latLng,
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';
class StoreDetailsPage extends StatefulWidget {
final Map<String, dynamic> arguments;
final Map<String, dynamic>? arguments;
///
StoreDetailsPage({this.arguments});
@ -48,8 +48,8 @@ class StoreDetailsPage extends StatefulWidget {
class _StoreDetailsPage extends State<StoreDetailsPage>
with WidgetsBindingObserver {
ApiService apiService;
RefreshController _refreshController;
late ApiService apiService;
RefreshController? _refreshController;
int commentTotal = 0;
var commentTextController = TextEditingController();
var commentFocus = FocusNode();
@ -61,7 +61,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
@override
void didChangeMetrics() {
super.didChangeMetrics();
WidgetsBinding.instance.addPostFrameCallback((_) {
WidgetsBinding.instance!.addPostFrameCallback((_) {
setState(() {
print("object: ${MediaQuery.of(context).viewInsets.bottom}");
if (MediaQuery.of(context).viewInsets.bottom == 0) {
@ -80,7 +80,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
WidgetsBinding.instance!.addObserver(this);
_refreshController = RefreshController();
@ -94,24 +94,24 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
});
}
Activity activity;
Article article;
List<MemberCommentList> memberList = [];
Activity? activity;
Article? article;
List<MemberCommentList?> memberList = [];
GlobalKey commentKey = GlobalKey();
ScrollController scrollController = ScrollController();
queryHtml() async { //activityInfo
if (widget.arguments["activityId"] != null) {
BaseData<Activity> baseData = await apiService.activityInfo(widget.arguments["activityId"]);
if (baseData != null && baseData.isSuccess) {
if (widget.arguments!["activityId"] != null) {
BaseData<Activity> baseData = await apiService.activityInfo(widget.arguments!["activityId"]);
if (baseData != null && baseData.isSuccess!) {
setState(() {
activity = baseData.data;
});
}
}
if (widget.arguments["articleId"] != null) {
BaseData<Article> baseData = await apiService.informationInfo(widget.arguments["articleId"]);
if (baseData != null && baseData.isSuccess) {
if (widget.arguments!["articleId"] != null) {
BaseData<Article> baseData = await apiService.informationInfo(widget.arguments!["articleId"]);
if (baseData != null && baseData.isSuccess!) {
setState(() {
article = baseData.data;
});
@ -123,26 +123,26 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
SSDKMap params = SSDKMap()
..setGeneral(
activity != null
? activity.mainTitle
? activity!.mainTitle!
: article != null
? article.mainTitle
? article!.mainTitle!
: "",
activity != null
? activity.viceTitle
? activity!.viceTitle
: article != null
? article.viceTitle
? article!.viceTitle
: "",
[
activity != null
? activity.coverImg
? activity!.coverImg
: article != null
? article.coverImg
? article!.coverImg
: "",
],
activity != null
? activity.coverImg
? activity!.coverImg!
: article != null
? article.coverImg
? article!.coverImg!
: "",
"",
buildShareUrl(),
@ -154,9 +154,9 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
);
debugPrint(activity != null
? activity.coverImg
? activity!.coverImg
: article != null
? article.coverImg
? article!.coverImg
: "");
showModalBottomSheet(
@ -167,7 +167,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
if (platform == ShareSDKPlatforms.line) {
params.map["type"] = SSDKContentTypes.text.value;
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,
(state, userData, contentEntity, error) {
@ -178,25 +178,25 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
}
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 {
BaseData<PageInfo<MemberCommentList>> baseData = await apiService.memberCommentList({
BaseData<PageInfo<MemberCommentList?>?> baseData = await apiService.memberCommentList({
"pageNum": 1,
"pageSize": 100,
"relationalId":
widget.arguments["activityId"] ?? widget.arguments["articleId"],
widget.arguments!["activityId"] ?? widget.arguments!["articleId"],
"relationalType": 1,
}).catchError((error) {
_refreshController.refreshFailed();
_refreshController?.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
_refreshController.refreshCompleted();
if (baseData != null && baseData.isSuccess!) {
_refreshController?.refreshCompleted();
setState(() {
commentTotal = baseData.data.size;
memberList = baseData.data.list;
commentTotal = baseData.data!.size;
memberList = baseData.data!.list!;
});
}
}
@ -204,7 +204,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
//
queryCommentLike(String id) async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
String token = sharedPreferences.getString("token");
String? token = sharedPreferences.getString("token");
if (token == null || token == "") {
SmartDialog.show(
widget: LoginTips(
@ -221,15 +221,15 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
}
BaseData baseData = await apiService.commentLike(id).catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
if (baseData != null && baseData.isSuccess!) {
setState(() {
memberList.forEach((element) {
if (element.id == id) {
if (element.liked) {
element.likes -= 1;
if (element!.id == id) {
if (element.liked!) {
element.likes = element.likes! - 1;
element.liked = false;
} else {
element.likes += 1;
element.likes = element.likes! + 1;
element.liked = true;
}
}
@ -241,27 +241,27 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
///
queryInformationLikes() async {
BaseData baseData = await apiService.informationLikes(
widget.arguments["activityId"] ?? widget.arguments["articleId"]);
if (baseData != null && baseData.isSuccess) {
widget.arguments!["activityId"] ?? widget.arguments!["articleId"]);
if (baseData != null && baseData.isSuccess!) {
setState(() {
if (article != null) {
if (article.liked) {
article.likes -= 1;
if (article!.liked!) {
article!.likes = article!.likes! - 1;
} else {
article.likes += 1;
article!.likes = article!.likes! + 1;
}
article.liked = !article.liked;
article!.liked = !article!.liked!;
} else if (activity != null) {
if (activity.liked) {
activity.likes -= 1;
if (activity!.liked!) {
activity!.likes = activity!.likes! - 1;
} else {
activity.likes += 1;
activity!.likes = activity!.likes! + 1;
}
activity.liked = !activity.liked;
activity!.liked = !activity!.liked!;
}
});
} 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,
"parentId": parenId,
"relationalId":
widget.arguments["activityId"] ?? widget.arguments["articleId"],
widget.arguments!["activityId"] ?? widget.arguments!["articleId"],
"relationalType": 1
}).catchError((error) {
_refreshController.refreshFailed();
_refreshController?.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
if (baseData != null && baseData.isSuccess!) {
commentTextController.text = "";
queryMemberCommentList();
}
@ -302,9 +302,9 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
background: Color(0xFFF7F7F7),
leadingColor: Colors.black,
title: activity != null
? activity.mainTitle
? activity!.mainTitle
: article != null
? article.mainTitle
? article!.mainTitle
: "",
titleSize: 18.sp,
titleColor: Colors.black,
@ -332,9 +332,9 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
alignment: Alignment.centerLeft,
child: Text(
activity != null
? activity.mainTitle
? activity!.mainTitle!
: article != null
? article.mainTitle
? article!.mainTitle!
: "",
style: TextStyle(
fontSize: 16.sp,
@ -349,7 +349,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
children: [
InkWell(
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(
fontWeight: FontWeight.normal,
fontSize: 14.sp,
@ -358,17 +358,17 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
),
onTap: () {
if (activity != null) {
if (widget.arguments["source"] != null &&
widget.arguments["source"] ==
activity.storeId) {
if (widget.arguments!["source"] != null &&
widget.arguments!["source"] ==
activity!.storeId) {
Navigator.of(context).pop();
} else {
Navigator.of(context).pushNamed(
'/router/union_detail_page',
arguments: {
"id": activity.storeId,
"id": activity!.storeId,
"source":
widget.arguments["activityId"]
widget.arguments!["activityId"]
});
}
}
@ -379,9 +379,9 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
),
Text(
activity != null
? activity.createTime
? activity!.createTime!
: article != null
? article.createTime
? article!.createTime!
: "",
style: TextStyle(
fontWeight: FontWeight.normal,
@ -394,9 +394,9 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
),
Html(
data: activity != null
? activity.content
? activity!.content
: article != null
? article.content
? article!.content
: "",
customImageRenders: {
base64DataUriMatcher(): base64ImageRender(),
@ -412,25 +412,25 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
customRender: {
"video": (context, parsedChild, attributes, element) {
return videoWidget(
double.tryParse(attributes['width'] ?? ""),
double.tryParse(attributes['width'] ?? "")!,
double.tryParse(
element.attributes['height'] ?? ""),
element.attributes['height'] ?? "")!,
element.children.first.attributes["src"],
element.attributes["sandbox"]);
},
"iframe":
(context, parsedChild, attributes, element) {
return videoWidget(
double.tryParse(attributes['width'] ?? ""),
double.tryParse(attributes['width'] ?? "")!,
double.tryParse(
element.attributes['height'] ?? ""),
element.attributes['height'] ?? "")!,
element.children.first.attributes["src"],
element.attributes["sandbox"]);
},
"audio": (context, parsedChild, attributes, element) {
final sources = <String>[
if (element.attributes['src'] != null)
element.attributes['src'],
element.attributes['src']!,
];
if (sources == null ||
sources.isEmpty ||
@ -505,10 +505,10 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
child: InkWell(
onTap: () {
showPressMenu(
memberList[position].createUser,
memberList[position]!.createUser!,
memberList[position]);
},
child: commentItem(memberList[position],
child: commentItem(memberList![position]!,
position, memberList.length),
),
);
@ -584,8 +584,8 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
delComment() async {
BaseData baseData = await apiService.delComment(
widget.arguments["activityId"] ?? widget.arguments["articleId"]);
if (baseData != null && baseData.isSuccess) {
widget.arguments!["activityId"] ?? widget.arguments!["articleId"]);
if (baseData != null && baseData.isSuccess!) {
queryMemberCommentList();
}
}
@ -710,20 +710,20 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
);
},
isLiked: (activity != null
? activity.liked
? activity!.liked
: article != null
? article.liked
? article!.liked
: false),
onTap: (isLiked) async {
await queryInformationLikes();
return (activity != null
? activity.liked
? activity!.liked!
: article != null
? article.liked
? article!.liked!
: false);
},
// likeCount: memberList.likes,
countBuilder: (int count, bool isLiked, String text) {
countBuilder: (int? count, bool isLiked, String text) {
return Text(
text,
style: TextStyle(
@ -740,14 +740,14 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
toComment() {
if (commentKey.currentContext == null) return;
RenderBox firstRenderBox = commentKey.currentContext.findRenderObject();
RenderBox firstRenderBox = commentKey.currentContext!.findRenderObject() as RenderBox;
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);
}
VideoPlayerController videoPlayerController;
ChewieController chewieAudioController;
Chewie chewies;
VideoPlayerController? videoPlayerController;
ChewieController? chewieAudioController;
Chewie? chewies;
Widget videoWidget(double width, double height, src, sandboxMode) {
print("src : $src");
@ -842,7 +842,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
textDirection: TextDirection.ltr,
),
Text(
memberList.createTime,
memberList.createTime!,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
@ -882,13 +882,13 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
},
isLiked: memberList.liked ?? false,
onTap: (isLiked) async {
await queryCommentLike(memberList.id);
await queryCommentLike(memberList.id!);
return (memberList == null || memberList.liked == null)
? false
: memberList.liked;
: memberList.liked!;
},
likeCount: memberList.likes,
countBuilder: (int count, bool isLiked, String text) {
countBuilder: (int? count, bool isLiked, String text) {
return Text(
text,
style: TextStyle(
@ -908,7 +908,7 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
child: Align(
alignment: Alignment.centerLeft,
child: Text(
memberList.content,
memberList.content!,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xff1A1A1A),
@ -981,10 +981,10 @@ class _StoreDetailsPage extends State<StoreDetailsPage>
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
if (chewieAudioController != null) chewieAudioController.dispose();
WidgetsBinding.instance!.removeObserver(this);
if (chewieAudioController != null) chewieAudioController!.dispose();
if (videoPlayerController != null) videoPlayerController.dispose();
if (videoPlayerController != null) videoPlayerController!.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';
class UnionDetailsPage extends StatefulWidget {
final Map<String, dynamic> arguments;
final Map<String, dynamic>? arguments;
UnionDetailsPage({this.arguments});
@ -40,7 +40,7 @@ class UnionDetailsPage extends StatefulWidget {
}
class _UnionDetailsPage extends State<UnionDetailsPage> {
ApiService apiService;
late ApiService apiService;
@override
void dispose() {
@ -59,18 +59,18 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
});
}
StoreInfo storeInfo;
List<Activity> activitys;
StoreInfo? storeInfo;
List<Activity>? activitys;
queryStoreInfo() async {
BaseData baseData = await apiService.queryStoreInfo(widget.arguments["id"])
BaseData baseData = await apiService.queryStoreInfo(widget.arguments!["id"])
.catchError((error) {
refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
if (baseData != null && baseData.isSuccess!) {
refreshController.refreshCompleted();
storeInfo = StoreInfo.fromJson(baseData.data);
activitys = storeInfo.informationVOPageVO.list
activitys = storeInfo!.informationVOPageVO!.list!
.map((e) => Activity.fromJson(e))
.toList();
if (mounted) setState(() {});
@ -86,7 +86,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
return Scaffold(
appBar: MyAppBar(
background: Color(0xFFF7F7F7),
title: storeInfo == null ? "" : storeInfo.storeName,
title: storeInfo == null ? "" : storeInfo!.storeName,
titleColor: Colors.black87,
titleSize: 18.sp,
leadingColor: Colors.black,
@ -149,7 +149,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
children: [
Text(
storeInfo != null
? storeInfo.storeName
? storeInfo!.storeName!
: "",
style: TextStyle(
fontSize: 16.sp,
@ -163,8 +163,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
child: Text(
S.of(context).ren(
storeInfo != null
? storeInfo
.perCapitaConsumption
? storeInfo!
.perCapitaConsumption!
: "",
),
style: TextStyle(
@ -179,7 +179,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
),
Text(
storeInfo != null
? storeInfo.address
? storeInfo!.address!
: "",
maxLines: 2,
textAlign: TextAlign.justify,
@ -192,7 +192,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
Row(
children: itemServer(
storeInfo != null
? storeInfo.businessService
? storeInfo!.businessService!
: "",
),
),
@ -205,12 +205,12 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
S.of(context).yingyeshijian(storeInfo ==
null
? ""
: (storeInfo.openStartTime ==
: (storeInfo!.openStartTime ==
null &&
storeInfo.openEndTime ==
storeInfo!.openEndTime ==
null)
? 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(
color: Color(0xFF353535),
fontWeight: FontWeight.w400,
@ -223,18 +223,18 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
InkWell(
onTap: () {
if (storeInfo == null ||
storeInfo.latitude == null ||
storeInfo.longitude == null ||
storeInfo.latitude == "" ||
storeInfo.longitude == "")
storeInfo!.latitude == null ||
storeInfo!.longitude == null ||
storeInfo!.latitude == "" ||
storeInfo!.longitude == "")
return;
Navigator.of(context).pushNamed(
'/router/location_map',
arguments: {
"lat": storeInfo.latitude,
"lng": storeInfo.longitude,
"lat": storeInfo!.latitude,
"lng": storeInfo!.longitude,
"storeName":
storeInfo.storeName,
storeInfo!.storeName,
});
},
child: Image.asset(
@ -276,7 +276,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
imgPath: "assets/image/icon_union_coupons.png",
),
),
(storeInfo != null && storeInfo.couponVOList != null)
(storeInfo != null && storeInfo!.couponVOList != null)
? buildCoupon()
: Container(
width: double.infinity,
@ -298,7 +298,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
imgPath: "assets/image/icon_union_start_store.png",
),
),
(activitys != null && activitys.length > 0)
(activitys != null && activitys!.length > 0)
? Container(
margin: EdgeInsets.only(bottom: 30.h),
child: AspectRatio(
@ -357,14 +357,14 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
bool isEnable() {
if (storeInfo == null) return false;
if (storeInfo.mini == null) return false;
String miniAppId = storeInfo.mini.miniAppId;
if (storeInfo!.mini == null) return false;
String miniAppId = storeInfo!.mini!.miniAppId!;
if (miniAppId == null ||
miniAppId == "" ||
storeInfo.mini.miniVersion == null ||
storeInfo.mini.miniVersion == "" ||
storeInfo.mini.miniDownloadUrl == null ||
storeInfo.mini.miniDownloadUrl == "") {
storeInfo!.mini!.miniVersion! == null ||
storeInfo!.mini!.miniVersion! == "" ||
storeInfo!.mini!.miniDownloadUrl! == null ||
storeInfo!.mini!.miniDownloadUrl! == "") {
return false;
} else {
return true;
@ -374,7 +374,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
Widget buildVip() {
return Container(
margin: EdgeInsets.symmetric(
vertical: (storeInfo != null && storeInfo.isVip) ? 12.h : 20.h,
vertical: (storeInfo != null && storeInfo!.isVip!) ? 12.h : 20.h,
horizontal: 16.w),
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
@ -383,7 +383,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
image: AssetImage("assets/image/icon_vip_bg.png"),
),
),
child: (storeInfo != null && storeInfo.isVip)
child: (storeInfo != null && storeInfo!.isVip!)
? Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
@ -409,7 +409,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
width: 8.w,
),
Text(
"¥${(storeInfo != null && storeInfo.memberSource != null) ? storeInfo.memberSource.balance : ""}",
"¥${(storeInfo != null && storeInfo!.memberSource != null) ? storeInfo!.memberSource!.balance! : ""}",
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w500,
@ -440,8 +440,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
width: 8.w,
),
Text(
(storeInfo != null && storeInfo.memberSource != null)
? "${storeInfo.memberSource.integral}"
(storeInfo != null && storeInfo!.memberSource != null)
? "${storeInfo!.memberSource!.integral!}"
: "",
style: TextStyle(
fontSize: 14.sp,
@ -519,8 +519,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
return Container(
height: 109.h,
child: ListView.builder(
itemCount: (storeInfo != null && storeInfo.couponVOList != null)
? storeInfo.couponVOList.length
itemCount: (storeInfo != null && storeInfo!.couponVOList != null)
? storeInfo!.couponVOList!.length
: 0,
physics: BouncingScrollPhysics(parent: PageScrollPhysics()),
scrollDirection: Axis.horizontal,
@ -554,9 +554,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
child: Text.rich(TextSpan(children: [
TextSpan(
text: (storeInfo != null &&
storeInfo.couponVOList != null &&
storeInfo
.couponVOList[position].bizType ==
storeInfo!.couponVOList != null &&
storeInfo!.couponVOList![position]!.bizType! ==
1)
? "¥"
: "",
@ -568,18 +567,17 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
),
TextSpan(
text: (storeInfo != null &&
storeInfo.couponVOList != null &&
storeInfo
.couponVOList[position].bizType ==
storeInfo!.couponVOList != null &&
storeInfo!
.couponVOList![position]!.bizType! ==
1)
? "${double.tryParse(storeInfo.couponVOList[position].discountAmount).toInt()}"
? "${double.tryParse(storeInfo!.couponVOList![position]!.discountAmount!)!.toInt()}"
: (storeInfo != null &&
storeInfo.couponVOList != null &&
storeInfo.couponVOList[position]
.bizType ==
storeInfo!.couponVOList != null &&
storeInfo!.couponVOList![position]!.bizType ==
5)
? S.of(context).duihuanquan
: "${storeInfo.couponVOList[position].discountPercent / 10}",
: "${storeInfo!.couponVOList![position]!.discountPercent! / 10}",
style: TextStyle(
fontSize: 36.sp,
color: Color(0xFFFF7A1A),
@ -614,9 +612,9 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
children: [
Text(
(storeInfo != null &&
storeInfo.couponVOList != null)
? storeInfo
.couponVOList[position].couponName
storeInfo!.couponVOList != null)
? storeInfo!
.couponVOList![position]!.couponName!
: "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
@ -628,22 +626,22 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
),
Text(
(storeInfo != null &&
storeInfo.couponVOList != null)
? (storeInfo.couponVOList[position]
storeInfo!.couponVOList != null)
? (storeInfo!.couponVOList![position]!
.bizType ==
1
? S.of(context).manlijiandaijinquan(
double.tryParse(storeInfo
.couponVOList[position]
.fullAmount)
double.tryParse(storeInfo!
.couponVOList![position]!
.fullAmount!)!
.toInt(),
double.tryParse(storeInfo
.couponVOList[position]
.discountAmount)
double.tryParse(storeInfo!
.couponVOList![position]!
.discountAmount!)!
.toInt())
: S.of(context).quanchangzhe(storeInfo
.couponVOList[position]
.discountPercent))
: S.of(context).quanchangzhe(storeInfo!
.couponVOList![position]!
.discountPercent!))
: "",
// (storeInfo != null && storeInfo.couponVOList != null) ? storeInfo.couponVOList[position].couponImg : "",
// S.of(context).manlijiandaijinquan(30, 5),
@ -657,15 +655,15 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
Text(
S.of(context).youxiaoqizhi(
(storeInfo != null &&
storeInfo.couponVOList !=
storeInfo!.couponVOList !=
null &&
storeInfo.couponVOList[position]
storeInfo!.couponVOList![position]!
.useStartTime !=
null &&
storeInfo.couponVOList[position]
storeInfo!.couponVOList![position]!
.useEndTime !=
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,
@ -682,25 +680,25 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
InkWell(
onTap: () {
if (storeInfo != null &&
storeInfo.couponVOList != null &&
storeInfo.couponVOList[position].status == 0) {
storeInfo!.couponVOList != null &&
storeInfo!.couponVOList![position]!.status == 0) {
receiveCoupon(
storeInfo.couponVOList[position].id);
storeInfo!.couponVOList![position]!.id);
}
},
child: Container(
height: 25.h,
child: RoundButton(
text: (storeInfo != null &&
storeInfo.couponVOList != null &&
storeInfo.couponVOList[position].status >
storeInfo!.couponVOList != null &&
storeInfo!.couponVOList![position]!.status! >
0)
? S.of(context).yilingqu
: S.of(context).lingqu,
textColor: Colors.white,
backgroup: (storeInfo != null &&
storeInfo.couponVOList != null &&
storeInfo.couponVOList[position].status >
storeInfo!.couponVOList != null &&
storeInfo!.couponVOList![position]!.status! >
0)
? Colors.grey
: Color(0xFF32A060),
@ -724,7 +722,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
///
receiveCoupon(couponId) async {
BaseData baseData = await apiService.receiveCoupon(couponId);
if (baseData != null && baseData.isSuccess) {
if (baseData != null && baseData.isSuccess!) {
queryStoreInfo();
showAlertDialog();
}
@ -743,8 +741,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
///VIP
receiveVip() async {
BaseData baseData = await apiService.minLogin(storeInfo.id);
if (baseData != null && baseData.isSuccess) {
BaseData baseData = await apiService.minLogin(storeInfo!.id!);
if (baseData != null && baseData.isSuccess!) {
SmartDialog.showToast(S.of(context).lingquchenggong,
alignment: Alignment.center);
setState(() {
@ -761,14 +759,14 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
itemBuilder: (context, position) {
return InkWell(
onTap: () {
if (widget.arguments["source"] != null &&
widget.arguments["source"] == activitys[position].id) {
if (widget.arguments!["source"] != null &&
widget.arguments!["source"] == activitys![position].id) {
Navigator.of(context).pop();
} else {
Navigator.of(context).pushNamed('/router/store_detail_page',
arguments: {
"activityId": activitys[position].id,
"source": widget.arguments["id"]
"activityId": activitys![position].id,
"source": widget.arguments!["id"]
});
}
},
@ -795,8 +793,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
mainAxisSize: MainAxisSize.max,
children: [
MImage(
(activitys != null && activitys.length > position)
? activitys[position].coverImg
(activitys != null && activitys!.length > position)
? activitys![position].coverImg!
: "",
aspectRatio: 2.2,
radius: BorderRadius.only(
@ -815,8 +813,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
children: [
Text(
(activitys != null &&
activitys.length > position)
? activitys[position].storeName
activitys!.length > position)
? activitys![position].storeName!
: "",
style: TextStyle(
fontSize: 14.sp,
@ -829,8 +827,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
),
Text(
(activitys != null &&
activitys.length > position)
? activitys[position].mainTitle
activitys!.length > position)
? activitys![position].mainTitle!
: "",
style: TextStyle(
fontSize: 12.sp,
@ -860,8 +858,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
),
),
child: Text(
(activitys != null && activitys.length > position)
? activitys[position].startTime.split(" ")[0]
(activitys != null && activitys!.length > position)
? activitys![position].startTime!.split(" ")[0]
: "",
style: TextStyle(
fontWeight: FontWeight.bold,
@ -877,7 +875,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
);
},
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),
child: MImage(
(storeInfo != null &&
storeInfo.bannerList != null &&
position < storeInfo.bannerList.length)
? storeInfo.bannerList[position].imgUrl
storeInfo!.bannerList != null &&
position < storeInfo!.bannerList!.length)
? storeInfo!.bannerList![position]!.imgUrl!
: "",
fit: BoxFit.cover,
radius: BorderRadius.circular(4),
@ -911,8 +909,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
),
);
},
itemCount: (storeInfo != null && storeInfo.bannerList != null)
? storeInfo.bannerList.length
itemCount: (storeInfo != null && storeInfo!.bannerList != null)
? storeInfo!.bannerList!.length
: 1),
);
}
@ -931,7 +929,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
// "position":"30.554638,114.34394500000002",
// "token":"Bearer eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R5cGUiOiJNSU5JIiwibmFtZSI6IiIsInRva2VuX3R5cGUiOiJ0b2tlbiIsInVzZXJpZCI6IjE0MTI2ODc1MjI0NTgyMzg5NzYiLCJhY2NvdW50IjoiIiwiZXhwIjoxNjI2Nzk1Nzc0LCJuYmYiOjE2MjY3NjY5NzR9.cggcx_vqTozKS-z9uygjV4uA2yHQ4eWssMAngd2c-i0"}
printMin() async {
String miniAppId = storeInfo.mini.miniAppId;
String miniAppId = storeInfo!.mini!.miniAppId!;
print("print isExistsApp: ${await Min.isExistsApp(miniAppId)}");
print("print getAppBasePath: ${await Min.getAppBasePath(miniAppId)}");
print("print currentPageUrl: ${await Min.currentPageUrl()}");
@ -946,8 +944,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
alignment: Alignment.center);
return;
}
BaseData baseData = await apiService.minLogin(storeInfo.id);
if (baseData != null && baseData.isSuccess) {
BaseData baseData = await apiService.minLogin(storeInfo!.id!);
if (baseData != null && baseData.isSuccess!) {
UserEntity userEntity = UserEntity.fromJson(baseData.data);
startMin(userEntity.token, userEntity.userId);
}
@ -955,12 +953,12 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
startMin(token, userId) async {
if (storeInfo == null) return;
if (storeInfo.mini == null) return;
if (storeInfo!.mini == null) return;
if (!(await Min.isInitialize())) {
await Min.initialize();
}
printMin();
String miniAppId = storeInfo.mini.miniAppId;
String miniAppId = storeInfo!.mini!.miniAppId!;
String filePath = "";
if (Platform.isAndroid) {
filePath = (await getExternalStorageDirectory()).path;
@ -973,8 +971,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
await downloadWgt(miniAppId, filePath);
await Min.reloadWgt(miniAppId, filePath);
} else {
String version = await Min.getAppVersionInfo(storeInfo.mini.miniAppId);
if (version != storeInfo.mini.miniVersion) {
String version = await Min.getAppVersionInfo(storeInfo!.mini!.miniAppId!);
if (version != storeInfo!.mini!.miniVersion!) {
await downloadWgt(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', //线
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
String nickname = sharedPreferences.getString("nick");
String mobile = sharedPreferences.getString("mobile");
String user = sharedPreferences.getString('user');
String latitude = sharedPreferences.getString("latitude");
String longitude = sharedPreferences.getString("longitude");
String? nickname = sharedPreferences.getString("nick");
String? mobile = sharedPreferences.getString("mobile");
String? user = sharedPreferences.getString('user');
String? latitude = sharedPreferences.getString("latitude");
String? longitude = sharedPreferences.getString("longitude");
print(user);
UserInfo userInfo = UserInfo.fromJson(jsonDecode(user));
UserInfo userInfo = UserInfo.fromJson(jsonDecode(user!));
Min.startMin(miniAppId, {
"token": "Bearer $token",
"shopId": widget.arguments["id"],
"tenantCode": storeInfo.tenantCode,
"shopId": widget.arguments!["id"],
"tenantCode": storeInfo!.tenantCode ?? "",
if (latitude != null && longitude != null)
"position": "$latitude,$longitude",
"baseURL": "https://pos.api.lotus-wallet.com/app/",
@ -1014,7 +1012,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
});
}
Function state;
Function? state;
double progressValue = 0;
String downText = "正在下载中...";
@ -1067,11 +1065,11 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
});
Response response = await Dio()
.download(storeInfo.mini.miniDownloadUrl, savePath,
.download(storeInfo!.mini!.miniDownloadUrl, savePath,
onReceiveProgress: (progress, max) {
progressValue = progress.toDouble() / max.toDouble();
// print("print progressValue: $progressValue");
state(() {});
state!(() {});
});
if (response.statusCode == 200) {
downText = "下载完成";
@ -1079,11 +1077,11 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
value.setStringList(
"miniAppid",
(value.getStringList("miniAppid") != null
? value.getStringList("miniAppid")
? value.getStringList("miniAppid")!
: [])
..add(appid));
});
state(() {});
state!(() {});
Future.delayed(Duration(seconds: 1), () {
if (Navigator.canPop(context)) {
Navigator.of(context).pop();
@ -1123,12 +1121,12 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
title: Text(S.of(context).bodadianhua),
actions: [
if (storeInfo != null &&
storeInfo.headMobile != null &&
storeInfo.headMobile != "")
storeInfo!.headMobile != null &&
storeInfo!.headMobile != "")
CupertinoActionSheetAction(
child: Text(storeInfo.headMobile),
child: Text(storeInfo!.headMobile!),
onPressed: () {
callMobile(storeInfo.headMobile);
callMobile(storeInfo!.headMobile);
Navigator.of(context).pop();
},
isDefaultAction: true,

62
lib/union/union_page.dart

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

24
lib/utils/MyPainter.dart

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

2
lib/utils/flutter_utils.dart

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

4
lib/utils/location.dart

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

14
lib/view_widget/border_text.dart

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

36
lib/view_widget/classic_header.dart

@ -30,14 +30,14 @@ class MyHeader extends StatelessWidget {
}
class MyClassicHeader extends RefreshIndicator {
final OuterBuilder outerBuilder;
final String releaseText,
final OuterBuilder? outerBuilder;
final String? releaseText,
idleText,
refreshingText,
completeText,
failedText,
canTwoLevelText;
final Widget releaseIcon,
final Widget? releaseIcon,
idleIcon,
refreshingIcon,
completeIcon,
@ -53,7 +53,7 @@ class MyClassicHeader extends RefreshIndicator {
final TextStyle completeTextStyle;
const MyClassicHeader({
Key key,
Key? key,
RefreshStyle refreshStyle: RefreshStyle.Follow,
double height: 60.0,
Duration completeDuration: const Duration(milliseconds: 600),
@ -95,18 +95,18 @@ class _ClassicHeaderState extends RefreshIndicatorState<MyClassicHeader> {
EnRefreshString();
return Text(
mode == RefreshStatus.canRefresh
? widget.releaseText ?? strings.canRefreshText
? widget.releaseText ?? strings.canRefreshText!
: mode == RefreshStatus.completed
? widget.completeText ?? strings.refreshCompleteText
? widget.completeText ?? strings.refreshCompleteText!
: mode == RefreshStatus.failed
? widget.failedText ?? strings.refreshFailedText
? widget.failedText ?? strings.refreshFailedText!
: mode == RefreshStatus.refreshing
? widget.refreshingText ?? strings.refreshingText
? widget.refreshingText ?? strings.refreshingText!
: mode == RefreshStatus.idle
? widget.idleText ?? strings.idleRefreshText
? widget.idleText ?? strings.idleRefreshText!
: mode == RefreshStatus.canTwoLevel
? widget.canTwoLevelText ??
strings.canTwoLevelText
strings.canTwoLevelText!
: "",
style: mode == RefreshStatus.completed
? widget.completeTextStyle
@ -115,17 +115,17 @@ class _ClassicHeaderState extends RefreshIndicatorState<MyClassicHeader> {
Widget _buildIcon(mode) {
Widget icon = mode == RefreshStatus.canRefresh
? widget.releaseIcon
? widget.releaseIcon!
: mode == RefreshStatus.idle
? widget.idleIcon
? widget.idleIcon!
: mode == RefreshStatus.completed
? widget.completeIcon
? widget.completeIcon!
: mode == RefreshStatus.failed
? widget.failedIcon
? widget.failedIcon!
: mode == RefreshStatus.canTwoLevel
? widget.canTwoLevelIcon
? widget.canTwoLevelIcon!
: mode == RefreshStatus.canTwoLevel
? widget.canTwoLevelIcon
? widget.canTwoLevelIcon!
: mode == RefreshStatus.refreshing
? widget.refreshingIcon ??
SizedBox(
@ -137,7 +137,7 @@ class _ClassicHeaderState extends RefreshIndicatorState<MyClassicHeader> {
: const CircularProgressIndicator(
strokeWidth: 2.0),
)
: widget.twoLevelView;
: widget.twoLevelView!;
return icon ?? Container();
}
@ -168,7 +168,7 @@ class _ClassicHeaderState extends RefreshIndicatorState<MyClassicHeader> {
children: children,
);
return widget.outerBuilder != null
? widget.outerBuilder(container)
? widget.outerBuilder!(container)
: Container(
child: Center(child: container),
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:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/separator.dart';
class CommentMenu extends StatefulWidget {
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';
class CouponWidget extends StatelessWidget {
final GestureTapCallback callback;
final Coupon coupon;
final GestureTapCallback? callback;
final Coupon? coupon;
CouponWidget(this.coupon, this.callback);
@ -34,14 +34,14 @@ class CouponWidget extends StatelessWidget {
child: Stack(
children: [
Image.asset(
coupon.status != 3
coupon!.status != 3
? "assets/image/ic_coupon_bg.png"
: "assets/image/ic_coupon_invalid_bg.png",
fit: BoxFit.cover,
width: double.infinity,
height: double.infinity,
),
if (coupon.status == 3)
if (coupon!.status == 3)
Positioned(
top: 10,
right: 0,
@ -57,7 +57,7 @@ class CouponWidget extends StatelessWidget {
),
),
Opacity(
opacity: coupon.status != 3 ? 1 : 0.54,
opacity: coupon!.status != 3 ? 1 : 0.54,
child: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
@ -73,10 +73,10 @@ class CouponWidget extends StatelessWidget {
margin: EdgeInsets.only(left: 20),
child: MImage(
(coupon == null ||
coupon.couponImg == null ||
coupon.couponImg == "")
coupon!.couponImg == null ||
coupon!.couponImg! == "")
? ""
: coupon.couponImg,
: coupon!.couponImg!,
)
// Image.network(
@ -106,7 +106,7 @@ class CouponWidget extends StatelessWidget {
Expanded(
flex: 1,
child: Text(
coupon.couponName ?? "",
coupon!.couponName ?? "",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
@ -114,7 +114,7 @@ class CouponWidget extends StatelessWidget {
),
),
),
(coupon.status == 0)
(coupon!.status == 0)
? Row(
children: [
RoundButton(
@ -132,13 +132,12 @@ class CouponWidget extends StatelessWidget {
backgroup:
Color(0xff32A060),
callback: () {
showAlertDialog(
context);
showAlertDialog(context);
},
),
],
)
: (coupon.status == 1)
: (coupon!.status == 1)
? Row(
children: [
Text(
@ -170,7 +169,7 @@ class CouponWidget extends StatelessWidget {
margin: EdgeInsets.only(right: 37),
alignment: Alignment.centerLeft,
child: Text(
coupon.couponDescription ?? "",
coupon!.couponDescription ?? "",
style: TextStyle(
fontSize: 10,
color: Color(0xFF4C4C4C),
@ -200,10 +199,10 @@ class CouponWidget extends StatelessWidget {
padding: EdgeInsets.only(left: 20),
alignment: Alignment.centerLeft,
child: Text(
coupon.status == 0
? S.of(context).faxingshijian(coupon.publishStartTime)
: coupon.status == 1
? S.of(context).lingqushijian(coupon.receiveTime)
coupon!.status == 0
? S.of(context).faxingshijian(coupon!.publishStartTime!)
: coupon!.status == 1
? S.of(context).lingqushijian(coupon!.receiveTime!)
: S.of(context).shiyongriqi,
style: TextStyle(
color: Color(0xFF727272),

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

Loading…
Cancel
Save