Commit 3e21f1ca authored by 汪林玲's avatar 汪林玲

加入null-safety

parent 9a50195e
# xiaoxiong_price_module # 小熊有好货-好价模块
A new Flutter package project. ### 引入说明
```
price_module:
git:
url: 'git@git.xiaomanxiong.com:flutter-plugin/xiaoxiong-price-module.git'
ref: 'null-safety'
## Getting Started ```
\ No newline at end of file
This project is a starting point for a Dart
[package](https://flutter.dev/developing-packages/),
a library module containing code that can be shared easily across
multiple Flutter or Dart projects.
For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
import 'package:flutter/foundation.dart';
class NotifyEventType { class NotifyEventType {
NotifyEventEnum eventType; NotifyEventEnum eventType;
NotifyEventType({@required this.eventType}); NotifyEventType({required this.eventType});
} }
enum NotifyEventEnum { enum NotifyEventEnum {
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
abstract class IDSAction<VM> { abstract class IDSAction<VM> {
VM vm; VM? vm;
void initState(); void initState();
......
...@@ -8,12 +8,12 @@ class DSProvider<VO extends IDSModel> extends ChangeNotifierProvider<VO> { ...@@ -8,12 +8,12 @@ class DSProvider<VO extends IDSModel> extends ChangeNotifierProvider<VO> {
final Widget Function( final Widget Function(
BuildContext context, BuildContext context,
VO value, VO value,
Widget child, Widget? child,
) builderWidget; ) builderWidget;
DSProvider.value({ DSProvider.value({
@required this.vo, required this.vo,
@required this.builderWidget, required this.builderWidget,
}) : super.value( }) : super.value(
value: vo, value: vo,
child: Consumer<VO>( child: Consumer<VO>(
......
...@@ -7,19 +7,19 @@ import 'package:provider/provider.dart'; ...@@ -7,19 +7,19 @@ import 'package:provider/provider.dart';
class DSProviderWidget<VM extends IDSModel, T extends IDSAction<VM>> extends StatefulWidget { class DSProviderWidget<VM extends IDSModel, T extends IDSAction<VM>> extends StatefulWidget {
final T dsAction; final T dsAction;
final Widget child; final Widget? child;
final Widget Function(BuildContext context,Widget child) builder; final Widget Function(BuildContext context,Widget? child) builder;
const DSProviderWidget({Key key,@required this.dsAction,@required this.builder,this.child}):super(key:key); const DSProviderWidget({Key? key,required this.dsAction,required this.builder,this.child}):super(key:key);
@override @override
_DSProviderWidgetState<VM,T> createState() => _DSProviderWidgetState<VM,T>(); _DSProviderWidgetState<VM,T> createState() => _DSProviderWidgetState<VM,T>();
} }
class _DSProviderWidgetState<VM extends IDSModel,T extends IDSAction<VM>> extends State<DSProviderWidget<VM,T>> { class _DSProviderWidgetState<VM extends IDSModel,T extends IDSAction<VM>> extends State<DSProviderWidget<VM,T>> {
T action; T? action;
Widget get _child => widget.child; Widget? get _child => widget.child;
@override @override
void initState() { void initState() {
...@@ -30,8 +30,8 @@ class _DSProviderWidgetState<VM extends IDSModel,T extends IDSAction<VM>> extend ...@@ -30,8 +30,8 @@ class _DSProviderWidgetState<VM extends IDSModel,T extends IDSAction<VM>> extend
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ChangeNotifierProvider<VM>.value( return ChangeNotifierProvider<VM?>.value(
value: action.vm, value: action!.vm,
child: Consumer<VM>( child: Consumer<VM>(
builder:(context,vm,child){ builder:(context,vm,child){
action?.initBuilder(context); action?.initBuilder(context);
......
class DSNetException implements Exception { class DSNetException implements Exception {
final String message; final String? message;
final int code; final int? code;
@pragma("vm:entry-point") @pragma("vm:entry-point")
const DSNetException({this.message = "", this.code}); const DSNetException({this.message = "", this.code});
String toString() { String toString() {
......
This diff is collapsed.
...@@ -28,15 +28,15 @@ abstract class IPriceDiscountAction<PriceDiscountVo> ...@@ -28,15 +28,15 @@ abstract class IPriceDiscountAction<PriceDiscountVo>
PriceDiscountVo get getVo; PriceDiscountVo get getVo;
} }
class PriceDiscountAction extends IPriceDiscountAction<PriceDiscountVo> { class PriceDiscountAction extends IPriceDiscountAction<PriceDiscountVo?> {
PriceRepository _priceRepository = PriceRepository.get(); PriceRepository _priceRepository = PriceRepository.get();
Map<int, dynamic> _platformIconMap; Map<int, dynamic>? _platformIconMap;
IPriceDiscountDelegate _discountDelegate; IPriceDiscountDelegate? _discountDelegate;
Map<String, dynamic> _pageParam; Map<String, dynamic>? _pageParam;
PriceDiscountAction({ PriceDiscountAction({
IPriceDiscountDelegate delegate, IPriceDiscountDelegate? delegate,
Map<String, dynamic> pageParam, Map<String, dynamic>? pageParam,
}) { }) {
this._pageParam = pageParam; this._pageParam = pageParam;
_discountDelegate = delegate; _discountDelegate = delegate;
...@@ -61,7 +61,7 @@ class PriceDiscountAction extends IPriceDiscountAction<PriceDiscountVo> { ...@@ -61,7 +61,7 @@ class PriceDiscountAction extends IPriceDiscountAction<PriceDiscountVo> {
pagesize: 10, pagesize: 10,
isRefresh: true, isRefresh: true,
); );
this.vm.notifyListener(); this.vm!.notifyListener();
} }
@override @override
...@@ -85,12 +85,12 @@ class PriceDiscountAction extends IPriceDiscountAction<PriceDiscountVo> { ...@@ -85,12 +85,12 @@ class PriceDiscountAction extends IPriceDiscountAction<PriceDiscountVo> {
}) { }) {
currentPage = page; currentPage = page;
if (isFirst) { if (isFirst) {
this.vm.viewState = DSViewState.busy; this.vm!.viewState = DSViewState.busy;
} }
_priceRepository _priceRepository
.getSellingRecommends( .getSellingRecommends(
keywords: _pageParam['keywords'], keywords: _pageParam!['keywords'],
excludeId: _pageParam['excludeId'], excludeId: _pageParam!['excludeId'],
page: page, page: page,
pagesize: pagesize, pagesize: pagesize,
) )
...@@ -99,37 +99,37 @@ class PriceDiscountAction extends IPriceDiscountAction<PriceDiscountVo> { ...@@ -99,37 +99,37 @@ class PriceDiscountAction extends IPriceDiscountAction<PriceDiscountVo> {
List<ProductItemEntity> productEntitys = value.data; List<ProductItemEntity> productEntitys = value.data;
productEntitys.forEach((ele) { productEntitys.forEach((ele) {
ele.releaseTime = TimeUtils.formatTime(timestamp: ele.releaseTime); ele.releaseTime = TimeUtils.formatTime(timestamp: ele.releaseTime!);
ele.platform = _getPlatformName(int.parse(ele.platform)); ele.platform = _getPlatformName(int.parse(ele.platform!));
}); });
if (isLoad) { if (isLoad) {
if (this.vm.productEntitys == null) { if (this.vm!.productEntitys == null) {
this.vm.productEntitys = List<ProductItemEntity>.empty(growable: true); this.vm!.productEntitys = List<ProductItemEntity>.empty(growable: true);
} }
this.vm.productEntitys.addAll(productEntitys); this.vm!.productEntitys!.addAll(productEntitys);
} else { } else {
this.vm.productEntitys = productEntitys; this.vm!.productEntitys = productEntitys;
if (this.vm.productEntitys.isEmpty) { if (this.vm!.productEntitys!.isEmpty) {
this.vm.viewState = DSViewState.empty; this.vm!.viewState = DSViewState.empty;
} else { } else {
this.vm.viewState = DSViewState.idle; this.vm!.viewState = DSViewState.idle;
} }
} }
} }
if (isLoad) { if (isLoad) {
_discountDelegate.onLoadComplete(isLoading: true); _discountDelegate!.onLoadComplete(isLoading: true);
} else if (isRefresh) { } else if (isRefresh) {
_discountDelegate.onLoadComplete(isLoading: false); _discountDelegate!.onLoadComplete(isLoading: false);
} }
}).catchError((error) { }).catchError((error) {
this.vm.viewState = DSViewState.error; this.vm!.viewState = DSViewState.error;
if (isLoad) { if (isLoad) {
_discountDelegate.onloadFailed(isLoading: true); _discountDelegate!.onloadFailed(isLoading: true);
} else if (isRefresh) { } else if (isRefresh) {
_discountDelegate.onloadFailed(isLoading: false); _discountDelegate!.onloadFailed(isLoading: false);
} }
}).whenComplete(() { }).whenComplete(() {
this.vm.notifyListener(); this.vm!.notifyListener();
}); });
} }
...@@ -138,16 +138,16 @@ class PriceDiscountAction extends IPriceDiscountAction<PriceDiscountVo> { ...@@ -138,16 +138,16 @@ class PriceDiscountAction extends IPriceDiscountAction<PriceDiscountVo> {
/// [platform] 平台id /// [platform] 平台id
/// ///
String _getPlatformName(int platform) { String _getPlatformName(int platform) {
if (_platformIconMap != null && _platformIconMap[platform] is Map) { if (_platformIconMap != null && _platformIconMap![platform] is Map) {
Map<String, dynamic> platformMap = Map<String, dynamic> platformMap =
Map<String, dynamic>.from(_platformIconMap[platform]); Map<String, dynamic>.from(_platformIconMap![platform]);
return platformMap['name'] ?? ''; return platformMap['name'] ?? '';
} }
return ''; return '';
} }
@override @override
PriceDiscountVo get getVo => this.vm; PriceDiscountVo? get getVo => this.vm;
} }
/// ///
...@@ -162,5 +162,5 @@ abstract class IPriceDiscountDelegate { ...@@ -162,5 +162,5 @@ abstract class IPriceDiscountDelegate {
/// ///
/// 数据加载失败 /// 数据加载失败
/// ///
void onloadFailed({bool isLoading = true, String msg}); void onloadFailed({bool isLoading = true, String? msg});
} }
...@@ -9,16 +9,16 @@ abstract class IPriceAction<PriceVo> extends IDSAction<PriceVo> { ...@@ -9,16 +9,16 @@ abstract class IPriceAction<PriceVo> extends IDSAction<PriceVo> {
/// ///
/// 代理设置 /// 代理设置
/// ///
IPriceAction({IPriceActionDelegate delegate, bool isGrid}); IPriceAction({IPriceActionDelegate? delegate, bool? isGrid});
/// ///
/// 设置分类参数 /// 设置分类参数
/// ///
void setPriceCategory( void setPriceCategory(
{List<dynamic> sellingTabList, {List<dynamic>? sellingTabList,
List<dynamic> priceCategory, List<dynamic>? priceCategory,
Map<int, dynamic> platformIconMap, Map<int, dynamic>? platformIconMap,
String keywords}); String? keywords});
/// ///
/// 获取分类Tab /// 获取分类Tab
...@@ -48,7 +48,7 @@ abstract class IPriceAction<PriceVo> extends IDSAction<PriceVo> { ...@@ -48,7 +48,7 @@ abstract class IPriceAction<PriceVo> extends IDSAction<PriceVo> {
/// ///
/// 查询筛选条件 /// 查询筛选条件
/// ///
void qryProductListEvent({String keywords, int page}); void qryProductListEvent({String? keywords, int? page});
/// ///
/// 刷新 /// 刷新
...@@ -63,10 +63,10 @@ abstract class IPriceAction<PriceVo> extends IDSAction<PriceVo> { ...@@ -63,10 +63,10 @@ abstract class IPriceAction<PriceVo> extends IDSAction<PriceVo> {
class PriceAction extends IPriceAction<PriceVo> { class PriceAction extends IPriceAction<PriceVo> {
PriceRepository _repository = PriceRepository.get(); PriceRepository _repository = PriceRepository.get();
Map<int, dynamic> platformIconMap; Map<int, dynamic>? platformIconMap;
String keywords; String? keywords;
bool isGrid = false; bool? isGrid = false;
IPriceActionDelegate delegate; IPriceActionDelegate? delegate;
PriceAction({this.delegate, this.isGrid}) : super(delegate: delegate); PriceAction({this.delegate, this.isGrid}) : super(delegate: delegate);
@override @override
...@@ -82,14 +82,14 @@ class PriceAction extends IPriceAction<PriceVo> { ...@@ -82,14 +82,14 @@ class PriceAction extends IPriceAction<PriceVo> {
} }
@override @override
List<dynamic> get sellingTabs => this.vm.sellingTabs ?? []; List<dynamic> get sellingTabs => this.vm!.sellingTabs ?? [];
@override @override
void setPriceCategory( void setPriceCategory(
{List<dynamic> sellingTabList, {List<dynamic>? sellingTabList,
List<dynamic> priceCategory, List<dynamic>? priceCategory,
Map<int, dynamic> platformIconMap, Map<int, dynamic>? platformIconMap,
String keywords}) { String? keywords}) {
this.platformIconMap = platformIconMap; this.platformIconMap = platformIconMap;
this.page = 1; this.page = 1;
if (keywords != null && keywords.isNotEmpty) { if (keywords != null && keywords.isNotEmpty) {
...@@ -99,16 +99,16 @@ class PriceAction extends IPriceAction<PriceVo> { ...@@ -99,16 +99,16 @@ class PriceAction extends IPriceAction<PriceVo> {
if (this.vm == null) { if (this.vm == null) {
this.vm = PriceVo(); this.vm = PriceVo();
} }
if (this.vm.tabListVo == null) { if (this.vm!.tabListVo == null) {
this.vm.tabListVo = TabListVo(); this.vm!.tabListVo = TabListVo();
} }
this.vm.sellingTabs = sellingTabList; this.vm!.sellingTabs = sellingTabList;
dynamic data = this dynamic data = this
.vm .vm!
.sellingTabs .sellingTabs
?.singleWhere((ele) => ele['is_default'] == '1', orElse: () => null); ?.singleWhere((ele) => ele['is_default'] == '1', orElse: () => null);
if (data != null && data is Map<String, dynamic>) { if (data != null && data is Map<String, dynamic>) {
this.vm.tabListVo.sellTab = Map<String, dynamic>.from(data); this.vm!.tabListVo!.sellTab = Map<String, dynamic>.from(data);
} }
if (priceCategory != null) { if (priceCategory != null) {
List<TabVo> tabList = List<TabVo>.empty(growable: true); List<TabVo> tabList = List<TabVo>.empty(growable: true);
...@@ -117,22 +117,22 @@ class PriceAction extends IPriceAction<PriceVo> { ...@@ -117,22 +117,22 @@ class PriceAction extends IPriceAction<PriceVo> {
tabList.add(TabVo.fromJson( tabList.add(TabVo.fromJson(
'${categoryMap['type']}', Map<String, dynamic>.from(ele))); '${categoryMap['type']}', Map<String, dynamic>.from(ele)));
}); });
TabListVo tabListVo = this.vm.tabListVo; TabListVo tabListVo = this.vm!.tabListVo!;
tabListVo.tabList = tabList; tabListVo.tabList = tabList;
this.vm.tabListVo = tabListVo; this.vm!.tabListVo = tabListVo;
} }
TabListVo tabListVo = this.vm.tabListVo; TabListVo tabListVo = this.vm!.tabListVo!;
String categoryId; String? categoryId;
if (tabListVo.sellTab != null && tabListVo.sellTab['id'] != null) { if (tabListVo.sellTab != null && tabListVo.sellTab!['id'] != null) {
categoryId = "${tabListVo.sellTab['id']}"; categoryId = "${tabListVo.sellTab!['id']}";
} }
_qryProductList(keywords: keywords, categoryId: categoryId); _qryProductList(keywords: keywords, categoryId: categoryId);
} }
@override @override
TabListVo getTabListVo() { TabListVo getTabListVo() {
return this.vm.tabListVo ?? TabListVo(); return this.vm!.tabListVo ?? TabListVo();
} }
@override @override
...@@ -145,12 +145,12 @@ class PriceAction extends IPriceAction<PriceVo> { ...@@ -145,12 +145,12 @@ class PriceAction extends IPriceAction<PriceVo> {
/// ///
@override @override
void resetProductList() async { void resetProductList() async {
for (TabVo item in this.vm.tabListVo?.tabList ?? []) { for (TabVo item in this.vm!.tabListVo?.tabList ?? []) {
item.selected = null; item.selected = null;
item.open = false; item.open = false;
} }
this.vm.tabListVo?.sellTab = null; this.vm!.tabListVo?.sellTab = null;
this.vm.tabListVo?.notifyListener(true); this.vm!.tabListVo?.notifyListener(true);
_qryProductList(keywords: this.keywords); _qryProductList(keywords: this.keywords);
} }
...@@ -158,12 +158,12 @@ class PriceAction extends IPriceAction<PriceVo> { ...@@ -158,12 +158,12 @@ class PriceAction extends IPriceAction<PriceVo> {
/// 过滤筛选条件 /// 过滤筛选条件
/// ///
@override @override
void qryProductListEvent({String keywords, int page = 1}) async { void qryProductListEvent({String? keywords, int? page = 1}) async {
if (keywords != null) { if (keywords != null) {
this.keywords = keywords; this.keywords = keywords;
} }
List<dynamic> filters; List<dynamic>? filters;
this.vm.tabListVo?.tabList?.forEach((ele) { this.vm!.tabListVo?.tabList.forEach((ele) {
if (filters == null) { if (filters == null) {
filters = List<dynamic>.empty(growable: true); filters = List<dynamic>.empty(growable: true);
} }
...@@ -172,39 +172,39 @@ class PriceAction extends IPriceAction<PriceVo> { ...@@ -172,39 +172,39 @@ class PriceAction extends IPriceAction<PriceVo> {
if (ele.keyName == 'category') { if (ele.keyName == 'category') {
data = { data = {
'key_name': ele.keyName, 'key_name': ele.keyName,
'key_value': '${ele.selected['id']}' 'key_value': '${ele.selected!['id']}'
}; };
} else if (ele.keyName == 'price_section') { } else if (ele.keyName == 'price_section') {
data = { data = {
'key_name': ele.keyName, 'key_name': ele.keyName,
'key_value': ele.selected['price_section'] 'key_value': ele.selected!['price_section']
}; };
} else { } else {
data = { data = {
'key_name': ele.keyName, 'key_name': ele.keyName,
'key_value': '${ele.selected['type']}' 'key_value': '${ele.selected!['type']}'
}; };
} }
if (data != null && data.isNotEmpty) { if (data.isNotEmpty) {
filters.add(data); filters!.add(data);
} }
} }
}); });
TabListVo tabListVo = this.vm.tabListVo; TabListVo tabListVo = this.vm!.tabListVo!;
String categoryId; String? categoryId;
if (tabListVo.sellTab != null && tabListVo.sellTab['id'] != null) { if (tabListVo.sellTab != null && tabListVo.sellTab!['id'] != null) {
categoryId = "${tabListVo.sellTab['id']}"; categoryId = "${tabListVo.sellTab!['id']}";
} }
_qryProductList( _qryProductList(
keywords: this.keywords, keywords: this.keywords,
filters: filters, filters: filters,
page: page, page: page!,
categoryId: categoryId); categoryId: categoryId);
} }
@override @override
void closeTab() { void closeTab() {
TabListVo tabListVo = this.vm.tabListVo; TabListVo tabListVo = this.vm!.tabListVo!;
tabListVo.tabList.forEach((ele) { tabListVo.tabList.forEach((ele) {
ele.open = false; ele.open = false;
}); });
...@@ -212,9 +212,9 @@ class PriceAction extends IPriceAction<PriceVo> { ...@@ -212,9 +212,9 @@ class PriceAction extends IPriceAction<PriceVo> {
} }
String getPlatformName(int platform) { String getPlatformName(int platform) {
if (platformIconMap != null && platformIconMap[platform] is Map) { if (platformIconMap != null && platformIconMap![platform] is Map) {
Map<String, dynamic> platformMap = Map<String, dynamic> platformMap =
Map<String, dynamic>.from(platformIconMap[platform]); Map<String, dynamic>.from(platformIconMap![platform]);
return platformMap['name'] ?? ''; return platformMap['name'] ?? '';
} }
return ''; return '';
...@@ -223,10 +223,10 @@ class PriceAction extends IPriceAction<PriceVo> { ...@@ -223,10 +223,10 @@ class PriceAction extends IPriceAction<PriceVo> {
void _qryProductList( void _qryProductList(
{int page = 1, {int page = 1,
int pagesize = 10, int pagesize = 10,
String keywords, String? keywords,
String categoryId, String? categoryId,
List<dynamic> filters}) async { List<dynamic>? filters}) async {
this.page = page ?? 1; this.page = page;
await _repository await _repository
.qryProductList( .qryProductList(
page: page, page: page,
...@@ -242,8 +242,8 @@ class PriceAction extends IPriceAction<PriceVo> { ...@@ -242,8 +242,8 @@ class PriceAction extends IPriceAction<PriceVo> {
if (value.isSuccess) { if (value.isSuccess) {
productList = value.data; productList = value.data;
productList.forEach((ele) { productList.forEach((ele) {
ele.releaseTime = TimeUtils.formatTime(timestamp: ele.releaseTime); ele.releaseTime = TimeUtils.formatTime(timestamp: ele.releaseTime!);
ele.platform = getPlatformName(int.parse(ele.platform)); ele.platform = getPlatformName(int.parse(ele.platform!));
}); });
} }
this.vm?.productListVo?.productList = productList; this.vm?.productListVo?.productList = productList;
...@@ -252,11 +252,10 @@ class PriceAction extends IPriceAction<PriceVo> { ...@@ -252,11 +252,10 @@ class PriceAction extends IPriceAction<PriceVo> {
if (value.isSuccess) { if (value.isSuccess) {
productList = value.data; productList = value.data;
productList.forEach((ele) { productList.forEach((ele) {
ele.releaseTime = TimeUtils.formatTime(timestamp: ele.releaseTime); ele.releaseTime = TimeUtils.formatTime(timestamp: ele.releaseTime!);
ele.platform = getPlatformName(int.parse(ele.platform)); ele.platform = getPlatformName(int.parse(ele.platform!));
}); });
this.vm?.productListVo?.productList.addAll(productList);
this.vm?.productListVo?.productList?.addAll(productList);
} }
} }
delegate?.onLoadComplete(); delegate?.onLoadComplete();
...@@ -293,5 +292,5 @@ abstract class IPriceActionDelegate { ...@@ -293,5 +292,5 @@ abstract class IPriceActionDelegate {
/// ///
/// 数据加载失败 /// 数据加载失败
/// ///
void onloadFailed({String msg}); void onloadFailed({String? msg});
} }
...@@ -2,50 +2,50 @@ import 'package:price_module/framework/model/ds_model.dart'; ...@@ -2,50 +2,50 @@ import 'package:price_module/framework/model/ds_model.dart';
import 'package:xiaoxiong_repository/entity/product_item_entity.dart'; import 'package:xiaoxiong_repository/entity/product_item_entity.dart';
class PriceDetailsVo extends IDSModel { class PriceDetailsVo extends IDSModel {
String productId; String? productId;
List<String> itemPic; List<String?>? itemPic;
String itemTitle; String? itemTitle;
String subTitle; String? subTitle;
String description; String? description;
String status; String? status;
//商品的ItemId //商品的ItemId
String itemId; String? itemId;
//平台Id //平台Id
String platform; String? platform;
//平台名称 //平台名称
String platformText; String? platformText;
//喜欢次数 //喜欢次数
String likeTimes; String? likeTimes;
//收藏次数 //收藏次数
String collegeTimes; String? collegeTimes;
//是否喜欢和收藏 //是否喜欢和收藏
bool isLike = false; bool isLike = false;
bool isFavorites = false; bool isFavorites = false;
//Button按钮的文字 //Button按钮的文字
String buttonText; String? buttonText;
String price; String? price;
String endPrice; String? endPrice;
//发布时间 //发布时间
String releaseTime; String? releaseTime;
String checkText; String? checkText;
//分享文字和分享URL //分享文字和分享URL
String shareUrl; String? shareUrl;
String shareMessage; String? shareMessage;
//优惠卷 //优惠卷
List<Coupon> coupons = []; List<Coupon> coupons = [];
//举报 //举报
List<ReportModel> reports = []; List<ReportModel>? reports = [];
//优惠卷过期描述 //优惠卷过期描述
String couponText; String? couponText;
String isOverdue; String? isOverdue;
String shopTitle; String? shopTitle;
String rebate; String? rebate;
List<dynamic> collectOrders; List<dynamic>? collectOrders;
Map<String, dynamic> newItemInfo; Map<String, dynamic>? newItemInfo;
//商品推荐相关信息 //商品推荐相关信息
List<ProductItemEntity> productEntitys; List<ProductItemEntity>? productEntitys;
PriceDetailsVo({ PriceDetailsVo({
this.productId, this.productId,
...@@ -79,15 +79,15 @@ class PriceDetailsVo extends IDSModel { ...@@ -79,15 +79,15 @@ class PriceDetailsVo extends IDSModel {
} }
class Coupon { class Coupon {
String url; String? url;
String name; String? name;
String status; String? status;
Coupon({this.url, this.name, this.status}); Coupon({this.url, this.name, this.status});
} }
class ReportModel { class ReportModel {
String value; String? value;
String text; String? text;
List<ReportModel> sub = []; List<ReportModel>? sub = [];
ReportModel({this.value, this.text, this.sub}); ReportModel({this.value, this.text, this.sub});
} }
...@@ -7,6 +7,6 @@ class PriceDiscountVo extends IDSModel{ ...@@ -7,6 +7,6 @@ class PriceDiscountVo extends IDSModel{
/// ///
/// 好价商品列表 /// 好价商品列表
/// ///
List<ProductItemEntity> productEntitys; List<ProductItemEntity>? productEntitys;
} }
\ No newline at end of file
...@@ -3,12 +3,12 @@ import 'package:xiaoxiong_repository/entity/product_item_entity.dart'; ...@@ -3,12 +3,12 @@ import 'package:xiaoxiong_repository/entity/product_item_entity.dart';
class PriceVo extends IDSModel { class PriceVo extends IDSModel {
// 商品列表 // 商品列表
ProductListVo productListVo; ProductListVo? productListVo;
//筛选Tab //筛选Tab
TabListVo tabListVo; TabListVo? tabListVo;
// 快捷分类列表 // 快捷分类列表
List<dynamic> sellingTabs; List<dynamic>? sellingTabs;
PriceVo({this.productListVo, this.tabListVo, this.sellingTabs}); PriceVo({this.productListVo, this.tabListVo, this.sellingTabs});
} }
...@@ -17,19 +17,19 @@ class TabListVo extends IDSModel { ...@@ -17,19 +17,19 @@ class TabListVo extends IDSModel {
//分类 //分类
List<TabVo> tabList = []; List<TabVo> tabList = [];
//快捷分类 //快捷分类
Map<String, dynamic> sellTab; Map<String, dynamic>? sellTab;
TabListVo({this.tabList = const [], this.sellTab}); TabListVo({this.tabList = const [], this.sellTab});
} }
class TabVo extends IDSModel { class TabVo extends IDSModel {
String type; String? type;
String text; String? text;
String keyName; String? keyName;
bool open = false; bool open = false;
Map<String, dynamic> selected; Map<String?, dynamic>? selected;
List<dynamic> structure; List<dynamic>? structure;
TabVo({this.type, this.text, this.keyName, this.structure, this.selected}); TabVo({this.type, this.text, this.keyName, this.structure, this.selected});
...@@ -45,7 +45,7 @@ class TabVo extends IDSModel { ...@@ -45,7 +45,7 @@ class TabVo extends IDSModel {
} }
class ProductListVo extends IDSModel { class ProductListVo extends IDSModel {
bool isGrid = false; bool? isGrid = false;
List<ProductItemEntity> productList = []; List<ProductItemEntity> productList = [];
ProductListVo({this.productList = const [], this.isGrid = false}); ProductListVo({this.productList = const [], this.isGrid = false});
} }
import 'package:flutter/material.dart';
import 'package:price_module/framework/model/ds_model.dart'; import 'package:price_module/framework/model/ds_model.dart';
import 'package:price_module/page/model/details/index.dart'; import 'package:price_module/page/model/details/index.dart';
import 'package:price_module/utils/time_utils.dart'; import 'package:price_module/utils/time_utils.dart';
...@@ -15,15 +14,15 @@ class PriceDetailsService { ...@@ -15,15 +14,15 @@ class PriceDetailsService {
/// 查询商品详情 /// 查询商品详情
/// [productId] 查询的商品Id /// [productId] 查询的商品Id
/// ///
Future<PriceDetailsVo> qryProductDetails({@required String productId}) async { Future<PriceDetailsVo> qryProductDetails({required String productId}) async {
return await _priceRepository return await _priceRepository
.qryProductDetails(id: productId) .qryProductDetails(id: productId)
.asStream() .asStream()
.map((event) { .map((event) {
PriceDetailsVo detailsVo; PriceDetailsVo? detailsVo;
if (event.isSuccess) { if (event.isSuccess) {
detailsVo = PriceDetailsVo(); detailsVo = PriceDetailsVo();
ProductDetailsEntity entity = event.data; ProductDetailsEntity entity = event.data!;
detailsVo.viewState = DSViewState.idle; detailsVo.viewState = DSViewState.idle;
detailsVo.likeTimes = entity.likeTimes; detailsVo.likeTimes = entity.likeTimes;
detailsVo.collegeTimes = entity.collegeTimes; detailsVo.collegeTimes = entity.collegeTimes;
...@@ -40,18 +39,16 @@ class PriceDetailsService { ...@@ -40,18 +39,16 @@ class PriceDetailsService {
detailsVo.isFavorites = entity.isCollect == '1'; detailsVo.isFavorites = entity.isCollect == '1';
detailsVo.shareMessage = entity.shareMessage ?? ''; detailsVo.shareMessage = entity.shareMessage ?? '';
detailsVo.shareUrl = entity.shareUrl ?? ''; detailsVo.shareUrl = entity.shareUrl ?? '';
if (entity.releaseTime != null && entity.releaseTime.length > 0) { if (entity.releaseTime != null && entity.releaseTime!.length > 0) {
detailsVo.releaseTime = detailsVo.releaseTime =
TimeUtils.formatTime(timestamp: entity.releaseTime); TimeUtils.formatTime(timestamp: entity.releaseTime!);
} }
detailsVo.checkText = entity.checkText ?? ''; detailsVo.checkText = entity.checkText ?? '';
detailsVo.endPrice = entity.endPrice; detailsVo.endPrice = entity.endPrice;
detailsVo.price = entity.price; detailsVo.price = entity.price;
detailsVo.coupons = detailsVo.coupons = List.generate(entity.couponInfos?.length??0, (index) {
List.generate(entity.couponInfos?.length, (index) { CouponInfo info = entity.couponInfos![index];
CouponInfo info = entity.couponInfos[index]; return Coupon(name: info.couponName, url: info.url, status: info.status);
return Coupon(
name: info.couponName, url: info.url, status: info.status);
}); });
detailsVo.isOverdue = entity.isOverdue; detailsVo.isOverdue = entity.isOverdue;
detailsVo.shopTitle = entity.shopTitle; detailsVo.shopTitle = entity.shopTitle;
...@@ -75,8 +72,8 @@ class PriceDetailsService { ...@@ -75,8 +72,8 @@ class PriceDetailsService {
/// [pagesize] 当前页显示的大小 /// [pagesize] 当前页显示的大小
/// ///
Future<DSResponseList<ProductItemEntity>> getSellingRecommends({ Future<DSResponseList<ProductItemEntity>> getSellingRecommends({
String keywords, String? keywords,
String excludeId, String? excludeId,
int page = 1, int page = 1,
int pagesize = 10, int pagesize = 10,
}) async { }) async {
...@@ -94,7 +91,7 @@ class PriceDetailsService { ...@@ -94,7 +91,7 @@ class PriceDetailsService {
/// [report_type] 举报的商品类型 /// [report_type] 举报的商品类型
/// ///
Future<dynamic> report( Future<dynamic> report(
{@required String id, @required String reportType}) async { {required String id, required String reportType}) async {
return await _priceRepository return await _priceRepository
.report(id: id, reportType: reportType) .report(id: id, reportType: reportType)
.asStream() .asStream()
...@@ -111,8 +108,8 @@ class PriceDetailsService { ...@@ -111,8 +108,8 @@ class PriceDetailsService {
/// [platform] 平台 /// [platform] 平台
/// ///
Future<dynamic> userLike( Future<dynamic> userLike(
{@required String markId, {required String markId,
@required String platform, required String platform,
String type = '2', String type = '2',
String status = '1'}) async { String status = '1'}) async {
return await _priceRepository return await _priceRepository
...@@ -128,8 +125,8 @@ class PriceDetailsService { ...@@ -128,8 +125,8 @@ class PriceDetailsService {
/// 用户收藏 /// 用户收藏
/// ///
Future<dynamic> userCollect( Future<dynamic> userCollect(
{@required String itemId, {required String itemId,
@required String platform, required String platform,
String type = '2', String type = '2',
String status = '1'}) async { String status = '1'}) async {
return await _priceRepository return await _priceRepository
...@@ -148,8 +145,8 @@ class PriceDetailsService { ...@@ -148,8 +145,8 @@ class PriceDetailsService {
/// [type] 转链类型 好价传6 默认为5 /// [type] 转链类型 好价传6 默认为5
/// ///
Future<DSResponseObject<TurnChainEntity>> turnChainForItemId( Future<DSResponseObject<TurnChainEntity>> turnChainForItemId(
{@required String itemId, {required String itemId,
@required String platform, required String platform,
String type = '6'}) async { String type = '6'}) async {
return await _priceRepository return await _priceRepository
.turnChainForItemId(itemId: itemId, platform: platform, type: type) .turnChainForItemId(itemId: itemId, platform: platform, type: type)
......
This diff is collapsed.
...@@ -19,7 +19,7 @@ import 'package:common_module/utils/xapp_utils.dart'; ...@@ -19,7 +19,7 @@ import 'package:common_module/utils/xapp_utils.dart';
/// ///
class PriceDiscountPage extends StatefulWidget { class PriceDiscountPage extends StatefulWidget {
final Map<String, dynamic> pageParam; final Map<String, dynamic> pageParam;
const PriceDiscountPage({Key key, @required this.pageParam}) const PriceDiscountPage({Key? key, required this.pageParam})
: super(key: key); : super(key: key);
@override @override
_PriceDiscountPageState createState() => _PriceDiscountPageState(); _PriceDiscountPageState createState() => _PriceDiscountPageState();
...@@ -27,10 +27,10 @@ class PriceDiscountPage extends StatefulWidget { ...@@ -27,10 +27,10 @@ class PriceDiscountPage extends StatefulWidget {
class _PriceDiscountPageState extends State<PriceDiscountPage> class _PriceDiscountPageState extends State<PriceDiscountPage>
with IPriceDiscountDelegate { with IPriceDiscountDelegate {
IPriceDiscountAction _discountAction; IPriceDiscountAction? _discountAction;
bool _isAudituser = false; bool? _isAudituser = false;
List<dynamic> _sellReportList; List<dynamic>? _sellReportList;
@override @override
void initState() { void initState() {
_isAudituser = widget.pageParam['isAudituser']; _isAudituser = widget.pageParam['isAudituser'];
...@@ -49,30 +49,30 @@ class _PriceDiscountPageState extends State<PriceDiscountPage> ...@@ -49,30 +49,30 @@ class _PriceDiscountPageState extends State<PriceDiscountPage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DSProviderWidget<PriceDiscountVo, return DSProviderWidget<PriceDiscountVo,
IPriceDiscountAction<PriceDiscountVo>>( IPriceDiscountAction<PriceDiscountVo>>(
dsAction: _discountAction, dsAction: _discountAction as IPriceDiscountAction<PriceDiscountVo>,
builder: (BuildContext context, Widget child) { builder: (BuildContext context, Widget? child) {
return Scaffold( return Scaffold(
appBar: buildAppBar(), appBar: buildAppBar() as PreferredSizeWidget,
body: _buildBody1(vo: _discountAction.getVo), body: _buildBody1(vo: _discountAction!.getVo),
); );
}, },
); );
} }
Widget _buildBody1({PriceDiscountVo vo}) { Widget _buildBody1({required PriceDiscountVo vo}) {
return PullWidget( return PullWidget(
controller: _refreshController, controller: _refreshController,
child: Container(child: _buildBody(vo: vo)), child: Container(child: _buildBody(vo: vo)),
onRefresh: () { onRefresh: () {
_discountAction.reloadData(); _discountAction!.reloadData();
}, },
onLoad: () { onLoad: () {
_discountAction.onLoad(); _discountAction!.onLoad();
}, },
); );
} }
Widget _buildBody({PriceDiscountVo vo}) { Widget _buildBody({required PriceDiscountVo vo}) {
if (vo.viewState == DSViewState.busy) { if (vo.viewState == DSViewState.busy) {
return LoadingPage( return LoadingPage(
padding: EdgeInsets.all(13.w), padding: EdgeInsets.all(13.w),
...@@ -86,7 +86,7 @@ class _PriceDiscountPageState extends State<PriceDiscountPage> ...@@ -86,7 +86,7 @@ class _PriceDiscountPageState extends State<PriceDiscountPage>
vo.viewState == DSViewState.empty ? '未发现数据,请刷新重试' : '加载失败,请刷新重试', vo.viewState == DSViewState.empty ? '未发现数据,请刷新重试' : '加载失败,请刷新重试',
onReloadTap: () { onReloadTap: () {
//重新加载数据 //重新加载数据
_discountAction.reloadData(); _discountAction!.reloadData();
}, },
); );
} }
...@@ -127,7 +127,7 @@ class _PriceDiscountPageState extends State<PriceDiscountPage> ...@@ -127,7 +127,7 @@ class _PriceDiscountPageState extends State<PriceDiscountPage>
} }
@override @override
void onloadFailed({bool isLoading = true, String msg}) { void onloadFailed({bool isLoading = true, String? msg}) {
if (isLoading) { if (isLoading) {
_refreshController.loadFailed(); _refreshController.loadFailed();
} else { } else {
......
...@@ -20,7 +20,7 @@ abstract class PricePageDelegate { ...@@ -20,7 +20,7 @@ abstract class PricePageDelegate {
/// [type] 1、白菜专区 2、爆单页面 3、搜索页面 4、商品详情 /// [type] 1、白菜专区 2、爆单页面 3、搜索页面 4、商品详情
/// [data] 当[type]等于4时,[data]为传递的数据 /// [data] 当[type]等于4时,[data]为传递的数据
/// ///
void onRouteTap({@required String type, Map<String, dynamic> data}); void onRouteTap({required String type, Map<String, dynamic>? data});
/// ///
/// 获取好价的快捷Tab /// 获取好价的快捷Tab
...@@ -29,11 +29,11 @@ abstract class PricePageDelegate { ...@@ -29,11 +29,11 @@ abstract class PricePageDelegate {
} }
class PricePage extends StatefulWidget { class PricePage extends StatefulWidget {
final PricePageDelegate pageDelegate; final PricePageDelegate? pageDelegate;
final List<dynamic> priceCategory; final List<dynamic>? priceCategory;
final Map<int, dynamic> platformIconMap; final Map<int, dynamic>? platformIconMap;
const PricePage( const PricePage(
{Key key, this.pageDelegate, this.platformIconMap, this.priceCategory}) {Key? key, this.pageDelegate, this.platformIconMap, this.priceCategory})
: super(key: key); : super(key: key);
@override @override
_PricePageState createState() => _PricePageState(); _PricePageState createState() => _PricePageState();
...@@ -41,14 +41,14 @@ class PricePage extends StatefulWidget { ...@@ -41,14 +41,14 @@ class PricePage extends StatefulWidget {
class _PricePageState extends BaseUmengPageViewItemState<PricePage> class _PricePageState extends BaseUmengPageViewItemState<PricePage>
with IPriceActionDelegate { with IPriceActionDelegate {
IPriceAction<PriceVo> _priceAction; IPriceAction<PriceVo>? _priceAction;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_priceAction = PriceAction(delegate: this); _priceAction = PriceAction(delegate: this);
_priceAction.setPriceCategory( _priceAction!.setPriceCategory(
sellingTabList: widget.pageDelegate.sellingTabList, sellingTabList: widget.pageDelegate!.sellingTabList,
priceCategory: widget.priceCategory, priceCategory: widget.priceCategory,
platformIconMap: widget.platformIconMap); platformIconMap: widget.platformIconMap);
} }
...@@ -57,7 +57,7 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage> ...@@ -57,7 +57,7 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
return DSProviderWidget<PriceVo, IPriceAction<PriceVo>>( return DSProviderWidget<PriceVo, IPriceAction<PriceVo>>(
dsAction: _priceAction, dsAction: _priceAction!,
builder: (BuildContext context, child) { builder: (BuildContext context, child) {
return Scaffold( return Scaffold(
backgroundColor: Color(0xFFF5F5F5), backgroundColor: Color(0xFFF5F5F5),
...@@ -65,12 +65,12 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage> ...@@ -65,12 +65,12 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage>
onSearchTap: () { onSearchTap: () {
widget.pageDelegate?.onRouteTap(type: '3'); widget.pageDelegate?.onRouteTap(type: '3');
}, },
isGrid: _priceAction.vm?.productListVo?.isGrid ?? false, isGrid: _priceAction!.vm?.productListVo?.isGrid ?? false,
onLayoutTap: (bool isGrid) async { onLayoutTap: (bool isGrid) async {
_priceAction.vm?.productListVo?.isGrid = isGrid ?? true; _priceAction!.vm?.productListVo?.isGrid = isGrid;
_priceAction.vm?.notifyListener(true); _priceAction!.vm?.notifyListener(true);
}), }) as PreferredSizeWidget?,
body: _buildBody(action: _priceAction), body: _buildBody(action: _priceAction!),
); );
}); });
} }
...@@ -81,7 +81,7 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage> ...@@ -81,7 +81,7 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage>
ValueNotifier<double> backColorListenable = ValueNotifier<double>(136.0.w); ValueNotifier<double> backColorListenable = ValueNotifier<double>(136.0.w);
GlobalKey anchorKey = GlobalKey(); GlobalKey anchorKey = GlobalKey();
Widget _buildBody({IPriceAction<PriceVo> action}) { Widget _buildBody({required IPriceAction<PriceVo> action}) {
return Stack( return Stack(
children: [ children: [
// 底部设置一个背景跟随滑动 // 底部设置一个背景跟随滑动
...@@ -105,33 +105,33 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage> ...@@ -105,33 +105,33 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage>
DSProvider.value( DSProvider.value(
vo: action.getTabListVo(), vo: action.getTabListVo(),
builderWidget: (BuildContext context, TabListVo tabListVo, builderWidget: (BuildContext context, TabListVo tabListVo,
Widget child) { Widget? child) {
return buildCategoryTapWidget( return buildCategoryTapWidget(
action.getTabListVo().tabList ?? [], action.getTabListVo().tabList,
action.sellingTabs, action.sellingTabs,
anchorKey: anchorKey, anchorKey: anchorKey,
sellTab: tabListVo.sellTab, sellTab: tabListVo.sellTab,
onChange: (int index, bool enable) { onChange: (int index, bool enable) {
tabListVo?.tabList[index].open = enable; tabListVo.tabList[index].open = enable;
tabListVo.notifyListener(true); tabListVo.notifyListener(true);
}, onChangeSort: (Map<String, dynamic> data) { }, onChangeSort: (Map<String, dynamic> data) {
tabListVo.sellTab = data; tabListVo.sellTab = data;
tabListVo.notifyListener(true); tabListVo.notifyListener(true);
_priceAction.qryProductListEvent(page: 1); _priceAction!.qryProductListEvent(page: 1);
double offset = _scrollViewController.offset; double offset = _scrollViewController.offset;
if (offset > 70.w) { if (offset > 70.w) {
_scrollViewController.animateTo(70.w, _scrollViewController.animateTo(70.w,
duration: Duration(milliseconds: 50), duration: Duration(milliseconds: 50),
curve: Curves.linear); curve: Curves.linear);
} }
}, onNodeChange: (int index, TabVo tabVo) { }, onNodeChange: (int? index, TabVo tabVo) {
tabVo.open = false; tabVo.open = false;
if (tabVo.selected != null && if (tabVo.selected != null &&
tabVo.selected['is_default'] == '1') { tabVo.selected!['is_default'] == '1') {
tabVo.selected = null; tabVo.selected = null;
} }
tabListVo.notifyListener(true); tabListVo.notifyListener(true);
_priceAction.qryProductListEvent(page: 1); _priceAction!.qryProductListEvent(page: 1);
double offset = _scrollViewController.offset; double offset = _scrollViewController.offset;
if (offset > 70.w) { if (offset > 70.w) {
_scrollViewController.animateTo(70.w, _scrollViewController.animateTo(70.w,
...@@ -145,7 +145,7 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage> ...@@ -145,7 +145,7 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage>
child: DSProvider.value( child: DSProvider.value(
vo: action.getProductListVo(), vo: action.getProductListVo(),
builderWidget: (BuildContext context, builderWidget: (BuildContext context,
ProductListVo productListVo, Widget child) { ProductListVo productListVo, Widget? child) {
if (productListVo.productList.isEmpty) { if (productListVo.productList.isEmpty) {
if (productListVo.viewState == DSViewState.busy) { if (productListVo.viewState == DSViewState.busy) {
return LoadingPage( return LoadingPage(
...@@ -211,10 +211,10 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage> ...@@ -211,10 +211,10 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage>
], ],
), ),
onLoad: () { onLoad: () {
action?.loadMore(); action.loadMore();
}, },
onRefresh: () { onRefresh: () {
action?.onRefresh(); action.onRefresh();
}, },
controller: _refreshController, controller: _refreshController,
), ),
...@@ -229,7 +229,7 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage> ...@@ -229,7 +229,7 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage>
} else if (scroll.metrics.pixels <= 500 && scrollIndex.value == 1) { } else if (scroll.metrics.pixels <= 500 && scrollIndex.value == 1) {
scrollIndex.value = 0; scrollIndex.value = 0;
} }
RenderBox renderBox = anchorKey.currentContext.findRenderObject(); RenderBox renderBox = anchorKey.currentContext!.findRenderObject() as RenderBox;
var offset = var offset =
renderBox.localToGlobal(Offset(0.0, renderBox.size.height)); renderBox.localToGlobal(Offset(0.0, renderBox.size.height));
if (scroll.runtimeType == ScrollStartNotification) { if (scroll.runtimeType == ScrollStartNotification) {
...@@ -270,7 +270,7 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage> ...@@ -270,7 +270,7 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage>
} }
@override @override
void onloadFailed({String msg}) { void onloadFailed({String? msg}) {
_refreshController.loadFailed(); _refreshController.loadFailed();
_refreshController.refreshCompleted(resetFooterState: true); _refreshController.refreshCompleted(resetFooterState: true);
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -5,20 +5,20 @@ import 'package:common_module/utils/xapp_utils.dart'; ...@@ -5,20 +5,20 @@ import 'package:common_module/utils/xapp_utils.dart';
typedef OverlayTapUpCallback = void Function(OverlayWidgetBuilder overlayBuilder); typedef OverlayTapUpCallback = void Function(OverlayWidgetBuilder overlayBuilder);
typedef OverlayWidgetBuilder = void Function(Widget overlayWidget); typedef OverlayWidgetBuilder = void Function(Widget? overlayWidget);
class OtherWidget extends StatefulWidget { class OtherWidget extends StatefulWidget {
final Widget child; final Widget child;
final OverlayTapUpCallback tapUpCallback; final OverlayTapUpCallback? tapUpCallback;
final GestureTapCallback onCloseTap; final GestureTapCallback? onCloseTap;
final Widget Function() onHeaderWidget; final Widget Function()? onHeaderWidget;
const OtherWidget({Key key, const OtherWidget({Key? key,
@required this.child, required this.child,
this.tapUpCallback, this.tapUpCallback,
this.onCloseTap, this.onCloseTap,
@required this.onHeaderWidget, required this.onHeaderWidget,
}) : super(key: key); }) : super(key: key);
@override @override
...@@ -28,21 +28,21 @@ class OtherWidget extends StatefulWidget { ...@@ -28,21 +28,21 @@ class OtherWidget extends StatefulWidget {
class _OtherWidgetState extends State<OtherWidget> { class _OtherWidgetState extends State<OtherWidget> {
GlobalKey globalKey = GlobalKey(); GlobalKey globalKey = GlobalKey();
OverlayEntry overlayEntry; OverlayEntry? overlayEntry;
void onCloseEntry({bool close}) { void onCloseEntry({bool? close}) {
if (overlayEntry != null) { if (overlayEntry != null) {
overlayEntry.remove(); overlayEntry!.remove();
overlayEntry = null; overlayEntry = null;
} }
if(widget.onCloseTap != null){ if(widget.onCloseTap != null){
widget.onCloseTap(); widget.onCloseTap!();
} }
} }
void showOverlayEntry({@required double height,@required double headerHeight ,@required Widget overlayWidget}) { void showOverlayEntry({required double height,required double headerHeight ,required Widget overlayWidget}) {
if(overlayEntry != null){ if(overlayEntry != null){
overlayEntry.remove(); overlayEntry!.remove();
overlayEntry = null; overlayEntry = null;
} }
overlayEntry = new OverlayEntry(maintainState: true,builder: (BuildContext context) { overlayEntry = new OverlayEntry(maintainState: true,builder: (BuildContext context) {
...@@ -50,7 +50,7 @@ class _OtherWidgetState extends State<OtherWidget> { ...@@ -50,7 +50,7 @@ class _OtherWidgetState extends State<OtherWidget> {
InkWell(child:Container(height:height ,color:Colors.transparent),onTap:onCloseEntry), InkWell(child:Container(height:height ,color:Colors.transparent),onTap:onCloseEntry),
Container( Container(
alignment: Alignment.center, alignment: Alignment.center,
child:widget.onHeaderWidget(),height:headerHeight, child:widget.onHeaderWidget!(),height:headerHeight,
color: Colors.transparent, color: Colors.transparent,
), ),
Container(child:overlayWidget,color:Color(0xFF000000).withAlpha(102)), Container(child:overlayWidget,color:Color(0xFF000000).withAlpha(102)),
...@@ -60,7 +60,7 @@ class _OtherWidgetState extends State<OtherWidget> { ...@@ -60,7 +60,7 @@ class _OtherWidgetState extends State<OtherWidget> {
), ),
],),color:Colors.transparent,)); ],),color:Colors.transparent,));
}); });
Overlay.of(context,rootOverlay: true).insert(overlayEntry); Overlay.of(context,rootOverlay: true)!.insert(overlayEntry!);
} }
@override @override
...@@ -80,12 +80,12 @@ class _OtherWidgetState extends State<OtherWidget> { ...@@ -80,12 +80,12 @@ class _OtherWidgetState extends State<OtherWidget> {
child: Container(child:widget.child,alignment:Alignment.center,), child: Container(child:widget.child,alignment:Alignment.center,),
onTap:(){ onTap:(){
if (overlayEntry != null) { if (overlayEntry != null) {
overlayEntry.remove(); overlayEntry!.remove();
overlayEntry = null; overlayEntry = null;
} }
RenderBox renderBox = context.findRenderObject(); RenderBox renderBox = context.findRenderObject() as RenderBox;
Offset offset = renderBox.localToGlobal(Offset.zero); Offset offset = renderBox.localToGlobal(Offset.zero);
widget.tapUpCallback((Widget overlayWidget){ widget.tapUpCallback!((Widget? overlayWidget){
if(overlayWidget == null){ if(overlayWidget == null){
onCloseEntry(close:true); onCloseEntry(close:true);
}else{ }else{
...@@ -105,16 +105,16 @@ class _OtherWidgetState extends State<OtherWidget> { ...@@ -105,16 +105,16 @@ class _OtherWidgetState extends State<OtherWidget> {
class OverlayEntryHeader extends StatefulWidget { class OverlayEntryHeader extends StatefulWidget {
final List<TabVo> tabList; final List<TabVo> tabList;
final String Function(TabVo) onHeaderTitle; final String? Function(TabVo)? onHeaderTitle;
final void Function(int,TabVo) onTap; final void Function(int,TabVo)? onTap;
const OverlayEntryHeader({ Key key,@required this.tabList,this.onHeaderTitle,this.onTap}) : super(key: key); const OverlayEntryHeader({ Key? key,required this.tabList,this.onHeaderTitle,this.onTap}) : super(key: key);
@override @override
_OverlayEntryHeaderState createState() => _OverlayEntryHeaderState(); _OverlayEntryHeaderState createState() => _OverlayEntryHeaderState();
} }
class _OverlayEntryHeaderState extends State<OverlayEntryHeader> { class _OverlayEntryHeaderState extends State<OverlayEntryHeader> {
List<TabVo> tabList; late List<TabVo> tabList;
@override @override
void initState() { void initState() {
...@@ -127,7 +127,7 @@ class _OverlayEntryHeaderState extends State<OverlayEntryHeader> { ...@@ -127,7 +127,7 @@ class _OverlayEntryHeaderState extends State<OverlayEntryHeader> {
return Row( return Row(
children:List.generate(tabList.length,(index){ children:List.generate(tabList.length,(index){
TabVo tabVo = tabList[index]; TabVo tabVo = tabList[index];
String title = widget.onHeaderTitle(tabVo); String? title = widget.onHeaderTitle!(tabVo);
return Expanded( return Expanded(
child:InkWell(child:Container( child:InkWell(child:Container(
alignment: Alignment.center, alignment: Alignment.center,
...@@ -146,7 +146,7 @@ class _OverlayEntryHeaderState extends State<OverlayEntryHeader> { ...@@ -146,7 +146,7 @@ class _OverlayEntryHeaderState extends State<OverlayEntryHeader> {
) )
],) ],)
),onTap:(){ ),onTap:(){
widget.onTap(index,tabVo); widget.onTap!(index,tabVo);
},), },),
flex:1, flex:1,
); );
......
...@@ -24,7 +24,7 @@ abstract class SearchWidgetDelegate { ...@@ -24,7 +24,7 @@ abstract class SearchWidgetDelegate {
/// ///
/// 设置页面isGrid /// 设置页面isGrid
/// ///
void setPageGrid({bool isGrid}); void setPageGrid({bool? isGrid});
} }
/// ///
...@@ -35,13 +35,13 @@ class SearchWidget extends StatefulWidget { ...@@ -35,13 +35,13 @@ class SearchWidget extends StatefulWidget {
final List<dynamic> priceCategory; final List<dynamic> priceCategory;
final Map<int, dynamic> platformIconMap; final Map<int, dynamic> platformIconMap;
final String keywords; final String keywords;
final void Function(Map<String, dynamic>) onGoodDetails; final void Function(Map<String, dynamic>)? onGoodDetails;
final void Function(SearchWidgetDelegate) onWidgetDelegate; final void Function(SearchWidgetDelegate)? onWidgetDelegate;
const SearchWidget( const SearchWidget(
{Key key, {Key? key,
@required this.priceCategory, required this.priceCategory,
@required this.keywords, required this.keywords,
@required this.platformIconMap, required this.platformIconMap,
this.isGrid = true, this.isGrid = true,
this.onGoodDetails, this.onGoodDetails,
this.onWidgetDelegate}) this.onWidgetDelegate})
...@@ -58,7 +58,7 @@ class _SearchWidgetState extends State<SearchWidget> ...@@ -58,7 +58,7 @@ class _SearchWidgetState extends State<SearchWidget>
IPriceActionDelegate { IPriceActionDelegate {
RefreshController _refreshController = RefreshController(); RefreshController _refreshController = RefreshController();
IPriceAction<PriceVo> _priceAction; IPriceAction<PriceVo>? _priceAction;
@override @override
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
...@@ -66,11 +66,11 @@ class _SearchWidgetState extends State<SearchWidget> ...@@ -66,11 +66,11 @@ class _SearchWidgetState extends State<SearchWidget>
@override @override
void initState() { void initState() {
if (widget.onWidgetDelegate != null) { if (widget.onWidgetDelegate != null) {
widget.onWidgetDelegate(this); widget.onWidgetDelegate!(this);
} }
_priceAction = PriceAction(delegate: this); _priceAction = PriceAction(delegate: this);
_searchKeywords = widget.keywords; _searchKeywords = widget.keywords;
_priceAction.setPriceCategory( _priceAction!.setPriceCategory(
priceCategory: widget.priceCategory, priceCategory: widget.priceCategory,
keywords: _searchKeywords, keywords: _searchKeywords,
platformIconMap: widget.platformIconMap); platformIconMap: widget.platformIconMap);
...@@ -78,18 +78,18 @@ class _SearchWidgetState extends State<SearchWidget> ...@@ -78,18 +78,18 @@ class _SearchWidgetState extends State<SearchWidget>
} }
@override @override
void setPageGrid({bool isGrid}) { void setPageGrid({bool? isGrid}) {
_priceAction.getProductListVo()?.isGrid = isGrid; _priceAction!.getProductListVo().isGrid = isGrid;
_priceAction.getProductListVo()?.notifyListener(true); _priceAction!.getProductListVo().notifyListener(true);
} }
String _searchKeywords; String? _searchKeywords;
@override @override
void onKeywordsSearch(String keywords) { void onKeywordsSearch(String keywords) {
if (_searchKeywords != keywords) { if (_searchKeywords != keywords) {
_searchKeywords = keywords; _searchKeywords = keywords;
_priceAction.qryProductListEvent(keywords: keywords); _priceAction!.qryProductListEvent(keywords: keywords);
} }
} }
...@@ -98,7 +98,7 @@ class _SearchWidgetState extends State<SearchWidget> ...@@ -98,7 +98,7 @@ class _SearchWidgetState extends State<SearchWidget>
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
return DSProviderWidget<PriceVo, IPriceAction<PriceVo>>( return DSProviderWidget<PriceVo, IPriceAction<PriceVo>>(
dsAction: _priceAction, dsAction: _priceAction!,
builder: (BuildContext context, child) { builder: (BuildContext context, child) {
return Container( return Container(
color: Color(0xFFF5F5F5), color: Color(0xFFF5F5F5),
...@@ -115,12 +115,12 @@ class _SearchWidgetState extends State<SearchWidget> ...@@ -115,12 +115,12 @@ class _SearchWidgetState extends State<SearchWidget>
children: [ children: [
//Tab分类Widget //Tab分类Widget
buildSortHeader( buildSortHeader(
action: _priceAction, keywords: widget.keywords), action: _priceAction!, keywords: widget.keywords),
//商品列表 //商品列表
DSProvider.value( DSProvider.value(
vo: _priceAction.getProductListVo(), vo: _priceAction!.getProductListVo(),
builderWidget: (BuildContext context, builderWidget: (BuildContext context,
ProductListVo productListVo, Widget widget1) { ProductListVo productListVo, Widget? widget1) {
if (productListVo.productList.isEmpty) { if (productListVo.productList.isEmpty) {
if (productListVo.viewState == DSViewState.busy) { if (productListVo.viewState == DSViewState.busy) {
return SliverToBoxAdapter( return SliverToBoxAdapter(
...@@ -168,7 +168,7 @@ class _SearchWidgetState extends State<SearchWidget> ...@@ -168,7 +168,7 @@ class _SearchWidgetState extends State<SearchWidget>
'remark': entity.special 'remark': entity.special
}; };
if (widget.onGoodDetails != null) { if (widget.onGoodDetails != null) {
widget.onGoodDetails(goodDetails); widget.onGoodDetails!(goodDetails);
} }
})); }));
} else { } else {
...@@ -188,7 +188,7 @@ class _SearchWidgetState extends State<SearchWidget> ...@@ -188,7 +188,7 @@ class _SearchWidgetState extends State<SearchWidget>
'remark': entity.special 'remark': entity.special
}; };
if (widget.onGoodDetails != null) { if (widget.onGoodDetails != null) {
widget.onGoodDetails(goodDetails); widget.onGoodDetails!(goodDetails);
} }
}, },
)); ));
...@@ -201,22 +201,22 @@ class _SearchWidgetState extends State<SearchWidget> ...@@ -201,22 +201,22 @@ class _SearchWidgetState extends State<SearchWidget>
//Tab分类Widget //Tab分类Widget
Widget buildSortHeader( Widget buildSortHeader(
{@required IPriceAction<PriceVo> action, String keywords}) { {required IPriceAction<PriceVo> action, String? keywords}) {
return DSProvider.value( return DSProvider.value(
vo: action.getTabListVo(), vo: action.getTabListVo(),
builderWidget: builderWidget:
(BuildContext context, TabListVo tabListVo, Widget widget) { (BuildContext context, TabListVo tabListVo, Widget? widget) {
return buildTapWidget(context, tabList: tabListVo.tabList ?? [], return buildTapWidget(context, tabList: tabListVo.tabList,
onChange: (index, enable) { onChange: (index, enable) {
tabListVo?.tabList[index].open = enable; tabListVo.tabList[index].open = enable;
tabListVo.notifyListener(true); tabListVo.notifyListener(true);
}, onNodeChange: (int index, TabVo tabVo) { }, onNodeChange: (int? index, TabVo tabVo) {
tabVo.open = false; tabVo.open = false;
if (tabVo.selected != null && tabVo.selected['is_default'] == '1') { if (tabVo.selected != null && tabVo.selected!['is_default'] == '1') {
tabVo.selected = null; tabVo.selected = null;
} }
tabListVo.notifyListener(true); tabListVo.notifyListener(true);
_priceAction.qryProductListEvent(keywords: keywords); _priceAction!.qryProductListEvent(keywords: keywords);
}); });
}); });
} }
...@@ -228,7 +228,7 @@ class _SearchWidgetState extends State<SearchWidget> ...@@ -228,7 +228,7 @@ class _SearchWidgetState extends State<SearchWidget>
} }
@override @override
void onloadFailed({String msg}) { void onloadFailed({String? msg}) {
_refreshController.loadFailed(); _refreshController.loadFailed();
_refreshController.refreshCompleted(resetFooterState: true); _refreshController.refreshCompleted(resetFooterState: true);
} }
......
import 'package:flutter/cupertino.dart';
import 'package:flutter_boost/flutter_boost.dart'; import 'package:flutter_boost/flutter_boost.dart';
/// ///
...@@ -14,14 +13,11 @@ class NavigateUtils { ...@@ -14,14 +13,11 @@ class NavigateUtils {
/// ///
/// ///
static Future<Map<dynamic, dynamic>> push({ static Future<Map<dynamic, dynamic>> push({
@required String path, required String path,
bool isNative = false, bool isNative = false,
bool needLogin = true, bool needLogin = true,
Map<String, dynamic> arguments = const {}, Map<String, dynamic> arguments = const {},
}) async { }) async {
if (arguments == null) {
arguments = {};
}
// 记录上一个页面的名称 // 记录上一个页面的名称
arguments['previousRouteName'] = _getPreviousRouteName(); arguments['previousRouteName'] = _getPreviousRouteName();
dynamic result = await BoostNavigator.instance.push( dynamic result = await BoostNavigator.instance.push(
...@@ -46,10 +42,10 @@ class NavigateUtils { ...@@ -46,10 +42,10 @@ class NavigateUtils {
/// [rootPath] 根路由路径 /// [rootPath] 根路由路径
/// ///
static popRoot({ static popRoot({
@required String rootPath, required String rootPath,
}) async { }) async {
await BoostNavigator.instance.pop().then((value) async { await BoostNavigator.instance.pop().then((value) async {
PageInfo pageInfo = BoostNavigator.instance.getTopPageInfo(); PageInfo? pageInfo = BoostNavigator.instance.getTopPageInfo();
String pageName = pageInfo?.pageName ?? ''; String pageName = pageInfo?.pageName ?? '';
if (pageName.isNotEmpty && pageName != rootPath) { if (pageName.isNotEmpty && pageName != rootPath) {
await popRoot(rootPath: rootPath); await popRoot(rootPath: rootPath);
...@@ -58,8 +54,8 @@ class NavigateUtils { ...@@ -58,8 +54,8 @@ class NavigateUtils {
} }
// 获取下一个新页面的上一个页面名称(页面路径) // 获取下一个新页面的上一个页面名称(页面路径)
static String _getPreviousRouteName() { static String? _getPreviousRouteName() {
PageInfo pageInfo = BoostNavigator.instance.getTopPageInfo(); PageInfo? pageInfo = BoostNavigator.instance.getTopPageInfo();
var boostPath = pageInfo?.pageName; var boostPath = pageInfo?.pageName;
return boostPath; return boostPath;
} }
......
...@@ -14,11 +14,11 @@ class TextSize { ...@@ -14,11 +14,11 @@ class TextSize {
/// ///
static Size calculateTextSize( static Size calculateTextSize(
BuildContext context, { BuildContext context, {
String value, String? value,
double fontSize, double? fontSize,
FontWeight fontWeight, FontWeight? fontWeight,
double maxWidth, required double maxWidth,
int maxLines, int? maxLines,
}) { }) {
TextPainter painter = TextPainter( TextPainter painter = TextPainter(
///AUTO:华为手机如果不指定locale的时候,该方法算出来的文字高度是比系统计算偏小的。 ///AUTO:华为手机如果不指定locale的时候,该方法算出来的文字高度是比系统计算偏小的。
......
...@@ -43,7 +43,7 @@ class TimeUtils { ...@@ -43,7 +43,7 @@ class TimeUtils {
return '0'; return '0';
} }
static String formatTime({String timestamp}) { static String formatTime({required String timestamp}) {
int time = int.parse(timestamp); int time = int.parse(timestamp);
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(time * 1000); DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(time * 1000);
DateTime endDate = new DateTime.now(); DateTime endDate = new DateTime.now();
......
...@@ -2,24 +2,24 @@ import 'package:flutter/material.dart'; ...@@ -2,24 +2,24 @@ import 'package:flutter/material.dart';
class ImageAnimationWidget extends StatelessWidget { class ImageAnimationWidget extends StatelessWidget {
final ValueNotifier<int> valueNotifier; final ValueNotifier<int>? valueNotifier;
final List<String> images; final List<String>? images;
final String package; final String? package;
final double width; final double? width;
final double height; final double? height;
const ImageAnimationWidget({ Key key,@required this.valueNotifier,@required this.images,this.package,this.width,this.height}) : super(key: key); const ImageAnimationWidget({ Key? key,required this.valueNotifier,required this.images,this.package,this.width,this.height}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ValueListenableBuilder<int>( return ValueListenableBuilder<int>(
valueListenable: valueNotifier, valueListenable: valueNotifier!,
builder: (BuildContext context, int value, Widget child) { builder: (BuildContext context, int value, Widget? child) {
String image; String image;
if(value>=0 && value < images.length){ if(value>=0 && value < images!.length){
image = images[value]; image = images![value];
}else{ }else{
image = images[0]; image = images![0];
} }
return Image.asset(image,package:package,gaplessPlayback: true,width:width,height:height,); return Image.asset(image,package:package,gaplessPlayback: true,width:width,height:height,);
} }
......
...@@ -2,12 +2,12 @@ import 'package:flutter/material.dart'; ...@@ -2,12 +2,12 @@ import 'package:flutter/material.dart';
Widget buildAppSearchBar({ Widget buildAppSearchBar({
double height = 48, double height = 48,
Decoration decoration, Decoration? decoration,
EdgeInsetsGeometry margin, EdgeInsetsGeometry? margin,
EdgeInsetsGeometry padding, EdgeInsetsGeometry? padding,
Widget left, Widget? left,
Widget child, Widget? child,
Widget right, Widget? right,
}) { }) {
return PreferredSize( return PreferredSize(
child: SafeArea( child: SafeArea(
......
...@@ -7,8 +7,8 @@ import 'package:common_module/utils/xapp_utils.dart'; ...@@ -7,8 +7,8 @@ import 'package:common_module/utils/xapp_utils.dart';
class LoadingPage extends StatelessWidget { class LoadingPage extends StatelessWidget {
final String msg; final String msg;
final int length; final int length;
final EdgeInsetsGeometry padding; final EdgeInsetsGeometry? padding;
const LoadingPage({Key key, this.padding, this.msg = '1', this.length = 6}) const LoadingPage({Key? key, this.padding, this.msg = '1', this.length = 6})
: super(key: key); : super(key: key);
@override @override
...@@ -120,12 +120,12 @@ class LoadingPage extends StatelessWidget { ...@@ -120,12 +120,12 @@ class LoadingPage extends StatelessWidget {
/// [onReloadTap] 重新加载按钮 /// [onReloadTap] 重新加载按钮
/// ///
class FailedLoadPage extends StatelessWidget { class FailedLoadPage extends StatelessWidget {
final EdgeInsetsGeometry margin; final EdgeInsetsGeometry? margin;
final String errorMsg; final String errorMsg;
final void Function() onContactTap; final void Function()? onContactTap;
final void Function() onReloadTap; final void Function()? onReloadTap;
const FailedLoadPage( const FailedLoadPage(
{Key key, {Key? key,
this.margin, this.margin,
this.errorMsg = '加载失败,请刷新重试', this.errorMsg = '加载失败,请刷新重试',
this.onContactTap, this.onContactTap,
...@@ -195,10 +195,10 @@ class FailedLoadPage extends StatelessWidget { ...@@ -195,10 +195,10 @@ class FailedLoadPage extends StatelessWidget {
} }
Widget _buildButtonWidget( Widget _buildButtonWidget(
{@required String text, {required String text,
@required TextStyle style, required TextStyle style,
Decoration decoration, Decoration? decoration,
void Function() onTap}) { void Function()? onTap}) {
return InkWell( return InkWell(
child: Container( child: Container(
width: 164.w, width: 164.w,
......
...@@ -3,11 +3,11 @@ import 'package:flutter/material.dart'; ...@@ -3,11 +3,11 @@ import 'package:flutter/material.dart';
class ImageWidget extends StatelessWidget { class ImageWidget extends StatelessWidget {
final String name; final String name;
final double width; final double? width;
final double height; final double? height;
final String package; final String package;
final BoxFit fit; final BoxFit? fit;
const ImageWidget({ Key key,@required this.name,this.width,this.height,this.package = 'price_module',this.fit}) : super(key: key); const ImageWidget({ Key? key,required this.name,this.width,this.height,this.package = 'price_module',this.fit}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
......
...@@ -8,27 +8,27 @@ import 'package:flutter/material.dart'; ...@@ -8,27 +8,27 @@ import 'package:flutter/material.dart';
/// ///
class ItemProduct extends StatelessWidget { class ItemProduct extends StatelessWidget {
final Widget image; final Widget image;
final double height; final double? height;
final Decoration decoration; final Decoration? decoration;
final EdgeInsetsGeometry margin; final EdgeInsetsGeometry? margin;
final EdgeInsetsGeometry rightMargin; final EdgeInsetsGeometry? rightMargin;
final Widget title; final Widget title;
final Widget price; final Widget? price;
final Widget platform; final Widget? platform;
final void Function() onTap; final void Function()? onTap;
const ItemProduct({ const ItemProduct({
Key key, Key? key,
@required this.image, required this.image,
this.height, this.height,
this.decoration, this.decoration,
this.margin, this.margin,
this.rightMargin, this.rightMargin,
@required this.title, required this.title,
this.platform, this.platform,
this.price, this.price,
this.onTap this.onTap
...@@ -46,8 +46,8 @@ class ItemProduct extends StatelessWidget { ...@@ -46,8 +46,8 @@ class ItemProduct extends StatelessWidget {
image, image,
Expanded(child:Container(margin:rightMargin,child:Column(crossAxisAlignment: CrossAxisAlignment.start,children: [ Expanded(child:Container(margin:rightMargin,child:Column(crossAxisAlignment: CrossAxisAlignment.start,children: [
title, title,
Expanded(child:price,flex:1,), Expanded(child:price!,flex:1,),
platform platform!
],))) ],)))
], ],
), ),
......
...@@ -3,7 +3,7 @@ import 'package:price_module/widget/image/image_widget.dart'; ...@@ -3,7 +3,7 @@ import 'package:price_module/widget/image/image_widget.dart';
import 'package:common_module/utils/xapp_utils.dart'; import 'package:common_module/utils/xapp_utils.dart';
// //
Future<T> showPopBottomSheet<T>({BuildContext context,String pageName,Map<String,dynamic> extras,@required List<Map<String, dynamic>> items}){ Future<T?> showPopBottomSheet<T>({required BuildContext context,String? pageName,Map<String,dynamic>? extras,required List<Map<String, dynamic>> items}){
return showModalBottomSheet( return showModalBottomSheet(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
...@@ -56,9 +56,9 @@ Future<T> showPopBottomSheet<T>({BuildContext context,String pageName,Map<String ...@@ -56,9 +56,9 @@ Future<T> showPopBottomSheet<T>({BuildContext context,String pageName,Map<String
Widget _buildShareWidget(BuildContext context, String key, Widget _buildShareWidget(BuildContext context, String key,
{@required String name, {required String name,
@required String title, required String title,
Map<String, dynamic> extras = const {}}) { Map<String, dynamic>? extras = const {}}) {
return Expanded( return Expanded(
child:InkWell( child:InkWell(
child: Column( child: Column(
......
...@@ -8,12 +8,12 @@ import 'package:common_module/utils/xapp_utils.dart'; ...@@ -8,12 +8,12 @@ import 'package:common_module/utils/xapp_utils.dart';
class PriceGridWidget extends StatelessWidget { class PriceGridWidget extends StatelessWidget {
final EdgeInsetsGeometry padding; final EdgeInsetsGeometry padding;
final bool shrinkWrap; final bool shrinkWrap;
final ScrollPhysics physics; final ScrollPhysics? physics;
final void Function(int) onItemTap; final void Function(int)? onItemTap;
final List<ProductItemEntity> list; final List<ProductItemEntity>? list;
final bool isHaoJia; final bool isHaoJia;
const PriceGridWidget( const PriceGridWidget(
{Key key, {Key? key,
this.padding = const EdgeInsets.all(0), this.padding = const EdgeInsets.all(0),
this.shrinkWrap = false, this.shrinkWrap = false,
this.physics, this.physics,
...@@ -31,15 +31,15 @@ class PriceGridWidget extends StatelessWidget { ...@@ -31,15 +31,15 @@ class PriceGridWidget extends StatelessWidget {
staggeredTileBuilder: (index) => StaggeredTile.fit(2), staggeredTileBuilder: (index) => StaggeredTile.fit(2),
mainAxisSpacing: 8.w, mainAxisSpacing: 8.w,
crossAxisSpacing: 9.w, crossAxisSpacing: 9.w,
itemCount: list.length, itemCount: list!.length,
itemBuilder: itemGridBuilder, itemBuilder: itemGridBuilder,
); );
} }
Widget itemGridBuilder(BuildContext context, int index) { Widget itemGridBuilder(BuildContext context, int index) {
ProductItemEntity vo = list[index]; ProductItemEntity vo = list![index];
return InkWell( return InkWell(
onTap: () => onItemTap(index), onTap: () => onItemTap!(index),
child: Container( child: Container(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
...@@ -56,7 +56,7 @@ class PriceGridWidget extends StatelessWidget { ...@@ -56,7 +56,7 @@ class PriceGridWidget extends StatelessWidget {
children: [ children: [
ClipRRect( ClipRRect(
child: CachedNetworkImage( child: CachedNetworkImage(
imageUrl: vo.itemPic, imageUrl: vo.itemPic!,
placeholder: (BuildContext c, String s) { placeholder: (BuildContext c, String s) {
return Image.asset( return Image.asset(
'assets/images/placeholder_image.png', 'assets/images/placeholder_image.png',
...@@ -77,7 +77,7 @@ class PriceGridWidget extends StatelessWidget { ...@@ -77,7 +77,7 @@ class PriceGridWidget extends StatelessWidget {
width: 0.5.w, color: Color(0xFFE9E9E9)), width: 0.5.w, color: Color(0xFFE9E9E9)),
borderRadius: BorderRadius.all(Radius.circular(3.w))), borderRadius: BorderRadius.all(Radius.circular(3.w))),
child: Text( child: Text(
vo.platform, vo.platform!,
style: TextStyle( style: TextStyle(
color: Color(0xFF666666), color: Color(0xFF666666),
fontSize: 10.w, fontSize: 10.w,
...@@ -98,19 +98,19 @@ class PriceGridWidget extends StatelessWidget { ...@@ -98,19 +98,19 @@ class PriceGridWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
vo.itemTitle, vo.itemTitle!,
maxLines: 2, maxLines: 2,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w600, fontSize: 14.w), fontWeight: FontWeight.w600, fontSize: 14.w),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
vo.descriptionText.isEmpty vo.descriptionText!.isEmpty
? Container() ? Container()
: SizedBox(height: 4.w), : SizedBox(height: 4.w),
vo.descriptionText.isEmpty vo.descriptionText!.isEmpty
? Container() ? Container()
: Text( : Text(
vo.descriptionText, vo.descriptionText!,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
...@@ -129,7 +129,7 @@ class PriceGridWidget extends StatelessWidget { ...@@ -129,7 +129,7 @@ class PriceGridWidget extends StatelessWidget {
bottomRight: Radius.circular(8.w))), bottomRight: Radius.circular(8.w))),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
vertical: 1.w, horizontal: 4.w), vertical: 1.w, horizontal: 4.w),
child: Text(vo.rebate, child: Text(vo.rebate!,
style: TextStyle( style: TextStyle(
color: Color(0xFFFF8000), color: Color(0xFFFF8000),
fontSize: 11.w, fontSize: 11.w,
...@@ -143,7 +143,7 @@ class PriceGridWidget extends StatelessWidget { ...@@ -143,7 +143,7 @@ class PriceGridWidget extends StatelessWidget {
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: ListView.builder( child: ListView.builder(
itemCount: itemCount:
vo.tags.length >= 1 ? 1 : vo.tags.length, vo.tags!.length >= 1 ? 1 : vo.tags!.length,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Container( return Container(
...@@ -154,7 +154,7 @@ class PriceGridWidget extends StatelessWidget { ...@@ -154,7 +154,7 @@ class PriceGridWidget extends StatelessWidget {
Radius.circular(2.w))), Radius.circular(2.w))),
padding: padding:
EdgeInsets.symmetric(horizontal: 2.w), EdgeInsets.symmetric(horizontal: 2.w),
child: Text('${vo.tags[index]}', child: Text('${vo.tags![index]}',
style: TextStyle( style: TextStyle(
color: Color(0xFFB0B0B0), color: Color(0xFFB0B0B0),
fontSize: 11.w, fontSize: 11.w,
...@@ -169,7 +169,7 @@ class PriceGridWidget extends StatelessWidget { ...@@ -169,7 +169,7 @@ class PriceGridWidget extends StatelessWidget {
), ),
SizedBox(height: 4.w), SizedBox(height: 4.w),
Text( Text(
vo.special, vo.special!,
style: TextStyle( style: TextStyle(
color: Color(0xFFFF0400), color: Color(0xFFFF0400),
fontSize: 13.w, fontSize: 13.w,
...@@ -187,13 +187,13 @@ class PriceGridWidget extends StatelessWidget { ...@@ -187,13 +187,13 @@ class PriceGridWidget extends StatelessWidget {
class PriceListWidget extends StatelessWidget { class PriceListWidget extends StatelessWidget {
final EdgeInsetsGeometry padding; final EdgeInsetsGeometry padding;
final bool shrinkWrap; final bool shrinkWrap;
final ScrollPhysics physics; final ScrollPhysics? physics;
final void Function(ProductItemEntity, int) onItemTap; final void Function(ProductItemEntity, int)? onItemTap;
final bool scroll; final bool scroll;
final List<ProductItemEntity> list; final List<ProductItemEntity>? list;
final bool isHaoJia; final bool isHaoJia;
const PriceListWidget( const PriceListWidget(
{Key key, {Key? key,
this.padding = const EdgeInsets.all(0), this.padding = const EdgeInsets.all(0),
this.scroll = false, this.scroll = false,
this.shrinkWrap = false, this.shrinkWrap = false,
...@@ -208,16 +208,16 @@ class PriceListWidget extends StatelessWidget { ...@@ -208,16 +208,16 @@ class PriceListWidget extends StatelessWidget {
shrinkWrap: shrinkWrap, shrinkWrap: shrinkWrap,
physics: physics, physics: physics,
padding: padding, padding: padding,
itemCount: list.length, itemCount: list!.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
ProductItemEntity itemVo = list[index]; ProductItemEntity itemVo = list![index];
return _buildPriceItem( return _buildPriceItem(
index: index, index: index,
scroll: scroll, scroll: scroll,
itemEntity: itemVo, itemEntity: itemVo,
onTap: () { onTap: () {
if (onItemTap != null) { if (onItemTap != null) {
onItemTap(itemVo, index); onItemTap!(itemVo, index);
} }
}, },
); );
...@@ -226,10 +226,10 @@ class PriceListWidget extends StatelessWidget { ...@@ -226,10 +226,10 @@ class PriceListWidget extends StatelessWidget {
} }
Widget _buildPriceItem( Widget _buildPriceItem(
{int index, {required int index,
bool scroll, required bool scroll,
ProductItemEntity itemEntity, required ProductItemEntity itemEntity,
void Function() onTap}) { void Function()? onTap}) {
return InkWell( return InkWell(
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
...@@ -261,8 +261,8 @@ class PriceListWidget extends StatelessWidget { ...@@ -261,8 +261,8 @@ class PriceListWidget extends StatelessWidget {
/// ///
/// 好价商品条目的标题等信息 /// 好价商品条目的标题等信息
/// ///
Widget _buildItemDetails({ProductItemEntity vo}) { Widget _buildItemDetails({required ProductItemEntity vo}) {
String descriptionText = vo.descriptionText; String? descriptionText = vo.descriptionText;
if (descriptionText != null && descriptionText.isNotEmpty) { if (descriptionText != null && descriptionText.isNotEmpty) {
descriptionText = descriptionText.replaceAll('\n', ''); descriptionText = descriptionText.replaceAll('\n', '');
descriptionText = descriptionText.replaceAll('\r', ''); descriptionText = descriptionText.replaceAll('\r', '');
...@@ -333,7 +333,7 @@ class PriceListWidget extends StatelessWidget { ...@@ -333,7 +333,7 @@ class PriceListWidget extends StatelessWidget {
child: Container( child: Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: ListView.builder( child: ListView.builder(
itemCount: vo.tags.length >= 1 ? 1 : vo.tags.length, itemCount: vo.tags!.length >= 1 ? 1 : vo.tags!.length,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Container( return Container(
...@@ -344,7 +344,7 @@ class PriceListWidget extends StatelessWidget { ...@@ -344,7 +344,7 @@ class PriceListWidget extends StatelessWidget {
BorderRadius.all(Radius.circular(2.w))), BorderRadius.all(Radius.circular(2.w))),
padding: EdgeInsets.symmetric(horizontal: 4.w), padding: EdgeInsets.symmetric(horizontal: 4.w),
alignment: Alignment.center, alignment: Alignment.center,
child: Text('${vo.tags[index]}', child: Text('${vo.tags![index]}',
style: TextStyle( style: TextStyle(
color: Color(0xFF666666), color: Color(0xFF666666),
fontSize: 11.w, fontSize: 11.w,
...@@ -377,7 +377,7 @@ class PriceListWidget extends StatelessWidget { ...@@ -377,7 +377,7 @@ class PriceListWidget extends StatelessWidget {
/// [scroll] 是否滚动 /// [scroll] 是否滚动
/// ///
Widget _buildLeftImage( Widget _buildLeftImage(
{@required String imageUrl, @required String source, bool scroll}) { {required String? imageUrl, required String source, required bool scroll}) {
return Container( return Container(
width: 104.w, width: 104.w,
height: 104.w, height: 104.w,
...@@ -390,7 +390,7 @@ class PriceListWidget extends StatelessWidget { ...@@ -390,7 +390,7 @@ class PriceListWidget extends StatelessWidget {
package: 'price_module', width: 104.w, height: 104.w) package: 'price_module', width: 104.w, height: 104.w)
: ClipRRect( : ClipRRect(
child: CachedNetworkImage( child: CachedNetworkImage(
imageUrl: imageUrl, imageUrl: imageUrl!,
placeholder: (BuildContext c, String s) { placeholder: (BuildContext c, String s) {
return Image.asset( return Image.asset(
'assets/images/placeholder_image.png', 'assets/images/placeholder_image.png',
......
...@@ -2,11 +2,11 @@ import 'package:flutter/cupertino.dart'; ...@@ -2,11 +2,11 @@ import 'package:flutter/cupertino.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
class PullWidget extends StatelessWidget { class PullWidget extends StatelessWidget {
final Widget child; final Widget? child;
final VoidCallback onRefresh; final VoidCallback? onRefresh;
final VoidCallback onLoad; final VoidCallback? onLoad;
final RefreshController controller; final RefreshController? controller;
final ScrollController scrollController; final ScrollController? scrollController;
PullWidget( PullWidget(
{this.child, {this.child,
...@@ -21,7 +21,7 @@ class PullWidget extends StatelessWidget { ...@@ -21,7 +21,7 @@ class PullWidget extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SmartRefresher( return SmartRefresher(
scrollController: scrollController, scrollController: scrollController,
controller: controller, controller: controller!,
enablePullDown: onRefresh != null, enablePullDown: onRefresh != null,
enablePullUp: onLoad != null, enablePullUp: onLoad != null,
onRefresh: onRefresh, onRefresh: onRefresh,
......
...@@ -5,7 +5,7 @@ import 'package:flutter/widgets.dart'; ...@@ -5,7 +5,7 @@ import 'package:flutter/widgets.dart';
import 'package:common_module/utils/xapp_utils.dart'; import 'package:common_module/utils/xapp_utils.dart';
Widget buildTabbarButton({@required String title,@required String tabBarType,TabbarController controller}){ Widget buildTabbarButton({required String title,required String tabBarType,TabbarController? controller}){
return Container(child:Column(mainAxisAlignment:MainAxisAlignment.center,children: [ return Container(child:Column(mainAxisAlignment:MainAxisAlignment.center,children: [
Container( Container(
width:24.w, width:24.w,
...@@ -24,7 +24,7 @@ Widget buildTabbarButton({@required String title,@required String tabBarType,Tab ...@@ -24,7 +24,7 @@ Widget buildTabbarButton({@required String title,@required String tabBarType,Tab
class TabbarWidget extends StatefulWidget { class TabbarWidget extends StatefulWidget {
final Function(TabbarController) controller; final Function(TabbarController) controller;
final String tabBarType; final String tabBarType;
const TabbarWidget({ Key key,@required this.controller,@required this.tabBarType}) : super(key: key); const TabbarWidget({ Key? key,required this.controller,required this.tabBarType}) : super(key: key);
@override @override
_TabbarWidgetState createState() => _TabbarWidgetState(); _TabbarWidgetState createState() => _TabbarWidgetState();
...@@ -32,8 +32,8 @@ class TabbarWidget extends StatefulWidget { ...@@ -32,8 +32,8 @@ class TabbarWidget extends StatefulWidget {
class _TabbarWidgetState extends State<TabbarWidget> with TabbarController,SingleTickerProviderStateMixin{ class _TabbarWidgetState extends State<TabbarWidget> with TabbarController,SingleTickerProviderStateMixin{
Animation<double> _animation; late Animation<double> _animation;
AnimationController _controller; late AnimationController _controller;
int interval = 200; int interval = 200;
List<Image> images=[]; List<Image> images=[];
...@@ -78,7 +78,7 @@ class _TabbarWidgetState extends State<TabbarWidget> with TabbarController,Singl ...@@ -78,7 +78,7 @@ class _TabbarWidgetState extends State<TabbarWidget> with TabbarController,Singl
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ValueListenableBuilder<int>( return ValueListenableBuilder<int>(
valueListenable: index, valueListenable: index,
builder: (BuildContext context, int value, Widget child) { builder: (BuildContext context, int value, Widget? child) {
return images[value]; return images[value];
} }
); );
......
...@@ -6,7 +6,7 @@ homepage: / ...@@ -6,7 +6,7 @@ homepage: /
publish_to: none publish_to: none
environment: environment:
sdk: ">=2.8.0 <3.0.0" sdk: '>=2.12.0 <3.0.0'
flutter: ">=1.17.0 <2.0.0" flutter: ">=1.17.0 <2.0.0"
dependencies: dependencies:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment