Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiong-price-module
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
flutter-plugin
xiaoxiong-price-module
Commits
3e21f1ca
Commit
3e21f1ca
authored
Oct 16, 2021
by
汪林玲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入null-safety
parent
9a50195e
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
736 additions
and
785 deletions
+736
-785
README.md
README.md
+8
-12
lib/eventbus/notify_event_type.dart
lib/eventbus/notify_event_type.dart
+1
-3
lib/framework/action/ds_action.dart
lib/framework/action/ds_action.dart
+1
-1
lib/framework/base/ds_provider.dart
lib/framework/base/ds_provider.dart
+3
-3
lib/framework/base/ds_provider_widget.dart
lib/framework/base/ds_provider_widget.dart
+7
-7
lib/framework/exception/ds_net_exception.dart
lib/framework/exception/ds_net_exception.dart
+2
-2
lib/page/action/details/index.dart
lib/page/action/details/index.dart
+71
-72
lib/page/action/discount/index.dart
lib/page/action/discount/index.dart
+29
-29
lib/page/action/index.dart
lib/page/action/index.dart
+56
-57
lib/page/model/details/index.dart
lib/page/model/details/index.dart
+32
-32
lib/page/model/discount/index.dart
lib/page/model/discount/index.dart
+1
-1
lib/page/model/index.dart
lib/page/model/index.dart
+10
-10
lib/page/service/details/index.dart
lib/page/service/details/index.dart
+17
-20
lib/page/view/details/index.dart
lib/page/view/details/index.dart
+67
-66
lib/page/view/discount/index.dart
lib/page/view/discount/index.dart
+14
-14
lib/page/view/index.dart
lib/page/view/index.dart
+27
-27
lib/page/widget/details/index.dart
lib/page/widget/details/index.dart
+108
-110
lib/page/widget/index.dart
lib/page/widget/index.dart
+125
-158
lib/page/widget/other/other_widget.dart
lib/page/widget/other/other_widget.dart
+24
-24
lib/page/widget/search/index.dart
lib/page/widget/search/index.dart
+29
-29
lib/route/navigate_utils.dart
lib/route/navigate_utils.dart
+5
-9
lib/utils/text_size.dart
lib/utils/text_size.dart
+5
-5
lib/utils/time_utils.dart
lib/utils/time_utils.dart
+1
-1
lib/widget/animation/image_animation_widget.dart
lib/widget/animation/image_animation_widget.dart
+11
-11
lib/widget/appbar/index.dart
lib/widget/appbar/index.dart
+6
-6
lib/widget/failed/failed_load_page.dart
lib/widget/failed/failed_load_page.dart
+10
-10
lib/widget/image/image_widget.dart
lib/widget/image/image_widget.dart
+4
-4
lib/widget/item/item_product.dart
lib/widget/item/item_product.dart
+12
-12
lib/widget/pop/index.dart
lib/widget/pop/index.dart
+4
-4
lib/widget/price/price_item.dart
lib/widget/price/price_item.dart
+34
-34
lib/widget/pull/pull_widget.dart
lib/widget/pull/pull_widget.dart
+6
-6
lib/widget/tabbar/index.dart
lib/widget/tabbar/index.dart
+5
-5
pubspec.yaml
pubspec.yaml
+1
-1
No files found.
README.md
View file @
3e21f1ca
#
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
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.
```
\ No newline at end of file
lib/eventbus/notify_event_type.dart
View file @
3e21f1ca
import
'package:flutter/foundation.dart'
;
class
NotifyEventType
{
NotifyEventEnum
eventType
;
NotifyEventType
({
@
required
this
.
eventType
});
NotifyEventType
({
required
this
.
eventType
});
}
enum
NotifyEventEnum
{
...
...
lib/framework/action/ds_action.dart
View file @
3e21f1ca
import
'package:flutter/material.dart'
;
abstract
class
IDSAction
<
VM
>
{
VM
vm
;
VM
?
vm
;
void
initState
();
...
...
lib/framework/base/ds_provider.dart
View file @
3e21f1ca
...
...
@@ -8,12 +8,12 @@ class DSProvider<VO extends IDSModel> extends ChangeNotifierProvider<VO> {
final
Widget
Function
(
BuildContext
context
,
VO
value
,
Widget
child
,
Widget
?
child
,
)
builderWidget
;
DSProvider
.
value
({
@
required
this
.
vo
,
@
required
this
.
builderWidget
,
required
this
.
vo
,
required
this
.
builderWidget
,
})
:
super
.
value
(
value:
vo
,
child:
Consumer
<
VO
>(
...
...
lib/framework/base/ds_provider_widget.dart
View file @
3e21f1ca
...
...
@@ -7,19 +7,19 @@ import 'package:provider/provider.dart';
class
DSProviderWidget
<
VM
extends
IDSModel
,
T
extends
IDSAction
<
VM
>>
extends
StatefulWidget
{
final
T
dsAction
;
final
Widget
child
;
final
Widget
Function
(
BuildContext
context
,
Widget
child
)
builder
;
final
Widget
?
child
;
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
_DSProviderWidgetState
<
VM
,
T
>
createState
()
=>
_DSProviderWidgetState
<
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
void
initState
()
{
...
...
@@ -30,8 +30,8 @@ class _DSProviderWidgetState<VM extends IDSModel,T extends IDSAction<VM>> extend
@override
Widget
build
(
BuildContext
context
)
{
return
ChangeNotifierProvider
<
VM
>.
value
(
value:
action
.
vm
,
return
ChangeNotifierProvider
<
VM
?
>.
value
(
value:
action
!
.
vm
,
child:
Consumer
<
VM
>(
builder:
(
context
,
vm
,
child
){
action
?.
initBuilder
(
context
);
...
...
lib/framework/exception/ds_net_exception.dart
View file @
3e21f1ca
class
DSNetException
implements
Exception
{
final
String
message
;
final
int
code
;
final
String
?
message
;
final
int
?
code
;
@pragma
(
"vm:entry-point"
)
const
DSNetException
({
this
.
message
=
""
,
this
.
code
});
String
toString
()
{
...
...
lib/page/action/details/index.dart
View file @
3e21f1ca
import
'package:flutter/material.dart'
;
import
'package:price_module/eventbus/notify_event_type.dart'
;
import
'package:price_module/eventbus/platform_icon_event.dart'
;
import
'package:price_module/framework/action/ds_action.dart'
;
...
...
@@ -17,7 +16,7 @@ abstract class IPriceDetailsAction<PriceDetailsVo>
/// 商品举报
/// [reportType] 举报类型
///
void
report
({
String
reportType
});
void
report
({
String
?
reportType
});
///
/// 用户点赞
...
...
@@ -34,7 +33,7 @@ abstract class IPriceDetailsAction<PriceDetailsVo>
///
/// 用户点击购买
///
Future
<
TurnChainEntity
>
goToBuyEvent
();
Future
<
TurnChainEntity
?
>
goToBuyEvent
();
///
/// 凑单购买
...
...
@@ -42,7 +41,7 @@ abstract class IPriceDetailsAction<PriceDetailsVo>
/// [platform] 平台
///
///
Future
<
TurnChainEntity
>
goToBuyItemId
({
String
itemId
,
String
platform
});
Future
<
TurnChainEntity
?>
goToBuyItemId
({
String
?
itemId
,
String
?
platform
});
///
/// 获取举报配置信息
...
...
@@ -53,16 +52,16 @@ abstract class IPriceDetailsAction<PriceDetailsVo>
class
PriceDetailsAction
extends
IPriceDetailsAction
<
PriceDetailsVo
>
{
PriceDetailsService
_detailsService
=
PriceDetailsService
();
IPriceDetailsActionDelegate
_actionDelegate
;
IPriceDetailsActionDelegate
?
_actionDelegate
;
Map
<
int
,
dynamic
>
_platformIconMap
;
Map
<
int
,
dynamic
>
?
_platformIconMap
;
List
<
dynamic
>
_sellReportList
=
[];
@override
List
<
dynamic
>
get
sellReportList
=>
_sellReportList
;
PriceDetailsAction
(
{
Map
<
String
,
dynamic
>
param
,
IPriceDetailsActionDelegate
delegate
})
{
{
required
Map
<
String
,
dynamic
>
param
,
IPriceDetailsActionDelegate
?
delegate
})
{
eventBus
.
on
<
PlatformIconEvent
>().
listen
((
event
)
{
_platformIconMap
=
event
.
map
;
});
...
...
@@ -71,15 +70,15 @@ class PriceDetailsAction extends IPriceDetailsAction<PriceDetailsVo> {
this
.
_actionDelegate
=
delegate
;
this
.
vm
=
PriceDetailsVo
(
productId:
param
[
'productId'
]);
if
(
param
[
'src'
]
!=
null
&&
param
[
'src'
]
is
String
)
{
this
.
vm
.
itemPic
=
[
param
[
'src'
]];
this
.
vm
!
.
itemPic
=
[
param
[
'src'
]];
}
if
(
param
[
'title'
]
!=
null
&&
param
[
'title'
]
is
String
)
{
this
.
vm
.
itemTitle
=
param
[
'title'
];
this
.
vm
!
.
itemTitle
=
param
[
'title'
];
}
if
(
param
[
'sellReportList'
]
is
List
)
{
_sellReportList
=
List
<
dynamic
>.
from
(
param
[
'sellReportList'
]);
try
{
this
.
vm
.
reports
=
this
.
vm
!
.
reports
=
List
<
ReportModel
>.
generate
(
sellReportList
.
length
,
(
index
)
{
Map
<
String
,
dynamic
>
sellReport
=
Map
<
String
,
dynamic
>.
from
(
sellReportList
[
index
]);
...
...
@@ -101,9 +100,9 @@ class PriceDetailsAction extends IPriceDetailsAction<PriceDetailsVo> {
}
@override
void
report
({
String
reportType
})
async
{
void
report
({
String
?
reportType
})
async
{
_detailsService
.
report
(
id:
this
.
vm
.
productId
,
reportType:
reportType
)
.
report
(
id:
this
.
vm
!.
productId
!,
reportType:
reportType
!
)
.
asStream
()
.
first
.
then
((
value
)
{
...
...
@@ -123,8 +122,8 @@ class PriceDetailsAction extends IPriceDetailsAction<PriceDetailsVo> {
disableLike
=
true
;
_detailsService
.
userLike
(
markId:
this
.
vm
.
productId
,
platform:
this
.
vm
.
platform
,
markId:
this
.
vm
!.
productId
!
,
platform:
this
.
vm
!.
platform
!
,
status:
status
?
'2'
:
'1'
)
.
asStream
()
.
first
...
...
@@ -132,15 +131,15 @@ class PriceDetailsAction extends IPriceDetailsAction<PriceDetailsVo> {
if
(
value
[
'code'
]
==
2000
)
{
if
(
status
)
{
try
{
this
.
vm
.
likeTimes
=
'
${int.parse(this.vm.likeTimes
) - 1}
'
;
this
.
vm
!.
likeTimes
=
'
${int.parse(this.vm!.likeTimes!
) - 1}
'
;
}
catch
(
e
)
{}
}
else
{
try
{
this
.
vm
.
likeTimes
=
'
${int.parse(this.vm.likeTimes
) + 1}
'
;
this
.
vm
!.
likeTimes
=
'
${int.parse(this.vm!.likeTimes!
) + 1}
'
;
}
catch
(
e
)
{}
}
this
.
vm
.
isLike
=
!
status
;
this
.
vm
.
notifyListener
(
true
);
this
.
vm
!
.
isLike
=
!
status
;
this
.
vm
!
.
notifyListener
(
true
);
}
})
.
catchError
((
error
)
{})
...
...
@@ -157,8 +156,8 @@ class PriceDetailsAction extends IPriceDetailsAction<PriceDetailsVo> {
disableCollect
=
true
;
_detailsService
.
userCollect
(
itemId:
this
.
vm
.
productId
,
platform:
this
.
vm
.
platform
,
itemId:
this
.
vm
!.
productId
!
,
platform:
this
.
vm
!.
platform
!
,
status:
status
?
'2'
:
'1'
)
.
asStream
()
.
first
...
...
@@ -169,15 +168,15 @@ class PriceDetailsAction extends IPriceDetailsAction<PriceDetailsVo> {
}
if
(
status
)
{
try
{
this
.
vm
.
collegeTimes
=
'
${int.parse(this.vm.collegeTimes
) - 1}
'
;
this
.
vm
!.
collegeTimes
=
'
${int.parse(this.vm!.collegeTimes!
) - 1}
'
;
}
catch
(
e
)
{}
}
else
{
try
{
this
.
vm
.
collegeTimes
=
'
${int.parse(this.vm.collegeTimes
) + 1}
'
;
this
.
vm
!.
collegeTimes
=
'
${int.parse(this.vm!.collegeTimes!
) + 1}
'
;
}
catch
(
e
)
{}
}
this
.
vm
.
isFavorites
=
!
status
;
this
.
vm
.
notifyListener
(
true
);
this
.
vm
!
.
isFavorites
=
!
status
;
this
.
vm
!
.
notifyListener
(
true
);
}
})
.
catchError
((
error
)
{})
...
...
@@ -188,63 +187,63 @@ class PriceDetailsAction extends IPriceDetailsAction<PriceDetailsVo> {
@override
void
initState
()
async
{
this
.
vm
.
viewState
=
DSViewState
.
busy
;
this
.
vm
!
.
viewState
=
DSViewState
.
busy
;
_detailsService
.
qryProductDetails
(
productId:
this
.
vm
.
productId
)
.
qryProductDetails
(
productId:
this
.
vm
!.
productId
!
)
.
asStream
()
.
first
.
then
((
value
)
{
this
.
vm
.
viewState
=
DSViewState
.
idle
;
this
.
vm
.
itemPic
=
value
.
itemPic
;
this
.
vm
.
itemId
=
value
.
itemId
;
this
.
vm
.
platform
=
value
.
platform
;
this
.
vm
.
platformText
=
_getPlatformName
(
int
.
parse
(
value
.
platform
));
this
.
vm
.
itemTitle
=
value
.
itemTitle
;
this
.
vm
.
subTitle
=
value
.
subTitle
;
this
.
vm
.
status
=
value
.
status
;
this
.
vm
.
likeTimes
=
value
.
likeTimes
;
this
.
vm
.
collegeTimes
=
value
.
collegeTimes
;
this
.
vm
.
buttonText
=
value
.
buttonText
;
this
.
vm
.
description
=
value
.
description
;
this
.
vm
.
releaseTime
=
value
.
releaseTime
;
this
.
vm
.
couponText
=
value
.
couponText
;
this
.
vm
.
checkText
=
value
.
checkText
;
this
.
vm
.
coupons
=
value
.
coupons
;
this
.
vm
.
shareUrl
=
value
.
shareUrl
;
this
.
vm
.
price
=
value
.
price
;
this
.
vm
.
endPrice
=
value
.
endPrice
;
this
.
vm
.
shareMessage
=
value
.
shareMessage
;
this
.
vm
.
isLike
=
value
.
isLike
;
this
.
vm
.
isFavorites
=
value
.
isFavorites
;
this
.
vm
.
isOverdue
=
value
.
isOverdue
;
this
.
vm
.
shopTitle
=
value
.
shopTitle
;
this
.
vm
.
rebate
=
value
.
rebate
;
this
.
vm
.
collectOrders
=
value
.
collectOrders
;
this
.
vm
.
newItemInfo
=
value
.
newItemInfo
;
this
.
vm
!
.
viewState
=
DSViewState
.
idle
;
this
.
vm
!
.
itemPic
=
value
.
itemPic
;
this
.
vm
!
.
itemId
=
value
.
itemId
;
this
.
vm
!
.
platform
=
value
.
platform
;
this
.
vm
!.
platformText
=
_getPlatformName
(
int
.
parse
(
value
.
platform
!
));
this
.
vm
!
.
itemTitle
=
value
.
itemTitle
;
this
.
vm
!
.
subTitle
=
value
.
subTitle
;
this
.
vm
!
.
status
=
value
.
status
;
this
.
vm
!
.
likeTimes
=
value
.
likeTimes
;
this
.
vm
!
.
collegeTimes
=
value
.
collegeTimes
;
this
.
vm
!
.
buttonText
=
value
.
buttonText
;
this
.
vm
!
.
description
=
value
.
description
;
this
.
vm
!
.
releaseTime
=
value
.
releaseTime
;
this
.
vm
!
.
couponText
=
value
.
couponText
;
this
.
vm
!
.
checkText
=
value
.
checkText
;
this
.
vm
!
.
coupons
=
value
.
coupons
;
this
.
vm
!
.
shareUrl
=
value
.
shareUrl
;
this
.
vm
!
.
price
=
value
.
price
;
this
.
vm
!
.
endPrice
=
value
.
endPrice
;
this
.
vm
!
.
shareMessage
=
value
.
shareMessage
;
this
.
vm
!
.
isLike
=
value
.
isLike
;
this
.
vm
!
.
isFavorites
=
value
.
isFavorites
;
this
.
vm
!
.
isOverdue
=
value
.
isOverdue
;
this
.
vm
!
.
shopTitle
=
value
.
shopTitle
;
this
.
vm
!
.
rebate
=
value
.
rebate
;
this
.
vm
!
.
collectOrders
=
value
.
collectOrders
;
this
.
vm
!
.
newItemInfo
=
value
.
newItemInfo
;
}).
catchError
((
error
)
{
this
.
vm
.
viewState
=
DSViewState
.
idle
;
this
.
vm
!
.
viewState
=
DSViewState
.
idle
;
}).
catchError
((
error
)
{
this
.
vm
.
viewState
=
DSViewState
.
error
;
this
.
vm
!
.
viewState
=
DSViewState
.
error
;
}).
whenComplete
(()
{
_detailsService
.
getSellingRecommends
(
excludeId:
this
.
vm
.
productId
,
keywords:
this
.
vm
.
itemTitle
,
excludeId:
this
.
vm
!
.
productId
,
keywords:
this
.
vm
!
.
itemTitle
,
page:
1
,
pagesize:
7
,
)
.
then
((
value
)
{
if
(
value
.
isSuccess
)
{
this
.
vm
.
productEntitys
=
value
.
data
;
this
.
vm
.
productEntitys
.
forEach
((
ele
)
{
ele
.
releaseTime
=
TimeUtils
.
formatTime
(
timestamp:
ele
.
releaseTime
);
ele
.
platform
=
_getPlatformName
(
int
.
parse
(
ele
.
platform
));
this
.
vm
!
.
productEntitys
=
value
.
data
;
this
.
vm
!.
productEntitys
!
.
forEach
((
ele
)
{
ele
.
releaseTime
=
TimeUtils
.
formatTime
(
timestamp:
ele
.
releaseTime
!
);
ele
.
platform
=
_getPlatformName
(
int
.
parse
(
ele
.
platform
!
));
});
}
}).
catchError
((
error
)
{
print
(
error
);
}).
whenComplete
(()
{
this
.
vm
.
notifyListener
(
true
);
this
.
vm
!
.
notifyListener
(
true
);
});
});
}
...
...
@@ -254,19 +253,19 @@ class PriceDetailsAction extends IPriceDetailsAction<PriceDetailsVo> {
/// [platform] 平台id
///
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
>.
from
(
_platformIconMap
[
platform
]);
Map
<
String
,
dynamic
>.
from
(
_platformIconMap
!
[
platform
]);
return
platformMap
[
'name'
]
??
''
;
}
return
''
;
}
@override
Future
<
TurnChainEntity
>
goToBuyEvent
()
async
{
Future
<
TurnChainEntity
?
>
goToBuyEvent
()
async
{
DSResponseObject
<
TurnChainEntity
>
resObject
=
await
_detailsService
.
turnChainForItemId
(
itemId:
this
.
vm
.
itemId
,
platform:
this
.
vm
.
platform
,
type:
'6'
)
itemId:
this
.
vm
!.
itemId
!,
platform:
this
.
vm
!.
platform
!
,
type:
'6'
)
.
asStream
()
.
first
;
if
(
resObject
.
isSuccess
)
{
...
...
@@ -276,15 +275,15 @@ class PriceDetailsAction extends IPriceDetailsAction<PriceDetailsVo> {
}
@override
Future
<
TurnChainEntity
>
goToBuyItemId
({
String
itemId
,
String
platform
,
Future
<
TurnChainEntity
?
>
goToBuyItemId
({
String
?
itemId
,
String
?
platform
,
})
async
{
if
(
platform
==
null
)
{
platform
=
this
.
vm
.
platform
;
platform
=
this
.
vm
!
.
platform
;
}
DSResponseObject
<
TurnChainEntity
>
resObject
=
await
_detailsService
.
turnChainForItemId
(
itemId:
itemId
,
platform:
platform
,
type:
'6'
)
.
turnChainForItemId
(
itemId:
itemId
!,
platform:
platform
!
,
type:
'6'
)
.
asStream
()
.
first
;
if
(
resObject
.
isSuccess
)
{
...
...
@@ -298,5 +297,5 @@ class PriceDetailsAction extends IPriceDetailsAction<PriceDetailsVo> {
/// 代理类,类似接口
///
abstract
class
IPriceDetailsActionDelegate
{
void
showTipsMsg
({
@
required
String
msg
});
void
showTipsMsg
({
required
String
msg
});
}
lib/page/action/discount/index.dart
View file @
3e21f1ca
...
...
@@ -28,15 +28,15 @@ abstract class IPriceDiscountAction<PriceDiscountVo>
PriceDiscountVo
get
getVo
;
}
class
PriceDiscountAction
extends
IPriceDiscountAction
<
PriceDiscountVo
>
{
class
PriceDiscountAction
extends
IPriceDiscountAction
<
PriceDiscountVo
?
>
{
PriceRepository
_priceRepository
=
PriceRepository
.
get
();
Map
<
int
,
dynamic
>
_platformIconMap
;
IPriceDiscountDelegate
_discountDelegate
;
Map
<
String
,
dynamic
>
_pageParam
;
Map
<
int
,
dynamic
>
?
_platformIconMap
;
IPriceDiscountDelegate
?
_discountDelegate
;
Map
<
String
,
dynamic
>
?
_pageParam
;
PriceDiscountAction
({
IPriceDiscountDelegate
delegate
,
Map
<
String
,
dynamic
>
pageParam
,
IPriceDiscountDelegate
?
delegate
,
Map
<
String
,
dynamic
>
?
pageParam
,
})
{
this
.
_pageParam
=
pageParam
;
_discountDelegate
=
delegate
;
...
...
@@ -61,7 +61,7 @@ class PriceDiscountAction extends IPriceDiscountAction<PriceDiscountVo> {
pagesize:
10
,
isRefresh:
true
,
);
this
.
vm
.
notifyListener
();
this
.
vm
!
.
notifyListener
();
}
@override
...
...
@@ -85,12 +85,12 @@ class PriceDiscountAction extends IPriceDiscountAction<PriceDiscountVo> {
})
{
currentPage
=
page
;
if
(
isFirst
)
{
this
.
vm
.
viewState
=
DSViewState
.
busy
;
this
.
vm
!
.
viewState
=
DSViewState
.
busy
;
}
_priceRepository
.
getSellingRecommends
(
keywords:
_pageParam
[
'keywords'
],
excludeId:
_pageParam
[
'excludeId'
],
keywords:
_pageParam
!
[
'keywords'
],
excludeId:
_pageParam
!
[
'excludeId'
],
page:
page
,
pagesize:
pagesize
,
)
...
...
@@ -99,37 +99,37 @@ class PriceDiscountAction extends IPriceDiscountAction<PriceDiscountVo> {
List
<
ProductItemEntity
>
productEntitys
=
value
.
data
;
productEntitys
.
forEach
((
ele
)
{
ele
.
releaseTime
=
TimeUtils
.
formatTime
(
timestamp:
ele
.
releaseTime
);
ele
.
platform
=
_getPlatformName
(
int
.
parse
(
ele
.
platform
));
ele
.
releaseTime
=
TimeUtils
.
formatTime
(
timestamp:
ele
.
releaseTime
!
);
ele
.
platform
=
_getPlatformName
(
int
.
parse
(
ele
.
platform
!
));
});
if
(
isLoad
)
{
if
(
this
.
vm
.
productEntitys
==
null
)
{
this
.
vm
.
productEntitys
=
List
<
ProductItemEntity
>.
empty
(
growable:
true
);
if
(
this
.
vm
!
.
productEntitys
==
null
)
{
this
.
vm
!
.
productEntitys
=
List
<
ProductItemEntity
>.
empty
(
growable:
true
);
}
this
.
vm
.
productEntitys
.
addAll
(
productEntitys
);
this
.
vm
!.
productEntitys
!
.
addAll
(
productEntitys
);
}
else
{
this
.
vm
.
productEntitys
=
productEntitys
;
if
(
this
.
vm
.
productEntitys
.
isEmpty
)
{
this
.
vm
.
viewState
=
DSViewState
.
empty
;
this
.
vm
!
.
productEntitys
=
productEntitys
;
if
(
this
.
vm
!.
productEntitys
!
.
isEmpty
)
{
this
.
vm
!
.
viewState
=
DSViewState
.
empty
;
}
else
{
this
.
vm
.
viewState
=
DSViewState
.
idle
;
this
.
vm
!
.
viewState
=
DSViewState
.
idle
;
}
}
}
if
(
isLoad
)
{
_discountDelegate
.
onLoadComplete
(
isLoading:
true
);
_discountDelegate
!
.
onLoadComplete
(
isLoading:
true
);
}
else
if
(
isRefresh
)
{
_discountDelegate
.
onLoadComplete
(
isLoading:
false
);
_discountDelegate
!
.
onLoadComplete
(
isLoading:
false
);
}
}).
catchError
((
error
)
{
this
.
vm
.
viewState
=
DSViewState
.
error
;
this
.
vm
!
.
viewState
=
DSViewState
.
error
;
if
(
isLoad
)
{
_discountDelegate
.
onloadFailed
(
isLoading:
true
);
_discountDelegate
!
.
onloadFailed
(
isLoading:
true
);
}
else
if
(
isRefresh
)
{
_discountDelegate
.
onloadFailed
(
isLoading:
false
);
_discountDelegate
!
.
onloadFailed
(
isLoading:
false
);
}
}).
whenComplete
(()
{
this
.
vm
.
notifyListener
();
this
.
vm
!
.
notifyListener
();
});
}
...
...
@@ -138,16 +138,16 @@ class PriceDiscountAction extends IPriceDiscountAction<PriceDiscountVo> {
/// [platform] 平台id
///
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
>.
from
(
_platformIconMap
[
platform
]);
Map
<
String
,
dynamic
>.
from
(
_platformIconMap
!
[
platform
]);
return
platformMap
[
'name'
]
??
''
;
}
return
''
;
}
@override
PriceDiscountVo
get
getVo
=>
this
.
vm
;
PriceDiscountVo
?
get
getVo
=>
this
.
vm
;
}
///
...
...
@@ -162,5 +162,5 @@ abstract class IPriceDiscountDelegate {
///
/// 数据加载失败
///
void
onloadFailed
({
bool
isLoading
=
true
,
String
msg
});
void
onloadFailed
({
bool
isLoading
=
true
,
String
?
msg
});
}
lib/page/action/index.dart
View file @
3e21f1ca
...
...
@@ -9,16 +9,16 @@ abstract class IPriceAction<PriceVo> extends IDSAction<PriceVo> {
///
/// 代理设置
///
IPriceAction
({
IPriceActionDelegate
delegate
,
bool
isGrid
});
IPriceAction
({
IPriceActionDelegate
?
delegate
,
bool
?
isGrid
});
///
/// 设置分类参数
///
void
setPriceCategory
(
{
List
<
dynamic
>
sellingTabList
,
List
<
dynamic
>
priceCategory
,
Map
<
int
,
dynamic
>
platformIconMap
,
String
keywords
});
{
List
<
dynamic
>
?
sellingTabList
,
List
<
dynamic
>
?
priceCategory
,
Map
<
int
,
dynamic
>
?
platformIconMap
,
String
?
keywords
});
///
/// 获取分类Tab
...
...
@@ -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> {
class
PriceAction
extends
IPriceAction
<
PriceVo
>
{
PriceRepository
_repository
=
PriceRepository
.
get
();
Map
<
int
,
dynamic
>
platformIconMap
;
String
keywords
;
bool
isGrid
=
false
;
IPriceActionDelegate
delegate
;
Map
<
int
,
dynamic
>
?
platformIconMap
;
String
?
keywords
;
bool
?
isGrid
=
false
;
IPriceActionDelegate
?
delegate
;
PriceAction
({
this
.
delegate
,
this
.
isGrid
})
:
super
(
delegate:
delegate
);
@override
...
...
@@ -82,14 +82,14 @@ class PriceAction extends IPriceAction<PriceVo> {
}
@override
List
<
dynamic
>
get
sellingTabs
=>
this
.
vm
.
sellingTabs
??
[];
List
<
dynamic
>
get
sellingTabs
=>
this
.
vm
!
.
sellingTabs
??
[];
@override
void
setPriceCategory
(
{
List
<
dynamic
>
sellingTabList
,
List
<
dynamic
>
priceCategory
,
Map
<
int
,
dynamic
>
platformIconMap
,
String
keywords
})
{
{
List
<
dynamic
>
?
sellingTabList
,
List
<
dynamic
>
?
priceCategory
,
Map
<
int
,
dynamic
>
?
platformIconMap
,
String
?
keywords
})
{
this
.
platformIconMap
=
platformIconMap
;
this
.
page
=
1
;
if
(
keywords
!=
null
&&
keywords
.
isNotEmpty
)
{
...
...
@@ -99,16 +99,16 @@ class PriceAction extends IPriceAction<PriceVo> {
if
(
this
.
vm
==
null
)
{
this
.
vm
=
PriceVo
();
}
if
(
this
.
vm
.
tabListVo
==
null
)
{
this
.
vm
.
tabListVo
=
TabListVo
();
if
(
this
.
vm
!
.
tabListVo
==
null
)
{
this
.
vm
!
.
tabListVo
=
TabListVo
();
}
this
.
vm
.
sellingTabs
=
sellingTabList
;
this
.
vm
!
.
sellingTabs
=
sellingTabList
;
dynamic
data
=
this
.
vm
.
vm
!
.
sellingTabs
?.
singleWhere
((
ele
)
=>
ele
[
'is_default'
]
==
'1'
,
orElse:
()
=>
null
);
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
)
{
List
<
TabVo
>
tabList
=
List
<
TabVo
>.
empty
(
growable:
true
);
...
...
@@ -117,22 +117,22 @@ class PriceAction extends IPriceAction<PriceVo> {
tabList
.
add
(
TabVo
.
fromJson
(
'
${categoryMap['type']}
'
,
Map
<
String
,
dynamic
>.
from
(
ele
)));
});
TabListVo
tabListVo
=
this
.
vm
.
tabListVo
;
TabListVo
tabListVo
=
this
.
vm
!.
tabListVo
!
;
tabListVo
.
tabList
=
tabList
;
this
.
vm
.
tabListVo
=
tabListVo
;
this
.
vm
!
.
tabListVo
=
tabListVo
;
}
TabListVo
tabListVo
=
this
.
vm
.
tabListVo
;
String
categoryId
;
if
(
tabListVo
.
sellTab
!=
null
&&
tabListVo
.
sellTab
[
'id'
]
!=
null
)
{
categoryId
=
"
${tabListVo.sellTab['id']}
"
;
TabListVo
tabListVo
=
this
.
vm
!.
tabListVo
!
;
String
?
categoryId
;
if
(
tabListVo
.
sellTab
!=
null
&&
tabListVo
.
sellTab
!
[
'id'
]
!=
null
)
{
categoryId
=
"
${tabListVo.sellTab
!
['id']}
"
;
}
_qryProductList
(
keywords:
keywords
,
categoryId:
categoryId
);
}
@override
TabListVo
getTabListVo
()
{
return
this
.
vm
.
tabListVo
??
TabListVo
();
return
this
.
vm
!
.
tabListVo
??
TabListVo
();
}
@override
...
...
@@ -145,12 +145,12 @@ class PriceAction extends IPriceAction<PriceVo> {
///
@override
void
resetProductList
()
async
{
for
(
TabVo
item
in
this
.
vm
.
tabListVo
?.
tabList
??
[])
{
for
(
TabVo
item
in
this
.
vm
!
.
tabListVo
?.
tabList
??
[])
{
item
.
selected
=
null
;
item
.
open
=
false
;
}
this
.
vm
.
tabListVo
?.
sellTab
=
null
;
this
.
vm
.
tabListVo
?.
notifyListener
(
true
);
this
.
vm
!
.
tabListVo
?.
sellTab
=
null
;
this
.
vm
!
.
tabListVo
?.
notifyListener
(
true
);
_qryProductList
(
keywords:
this
.
keywords
);
}
...
...
@@ -158,12 +158,12 @@ class PriceAction extends IPriceAction<PriceVo> {
/// 过滤筛选条件
///
@override
void
qryProductListEvent
({
String
keywords
,
int
page
=
1
})
async
{
void
qryProductListEvent
({
String
?
keywords
,
int
?
page
=
1
})
async
{
if
(
keywords
!=
null
)
{
this
.
keywords
=
keywords
;
}
List
<
dynamic
>
filters
;
this
.
vm
.
tabListVo
?.
tabList
?
.
forEach
((
ele
)
{
List
<
dynamic
>
?
filters
;
this
.
vm
!.
tabListVo
?.
tabList
.
forEach
((
ele
)
{
if
(
filters
==
null
)
{
filters
=
List
<
dynamic
>.
empty
(
growable:
true
);
}
...
...
@@ -172,39 +172,39 @@ class PriceAction extends IPriceAction<PriceVo> {
if
(
ele
.
keyName
==
'category'
)
{
data
=
{
'key_name'
:
ele
.
keyName
,
'key_value'
:
'
${ele.selected['id']}
'
'key_value'
:
'
${ele.selected
!
['id']}
'
};
}
else
if
(
ele
.
keyName
==
'price_section'
)
{
data
=
{
'key_name'
:
ele
.
keyName
,
'key_value'
:
ele
.
selected
[
'price_section'
]
'key_value'
:
ele
.
selected
!
[
'price_section'
]
};
}
else
{
data
=
{
'key_name'
:
ele
.
keyName
,
'key_value'
:
'
${ele.selected['type']}
'
'key_value'
:
'
${ele.selected
!
['type']}
'
};
}
if
(
data
!=
null
&&
data
.
isNotEmpty
)
{
filters
.
add
(
data
);
if
(
data
.
isNotEmpty
)
{
filters
!
.
add
(
data
);
}
}
});
TabListVo
tabListVo
=
this
.
vm
.
tabListVo
;
String
categoryId
;
if
(
tabListVo
.
sellTab
!=
null
&&
tabListVo
.
sellTab
[
'id'
]
!=
null
)
{
categoryId
=
"
${tabListVo.sellTab['id']}
"
;
TabListVo
tabListVo
=
this
.
vm
!.
tabListVo
!
;
String
?
categoryId
;
if
(
tabListVo
.
sellTab
!=
null
&&
tabListVo
.
sellTab
!
[
'id'
]
!=
null
)
{
categoryId
=
"
${tabListVo.sellTab
!
['id']}
"
;
}
_qryProductList
(
keywords:
this
.
keywords
,
filters:
filters
,
page:
page
,
page:
page
!
,
categoryId:
categoryId
);
}
@override
void
closeTab
()
{
TabListVo
tabListVo
=
this
.
vm
.
tabListVo
;
TabListVo
tabListVo
=
this
.
vm
!.
tabListVo
!
;
tabListVo
.
tabList
.
forEach
((
ele
)
{
ele
.
open
=
false
;
});
...
...
@@ -212,9 +212,9 @@ class PriceAction extends IPriceAction<PriceVo> {
}
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
>.
from
(
platformIconMap
[
platform
]);
Map
<
String
,
dynamic
>.
from
(
platformIconMap
!
[
platform
]);
return
platformMap
[
'name'
]
??
''
;
}
return
''
;
...
...
@@ -223,10 +223,10 @@ class PriceAction extends IPriceAction<PriceVo> {
void
_qryProductList
(
{
int
page
=
1
,
int
pagesize
=
10
,
String
keywords
,
String
categoryId
,
List
<
dynamic
>
filters
})
async
{
this
.
page
=
page
??
1
;
String
?
keywords
,
String
?
categoryId
,
List
<
dynamic
>
?
filters
})
async
{
this
.
page
=
page
;
await
_repository
.
qryProductList
(
page:
page
,
...
...
@@ -242,8 +242,8 @@ class PriceAction extends IPriceAction<PriceVo> {
if
(
value
.
isSuccess
)
{
productList
=
value
.
data
;
productList
.
forEach
((
ele
)
{
ele
.
releaseTime
=
TimeUtils
.
formatTime
(
timestamp:
ele
.
releaseTime
);
ele
.
platform
=
getPlatformName
(
int
.
parse
(
ele
.
platform
));
ele
.
releaseTime
=
TimeUtils
.
formatTime
(
timestamp:
ele
.
releaseTime
!
);
ele
.
platform
=
getPlatformName
(
int
.
parse
(
ele
.
platform
!
));
});
}
this
.
vm
?.
productListVo
?.
productList
=
productList
;
...
...
@@ -252,11 +252,10 @@ class PriceAction extends IPriceAction<PriceVo> {
if
(
value
.
isSuccess
)
{
productList
=
value
.
data
;
productList
.
forEach
((
ele
)
{
ele
.
releaseTime
=
TimeUtils
.
formatTime
(
timestamp:
ele
.
releaseTime
);
ele
.
platform
=
getPlatformName
(
int
.
parse
(
ele
.
platform
));
ele
.
releaseTime
=
TimeUtils
.
formatTime
(
timestamp:
ele
.
releaseTime
!
);
ele
.
platform
=
getPlatformName
(
int
.
parse
(
ele
.
platform
!
));
});
this
.
vm
?.
productListVo
?.
productList
?.
addAll
(
productList
);
this
.
vm
?.
productListVo
?.
productList
.
addAll
(
productList
);
}
}
delegate
?.
onLoadComplete
();
...
...
@@ -293,5 +292,5 @@ abstract class IPriceActionDelegate {
///
/// 数据加载失败
///
void
onloadFailed
({
String
msg
});
void
onloadFailed
({
String
?
msg
});
}
lib/page/model/details/index.dart
View file @
3e21f1ca
...
...
@@ -2,50 +2,50 @@ import 'package:price_module/framework/model/ds_model.dart';
import
'package:xiaoxiong_repository/entity/product_item_entity.dart'
;
class
PriceDetailsVo
extends
IDSModel
{
String
productId
;
List
<
String
>
itemPic
;
String
itemTitle
;
String
subTitle
;
String
description
;
String
status
;
String
?
productId
;
List
<
String
?>?
itemPic
;
String
?
itemTitle
;
String
?
subTitle
;
String
?
description
;
String
?
status
;
//商品的ItemId
String
itemId
;
String
?
itemId
;
//平台Id
String
platform
;
String
?
platform
;
//平台名称
String
platformText
;
String
?
platformText
;
//喜欢次数
String
likeTimes
;
String
?
likeTimes
;
//收藏次数
String
collegeTimes
;
String
?
collegeTimes
;
//是否喜欢和收藏
bool
isLike
=
false
;
bool
isFavorites
=
false
;
//Button按钮的文字
String
buttonText
;
String
price
;
String
endPrice
;
String
?
buttonText
;
String
?
price
;
String
?
endPrice
;
//发布时间
String
releaseTime
;
String
checkText
;
String
?
releaseTime
;
String
?
checkText
;
//分享文字和分享URL
String
shareUrl
;
String
shareMessage
;
String
?
shareUrl
;
String
?
shareMessage
;
//优惠卷
List
<
Coupon
>
coupons
=
[];
//举报
List
<
ReportModel
>
reports
=
[];
List
<
ReportModel
>
?
reports
=
[];
//优惠卷过期描述
String
couponText
;
String
?
couponText
;
String
isOverdue
;
String
shopTitle
;
String
rebate
;
List
<
dynamic
>
collectOrders
;
Map
<
String
,
dynamic
>
newItemInfo
;
String
?
isOverdue
;
String
?
shopTitle
;
String
?
rebate
;
List
<
dynamic
>
?
collectOrders
;
Map
<
String
,
dynamic
>
?
newItemInfo
;
//商品推荐相关信息
List
<
ProductItemEntity
>
productEntitys
;
List
<
ProductItemEntity
>
?
productEntitys
;
PriceDetailsVo
({
this
.
productId
,
...
...
@@ -79,15 +79,15 @@ class PriceDetailsVo extends IDSModel {
}
class
Coupon
{
String
url
;
String
name
;
String
status
;
String
?
url
;
String
?
name
;
String
?
status
;
Coupon
({
this
.
url
,
this
.
name
,
this
.
status
});
}
class
ReportModel
{
String
value
;
String
text
;
List
<
ReportModel
>
sub
=
[];
String
?
value
;
String
?
text
;
List
<
ReportModel
>
?
sub
=
[];
ReportModel
({
this
.
value
,
this
.
text
,
this
.
sub
});
}
lib/page/model/discount/index.dart
View file @
3e21f1ca
...
...
@@ -7,6 +7,6 @@ class PriceDiscountVo extends IDSModel{
///
/// 好价商品列表
///
List
<
ProductItemEntity
>
productEntitys
;
List
<
ProductItemEntity
>
?
productEntitys
;
}
\ No newline at end of file
lib/page/model/index.dart
View file @
3e21f1ca
...
...
@@ -3,12 +3,12 @@ import 'package:xiaoxiong_repository/entity/product_item_entity.dart';
class
PriceVo
extends
IDSModel
{
// 商品列表
ProductListVo
productListVo
;
ProductListVo
?
productListVo
;
//筛选Tab
TabListVo
tabListVo
;
TabListVo
?
tabListVo
;
// 快捷分类列表
List
<
dynamic
>
sellingTabs
;
List
<
dynamic
>
?
sellingTabs
;
PriceVo
({
this
.
productListVo
,
this
.
tabListVo
,
this
.
sellingTabs
});
}
...
...
@@ -17,19 +17,19 @@ class TabListVo extends IDSModel {
//分类
List
<
TabVo
>
tabList
=
[];
//快捷分类
Map
<
String
,
dynamic
>
sellTab
;
Map
<
String
,
dynamic
>
?
sellTab
;
TabListVo
({
this
.
tabList
=
const
[],
this
.
sellTab
});
}
class
TabVo
extends
IDSModel
{
String
type
;
String
text
;
String
keyName
;
String
?
type
;
String
?
text
;
String
?
keyName
;
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
});
...
...
@@ -45,7 +45,7 @@ class TabVo extends IDSModel {
}
class
ProductListVo
extends
IDSModel
{
bool
isGrid
=
false
;
bool
?
isGrid
=
false
;
List
<
ProductItemEntity
>
productList
=
[];
ProductListVo
({
this
.
productList
=
const
[],
this
.
isGrid
=
false
});
}
lib/page/service/details/index.dart
View file @
3e21f1ca
import
'package:flutter/material.dart'
;
import
'package:price_module/framework/model/ds_model.dart'
;
import
'package:price_module/page/model/details/index.dart'
;
import
'package:price_module/utils/time_utils.dart'
;
...
...
@@ -15,15 +14,15 @@ class PriceDetailsService {
/// 查询商品详情
/// [productId] 查询的商品Id
///
Future
<
PriceDetailsVo
>
qryProductDetails
({
@
required
String
productId
})
async
{
Future
<
PriceDetailsVo
>
qryProductDetails
({
required
String
productId
})
async
{
return
await
_priceRepository
.
qryProductDetails
(
id:
productId
)
.
asStream
()
.
map
((
event
)
{
PriceDetailsVo
detailsVo
;
PriceDetailsVo
?
detailsVo
;
if
(
event
.
isSuccess
)
{
detailsVo
=
PriceDetailsVo
();
ProductDetailsEntity
entity
=
event
.
data
;
ProductDetailsEntity
entity
=
event
.
data
!
;
detailsVo
.
viewState
=
DSViewState
.
idle
;
detailsVo
.
likeTimes
=
entity
.
likeTimes
;
detailsVo
.
collegeTimes
=
entity
.
collegeTimes
;
...
...
@@ -40,18 +39,16 @@ class PriceDetailsService {
detailsVo
.
isFavorites
=
entity
.
isCollect
==
'1'
;
detailsVo
.
shareMessage
=
entity
.
shareMessage
??
''
;
detailsVo
.
shareUrl
=
entity
.
shareUrl
??
''
;
if
(
entity
.
releaseTime
!=
null
&&
entity
.
releaseTime
.
length
>
0
)
{
if
(
entity
.
releaseTime
!=
null
&&
entity
.
releaseTime
!
.
length
>
0
)
{
detailsVo
.
releaseTime
=
TimeUtils
.
formatTime
(
timestamp:
entity
.
releaseTime
);
TimeUtils
.
formatTime
(
timestamp:
entity
.
releaseTime
!
);
}
detailsVo
.
checkText
=
entity
.
checkText
??
''
;
detailsVo
.
endPrice
=
entity
.
endPrice
;
detailsVo
.
price
=
entity
.
price
;
detailsVo
.
coupons
=
List
.
generate
(
entity
.
couponInfos
?.
length
,
(
index
)
{
CouponInfo
info
=
entity
.
couponInfos
[
index
];
return
Coupon
(
name:
info
.
couponName
,
url:
info
.
url
,
status:
info
.
status
);
detailsVo
.
coupons
=
List
.
generate
(
entity
.
couponInfos
?.
length
??
0
,
(
index
)
{
CouponInfo
info
=
entity
.
couponInfos
![
index
];
return
Coupon
(
name:
info
.
couponName
,
url:
info
.
url
,
status:
info
.
status
);
});
detailsVo
.
isOverdue
=
entity
.
isOverdue
;
detailsVo
.
shopTitle
=
entity
.
shopTitle
;
...
...
@@ -75,8 +72,8 @@ class PriceDetailsService {
/// [pagesize] 当前页显示的大小
///
Future
<
DSResponseList
<
ProductItemEntity
>>
getSellingRecommends
({
String
keywords
,
String
excludeId
,
String
?
keywords
,
String
?
excludeId
,
int
page
=
1
,
int
pagesize
=
10
,
})
async
{
...
...
@@ -94,7 +91,7 @@ class PriceDetailsService {
/// [report_type] 举报的商品类型
///
Future
<
dynamic
>
report
(
{
@required
String
id
,
@
required
String
reportType
})
async
{
{
required
String
id
,
required
String
reportType
})
async
{
return
await
_priceRepository
.
report
(
id:
id
,
reportType:
reportType
)
.
asStream
()
...
...
@@ -111,8 +108,8 @@ class PriceDetailsService {
/// [platform] 平台
///
Future
<
dynamic
>
userLike
(
{
@
required
String
markId
,
@
required
String
platform
,
{
required
String
markId
,
required
String
platform
,
String
type
=
'2'
,
String
status
=
'1'
})
async
{
return
await
_priceRepository
...
...
@@ -128,8 +125,8 @@ class PriceDetailsService {
/// 用户收藏
///
Future
<
dynamic
>
userCollect
(
{
@
required
String
itemId
,
@
required
String
platform
,
{
required
String
itemId
,
required
String
platform
,
String
type
=
'2'
,
String
status
=
'1'
})
async
{
return
await
_priceRepository
...
...
@@ -148,8 +145,8 @@ class PriceDetailsService {
/// [type] 转链类型 好价传6 默认为5
///
Future
<
DSResponseObject
<
TurnChainEntity
>>
turnChainForItemId
(
{
@
required
String
itemId
,
@
required
String
platform
,
{
required
String
itemId
,
required
String
platform
,
String
type
=
'6'
})
async
{
return
await
_priceRepository
.
turnChainForItemId
(
itemId:
itemId
,
platform:
platform
,
type:
type
)
...
...
lib/page/view/details/index.dart
View file @
3e21f1ca
...
...
@@ -16,24 +16,24 @@ import 'package:xiaoxiong_repository/entity/product_item_entity.dart';
class
PriceDetailsPage
extends
StatefulWidget
{
final
Map
<
String
,
dynamic
>
pageParam
;
final
Function
(
Map
<
String
,
dynamic
>)
onCallbackParams
;
final
Function
(
String
,
String
)
onH5Callback
;
final
Function
(
String
)
onCopyLink
;
final
Function
(
Map
<
String
,
dynamic
>)
?
onCallbackParams
;
final
Function
(
String
?,
String
?)?
onH5Callback
;
final
Function
(
String
?
)
onCopyLink
;
final
Widget
Function
(
BuildContext
context
,
PriceDetailsVo
detailsVo
,
GlobalKey
convertKey
,
)
onShareWidget
;
)
?
onShareWidget
;
final
Function
(
BuildContext
context
,
{
String
path
,
String
type
,
@
required
GlobalKey
convertKey
})
onShare
;
{
String
?
path
,
String
?
type
,
required
GlobalKey
convertKey
})
onShare
;
const
PriceDetailsPage
(
{
Key
key
,
@
required
this
.
pageParam
,
{
Key
?
key
,
required
this
.
pageParam
,
this
.
onShareWidget
,
this
.
onCallbackParams
,
this
.
onH5Callback
,
@
required
this
.
onCopyLink
,
@
required
this
.
onShare
})
required
this
.
onCopyLink
,
required
this
.
onShare
})
:
super
(
key:
key
);
@override
...
...
@@ -45,16 +45,16 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
//分享图片key
GlobalKey
_convertKey
=
GlobalKey
();
IPriceDetailsAction
<
PriceDetailsVo
>
_detailsAction
;
IPriceDetailsAction
<
PriceDetailsVo
>
?
_detailsAction
;
ScrollController
scrollController
=
ScrollController
();
bool
silverCollapsed
=
false
;
ValueNotifier
<
int
>
_appBarListenable
=
ValueNotifier
<
int
>(
0
);
AnimationController
likeAnimationController
;
AnimationController
favoritesAnimationController
;
bool
isAudituser
;
AnimationController
?
likeAnimationController
;
AnimationController
?
favoritesAnimationController
;
bool
?
isAudituser
;
@override
void
initState
()
{
likeImages
.
add
(
'assets/images/like/ic_like_unselected.png'
);
...
...
@@ -69,22 +69,22 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
AnimationController
(
vsync:
this
,
duration:
Duration
(
milliseconds:
400
));
Animation
<
double
>
likeAnimation
=
Tween
<
double
>(
begin:
1
,
end:
likeImages
.
length
.
toDouble
()
-
1
)
.
animate
(
likeAnimationController
);
likeAnimationController
.
addListener
(()
{
.
animate
(
likeAnimationController
!
);
likeAnimationController
!
.
addListener
(()
{
likeValueNotifier
.
value
=
likeAnimation
.
value
.
toInt
();
});
favoritesAnimationController
=
AnimationController
(
vsync:
this
,
duration:
Duration
(
milliseconds:
400
));
Animation
<
double
>
favoritesAnimation
=
Tween
<
double
>(
begin:
1
,
end:
favoritesImages
.
length
.
toDouble
()
-
1
)
.
animate
(
favoritesAnimationController
);
favoritesAnimationController
.
addListener
(()
{
.
animate
(
favoritesAnimationController
!
);
favoritesAnimationController
!
.
addListener
(()
{
favoritesValueNotifier
.
value
=
favoritesAnimation
.
value
.
toInt
();
});
super
.
initState
();
try
{
if
(
widget
.
pageParam
[
"isAudituser"
]
!=
null
)
{
isAudituser
=
widget
.
pageParam
[
"isAudituser"
]
as
bool
;
isAudituser
=
widget
.
pageParam
[
"isAudituser"
]
as
bool
?
;
}
}
catch
(
e
)
{}
_detailsAction
=
...
...
@@ -108,12 +108,12 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
/// 好价详情
///
Widget
_buildBody
(
BuildContext
context
,
{
ScrollController
controller
,
@
required
PriceDetailsVo
detailsVo
})
{
{
ScrollController
?
controller
,
required
PriceDetailsVo
detailsVo
})
{
return
NotificationListener
(
child:
Stack
(
children:
[
detailsVo
.
viewState
==
DSViewState
.
busy
?
Container
()
:
widget
.
onShareWidget
(
context
,
detailsVo
,
_convertKey
),
:
widget
.
onShareWidget
!
(
context
,
detailsVo
,
_convertKey
),
Container
(
color:
Colors
.
white
,
child:
ListView
(
...
...
@@ -124,7 +124,7 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
//顶部的滚动栏
buildSwiperWidget
(
images:
detailsVo
?
.
itemPic
??
[]),
buildSwiperWidget
(
images:
detailsVo
.
itemPic
??
[]),
SizedBox
(
height:
16
,
...
...
@@ -132,7 +132,7 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
Container
(
child:
LayoutBuilder
(
builder:
(
BuildContext
context
,
BoxConstraints
constraints
)
{
String
value
=
detailsVo
.
itemTitle
;
String
value
=
detailsVo
.
itemTitle
!
;
return
Text
(
value
,
style:
TextStyle
(
...
...
@@ -156,10 +156,10 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
buildProductNewlastWidget
(
newInfo:
detailsVo
.
newItemInfo
,
goBuy:
()
{
_detailsAction
.
goToBuyEvent
().
then
((
value
)
{
_detailsAction
!
.
goToBuyEvent
().
then
((
value
)
{
if
(
value
!=
null
&&
widget
.
onH5Callback
!=
null
)
{
widget
.
onH5Callback
(
widget
.
onH5Callback
!
(
value
.
appLink
,
value
.
platform
);
}
}).
catchError
((
error
)
{
...
...
@@ -174,7 +174,7 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
if
(
coupon
[
'status'
]
==
'1'
&&
coupon
[
'url'
]
!=
null
)
{
if
(
widget
.
onH5Callback
!=
null
)
{
widget
.
onH5Callback
(
widget
.
onH5Callback
!
(
coupon
[
'url'
],
detailsVo
.
platform
);
}
}
...
...
@@ -186,24 +186,24 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
onCouponTap:
(
Coupon
coupon
)
{
if
(
coupon
.
status
==
'1'
&&
coupon
.
url
!=
null
)
{
if
(
widget
.
onH5Callback
!=
null
)
{
widget
.
onH5Callback
(
widget
.
onH5Callback
!
(
coupon
.
url
,
detailsVo
.
platform
);
}
}
},
onPurchase:
(
data
)
{
if
(
data
==
null
||
data
[
'item_id'
]
==
null
)
{
if
(
data
[
'item_id'
]
==
null
)
{
return
;
}
String
itemId
=
data
[
'item_id'
];
String
platform
=
data
[
'platform'
];
_detailsAction
String
?
itemId
=
data
[
'item_id'
];
String
?
platform
=
data
[
'platform'
];
_detailsAction
!
.
goToBuyItemId
(
itemId:
itemId
,
platform:
platform
)
.
then
(
(
value
)
{
if
(
value
!=
null
&&
widget
.
onH5Callback
!=
null
)
{
widget
.
onH5Callback
(
widget
.
onH5Callback
!
(
value
.
appLink
,
value
.
platform
);
}
},
...
...
@@ -219,7 +219,7 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
//商品详情
Container
(
margin:
EdgeInsets
.
only
(
top:
16
.
w
),
child:
Html
(
data:
detailsVo
?
.
description
??
''
)),
child:
Html
(
data:
detailsVo
.
description
??
''
)),
//举报和提示
detailsVo
.
viewState
==
DSViewState
.
busy
?
Container
(
...
...
@@ -257,7 +257,7 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
RoutePath
.
PRICE_DISCOUNT_PAGE
.
path
(),
arguments:
{
'isAudituser'
:
isAudituser
,
'sellReportList'
:
_detailsAction
.
sellReportList
,
'sellReportList'
:
_detailsAction
!
.
sellReportList
,
'excludeId'
:
detailsVo
.
productId
,
'keywords'
:
detailsVo
.
itemTitle
,
},
...
...
@@ -266,7 +266,7 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
onItemTap:
(
ProductItemEntity
entity
,
int
index
)
async
{
Map
<
String
,
dynamic
>
params
=
{
'isAudituser'
:
isAudituser
,
'sellReportList'
:
_detailsAction
.
sellReportList
,
'sellReportList'
:
_detailsAction
!
.
sellReportList
,
'productId'
:
entity
.
id
,
'src'
:
entity
.
itemPic
,
'title'
:
entity
.
itemTitle
,
...
...
@@ -284,7 +284,8 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
audituser:
isAudituser
,
detailsVo:
detailsVo
,
listenable:
_appBarListenable
,
onSharePressed:
onSharePressed
),
onSharePressed:
(
PriceDetailsVo
?
detailsVo
)=>
onSharePressed
(
detailsVo:
detailsVo
)
),
]),
onNotification:
(
ScrollNotification
notification
)
{
if
(
notification
.
metrics
.
outOfRange
==
true
||
...
...
@@ -307,7 +308,7 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
);
}
void
onSharePressed
({
@required
PriceDetailsVo
detailsVo
})
{
void
onSharePressed
({
required
PriceDetailsVo
?
detailsVo
})
{
List
<
Map
<
String
,
dynamic
>>
items
=
[
{
'key'
:
'friend'
,
...
...
@@ -331,14 +332,14 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
}
];
showShareModalBottom
<
String
>(
context
,
items:
items
,
extras:
{
'product_id'
:
detailsVo
.
productId
,
'product_id'
:
detailsVo
!
.
productId
,
'platform'
:
detailsVo
.
platform
,
'item_id'
:
detailsVo
.
itemId
,
}).
then
((
value
)
async
{
if
(
value
==
'product'
)
{
if
(
widget
.
onCallbackParams
!=
null
)
{
if
(
detailsVo
.
platform
==
'10'
||
detailsVo
.
platform
==
'1'
)
{
widget
.
onCallbackParams
(
widget
.
onCallbackParams
!
(
{
'itemId'
:
detailsVo
.
itemId
,
'platform'
:
detailsVo
.
platform
});
}
else
{
_showShareQRModalBottom
(
context:
context
,
detailsVo:
detailsVo
);
...
...
@@ -353,14 +354,14 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
scene:
value
==
'wechat'
?
WeChatScene
.
SESSION
:
WeChatScene
.
TIMELINE
,
thumbnail:
WeChatImage
.
network
(
detailsVo
.
itemPic
[
0
]
));
thumbnail:
WeChatImage
.
network
(
detailsVo
.
itemPic
![
0
]!
));
shareToWeChat
(
model
).
then
((
value
)
{});
}
catch
(
e
)
{
print
(
"------------------------------> value:
$e
"
);
}
}
else
if
(
value
==
'copyLink'
)
{
if
(
detailsVo
.
shareMessage
!=
null
&&
detailsVo
.
shareMessage
.
isNotEmpty
)
{
detailsVo
.
shareMessage
!
.
isNotEmpty
)
{
widget
.
onCopyLink
(
detailsVo
.
shareMessage
);
FlutterNativeToast
.
showToast
(
'复制成功'
);
}
...
...
@@ -374,7 +375,7 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
/// detailsVo 商品详情
///
void
_showShareQRModalBottom
(
{
BuildContext
context
,
PriceDetailsVo
detailsVo
})
{
{
required
BuildContext
context
,
required
PriceDetailsVo
detailsVo
})
{
List
<
Map
<
String
,
dynamic
>>
items
=
[
{
'key'
:
'photo_save'
,
...
...
@@ -408,13 +409,13 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
/// [reports] 举报弹窗的信息
///
void
_showReceiveModalBottom
(
BuildContext
context
,
{
@
required
List
<
ReportModel
>
reports
})
{
{
required
List
<
ReportModel
>
reports
})
{
showReceiveModalBottom
<
ReportModel
>(
context
,
items:
reports
).
then
((
value
)
{
if
(
value
!=
null
)
{
if
(
value
.
sub
!=
null
&&
value
.
sub
.
length
>
0
)
{
_showReceiveModalBottom
(
context
,
reports:
value
.
sub
);
if
(
value
.
sub
!=
null
&&
value
.
sub
!
.
length
>
0
)
{
_showReceiveModalBottom
(
context
,
reports:
value
.
sub
!
);
}
else
{
_detailsAction
.
report
(
reportType:
value
.
value
);
_detailsAction
!
.
report
(
reportType:
value
.
value
);
}
}
});
...
...
@@ -424,12 +425,12 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
Widget
build
(
BuildContext
context
)
{
return
DSProviderWidget
<
PriceDetailsVo
,
IPriceDetailsAction
<
PriceDetailsVo
>>(
dsAction:
_detailsAction
,
dsAction:
_detailsAction
!
,
builder:
(
BuildContext
context
,
child
)
{
return
Scaffold
(
backgroundColor:
Colors
.
white
,
body:
_buildBody
(
context
,
controller:
scrollController
,
detailsVo:
_detailsAction
.
vm
),
bottomNavigationBar:
_buildNavigationBar
(
detailsVo:
_detailsAction
.
vm
,
detailsAction:
_detailsAction
),
body:
_buildBody
(
context
,
controller:
scrollController
,
detailsVo:
_detailsAction
!.
vm
!
),
bottomNavigationBar:
_buildNavigationBar
(
detailsVo:
_detailsAction
!.
vm
!
,
detailsAction:
_detailsAction
),
);
},
);
...
...
@@ -445,18 +446,18 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
/// 底部按钮区域
///
Widget
_buildNavigationBar
({
@
required
PriceDetailsVo
detailsVo
,
IPriceDetailsAction
<
PriceDetailsVo
>
detailsAction
,
required
PriceDetailsVo
detailsVo
,
IPriceDetailsAction
<
PriceDetailsVo
>
?
detailsAction
,
})
{
return
buildBottomNavWidget
(
like:
detailsVo
?
.
likeTimes
??
'0'
,
favorites:
detailsVo
?
.
collegeTimes
??
'0'
,
isLike:
detailsVo
?.
isLike
??
fals
e
,
like:
detailsVo
.
likeTimes
??
'0'
,
favorites:
detailsVo
.
collegeTimes
??
'0'
,
isLike:
detailsVo
.
isLik
e
,
status:
detailsVo
.
status
,
isFavorites:
detailsVo
?.
isFavorites
??
false
,
isFavorites:
detailsVo
.
isFavorites
,
text:
detailsVo
.
viewState
==
DSViewState
.
busy
?
'加载中'
:
detailsVo
?
.
buttonText
??
''
,
:
detailsVo
.
buttonText
??
''
,
extras:
{
'platform'
:
detailsVo
.
platform
,
'item_id'
:
detailsVo
.
itemId
,
...
...
@@ -471,9 +472,9 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
///
/// 如果是淘宝、天猫、和拼多多需要提示授权
///
detailsAction
.
goToBuyEvent
().
then
((
value
)
{
detailsAction
!
.
goToBuyEvent
().
then
((
value
)
{
if
(
value
!=
null
&&
widget
.
onH5Callback
!=
null
)
{
widget
.
onH5Callback
(
value
.
appLink
,
value
.
platform
);
widget
.
onH5Callback
!
(
value
.
appLink
,
value
.
platform
);
}
}).
catchError
((
error
)
{
if
(
error
is
DSNetException
)
{
...
...
@@ -483,19 +484,19 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
});
},
onFavoritesTap:
()
{
detailsAction
.
userCollect
(
status:
detailsVo
?.
isFavorites
??
false
);
if
(
detailsVo
?.
isFavorites
??
false
)
{
detailsAction
!.
userCollect
(
status:
detailsVo
.
isFavorites
);
if
(
detailsVo
.
isFavorites
)
{
favoritesValueNotifier
.
value
=
0
;
}
else
{
favoritesAnimationController
.
forward
(
from:
0
);
favoritesAnimationController
!
.
forward
(
from:
0
);
}
},
onLikeTap:
()
{
detailsAction
.
userLike
(
status:
detailsVo
?.
isLike
??
fals
e
);
if
(
detailsVo
?.
isLike
??
fals
e
)
{
detailsAction
!.
userLike
(
status:
detailsVo
.
isLik
e
);
if
(
detailsVo
.
isLik
e
)
{
likeValueNotifier
.
value
=
0
;
}
else
{
likeAnimationController
.
forward
(
from:
0
);
likeAnimationController
!
.
forward
(
from:
0
);
}
},
);
...
...
@@ -505,13 +506,13 @@ class _PriceDetailsPageState extends State<PriceDetailsPage>
void
dispose
()
{
likeAnimationController
?.
dispose
();
favoritesAnimationController
?.
dispose
();
likeValueNotifier
?
.
dispose
();
favoritesValueNotifier
?
.
dispose
();
likeValueNotifier
.
dispose
();
favoritesValueNotifier
.
dispose
();
super
.
dispose
();
}
@override
void
showTipsMsg
({
String
msg
})
{
void
showTipsMsg
({
required
String
msg
})
{
FlutterNativeToast
.
showToast
(
msg
);
}
}
lib/page/view/discount/index.dart
View file @
3e21f1ca
...
...
@@ -19,7 +19,7 @@ import 'package:common_module/utils/xapp_utils.dart';
///
class
PriceDiscountPage
extends
StatefulWidget
{
final
Map
<
String
,
dynamic
>
pageParam
;
const
PriceDiscountPage
({
Key
key
,
@
required
this
.
pageParam
})
const
PriceDiscountPage
({
Key
?
key
,
required
this
.
pageParam
})
:
super
(
key:
key
);
@override
_PriceDiscountPageState
createState
()
=>
_PriceDiscountPageState
();
...
...
@@ -27,10 +27,10 @@ class PriceDiscountPage extends StatefulWidget {
class
_PriceDiscountPageState
extends
State
<
PriceDiscountPage
>
with
IPriceDiscountDelegate
{
IPriceDiscountAction
_discountAction
;
IPriceDiscountAction
?
_discountAction
;
bool
_isAudituser
=
false
;
List
<
dynamic
>
_sellReportList
;
bool
?
_isAudituser
=
false
;
List
<
dynamic
>
?
_sellReportList
;
@override
void
initState
()
{
_isAudituser
=
widget
.
pageParam
[
'isAudituser'
];
...
...
@@ -49,30 +49,30 @@ class _PriceDiscountPageState extends State<PriceDiscountPage>
Widget
build
(
BuildContext
context
)
{
return
DSProviderWidget
<
PriceDiscountVo
,
IPriceDiscountAction
<
PriceDiscountVo
>>(
dsAction:
_discountAction
,
builder:
(
BuildContext
context
,
Widget
child
)
{
dsAction:
_discountAction
as
IPriceDiscountAction
<
PriceDiscountVo
>
,
builder:
(
BuildContext
context
,
Widget
?
child
)
{
return
Scaffold
(
appBar:
buildAppBar
(),
body:
_buildBody1
(
vo:
_discountAction
.
getVo
),
appBar:
buildAppBar
()
as
PreferredSizeWidget
,
body:
_buildBody1
(
vo:
_discountAction
!
.
getVo
),
);
},
);
}
Widget
_buildBody1
({
PriceDiscountVo
vo
})
{
Widget
_buildBody1
({
required
PriceDiscountVo
vo
})
{
return
PullWidget
(
controller:
_refreshController
,
child:
Container
(
child:
_buildBody
(
vo:
vo
)),
onRefresh:
()
{
_discountAction
.
reloadData
();
_discountAction
!
.
reloadData
();
},
onLoad:
()
{
_discountAction
.
onLoad
();
_discountAction
!
.
onLoad
();
},
);
}
Widget
_buildBody
({
PriceDiscountVo
vo
})
{
Widget
_buildBody
({
required
PriceDiscountVo
vo
})
{
if
(
vo
.
viewState
==
DSViewState
.
busy
)
{
return
LoadingPage
(
padding:
EdgeInsets
.
all
(
13
.
w
),
...
...
@@ -86,7 +86,7 @@ class _PriceDiscountPageState extends State<PriceDiscountPage>
vo
.
viewState
==
DSViewState
.
empty
?
'未发现数据,请刷新重试'
:
'加载失败,请刷新重试'
,
onReloadTap:
()
{
//重新加载数据
_discountAction
.
reloadData
();
_discountAction
!
.
reloadData
();
},
);
}
...
...
@@ -127,7 +127,7 @@ class _PriceDiscountPageState extends State<PriceDiscountPage>
}
@override
void
onloadFailed
({
bool
isLoading
=
true
,
String
msg
})
{
void
onloadFailed
({
bool
isLoading
=
true
,
String
?
msg
})
{
if
(
isLoading
)
{
_refreshController
.
loadFailed
();
}
else
{
...
...
lib/page/view/index.dart
View file @
3e21f1ca
...
...
@@ -20,7 +20,7 @@ abstract class PricePageDelegate {
/// [type] 1、白菜专区 2、爆单页面 3、搜索页面 4、商品详情
/// [data] 当[type]等于4时,[data]为传递的数据
///
void
onRouteTap
({
@required
String
type
,
Map
<
String
,
dynamic
>
data
});
void
onRouteTap
({
required
String
type
,
Map
<
String
,
dynamic
>?
data
});
///
/// 获取好价的快捷Tab
...
...
@@ -29,11 +29,11 @@ abstract class PricePageDelegate {
}
class
PricePage
extends
StatefulWidget
{
final
PricePageDelegate
pageDelegate
;
final
List
<
dynamic
>
priceCategory
;
final
Map
<
int
,
dynamic
>
platformIconMap
;
final
PricePageDelegate
?
pageDelegate
;
final
List
<
dynamic
>
?
priceCategory
;
final
Map
<
int
,
dynamic
>
?
platformIconMap
;
const
PricePage
(
{
Key
key
,
this
.
pageDelegate
,
this
.
platformIconMap
,
this
.
priceCategory
})
{
Key
?
key
,
this
.
pageDelegate
,
this
.
platformIconMap
,
this
.
priceCategory
})
:
super
(
key:
key
);
@override
_PricePageState
createState
()
=>
_PricePageState
();
...
...
@@ -41,14 +41,14 @@ class PricePage extends StatefulWidget {
class
_PricePageState
extends
BaseUmengPageViewItemState
<
PricePage
>
with
IPriceActionDelegate
{
IPriceAction
<
PriceVo
>
_priceAction
;
IPriceAction
<
PriceVo
>
?
_priceAction
;
@override
void
initState
()
{
super
.
initState
();
_priceAction
=
PriceAction
(
delegate:
this
);
_priceAction
.
setPriceCategory
(
sellingTabList:
widget
.
pageDelegate
.
sellingTabList
,
_priceAction
!
.
setPriceCategory
(
sellingTabList:
widget
.
pageDelegate
!
.
sellingTabList
,
priceCategory:
widget
.
priceCategory
,
platformIconMap:
widget
.
platformIconMap
);
}
...
...
@@ -57,7 +57,7 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage>
Widget
build
(
BuildContext
context
)
{
super
.
build
(
context
);
return
DSProviderWidget
<
PriceVo
,
IPriceAction
<
PriceVo
>>(
dsAction:
_priceAction
,
dsAction:
_priceAction
!
,
builder:
(
BuildContext
context
,
child
)
{
return
Scaffold
(
backgroundColor:
Color
(
0xFFF5F5F5
),
...
...
@@ -65,12 +65,12 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage>
onSearchTap:
()
{
widget
.
pageDelegate
?.
onRouteTap
(
type:
'3'
);
},
isGrid:
_priceAction
.
vm
?.
productListVo
?.
isGrid
??
false
,
isGrid:
_priceAction
!
.
vm
?.
productListVo
?.
isGrid
??
false
,
onLayoutTap:
(
bool
isGrid
)
async
{
_priceAction
.
vm
?.
productListVo
?.
isGrid
=
isGrid
??
true
;
_priceAction
.
vm
?.
notifyListener
(
true
);
}),
body:
_buildBody
(
action:
_priceAction
),
_priceAction
!.
vm
?.
productListVo
?.
isGrid
=
isGrid
;
_priceAction
!
.
vm
?.
notifyListener
(
true
);
})
as
PreferredSizeWidget
?
,
body:
_buildBody
(
action:
_priceAction
!
),
);
});
}
...
...
@@ -81,7 +81,7 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage>
ValueNotifier
<
double
>
backColorListenable
=
ValueNotifier
<
double
>(
136.0
.
w
);
GlobalKey
anchorKey
=
GlobalKey
();
Widget
_buildBody
({
IPriceAction
<
PriceVo
>
action
})
{
Widget
_buildBody
({
required
IPriceAction
<
PriceVo
>
action
})
{
return
Stack
(
children:
[
// 底部设置一个背景跟随滑动
...
...
@@ -105,33 +105,33 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage>
DSProvider
.
value
(
vo:
action
.
getTabListVo
(),
builderWidget:
(
BuildContext
context
,
TabListVo
tabListVo
,
Widget
child
)
{
Widget
?
child
)
{
return
buildCategoryTapWidget
(
action
.
getTabListVo
().
tabList
??
[]
,
action
.
getTabListVo
().
tabList
,
action
.
sellingTabs
,
anchorKey:
anchorKey
,
sellTab:
tabListVo
.
sellTab
,
onChange:
(
int
index
,
bool
enable
)
{
tabListVo
?
.
tabList
[
index
].
open
=
enable
;
tabListVo
.
tabList
[
index
].
open
=
enable
;
tabListVo
.
notifyListener
(
true
);
},
onChangeSort:
(
Map
<
String
,
dynamic
>
data
)
{
tabListVo
.
sellTab
=
data
;
tabListVo
.
notifyListener
(
true
);
_priceAction
.
qryProductListEvent
(
page:
1
);
_priceAction
!
.
qryProductListEvent
(
page:
1
);
double
offset
=
_scrollViewController
.
offset
;
if
(
offset
>
70
.
w
)
{
_scrollViewController
.
animateTo
(
70
.
w
,
duration:
Duration
(
milliseconds:
50
),
curve:
Curves
.
linear
);
}
},
onNodeChange:
(
int
index
,
TabVo
tabVo
)
{
},
onNodeChange:
(
int
?
index
,
TabVo
tabVo
)
{
tabVo
.
open
=
false
;
if
(
tabVo
.
selected
!=
null
&&
tabVo
.
selected
[
'is_default'
]
==
'1'
)
{
tabVo
.
selected
!
[
'is_default'
]
==
'1'
)
{
tabVo
.
selected
=
null
;
}
tabListVo
.
notifyListener
(
true
);
_priceAction
.
qryProductListEvent
(
page:
1
);
_priceAction
!
.
qryProductListEvent
(
page:
1
);
double
offset
=
_scrollViewController
.
offset
;
if
(
offset
>
70
.
w
)
{
_scrollViewController
.
animateTo
(
70
.
w
,
...
...
@@ -145,7 +145,7 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage>
child:
DSProvider
.
value
(
vo:
action
.
getProductListVo
(),
builderWidget:
(
BuildContext
context
,
ProductListVo
productListVo
,
Widget
child
)
{
ProductListVo
productListVo
,
Widget
?
child
)
{
if
(
productListVo
.
productList
.
isEmpty
)
{
if
(
productListVo
.
viewState
==
DSViewState
.
busy
)
{
return
LoadingPage
(
...
...
@@ -211,10 +211,10 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage>
],
),
onLoad:
()
{
action
?
.
loadMore
();
action
.
loadMore
();
},
onRefresh:
()
{
action
?
.
onRefresh
();
action
.
onRefresh
();
},
controller:
_refreshController
,
),
...
...
@@ -229,7 +229,7 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage>
}
else
if
(
scroll
.
metrics
.
pixels
<=
500
&&
scrollIndex
.
value
==
1
)
{
scrollIndex
.
value
=
0
;
}
RenderBox
renderBox
=
anchorKey
.
currentContext
.
findRenderObject
()
;
RenderBox
renderBox
=
anchorKey
.
currentContext
!.
findRenderObject
()
as
RenderBox
;
var
offset
=
renderBox
.
localToGlobal
(
Offset
(
0.0
,
renderBox
.
size
.
height
));
if
(
scroll
.
runtimeType
==
ScrollStartNotification
)
{
...
...
@@ -270,7 +270,7 @@ class _PricePageState extends BaseUmengPageViewItemState<PricePage>
}
@override
void
onloadFailed
({
String
msg
})
{
void
onloadFailed
({
String
?
msg
})
{
_refreshController
.
loadFailed
();
_refreshController
.
refreshCompleted
(
resetFooterState:
true
);
}
...
...
lib/page/widget/details/index.dart
View file @
3e21f1ca
...
...
@@ -24,14 +24,14 @@ import 'package:xiaoxiong_repository/entity/product_item_entity.dart';
/// [actions] action
///
Widget
buildAppBar
(
BuildContext
context
,
{
@
required
PriceDetailsVo
detailsVo
,
bool
audituser
=
false
,
{
required
PriceDetailsVo
detailsVo
,
bool
?
audituser
=
false
,
String
title
=
''
,
ValueListenable
<
int
>
listenable
,
void
Function
(
{
PriceDetailsVo
detailsVo
})
onSharePressed
})
{
required
ValueListenable
<
int
>
listenable
,
void
Function
(
PriceDetailsVo
detailsVo
)?
onSharePressed
})
{
return
ValueListenableBuilder
<
int
>(
valueListenable:
listenable
,
builder:
(
BuildContext
context
,
int
value
,
Widget
child
)
{
builder:
(
BuildContext
context
,
int
value
,
Widget
?
child
)
{
return
Container
(
height:
48
.
w
+
MediaQuery
.
of
(
context
).
padding
.
top
,
child:
AppBar
(
...
...
@@ -51,11 +51,11 @@ Widget buildAppBar(BuildContext context,
Navigator
.
maybePop
(
context
);
},
),
actions:
audituser
actions:
audituser
!
?
[]
:
[
IconButton
(
icon:
Image
.
asset
(
'assets/images/ic_btn_share1.png'
,
package:
'price_module'
,
width:
26
.
w
),
onPressed:
()
=>
onSharePressed
(
detailsVo:
detailsVo
)
onPressed:
()
=>
onSharePressed
!(
detailsVo
)
)],
));
},
...
...
@@ -67,10 +67,10 @@ Widget buildAppBar(BuildContext context,
///
///
Widget
buildBody
(
BuildContext
context
,
{
@
required
ScrollController
controller
,
@
required
List
<
Widget
>
slivers
,
PointerMoveEventListener
onPointerMove
,
PointerUpEventListener
onPointerUp
})
{
{
required
ScrollController
controller
,
required
List
<
Widget
>
slivers
,
PointerMoveEventListener
?
onPointerMove
,
PointerUpEventListener
?
onPointerUp
})
{
return
Listener
(
onPointerMove:
onPointerMove
,
onPointerUp:
onPointerUp
,
...
...
@@ -88,7 +88,7 @@ Widget buildBody(BuildContext context,
/// 好价商品详情滚动栏图片
/// [images] 滚动栏图片
///
Widget
buildSwiperWidget
(
{
List
<
String
>
images
})
{
Widget
buildSwiperWidget
(
{
List
<
String
?>?
images
})
{
Widget
_swiperWidget
;
int
length
=
(
images
?.
length
??
0
);
if
(
length
<=
0
)
{
...
...
@@ -98,17 +98,17 @@ Widget buildSwiperWidget({List<String> images}) {
width:
200
,
);
}
else
if
(
length
==
1
)
{
_swiperWidget
=
_buildCachedImage
(
image:
images
[
0
]
);
_swiperWidget
=
_buildCachedImage
(
image:
images
![
0
]!
);
}
else
{
_swiperWidget
=
Swiper
(
itemCount:
length
,
loop:
false
,
autoplay:
false
,
autoplayDelay:
5
*
1000
,
onIndexChanged:
(
int
index
)
{},
onIndexChanged:
(
int
?
index
)
{},
pagination:
_buildSwiperPlugin
(),
itemBuilder:
(
BuildContext
context
,
int
index
)
{
String
image
=
images
[
index
]
;
String
image
=
images
![
index
]!
;
return
_buildCachedImage
(
image:
image
);
},
);
...
...
@@ -120,7 +120,7 @@ Widget buildSwiperWidget({List<String> images}) {
);
}
Widget
_buildCachedImage
(
{
String
image
})
{
Widget
_buildCachedImage
(
{
required
String
image
})
{
return
CachedNetworkImage
(
imageUrl:
image
,
placeholder:
(
BuildContext
c
,
String
s
)
{
...
...
@@ -134,7 +134,7 @@ Widget _buildCachedImage({String image}) {
dynamic
_buildSwiperPlugin
(
)
{
return
SwiperCustomPagination
(
builder:
(
BuildContext
context
,
SwiperPluginConfig
config
)
{
builder:
(
BuildContext
context
,
SwiperPluginConfig
?
config
)
{
return
Positioned
(
bottom:
0
.
w
,
right:
0
.
w
,
...
...
@@ -146,7 +146,7 @@ dynamic _buildSwiperPlugin() {
color:
Color
(
0xFF979797
),
borderRadius:
BorderRadius
.
circular
(
10
.
w
)),
child:
Text
(
'
${config
.activeIndex
+ 1}
/
${config.itemCount}
'
,
'
${config
!.activeIndex!
+ 1}
/
${config.itemCount}
'
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
12
.
w
,
...
...
@@ -166,13 +166,13 @@ dynamic _buildSwiperPlugin() {
///
Widget
buildSliverAppBar
(
{
double
top
=
0
,
@
required
Widget
leading
,
Widget
action
,
@
required
bool
isBusy
,
String
title
,
@
required
double
expandedHeight
,
@
required
int
itemCount
,
@
required
IndexedWidgetBuilder
itemBuilder
})
{
required
Widget
leading
,
required
Widget
action
,
required
bool
isBusy
,
required
String
title
,
required
double
expandedHeight
,
required
int
itemCount
,
required
IndexedWidgetBuilder
itemBuilder
})
{
return
SliverAppBar
(
elevation:
0.1
,
backgroundColor:
isBusy
?
Color
(
0xFFE9E9E9
)
:
Colors
.
white
,
...
...
@@ -200,7 +200,7 @@ Widget buildSliverAppBar(
autoplay:
true
,
autoplayDelay:
5
*
1000
,
itemBuilder:
itemBuilder
,
onIndexChanged:
(
int
index
)
{},
onIndexChanged:
(
int
?
index
)
{},
pagination:
_buildCustomPagination
(),
),
)));
...
...
@@ -209,7 +209,7 @@ Widget buildSliverAppBar(
///
/// 商品详情部分
///
Widget
buildDetailsWidget
(
{
@
required
List
<
Widget
>
children
})
{
Widget
buildDetailsWidget
(
{
required
List
<
Widget
>
children
})
{
return
SliverToBoxAdapter
(
child:
Container
(
color:
Colors
.
white
,
...
...
@@ -228,8 +228,8 @@ Widget buildDetailsWidget({@required List<Widget> children}) {
/// [expired] 是否过期
///
Widget
buildTitleWidget
(
{
@
required
String
title
,
@
required
String
subTitle
,
required
String
title
,
required
String
subTitle
,
bool
expired
=
false
,
})
{
return
Container
(
...
...
@@ -266,15 +266,15 @@ Widget buildTitleWidget({
/// 商品信息
///
Widget
buildStoreInfoWidget
(
{
@
required
PriceDetailsVo
vo
,
void
Function
(
Coupon
)
onCouponTap
,
void
Function
(
Map
<
String
,
dynamic
>)
onPurchase
})
{
{
required
PriceDetailsVo
vo
,
void
Function
(
Coupon
)
?
onCouponTap
,
void
Function
(
Map
<
String
,
dynamic
>)
?
onPurchase
})
{
if
((
vo
.
shopTitle
??
''
).
isEmpty
)
{
return
Container
();
}
/// 凑单购买
Widget
getCollectOrders
({
List
<
dynamic
>
orders
})
{
Widget
getCollectOrders
({
required
List
<
dynamic
>
orders
})
{
Widget
getOrdersItemWidget
(
dynamic
data
)
{
return
InkWell
(
child:
Container
(
...
...
@@ -322,9 +322,9 @@ Widget buildStoreInfoWidget(
/// 优惠卷Widget
/// [coupon] 优惠卷
///
Widget
getCouponWidget
({
Coupon
coupon
})
{
Widget
getCouponWidget
({
required
Coupon
coupon
})
{
return
InkWell
(
child:
RichText
(
text:
TextSpan
(
children:
[
WidgetSpan
(
child:
Container
(
height:
16
.
w
,
child:
Text
(
coupon
.
name
,
style:
TextStyle
(
color:
Color
(
coupon
.
status
==
'1'
?
0xFFFF0400
:
0xFF999999
),
fontSize:
12
.
w
)),),),
WidgetSpan
(
child:
Container
(
height:
16
.
w
,
child:
Text
(
coupon
.
name
!
,
style:
TextStyle
(
color:
Color
(
coupon
.
status
==
'1'
?
0xFFFF0400
:
0xFF999999
),
fontSize:
12
.
w
)),),),
WidgetSpan
(
child:
Container
(
width:
16
.
w
,
alignment:
Alignment
.
centerLeft
,
...
...
@@ -361,7 +361,7 @@ Widget buildStoreInfoWidget(
width:
0.5
.
w
,
height:
13
.
w
,
),
Text
(
vo
.
shopTitle
,
Text
(
vo
.
shopTitle
!
,
style:
TextStyle
(
fontSize:
12
.
w
,
color:
Color
(
0xFF302600
))),
],
),
...
...
@@ -380,7 +380,7 @@ Widget buildStoreInfoWidget(
),
Container
(
width:
280
.
w
,
child:
getCollectOrders
(
orders:
vo
.
collectOrders
),
child:
getCollectOrders
(
orders:
vo
.
collectOrders
!
),
),
],
),
...
...
@@ -391,7 +391,7 @@ Widget buildStoreInfoWidget(
:
Container
(),
//优惠
(
vo
.
coupons
?.
length
??
0
)
>
0
vo
.
coupons
.
length
>
0
?
Container
(
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
...
...
@@ -409,7 +409,7 @@ Widget buildStoreInfoWidget(
alignment:
WrapAlignment
.
start
,
runSpacing:
6
.
w
,
children:
List
.
generate
(
vo
.
coupons
?.
length
??
0
,
vo
.
coupons
.
length
,
(
index
)
=>
getCouponWidget
(
coupon:
vo
.
coupons
[
index
],
),
...
...
@@ -442,7 +442,7 @@ Widget buildStoreInfoWidget(
bottomRight:
Radius
.
circular
(
8.0
),
topRight:
Radius
.
circular
(
8.0
),
topLeft:
Radius
.
circular
(
8.0
))),
child:
Text
(
vo
.
rebate
,
child:
Text
(
vo
.
rebate
!
,
style:
TextStyle
(
fontWeight:
FontWeight
.
w600
,
fontSize:
11
.
w
,
...
...
@@ -460,13 +460,13 @@ Widget buildStoreInfoWidget(
/// 商品信息
///
Widget
buildProductNewlastWidget
(
{
@required
Map
<
String
,
dynamic
>
newInfo
,
void
Function
()
goBuy
,
void
Function
(
Map
<
String
,
dynamic
>)
onCouponTap
})
{
{
required
Map
<
String
,
dynamic
>?
newInfo
,
void
Function
()
?
goBuy
,
void
Function
(
Map
<
String
,
dynamic
>)
?
onCouponTap
})
{
if
(
newInfo
==
null
)
{
return
Container
();
}
List
<
dynamic
>
couponInfo
=
[];
List
<
dynamic
>
?
couponInfo
=
[];
if
(
newInfo
[
'coupon_info'
]
is
List
)
{
couponInfo
=
newInfo
[
'coupon_info'
];
}
...
...
@@ -533,7 +533,7 @@ Widget buildProductNewlastWidget(
onTap:
goBuy
),
],
),
couponInfo
.
isNotEmpty
couponInfo
!
.
isNotEmpty
?
SizedBox
(
height:
4
.
w
,
)
...
...
@@ -554,7 +554,7 @@ Widget buildProductNewlastWidget(
itemCount:
couponInfo
.
length
,
padding:
EdgeInsets
.
zero
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
Map
<
String
,
dynamic
>
data
=
couponInfo
[
index
];
Map
<
String
,
dynamic
>
data
=
couponInfo
!
[
index
];
return
InkWell
(
child:
Container
(
alignment:
Alignment
.
centerLeft
,
...
...
@@ -602,18 +602,18 @@ Widget buildProductNewlastWidget(
/// [onReceiveTap] 点击领取优惠卷
///
Widget
buildCouponWidget
(
BuildContext
context
,
{
@required
List
<
Coupon
>
coupons
,
@
required
String
couponText
,
@
required
Function
(
Coupon
)
onReceiveTap
})
{
if
(
coupons
==
null
||
coupons
.
isEmpty
)
{
{
required
List
<
Coupon
?
>
coupons
,
required
String
couponText
,
required
Function
(
Coupon
)
onReceiveTap
})
{
if
(
coupons
.
isEmpty
)
{
return
Container
();
}
///
/// 优惠卷全部过期
///
if
(
couponText
!=
null
&&
couponText
.
isNotEmpty
)
{
Coupon
coupon
;
if
(
couponText
.
isNotEmpty
)
{
Coupon
?
coupon
;
try
{
coupon
=
coupons
.
singleWhere
((
ele
)
=>
'
${ele?.status}
'
==
'1'
,
orElse:
()
{
...
...
@@ -654,7 +654,7 @@ Widget buildCouponWidget(BuildContext context,
runSpacing:
6
.
rpx
,
children:
List
<
Widget
>.
generate
(
coupons
.
length
,
(
index
)
{
Coupon
coupon
=
coupons
[
index
];
Coupon
coupon
=
coupons
[
index
]
!
;
return
Container
(
child:
Text
(
'
${coupon.name}
'
,
...
...
@@ -780,7 +780,7 @@ Widget buildCouponWidget(BuildContext context,
),
]));
}
Coupon
coupon
=
coupons
[
index
-
1
];
Coupon
coupon
=
coupons
[
index
-
1
]
!
;
return
Container
(
margin:
EdgeInsets
.
only
(
left:
13
.
w
,
...
...
@@ -797,7 +797,7 @@ Widget buildCouponWidget(BuildContext context,
child:
Row
(
children:
[
Expanded
(
child:
Text
(
coupon
.
name
,
coupon
.
name
!
,
style:
TextStyle
(
fontSize:
15
.
w
,
fontWeight:
FontWeight
.
w500
,
...
...
@@ -829,8 +829,7 @@ Widget buildCouponWidget(BuildContext context,
.
circular
(
16
.
w
))),
),
onTap:
()
{
if
(
onReceiveTap
!=
null
&&
coupon
.
status
==
'1'
)
{
if
(
coupon
.
status
==
'1'
)
{
onReceiveTap
(
coupon
);
Navigator
.
maybePop
(
context
);
}
...
...
@@ -861,7 +860,7 @@ Widget buildCouponWidget(BuildContext context,
child:
Wrap
(
runSpacing:
6
.
rpx
,
children:
List
<
Widget
>.
generate
(
coupons
.
length
,
(
index
)
{
Coupon
coupon
=
coupons
[
index
];
Coupon
coupon
=
coupons
[
index
]
!
;
return
Container
(
child:
Text
(
'
${coupon.name}
'
,
...
...
@@ -958,7 +957,7 @@ Widget buildCouponWidget(BuildContext context,
),
]));
}
Coupon
coupon
=
coupons
[
index
-
1
];
Coupon
coupon
=
coupons
[
index
-
1
]
!
;
return
Container
(
margin:
EdgeInsets
.
only
(
left:
13
.
w
,
...
...
@@ -975,7 +974,7 @@ Widget buildCouponWidget(BuildContext context,
child:
Row
(
children:
[
Expanded
(
child:
Text
(
coupon
.
name
,
coupon
.
name
!
,
style:
TextStyle
(
fontSize:
15
.
w
,
fontWeight:
FontWeight
.
w500
,
...
...
@@ -1003,8 +1002,7 @@ Widget buildCouponWidget(BuildContext context,
Radius
.
circular
(
16
.
w
))),
),
onTap:
()
{
if
(
onReceiveTap
!=
null
&&
coupon
.
status
==
'1'
)
{
if
(
coupon
.
status
==
'1'
)
{
onReceiveTap
(
coupon
);
Navigator
.
maybePop
(
context
);
}
...
...
@@ -1022,17 +1020,17 @@ Widget buildCouponWidget(BuildContext context,
/// [html] 商品图文信息
///
Widget
buildProductDetailsWidget
(
BuildContext
context
,
{
@
required
String
html
})
{
{
required
String
html
})
{
return
Container
(
margin:
EdgeInsets
.
only
(
top:
16
.
w
,
bottom:
4
.
w
,
left:
4
.
w
,
right:
4
.
w
),
child:
Html
(
data:
html
,
style:
{},
customRender:
{},
onLinkTap:
(
String
url
,
RenderContext
context
,
Map
<
String
,
String
>
attributes
,
dom
.
Element
element
)
{
onLinkTap:
(
String
?
url
,
RenderContext
context
,
Map
<
String
,
String
>
attributes
,
dom
.
Element
?
element
)
{
print
(
"=========>onLinkTap
$url
"
);
},
onImageTap:
(
String
url
,
RenderContext
context
,
Map
<
String
,
String
>
attributes
,
dom
.
Element
element
)
{
onImageTap:
(
String
?
url
,
RenderContext
context
,
Map
<
String
,
String
>
attributes
,
dom
.
Element
?
element
)
{
print
(
"=========>onImageTap
$url
"
);
},
onImageError:
(
exception
,
stackTrace
)
{
...
...
@@ -1046,10 +1044,10 @@ Widget buildProductDetailsWidget(BuildContext context,
/// [onReportTap] 举报按钮
///
Widget
buildPromptWidget
(
{
@required
String
releaseTime
,
@required
String
checkText
,
VoidCallback
onReportTap
,
Map
<
String
,
dynamic
>
extras
})
{
{
required
String
?
releaseTime
,
required
String
?
checkText
,
VoidCallback
?
onReportTap
,
Map
<
String
,
dynamic
>
?
extras
})
{
return
Container
(
child:
Column
(
children:
[
...
...
@@ -1093,9 +1091,9 @@ Widget buildPromptWidget(
/// 相关优惠信息
///
Widget
buildRelatedDiscountWidget
(
{
List
<
ProductItemEntity
>
productEntitys
,
void
Function
(
ProductItemEntity
,
int
)
onItemTap
,
void
Function
()
onMoreTap
})
{
{
List
<
ProductItemEntity
>
?
productEntitys
,
void
Function
(
ProductItemEntity
,
int
)
?
onItemTap
,
void
Function
()
?
onMoreTap
})
{
bool
isShowMore
=
false
;
if
(
productEntitys
==
null
||
productEntitys
.
length
<=
0
)
{
return
Container
();
...
...
@@ -1157,7 +1155,7 @@ Widget buildRelatedDiscountWidget(
/// 分享弹窗
///
///
Future
<
T
>
showShareModalBottom
<
T
>(
BuildContext
context
,{
@
required
List
<
Map
<
String
,
dynamic
>>
items
,
Map
<
String
,
dynamic
>
extras
=
const
{}})
{
Future
<
T
?>
showShareModalBottom
<
T
>(
BuildContext
context
,{
required
List
<
Map
<
String
,
dynamic
>>
items
,
Map
<
String
,
dynamic
>
extras
=
const
{}})
{
return
showPopBottomSheet
(
context:
context
,
pageName:
RoutePath
.
PRICE_DETAIL_PAGE
.
path
(),
items:
items
,
extras:
extras
);
}
...
...
@@ -1166,12 +1164,12 @@ Future<T> showShareModalBottom<T>(BuildContext context,{@required List<Map<Strin
/// [context] 上下文对象
/// [items] 菜单列表
///
Future
<
T
>
showReceiveModalBottom
<
T
>(
BuildContext
context
,
{
@
required
List
<
ReportModel
>
items
})
{
Future
<
T
?
>
showReceiveModalBottom
<
T
>(
BuildContext
context
,
{
required
List
<
ReportModel
>
items
})
{
return
_showModalBottomList
(
context
,
itemCount:
items
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
Widget
widget
;
ReportModel
reportModel
;
ReportModel
?
reportModel
;
if
(
index
==
items
.
length
)
{
widget
=
Container
(
color:
Colors
.
white
,
...
...
@@ -1194,7 +1192,7 @@ Future<T> showReceiveModalBottom<T>(BuildContext context,
alignment:
Alignment
.
center
,
height:
49
,
child:
Text
(
items
[
index
].
text
,
items
[
index
].
text
!
,
style:
TextStyle
(
fontSize:
15
,
color:
Color
(
0xFF302600
)),
),
margin:
EdgeInsets
.
only
(
top:
index
==
0
?
0
:
0.6
),
...
...
@@ -1218,21 +1216,21 @@ Future<T> showReceiveModalBottom<T>(BuildContext context,
/// [onBuyTap] 购买
///
Widget
buildBottomNavWidget
(
{
@
required
String
like
,
@
required
String
favorites
,
{
required
String
like
,
required
String
favorites
,
bool
isLike
=
false
,
bool
isFavorites
=
false
,
@
required
String
text
,
VoidCallback
onLikeTap
,
VoidCallback
onFavoritesTap
,
VoidCallback
onBuyTap
,
VoidCallback
onShareTap
,
String
status
,
Map
<
String
,
dynamic
>
extras
,
@
required
List
<
String
>
favoritesImages
,
@
required
ValueNotifier
<
int
>
favoritesValueNotifier
,
@
required
List
<
String
>
likeImages
,
@
required
ValueNotifier
<
int
>
likeValueNotifier
})
{
required
String
text
,
VoidCallback
?
onLikeTap
,
VoidCallback
?
onFavoritesTap
,
VoidCallback
?
onBuyTap
,
VoidCallback
?
onShareTap
,
String
?
status
,
Map
<
String
,
dynamic
>
?
extras
,
required
List
<
String
>
favoritesImages
,
required
ValueNotifier
<
int
>
favoritesValueNotifier
,
required
List
<
String
>
likeImages
,
required
ValueNotifier
<
int
>
likeValueNotifier
})
{
if
(
isLike
)
{
likeValueNotifier
.
value
=
likeImages
.
length
-
1
;
}
else
{
...
...
@@ -1273,7 +1271,7 @@ Widget buildBottomNavWidget(
),
],
),
AuditModeUtils
.
getInstance
().
isAuditMode
()?
Container
(
width:
1
):
InkWell
(
AuditModeUtils
.
getInstance
()
!
.
isAuditMode
()?
Container
(
width:
1
):
InkWell
(
child:
Container
(
margin:
EdgeInsets
.
only
(
right:
24
.
w
,
left:
10
.
w
),
child:
Column
(
...
...
@@ -1307,16 +1305,16 @@ Widget buildBottomNavWidget(
}
Widget
_buildAnimationText
(
{
@
required
String
text
,
ValueNotifier
<
int
>
valueNotifier
,
double
width1
,
EdgeInsetsGeometry
margin
,
required
String
text
,
ValueNotifier
<
int
>
?
valueNotifier
,
double
?
width1
,
EdgeInsetsGeometry
?
margin
,
String
package
=
'price_module'
,
List
<
String
>
images
,
double
width
,
double
height
,
VoidCallback
onTap
,
TextStyle
style
,
List
<
String
>
?
images
,
double
?
width
,
double
?
height
,
VoidCallback
?
onTap
,
TextStyle
?
style
,
})
{
return
Container
(
padding:
margin
,
...
...
@@ -1344,13 +1342,13 @@ Widget _buildAnimationText({
/// [onTap] 点击事件
///
Widget
_buildIconText
(
{
@
required
String
image
,
@
required
String
text
,
{
required
String
image
,
required
String
text
,
double
width
=
24
,
double
width1
,
EdgeInsetsGeometry
margin
,
TextStyle
style
,
VoidCallback
onTap
})
{
double
?
width1
,
EdgeInsetsGeometry
?
margin
,
TextStyle
?
style
,
VoidCallback
?
onTap
})
{
return
Container
(
width:
width1
,
padding:
margin
,
...
...
@@ -1375,7 +1373,7 @@ Widget _buildIconText(
///
SwiperPlugin
_buildCustomPagination
(
)
{
return
SwiperCustomPagination
(
builder:
(
BuildContext
context
,
SwiperPluginConfig
config
)
{
builder:
(
BuildContext
context
,
SwiperPluginConfig
?
config
)
{
return
Positioned
(
bottom:
12
.
w
,
right:
12
.
w
,
...
...
@@ -1387,7 +1385,7 @@ SwiperPlugin _buildCustomPagination() {
color:
Color
.
fromRGBO
(
48
,
38
,
0
,
0.4
),
borderRadius:
BorderRadius
.
circular
(
10
.
w
)),
child:
Text
(
'
${config
.activeIndex
+ 1}
/
${config.itemCount}
'
,
'
${config
!.activeIndex!
+ 1}
/
${config.itemCount}
'
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
12
.
w
,
...
...
@@ -1397,8 +1395,8 @@ SwiperPlugin _buildCustomPagination() {
});
}
Future
<
T
>
_showModalBottomList
<
T
>(
BuildContext
context
,
{
@required
int
itemCount
,
@
required
IndexedWidgetBuilder
itemBuilder
})
{
Future
<
T
?
>
_showModalBottomList
<
T
>(
BuildContext
context
,
{
required
int
itemCount
,
required
IndexedWidgetBuilder
itemBuilder
})
{
return
showModalBottomSheet
(
context:
context
,
builder:
(
BuildContext
context
)
{
...
...
lib/page/widget/index.dart
View file @
3e21f1ca
...
...
@@ -18,8 +18,8 @@ import 'package:common_module/utils/xapp_utils.dart';
/// [onLayoutTap] 布局变化点击事件
///
Widget
buildAppBar
(
{
@
required
Function
onSearchTap
,
@
required
Function
(
bool
)
onLayoutTap
,
required
Function
onSearchTap
,
required
Function
(
bool
)
onLayoutTap
,
bool
isGrid
=
false
,
})
{
return
buildAppSearchBar
(
...
...
@@ -38,7 +38,7 @@ Widget buildAppBar({
decoration:
BoxDecoration
(
color:
Color
(
0xFFFFFFFF
),
borderRadius:
BorderRadius
.
circular
(
17
.
w
)),
child:
InkWell
(
onTap:
onSearchTap
,
onTap:
onSearchTap
as
void
Function
()?
,
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
...
...
@@ -65,13 +65,13 @@ Widget buildAppBar({
right:
InkWell
(
child:
Image
.
asset
(
'assets/images/price_layout_'
+
(
(
isGrid
??
false
)
?
'list'
:
'grid'
)
+
(
isGrid
?
'list'
:
'grid'
)
+
'_icon.png'
,
package:
'price_module'
,
width:
28
.
w
,
height:
28
.
w
,
),
onTap:
()
=>
onLayoutTap
(!
(
isGrid
??
false
)
),
onTap:
()
=>
onLayoutTap
(!
isGrid
),
),
);
}
...
...
@@ -80,7 +80,7 @@ Widget buildAppBar({
/// 专区部分单个Widget
/// [image] 单个Widget的图片
///
Widget
_buildZoneItemWidget
(
{
@required
String
image
,
void
Function
()
onTap
})
{
Widget
_buildZoneItemWidget
(
{
required
String
image
,
void
Function
()?
onTap
})
{
return
Expanded
(
child:
InkWell
(
child:
Container
(
...
...
@@ -107,7 +107,7 @@ Widget _buildZoneItemWidget({@required String image, void Function() onTap}) {
/// 专区Widget
/// [onValueTap] 专区点击事件
///
Widget
buildZoneWidget
(
{
void
Function
(
String
)
onValueTap
})
{
Widget
buildZoneWidget
(
{
void
Function
(
String
)
?
onValueTap
})
{
return
Container
(
margin:
EdgeInsets
.
symmetric
(
vertical:
8
.
w
,
horizontal:
13
.
w
),
child:
Row
(
...
...
@@ -140,10 +140,10 @@ Widget buildZoneWidget({void Function(String) onValueTap}) {
/// [valueListenable] 数据变化
///
Widget
backgroundColorWidget
(
{
@
required
ValueListenable
<
double
>
valueListenable
})
{
{
required
ValueListenable
<
double
>
valueListenable
})
{
return
ValueListenableBuilder
<
double
>(
valueListenable:
valueListenable
,
builder:
(
BuildContext
context
,
double
value
,
Widget
child
)
{
builder:
(
BuildContext
context
,
double
value
,
Widget
?
child
)
{
return
Positioned
(
child:
Container
(
height:
200
,
...
...
@@ -167,11 +167,11 @@ Widget backgroundColorWidget(
/// [onPressed] 点击回到顶部按钮
///
Widget
backTopWidget
(
{
@
required
ValueListenable
<
int
>
valueListenable
,
@
required
void
Function
()
onPressed
})
{
{
required
ValueListenable
<
int
>
valueListenable
,
required
void
Function
()
onPressed
})
{
return
ValueListenableBuilder
<
int
>(
valueListenable:
valueListenable
,
builder:
(
BuildContext
context
,
dynamic
value
,
Widget
child
)
{
builder:
(
BuildContext
context
,
dynamic
value
,
Widget
?
child
)
{
if
(
value
==
1
)
{
return
Positioned
(
bottom:
10
.
w
,
...
...
@@ -186,12 +186,12 @@ Widget backTopWidget(
}
Widget
buildCustomScroll
(
{
@
required
List
<
Widget
>
children
,
void
Function
()
onRefresh
,
void
Function
()
onLoad
,
RefreshController
refreshController
,
@
required
bool
Function
(
ScrollNotification
)
onNotification
,
@
required
ScrollController
controller
})
{
{
required
List
<
Widget
>
children
,
void
Function
()
?
onRefresh
,
void
Function
()
?
onLoad
,
RefreshController
?
refreshController
,
required
bool
Function
(
ScrollNotification
)
onNotification
,
required
ScrollController
controller
})
{
return
NotificationListener
(
onNotification:
onNotification
,
child:
PullWidget
(
...
...
@@ -212,10 +212,10 @@ Widget buildCustomScroll(
/// [structure] 分类的数据结构
///
Widget
_buildClassifyShowWidget
(
{
List
<
dynamic
>
structure
,
@
required
void
Function
(
Map
<
String
,
dynamic
>)
onResultTap
,
@
required
void
Function
()
onResetTap
,
Map
<
String
,
dynamic
>
selected
})
{
{
List
<
dynamic
>
?
structure
,
required
void
Function
(
Map
<
String
,
dynamic
>)
onResultTap
,
required
void
Function
()
onResetTap
,
Map
<
String
?,
dynamic
>?
selected
})
{
return
ClassifyShowWidget
(
selected:
selected
,
structure:
structure
,
...
...
@@ -227,7 +227,7 @@ Widget _buildClassifyShowWidget(
///
/// 商城和最新Tab
///
Widget
_newestTabWidget
(
{
List
<
dynamic
>
structure
,
void
Function
(
int
)
onChange
,
Map
<
String
,
dynamic
>
selected
})
{
Widget
_newestTabWidget
(
{
required
List
<
dynamic
>
structure
,
void
Function
(
int
)?
onChange
,
Map
<
String
?,
dynamic
>?
selected
})
{
return
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
vertical
(
bottom:
Radius
.
circular
(
10
))),
child:
Column
(
...
...
@@ -259,16 +259,16 @@ Widget _newestTabWidget({List<dynamic> structure,void Function(int) onChange,Map
/// Tab
///
Widget
buildTapWidget
(
BuildContext
context
,
{
@
required
List
<
TabVo
>
tabList
,
void
Function
(
int
,
bool
)
onChange
,
@required
void
Function
(
int
,
TabVo
)
onNodeChange
})
{
Widget
categoryWidget
({
Widget
Function
()
onHeaderWidget
})
{
return
Container
(
{
required
List
<
TabVo
>
tabList
,
void
Function
(
int
,
bool
)
?
onChange
,
required
void
Function
(
int
?
,
TabVo
)
onNodeChange
})
{
Widget
categoryWidget
({
Widget
Function
()
?
onHeaderWidget
})
{
return
Container
(
height:
40
.
w
,
color:
Color
(
0xFFF5F5F5
),
child:
Row
(
children:
List
<
Widget
>.
generate
(
tabList
.
length
,
(
index
)
{
TabVo
tabVo
=
tabList
[
index
];
String
title
=
getHeaderTitle
(
tabVo
);
String
?
title
=
getHeaderTitle
(
tabVo
);
return
Expanded
(
child:
OtherWidget
(
onHeaderWidget:
onHeaderWidget
,
...
...
@@ -306,22 +306,20 @@ Widget buildTapWidget(BuildContext context,
onChange
(
index
,
true
);
}
if
(
tabVo
.
type
==
'3'
)
{
List
<
String
>
tabs
=
[];
List
<
String
?
>
tabs
=
[];
tabVo
.
structure
?.
forEach
((
ele
)
{
tabs
.
add
(
ele
[
'text'
]);
});
callback
(
_newestTabWidget
(
structure:
tabVo
.
structure
,
structure:
tabVo
.
structure
!
,
onChange:
(
v
)
{
if
(
tabVo
.
structure
!=
null
&&
tabVo
.
structure
.
length
>
v
)
{
dynamic
data
=
tabVo
.
structure
[
v
];
tabVo
.
structure
!
.
length
>
v
)
{
dynamic
data
=
tabVo
.
structure
!
[
v
];
tabVo
.
selected
=
data
;
if
(
onNodeChange
!=
null
)
{
onNodeChange
(
index
,
tabVo
);
}
onNodeChange
(
index
,
tabVo
);
callback
(
null
);
}
},
...
...
@@ -330,20 +328,16 @@ Widget buildTapWidget(BuildContext context,
);
}
else
if
(
tabVo
.
type
==
'4'
)
{
callback
(
_buildPriceShowWidget
(
structure:
tabVo
.
structure
[
0
],
structure:
tabVo
.
structure
!
[
0
],
keyName:
tabVo
.
keyName
,
onResultTap:
(
Map
<
String
,
dynamic
>
data
)
{
onResultTap:
(
Map
<
String
?
,
dynamic
>
data
)
{
tabVo
.
selected
=
data
;
if
(
onNodeChange
!=
null
)
{
onNodeChange
(
index
,
tabVo
);
}
onNodeChange
(
index
,
tabVo
);
callback
(
null
);
},
onResetTap:
()
{
tabVo
.
selected
=
null
;
if
(
onNodeChange
!=
null
)
{
onNodeChange
(
index
,
tabVo
);
}
onNodeChange
(
index
,
tabVo
);
callback
(
null
);
},
selected:
tabVo
.
selected
??
{},
...
...
@@ -354,16 +348,12 @@ Widget buildTapWidget(BuildContext context,
structure:
tabVo
.
structure
,
onResetTap:
()
{
tabVo
.
selected
=
null
;
if
(
onNodeChange
!=
null
)
{
onNodeChange
(
index
,
tabVo
);
}
onNodeChange
(
index
,
tabVo
);
callback
(
null
);
},
onResultTap:
(
Map
<
String
,
dynamic
>
result
)
{
tabVo
.
selected
=
result
;
if
(
onNodeChange
!=
null
)
{
onNodeChange
(
index
,
tabVo
);
}
onNodeChange
(
index
,
tabVo
);
callback
(
null
);
}));
}
...
...
@@ -409,11 +399,11 @@ Widget buildTapWidget(BuildContext context,
/// 价格Table
///
Widget
_buildPriceShowWidget
(
{
Map
<
String
,
dynamic
>
structure
,
String
keyName
,
@required
void
Function
(
Map
<
String
,
dynamic
>)
onResultTap
,
@
required
void
Function
()
onResetTap
,
Map
<
String
,
dynamic
>
selected
})
{
{
required
Map
<
String
,
dynamic
>
structure
,
String
?
keyName
,
required
void
Function
(
Map
<
String
?
,
dynamic
>)
onResultTap
,
required
void
Function
()
onResetTap
,
Map
<
String
?,
dynamic
>?
selected
})
{
TextEditingController
controller1
=
TextEditingController
();
TextEditingController
controller2
=
TextEditingController
();
...
...
@@ -437,7 +427,7 @@ Widget _buildPriceShowWidget(
keyName2
=
'
${labels[1]['key_name']}
'
;
}
}
if
(
selected
[
keyName1
]
is
String
)
{
if
(
selected
!
[
keyName1
]
is
String
)
{
controller1
.
text
=
'
${selected[keyName1]}
'
;
}
if
(
selected
[
keyName2
]
is
String
)
{
...
...
@@ -562,11 +552,8 @@ Widget _buildPriceShowWidget(
borderRadius:
BorderRadius
.
circular
(
8
)),
),
onTap:
()
{
if
(
onResetTap
!=
null
)
{
onResetTap
();
}
onResetTap
();
}),
flex:
1
,
),
SizedBox
(
width:
12
),
...
...
@@ -583,31 +570,23 @@ Widget _buildPriceShowWidget(
color:
Color
(
0xFFFFBB00
)),
),
onTap:
()
{
if
(
onResultTap
!=
null
)
{
Map
<
String
,
dynamic
>
resultMap
=
{};
String
lowest
=
controller1
.
text
.
trim
();
String
highest
=
controller2
.
text
.
trim
();
if
(
keyName1
!=
null
&&
keyName1
.
isNotEmpty
&&
lowest
.
isNotEmpty
)
{
resultMap
[
keyName1
]
=
lowest
;
}
if
(
keyName2
!=
null
&&
keyName2
.
isNotEmpty
&&
highest
.
isNotEmpty
)
{
resultMap
[
keyName2
]
=
highest
;
}
if
(
resultMap
.
isEmpty
)
{
onResetTap
();
}
else
{
Map
<
String
,
dynamic
>
result
=
{
'keyName'
:
keyName
,
keyName:
resultMap
};
onResultTap
(
result
);
}
Map
<
String
,
dynamic
>
resultMap
=
{};
String
lowest
=
controller1
.
text
.
trim
();
String
highest
=
controller2
.
text
.
trim
();
if
(
keyName1
.
isNotEmpty
&&
lowest
.
isNotEmpty
)
{
resultMap
[
keyName1
]
=
lowest
;
}
}),
if
(
keyName2
.
isNotEmpty
&&
highest
.
isNotEmpty
)
{
resultMap
[
keyName2
]
=
highest
;
}
if
(
resultMap
.
isEmpty
)
{
onResetTap
();
}
else
{
Map
<
String
?,
dynamic
>
result
=
{
'keyName'
:
keyName
,
keyName:
resultMap
};
onResultTap
(
result
);
}
}
),
flex:
3
,
),
...
...
@@ -620,9 +599,9 @@ Widget _buildPriceShowWidget(
}
Widget
_buildNewestWidget
(
{
@
required
List
<
dynamic
>
structure
,
@
required
void
Function
(
int
)
onChange
,
Map
<
String
,
dynamic
>
selected
})
{
{
required
List
<
dynamic
>
structure
,
required
void
Function
(
int
)
onChange
,
Map
<
String
?,
dynamic
>?
selected
})
{
return
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
...
...
@@ -630,7 +609,7 @@ Widget _buildNewestWidget(
child:
ListView
.
builder
(
padding:
EdgeInsets
.
zero
,
shrinkWrap:
true
,
itemCount:
structure
?.
length
??
0
,
itemCount:
structure
.
length
,
physics:
NeverScrollableScrollPhysics
(),
itemBuilder:
(
BuildContext
context
,
int
index
)
{
dynamic
map
=
structure
[
index
];
...
...
@@ -649,9 +628,7 @@ Widget _buildNewestWidget(
color:
Color
(
enable
?
0xFFFF8000
:
0xFF666666
))),
),
onTap:
()
{
if
(
onChange
!=
null
)
{
onChange
(
index
);
}
onChange
(
index
);
},
);
},
...
...
@@ -659,39 +636,39 @@ Widget _buildNewestWidget(
);
}
String
getHeaderTitle
(
TabVo
tabVo
){
String
title
=
''
;
String
?
getHeaderTitle
(
TabVo
tabVo
){
String
?
title
=
''
;
if
(
tabVo
.
selected
==
null
)
{
title
=
tabVo
.
text
;
}
else
if
(
tabVo
.
keyName
==
'price_section'
)
{
try
{
if
(
tabVo
.
selected
[
'price_section'
]
is
Map
)
{
Map
<
String
,
dynamic
>.
from
(
tabVo
.
selected
[
'price_section'
])
if
(
tabVo
.
selected
!
[
'price_section'
]
is
Map
)
{
Map
<
String
,
dynamic
>.
from
(
tabVo
.
selected
!
[
'price_section'
])
.
values
.
forEach
((
ele
)
{
if
(
title
.
isNotEmpty
)
{
title
=
title
+
'-'
;
if
(
title
!
.
isNotEmpty
)
{
title
=
title
!
+
'-'
;
}
title
=
title
+
'
$ele
'
;
title
=
title
!
+
'
$ele
'
;
});
}
}
catch
(
e
)
{
title
=
tabVo
.
text
;
}
}
else
{
title
=
'
${tabVo.selected
['text'] ?? tabVo.selected
['name']}
'
;
title
=
'
${tabVo.selected
!['text'] ?? tabVo.selected!
['name']}
'
;
}
return
title
;
}
void
onTapUpCallback
(
{
OverlayWidgetBuilder
callback
,
void
Function
(
int
,
bool
)
onChange
,
TabVo
tabVo
,
void
Function
(
int
,
TabVo
)
onNodeChange
,
int
index
}){
void
onTapUpCallback
(
{
OverlayWidgetBuilder
?
callback
,
void
Function
(
int
,
bool
)?
onChange
,
required
TabVo
tabVo
,
void
Function
(
int
?,
TabVo
)?
onNodeChange
,
int
?
index
}){
if
(
tabVo
.
type
==
'3'
)
{
callback
(
_buildNewestWidget
(
callback
!
(
_buildNewestWidget
(
structure:
tabVo
.
structure
??
[],
onChange:
(
v
)
{
if
(
tabVo
.
structure
!=
null
&&
tabVo
.
structure
.
length
>
v
)
{
if
(
tabVo
.
structure
!=
null
&&
tabVo
.
structure
!
.
length
>
v
)
{
callback
(
null
);
dynamic
data
=
tabVo
.
structure
[
v
];
dynamic
data
=
tabVo
.
structure
!
[
v
];
tabVo
.
selected
=
data
;
if
(
onNodeChange
!=
null
)
{
onNodeChange
(
index
,
tabVo
);
...
...
@@ -700,10 +677,10 @@ void onTapUpCallback({OverlayWidgetBuilder callback,void Function(int, bool) onC
},
selected:
tabVo
.
selected
));
}
else
if
(
tabVo
.
type
==
'4'
)
{
callback
(
_buildPriceShowWidget
(
structure:
tabVo
.
structure
[
0
],
callback
!
(
_buildPriceShowWidget
(
structure:
tabVo
.
structure
!
[
0
],
keyName:
tabVo
.
keyName
,
onResultTap:
(
Map
<
String
,
dynamic
>
data
)
{
onResultTap:
(
Map
<
String
?
,
dynamic
>
data
)
{
tabVo
.
selected
=
data
;
if
(
onNodeChange
!=
null
)
{
onNodeChange
(
index
,
tabVo
);
...
...
@@ -720,7 +697,7 @@ void onTapUpCallback({OverlayWidgetBuilder callback,void Function(int, bool) onC
selected:
tabVo
.
selected
??
{},
));
}
else
if
(
tabVo
.
type
==
'5'
)
{
callback
(
_buildClassifyShowWidget
(
callback
!
(
_buildClassifyShowWidget
(
selected:
tabVo
.
selected
,
structure:
tabVo
.
structure
,
onResetTap:
()
{
...
...
@@ -740,21 +717,21 @@ void onTapUpCallback({OverlayWidgetBuilder callback,void Function(int, bool) onC
}
}
OverlayWidgetBuilder
mCallback
;
OverlayWidgetBuilder
?
mCallback
;
int
_jindex
=
-
1
;
///
/// 分类
///
Widget
buildCategoryTapWidget
(
List
<
TabVo
>
tabList
,
List
<
dynamic
>
sellingTabs
,
{
GlobalKey
anchorKey
,
Map
<
String
,
dynamic
>
sellTab
,
void
Function
(
Map
<
String
,
dynamic
>)
onChangeSort
,
@
required
void
Function
(
int
,
bool
)
onChange
,
@required
void
Function
(
int
,
TabVo
)
onNodeChange
})
{
Widget
categoryWidget
(
int
index
,{
Widget
Function
()
onHeaderWidget
})
{
{
GlobalKey
?
anchorKey
,
Map
<
String
,
dynamic
>
?
sellTab
,
void
Function
(
Map
<
String
,
dynamic
>)
?
onChangeSort
,
required
void
Function
(
int
,
bool
)
onChange
,
required
void
Function
(
int
?
,
TabVo
)
onNodeChange
})
{
Widget
categoryWidget
(
int
index
,{
Widget
Function
()
?
onHeaderWidget
})
{
TabVo
tabVo
=
tabList
[
index
];
String
title
=
getHeaderTitle
(
tabVo
);
String
?
title
=
getHeaderTitle
(
tabVo
);
return
Expanded
(
child:
OtherWidget
(
onHeaderWidget:
onHeaderWidget
,
...
...
@@ -781,19 +758,15 @@ Widget buildCategoryTapWidget(List<TabVo> tabList, List<dynamic> sellingTabs,
],
),
onCloseTap:
()
{
if
(
onChange
!=
null
&&
_jindex
!=
-
1
)
{
if
(
_jindex
!=
-
1
)
{
onChange
(
_jindex
,
false
);
}
if
(
onChange
!=
null
)
{
onChange
(
index
,
false
);
}
onChange
(
index
,
false
);
_jindex
=
-
1
;
},
tapUpCallback:
(
OverlayWidgetBuilder
callback
)
{
mCallback
=
callback
;
if
(
onChange
!=
null
)
{
onChange
(
index
,
true
);
}
onChange
(
index
,
true
);
onTapUpCallback
(
callback:
mCallback
,
onChange:
onChange
,
tabVo:
tabVo
,
onNodeChange:
onNodeChange
,
index:
index
);
},
),
...
...
@@ -833,9 +806,7 @@ Widget buildCategoryTapWidget(List<TabVo> tabList, List<dynamic> sellingTabs,
},
onTap:
(
int
jindex
,
TabVo
tabVo
){
_jindex
=
jindex
;
if
(
mCallback
==
null
){
return
;}
if
(
onChange
!=
null
)
{
onChange
(
jindex
,
true
);
}
onChange
(
jindex
,
true
);
onTapUpCallback
(
callback:
mCallback
,
onChange:
onChange
,
tabVo:
tabVo
,
onNodeChange:
onNodeChange
,
index:
jindex
);
},);
})
...
...
@@ -899,7 +870,7 @@ Widget buildCategoryTapWidget(List<TabVo> tabList, List<dynamic> sellingTabs,
///
/// 当搜索的商品数据为空
///
Widget
buildEmptyProductList
(
{
bool
refresh
=
false
,
void
Function
()
onResetTap
})
{
Widget
buildEmptyProductList
(
{
bool
refresh
=
false
,
void
Function
()
?
onResetTap
})
{
Widget
widget
=
Container
(
margin:
EdgeInsets
.
only
(
top:
120
.
w
),
child:
Column
(
...
...
@@ -924,9 +895,9 @@ Widget buildEmptyProductList({bool refresh = false, void Function() onResetTap})
class
_SliverTabBarDelegate
extends
SliverPersistentHeaderDelegate
{
_SliverTabBarDelegate
({
@
required
this
.
minHeight
,
@
required
this
.
maxHeight
,
@
required
this
.
child
,
required
this
.
minHeight
,
required
this
.
maxHeight
,
required
this
.
child
,
});
final
double
minHeight
;
...
...
@@ -957,16 +928,16 @@ class _SliverTabBarDelegate extends SliverPersistentHeaderDelegate {
/// 分类Widget
///
class
ClassifyShowWidget
extends
StatefulWidget
{
final
Map
<
String
,
dynamic
>
selected
;
final
Map
<
String
?,
dynamic
>?
selected
;
final
void
Function
(
Map
<
String
,
dynamic
>)
onResultTap
;
final
void
Function
()
onResetTap
;
final
List
<
dynamic
>
structure
;
final
List
<
dynamic
>
?
structure
;
const
ClassifyShowWidget
(
{
Key
key
,
{
Key
?
key
,
this
.
structure
,
@
required
this
.
onResultTap
,
@
required
this
.
onResetTap
,
required
this
.
onResultTap
,
required
this
.
onResetTap
,
this
.
selected
})
:
super
(
key:
key
);
...
...
@@ -975,7 +946,7 @@ class ClassifyShowWidget extends StatefulWidget {
}
class
_ClassifyShowWidgetState
extends
State
<
ClassifyShowWidget
>
{
List
<
dynamic
>
structure
,
structureNode1
;
List
<
dynamic
>
?
structure
,
structureNode1
;
int
childNode1
=
0
,
childNode2
=
0
;
...
...
@@ -983,18 +954,18 @@ class _ClassifyShowWidgetState extends State<ClassifyShowWidget> {
void
initState
()
{
this
.
structure
=
widget
.
structure
;
try
{
if
(
widget
.
selected
!=
null
&&
widget
.
selected
.
isNotEmpty
)
{
String
level
=
widget
.
selected
[
'level'
];
String
parentId
=
widget
.
selected
[
'parent_id'
];
String
id
=
widget
.
selected
[
'id'
];
if
(
widget
.
selected
!=
null
&&
widget
.
selected
!
.
isNotEmpty
)
{
String
?
level
=
widget
.
selected
!
[
'level'
];
String
?
parentId
=
widget
.
selected
!
[
'parent_id'
];
String
?
id
=
widget
.
selected
!
[
'id'
];
if
(
level
==
'1'
)
{
childNode1
=
this
.
structure
.
indexWhere
((
ele
)
=>
(
ele
[
'id'
]
==
id
));
childNode1
=
this
.
structure
!
.
indexWhere
((
ele
)
=>
(
ele
[
'id'
]
==
id
));
}
else
if
(
level
==
'2'
)
{
childNode1
=
this
.
structure
.
indexWhere
((
ele
)
=>
(
ele
[
'id'
]
==
parentId
));
if
(
this
.
structure
[
childNode1
]
!=
null
)
{
this
.
structure
!
.
indexWhere
((
ele
)
=>
(
ele
[
'id'
]
==
parentId
));
if
(
this
.
structure
!
[
childNode1
]
!=
null
)
{
childNode2
=
List
<
dynamic
>.
from
(
Map
<
String
,
dynamic
>.
from
(
this
.
structure
[
childNode1
])[
'child'
])
this
.
structure
!
[
childNode1
])[
'child'
])
.
indexWhere
((
ele
)
=>
(
ele
[
'id'
]
==
id
));
}
}
...
...
@@ -1005,8 +976,8 @@ class _ClassifyShowWidgetState extends State<ClassifyShowWidget> {
@override
Widget
build
(
BuildContext
context
)
{
if
(
structure
[
childNode1
][
'child'
]
!=
null
)
{
structureNode1
=
List
<
dynamic
>.
from
(
structure
[
childNode1
][
'child'
]);
if
(
structure
!
[
childNode1
][
'child'
]
!=
null
)
{
structureNode1
=
List
<
dynamic
>.
from
(
structure
!
[
childNode1
][
'child'
]);
}
return
Container
(
alignment:
Alignment
.
topCenter
,
...
...
@@ -1024,10 +995,10 @@ class _ClassifyShowWidgetState extends State<ClassifyShowWidget> {
width:
94
.
w
,
padding:
EdgeInsets
.
all
(
0
),
child:
ListView
.
builder
(
itemCount:
structure
.
length
,
itemCount:
structure
!
.
length
,
padding:
EdgeInsets
.
all
(
0
),
itemBuilder:
(
BuildContext
context
,
int
index
)
{
dynamic
dMap
=
structure
[
index
];
dynamic
dMap
=
structure
!
[
index
];
return
InkWell
(
child:
Container
(
padding:
EdgeInsets
.
only
(
left:
12
.
w
),
...
...
@@ -1065,16 +1036,16 @@ class _ClassifyShowWidgetState extends State<ClassifyShowWidget> {
);
}),
),
if
(
structureNode1
!=
null
&&
structureNode1
.
length
>
0
)
if
(
structureNode1
!=
null
&&
structureNode1
!
.
length
>
0
)
Expanded
(
child:
Container
(
color:
Colors
.
white
,
child:
GridView
.
builder
(
padding:
EdgeInsets
.
all
(
0
),
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
2
,
crossAxisSpacing:
1
.
w
,
childAspectRatio:
3.3
.
w
),
itemCount:
structureNode1
.
length
,
itemCount:
structureNode1
!
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
dynamic
dMap
=
structureNode1
[
index
];
dynamic
dMap
=
structureNode1
!
[
index
];
return
InkWell
(
child:
Container
(
padding:
EdgeInsets
.
only
(
left:
24
.
w
),
...
...
@@ -1114,9 +1085,7 @@ class _ClassifyShowWidgetState extends State<ClassifyShowWidget> {
borderRadius:
BorderRadius
.
circular
(
8
.
w
)),
),
onTap:
()
{
if
(
widget
.
onResetTap
!=
null
)
{
widget
.
onResetTap
();
}
widget
.
onResetTap
();
}),
flex:
1
,
...
...
@@ -1131,17 +1100,15 @@ class _ClassifyShowWidgetState extends State<ClassifyShowWidget> {
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
8
),
color:
Color
(
0xFFFFBB00
)),
),
onTap:
()
{
if
(
structureNode1
!=
null
&&
structureNode1
.
isNotEmpty
)
{
if
(
structureNode1
!=
null
&&
structureNode1
!
.
isNotEmpty
)
{
Map
<
String
,
dynamic
>
result
=
{};
if
(
childNode2
==
0
)
{
result
=
Map
<
String
,
dynamic
>.
from
(
structure
[
childNode1
]);
result
=
Map
<
String
,
dynamic
>.
from
(
structure
!
[
childNode1
]);
}
else
{
result
=
Map
<
String
,
dynamic
>.
from
(
structureNode1
[
childNode2
]);
result
=
Map
<
String
,
dynamic
>.
from
(
structureNode1
!
[
childNode2
]);
}
result
.
remove
(
'child'
);
if
(
widget
.
onResultTap
!=
null
)
{
widget
.
onResultTap
(
result
);
}
widget
.
onResultTap
(
result
);
}
}),
flex:
3
,
...
...
lib/page/widget/other/other_widget.dart
View file @
3e21f1ca
...
...
@@ -5,20 +5,20 @@ import 'package:common_module/utils/xapp_utils.dart';
typedef
OverlayTapUpCallback
=
void
Function
(
OverlayWidgetBuilder
overlayBuilder
);
typedef
OverlayWidgetBuilder
=
void
Function
(
Widget
overlayWidget
);
typedef
OverlayWidgetBuilder
=
void
Function
(
Widget
?
overlayWidget
);
class
OtherWidget
extends
StatefulWidget
{
final
Widget
child
;
final
OverlayTapUpCallback
tapUpCallback
;
final
GestureTapCallback
onCloseTap
;
final
Widget
Function
()
onHeaderWidget
;
final
OverlayTapUpCallback
?
tapUpCallback
;
final
GestureTapCallback
?
onCloseTap
;
final
Widget
Function
()
?
onHeaderWidget
;
const
OtherWidget
({
Key
key
,
@
required
this
.
child
,
const
OtherWidget
({
Key
?
key
,
required
this
.
child
,
this
.
tapUpCallback
,
this
.
onCloseTap
,
@
required
this
.
onHeaderWidget
,
required
this
.
onHeaderWidget
,
})
:
super
(
key:
key
);
@override
...
...
@@ -28,21 +28,21 @@ class OtherWidget extends StatefulWidget {
class
_OtherWidgetState
extends
State
<
OtherWidget
>
{
GlobalKey
globalKey
=
GlobalKey
();
OverlayEntry
overlayEntry
;
OverlayEntry
?
overlayEntry
;
void
onCloseEntry
({
bool
close
})
{
void
onCloseEntry
({
bool
?
close
})
{
if
(
overlayEntry
!=
null
)
{
overlayEntry
.
remove
();
overlayEntry
!
.
remove
();
overlayEntry
=
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
){
overlayEntry
.
remove
();
overlayEntry
!
.
remove
();
overlayEntry
=
null
;
}
overlayEntry
=
new
OverlayEntry
(
maintainState:
true
,
builder:
(
BuildContext
context
)
{
...
...
@@ -50,7 +50,7 @@ class _OtherWidgetState extends State<OtherWidget> {
InkWell
(
child:
Container
(
height:
height
,
color:
Colors
.
transparent
),
onTap:
onCloseEntry
),
Container
(
alignment:
Alignment
.
center
,
child:
widget
.
onHeaderWidget
(),
height:
headerHeight
,
child:
widget
.
onHeaderWidget
!
(),
height:
headerHeight
,
color:
Colors
.
transparent
,
),
Container
(
child:
overlayWidget
,
color:
Color
(
0xFF000000
).
withAlpha
(
102
)),
...
...
@@ -60,7 +60,7 @@ class _OtherWidgetState extends State<OtherWidget> {
),
],),
color:
Colors
.
transparent
,));
});
Overlay
.
of
(
context
,
rootOverlay:
true
)
.
insert
(
overlayEntry
);
Overlay
.
of
(
context
,
rootOverlay:
true
)
!.
insert
(
overlayEntry
!
);
}
@override
...
...
@@ -80,12 +80,12 @@ class _OtherWidgetState extends State<OtherWidget> {
child:
Container
(
child:
widget
.
child
,
alignment:
Alignment
.
center
,),
onTap:
(){
if
(
overlayEntry
!=
null
)
{
overlayEntry
.
remove
();
overlayEntry
!
.
remove
();
overlayEntry
=
null
;
}
RenderBox
renderBox
=
context
.
findRenderObject
();
RenderBox
renderBox
=
context
.
findRenderObject
()
as
RenderBox
;
Offset
offset
=
renderBox
.
localToGlobal
(
Offset
.
zero
);
widget
.
tapUpCallback
((
Widget
overlayWidget
){
widget
.
tapUpCallback
!((
Widget
?
overlayWidget
){
if
(
overlayWidget
==
null
){
onCloseEntry
(
close:
true
);
}
else
{
...
...
@@ -105,16 +105,16 @@ class _OtherWidgetState extends State<OtherWidget> {
class
OverlayEntryHeader
extends
StatefulWidget
{
final
List
<
TabVo
>
tabList
;
final
String
Function
(
TabVo
)
onHeaderTitle
;
final
void
Function
(
int
,
TabVo
)
onTap
;
const
OverlayEntryHeader
({
Key
key
,
@
required
this
.
tabList
,
this
.
onHeaderTitle
,
this
.
onTap
})
:
super
(
key:
key
);
final
String
?
Function
(
TabVo
)?
onHeaderTitle
;
final
void
Function
(
int
,
TabVo
)
?
onTap
;
const
OverlayEntryHeader
({
Key
?
key
,
required
this
.
tabList
,
this
.
onHeaderTitle
,
this
.
onTap
})
:
super
(
key:
key
);
@override
_OverlayEntryHeaderState
createState
()
=>
_OverlayEntryHeaderState
();
}
class
_OverlayEntryHeaderState
extends
State
<
OverlayEntryHeader
>
{
List
<
TabVo
>
tabList
;
late
List
<
TabVo
>
tabList
;
@override
void
initState
()
{
...
...
@@ -127,7 +127,7 @@ class _OverlayEntryHeaderState extends State<OverlayEntryHeader> {
return
Row
(
children:
List
.
generate
(
tabList
.
length
,(
index
){
TabVo
tabVo
=
tabList
[
index
];
String
title
=
widget
.
onHeaderTitle
(
tabVo
);
String
?
title
=
widget
.
onHeaderTitle
!
(
tabVo
);
return
Expanded
(
child:
InkWell
(
child:
Container
(
alignment:
Alignment
.
center
,
...
...
@@ -146,7 +146,7 @@ class _OverlayEntryHeaderState extends State<OverlayEntryHeader> {
)
],)
),
onTap:
(){
widget
.
onTap
(
index
,
tabVo
);
widget
.
onTap
!
(
index
,
tabVo
);
},),
flex:
1
,
);
...
...
lib/page/widget/search/index.dart
View file @
3e21f1ca
...
...
@@ -24,7 +24,7 @@ abstract class SearchWidgetDelegate {
///
/// 设置页面isGrid
///
void
setPageGrid
({
bool
isGrid
});
void
setPageGrid
({
bool
?
isGrid
});
}
///
...
...
@@ -35,13 +35,13 @@ class SearchWidget extends StatefulWidget {
final
List
<
dynamic
>
priceCategory
;
final
Map
<
int
,
dynamic
>
platformIconMap
;
final
String
keywords
;
final
void
Function
(
Map
<
String
,
dynamic
>)
onGoodDetails
;
final
void
Function
(
SearchWidgetDelegate
)
onWidgetDelegate
;
final
void
Function
(
Map
<
String
,
dynamic
>)
?
onGoodDetails
;
final
void
Function
(
SearchWidgetDelegate
)
?
onWidgetDelegate
;
const
SearchWidget
(
{
Key
key
,
@
required
this
.
priceCategory
,
@
required
this
.
keywords
,
@
required
this
.
platformIconMap
,
{
Key
?
key
,
required
this
.
priceCategory
,
required
this
.
keywords
,
required
this
.
platformIconMap
,
this
.
isGrid
=
true
,
this
.
onGoodDetails
,
this
.
onWidgetDelegate
})
...
...
@@ -58,7 +58,7 @@ class _SearchWidgetState extends State<SearchWidget>
IPriceActionDelegate
{
RefreshController
_refreshController
=
RefreshController
();
IPriceAction
<
PriceVo
>
_priceAction
;
IPriceAction
<
PriceVo
>
?
_priceAction
;
@override
bool
get
wantKeepAlive
=>
true
;
...
...
@@ -66,11 +66,11 @@ class _SearchWidgetState extends State<SearchWidget>
@override
void
initState
()
{
if
(
widget
.
onWidgetDelegate
!=
null
)
{
widget
.
onWidgetDelegate
(
this
);
widget
.
onWidgetDelegate
!
(
this
);
}
_priceAction
=
PriceAction
(
delegate:
this
);
_searchKeywords
=
widget
.
keywords
;
_priceAction
.
setPriceCategory
(
_priceAction
!
.
setPriceCategory
(
priceCategory:
widget
.
priceCategory
,
keywords:
_searchKeywords
,
platformIconMap:
widget
.
platformIconMap
);
...
...
@@ -78,18 +78,18 @@ class _SearchWidgetState extends State<SearchWidget>
}
@override
void
setPageGrid
({
bool
isGrid
})
{
_priceAction
.
getProductListVo
()?
.
isGrid
=
isGrid
;
_priceAction
.
getProductListVo
()?
.
notifyListener
(
true
);
void
setPageGrid
({
bool
?
isGrid
})
{
_priceAction
!.
getProductListVo
()
.
isGrid
=
isGrid
;
_priceAction
!.
getProductListVo
()
.
notifyListener
(
true
);
}
String
_searchKeywords
;
String
?
_searchKeywords
;
@override
void
onKeywordsSearch
(
String
keywords
)
{
if
(
_searchKeywords
!=
keywords
)
{
_searchKeywords
=
keywords
;
_priceAction
.
qryProductListEvent
(
keywords:
keywords
);
_priceAction
!
.
qryProductListEvent
(
keywords:
keywords
);
}
}
...
...
@@ -98,7 +98,7 @@ class _SearchWidgetState extends State<SearchWidget>
Widget
build
(
BuildContext
context
)
{
super
.
build
(
context
);
return
DSProviderWidget
<
PriceVo
,
IPriceAction
<
PriceVo
>>(
dsAction:
_priceAction
,
dsAction:
_priceAction
!
,
builder:
(
BuildContext
context
,
child
)
{
return
Container
(
color:
Color
(
0xFFF5F5F5
),
...
...
@@ -115,12 +115,12 @@ class _SearchWidgetState extends State<SearchWidget>
children:
[
//Tab分类Widget
buildSortHeader
(
action:
_priceAction
,
keywords:
widget
.
keywords
),
action:
_priceAction
!
,
keywords:
widget
.
keywords
),
//商品列表
DSProvider
.
value
(
vo:
_priceAction
.
getProductListVo
(),
vo:
_priceAction
!
.
getProductListVo
(),
builderWidget:
(
BuildContext
context
,
ProductListVo
productListVo
,
Widget
widget1
)
{
ProductListVo
productListVo
,
Widget
?
widget1
)
{
if
(
productListVo
.
productList
.
isEmpty
)
{
if
(
productListVo
.
viewState
==
DSViewState
.
busy
)
{
return
SliverToBoxAdapter
(
...
...
@@ -168,7 +168,7 @@ class _SearchWidgetState extends State<SearchWidget>
'remark'
:
entity
.
special
};
if
(
widget
.
onGoodDetails
!=
null
)
{
widget
.
onGoodDetails
(
goodDetails
);
widget
.
onGoodDetails
!
(
goodDetails
);
}
}));
}
else
{
...
...
@@ -188,7 +188,7 @@ class _SearchWidgetState extends State<SearchWidget>
'remark'
:
entity
.
special
};
if
(
widget
.
onGoodDetails
!=
null
)
{
widget
.
onGoodDetails
(
goodDetails
);
widget
.
onGoodDetails
!
(
goodDetails
);
}
},
));
...
...
@@ -201,22 +201,22 @@ class _SearchWidgetState extends State<SearchWidget>
//Tab分类Widget
Widget
buildSortHeader
(
{
@required
IPriceAction
<
PriceVo
>
action
,
String
keywords
})
{
{
required
IPriceAction
<
PriceVo
>
action
,
String
?
keywords
})
{
return
DSProvider
.
value
(
vo:
action
.
getTabListVo
(),
builderWidget:
(
BuildContext
context
,
TabListVo
tabListVo
,
Widget
widget
)
{
return
buildTapWidget
(
context
,
tabList:
tabListVo
.
tabList
??
[]
,
(
BuildContext
context
,
TabListVo
tabListVo
,
Widget
?
widget
)
{
return
buildTapWidget
(
context
,
tabList:
tabListVo
.
tabList
,
onChange:
(
index
,
enable
)
{
tabListVo
?
.
tabList
[
index
].
open
=
enable
;
tabListVo
.
tabList
[
index
].
open
=
enable
;
tabListVo
.
notifyListener
(
true
);
},
onNodeChange:
(
int
index
,
TabVo
tabVo
)
{
},
onNodeChange:
(
int
?
index
,
TabVo
tabVo
)
{
tabVo
.
open
=
false
;
if
(
tabVo
.
selected
!=
null
&&
tabVo
.
selected
[
'is_default'
]
==
'1'
)
{
if
(
tabVo
.
selected
!=
null
&&
tabVo
.
selected
!
[
'is_default'
]
==
'1'
)
{
tabVo
.
selected
=
null
;
}
tabListVo
.
notifyListener
(
true
);
_priceAction
.
qryProductListEvent
(
keywords:
keywords
);
_priceAction
!
.
qryProductListEvent
(
keywords:
keywords
);
});
});
}
...
...
@@ -228,7 +228,7 @@ class _SearchWidgetState extends State<SearchWidget>
}
@override
void
onloadFailed
({
String
msg
})
{
void
onloadFailed
({
String
?
msg
})
{
_refreshController
.
loadFailed
();
_refreshController
.
refreshCompleted
(
resetFooterState:
true
);
}
...
...
lib/route/navigate_utils.dart
View file @
3e21f1ca
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_boost/flutter_boost.dart'
;
///
...
...
@@ -14,14 +13,11 @@ class NavigateUtils {
///
///
static
Future
<
Map
<
dynamic
,
dynamic
>>
push
({
@
required
String
path
,
required
String
path
,
bool
isNative
=
false
,
bool
needLogin
=
true
,
Map
<
String
,
dynamic
>
arguments
=
const
{},
})
async
{
if
(
arguments
==
null
)
{
arguments
=
{};
}
// 记录上一个页面的名称
arguments
[
'previousRouteName'
]
=
_getPreviousRouteName
();
dynamic
result
=
await
BoostNavigator
.
instance
.
push
(
...
...
@@ -46,10 +42,10 @@ class NavigateUtils {
/// [rootPath] 根路由路径
///
static
popRoot
({
@
required
String
rootPath
,
required
String
rootPath
,
})
async
{
await
BoostNavigator
.
instance
.
pop
().
then
((
value
)
async
{
PageInfo
pageInfo
=
BoostNavigator
.
instance
.
getTopPageInfo
();
PageInfo
?
pageInfo
=
BoostNavigator
.
instance
.
getTopPageInfo
();
String
pageName
=
pageInfo
?.
pageName
??
''
;
if
(
pageName
.
isNotEmpty
&&
pageName
!=
rootPath
)
{
await
popRoot
(
rootPath:
rootPath
);
...
...
@@ -58,8 +54,8 @@ class NavigateUtils {
}
// 获取下一个新页面的上一个页面名称(页面路径)
static
String
_getPreviousRouteName
()
{
PageInfo
pageInfo
=
BoostNavigator
.
instance
.
getTopPageInfo
();
static
String
?
_getPreviousRouteName
()
{
PageInfo
?
pageInfo
=
BoostNavigator
.
instance
.
getTopPageInfo
();
var
boostPath
=
pageInfo
?.
pageName
;
return
boostPath
;
}
...
...
lib/utils/text_size.dart
View file @
3e21f1ca
...
...
@@ -14,11 +14,11 @@ class TextSize {
///
static
Size
calculateTextSize
(
BuildContext
context
,
{
String
value
,
double
fontSize
,
FontWeight
fontWeight
,
double
maxWidth
,
int
maxLines
,
String
?
value
,
double
?
fontSize
,
FontWeight
?
fontWeight
,
required
double
maxWidth
,
int
?
maxLines
,
})
{
TextPainter
painter
=
TextPainter
(
///AUTO:华为手机如果不指定locale的时候,该方法算出来的文字高度是比系统计算偏小的。
...
...
lib/utils/time_utils.dart
View file @
3e21f1ca
...
...
@@ -43,7 +43,7 @@ class TimeUtils {
return
'0'
;
}
static
String
formatTime
({
String
timestamp
})
{
static
String
formatTime
({
required
String
timestamp
})
{
int
time
=
int
.
parse
(
timestamp
);
DateTime
dateTime
=
DateTime
.
fromMillisecondsSinceEpoch
(
time
*
1000
);
DateTime
endDate
=
new
DateTime
.
now
();
...
...
lib/widget/animation/image_animation_widget.dart
View file @
3e21f1ca
...
...
@@ -2,24 +2,24 @@ import 'package:flutter/material.dart';
class
ImageAnimationWidget
extends
StatelessWidget
{
final
ValueNotifier
<
int
>
valueNotifier
;
final
List
<
String
>
images
;
final
String
package
;
final
double
width
;
final
double
height
;
final
ValueNotifier
<
int
>
?
valueNotifier
;
final
List
<
String
>
?
images
;
final
String
?
package
;
final
double
?
width
;
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
Widget
build
(
BuildContext
context
)
{
return
ValueListenableBuilder
<
int
>(
valueListenable:
valueNotifier
,
builder:
(
BuildContext
context
,
int
value
,
Widget
child
)
{
valueListenable:
valueNotifier
!
,
builder:
(
BuildContext
context
,
int
value
,
Widget
?
child
)
{
String
image
;
if
(
value
>=
0
&&
value
<
images
.
length
){
image
=
images
[
value
];
if
(
value
>=
0
&&
value
<
images
!
.
length
){
image
=
images
!
[
value
];
}
else
{
image
=
images
[
0
];
image
=
images
!
[
0
];
}
return
Image
.
asset
(
image
,
package:
package
,
gaplessPlayback:
true
,
width:
width
,
height:
height
,);
}
...
...
lib/widget/appbar/index.dart
View file @
3e21f1ca
...
...
@@ -2,12 +2,12 @@ import 'package:flutter/material.dart';
Widget
buildAppSearchBar
(
{
double
height
=
48
,
Decoration
decoration
,
EdgeInsetsGeometry
margin
,
EdgeInsetsGeometry
padding
,
Widget
left
,
Widget
child
,
Widget
right
,
Decoration
?
decoration
,
EdgeInsetsGeometry
?
margin
,
EdgeInsetsGeometry
?
padding
,
Widget
?
left
,
Widget
?
child
,
Widget
?
right
,
})
{
return
PreferredSize
(
child:
SafeArea
(
...
...
lib/widget/failed/failed_load_page.dart
View file @
3e21f1ca
...
...
@@ -7,8 +7,8 @@ import 'package:common_module/utils/xapp_utils.dart';
class
LoadingPage
extends
StatelessWidget
{
final
String
msg
;
final
int
length
;
final
EdgeInsetsGeometry
padding
;
const
LoadingPage
({
Key
key
,
this
.
padding
,
this
.
msg
=
'1'
,
this
.
length
=
6
})
final
EdgeInsetsGeometry
?
padding
;
const
LoadingPage
({
Key
?
key
,
this
.
padding
,
this
.
msg
=
'1'
,
this
.
length
=
6
})
:
super
(
key:
key
);
@override
...
...
@@ -120,12 +120,12 @@ class LoadingPage extends StatelessWidget {
/// [onReloadTap] 重新加载按钮
///
class
FailedLoadPage
extends
StatelessWidget
{
final
EdgeInsetsGeometry
margin
;
final
EdgeInsetsGeometry
?
margin
;
final
String
errorMsg
;
final
void
Function
()
onContactTap
;
final
void
Function
()
onReloadTap
;
final
void
Function
()
?
onContactTap
;
final
void
Function
()
?
onReloadTap
;
const
FailedLoadPage
(
{
Key
key
,
{
Key
?
key
,
this
.
margin
,
this
.
errorMsg
=
'加载失败,请刷新重试'
,
this
.
onContactTap
,
...
...
@@ -195,10 +195,10 @@ class FailedLoadPage extends StatelessWidget {
}
Widget
_buildButtonWidget
(
{
@
required
String
text
,
@
required
TextStyle
style
,
Decoration
decoration
,
void
Function
()
onTap
})
{
{
required
String
text
,
required
TextStyle
style
,
Decoration
?
decoration
,
void
Function
()
?
onTap
})
{
return
InkWell
(
child:
Container
(
width:
164
.
w
,
...
...
lib/widget/image/image_widget.dart
View file @
3e21f1ca
...
...
@@ -3,11 +3,11 @@ import 'package:flutter/material.dart';
class
ImageWidget
extends
StatelessWidget
{
final
String
name
;
final
double
width
;
final
double
height
;
final
double
?
width
;
final
double
?
height
;
final
String
package
;
final
BoxFit
fit
;
const
ImageWidget
({
Key
key
,
@
required
this
.
name
,
this
.
width
,
this
.
height
,
this
.
package
=
'price_module'
,
this
.
fit
})
:
super
(
key:
key
);
final
BoxFit
?
fit
;
const
ImageWidget
({
Key
?
key
,
required
this
.
name
,
this
.
width
,
this
.
height
,
this
.
package
=
'price_module'
,
this
.
fit
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
...
...
lib/widget/item/item_product.dart
View file @
3e21f1ca
...
...
@@ -8,27 +8,27 @@ import 'package:flutter/material.dart';
///
class
ItemProduct
extends
StatelessWidget
{
final
Widget
image
;
final
double
height
;
final
Decoration
decoration
;
final
EdgeInsetsGeometry
margin
;
final
double
?
height
;
final
Decoration
?
decoration
;
final
EdgeInsetsGeometry
?
margin
;
final
EdgeInsetsGeometry
rightMargin
;
final
EdgeInsetsGeometry
?
rightMargin
;
final
Widget
title
;
final
Widget
price
;
final
Widget
platform
;
final
Widget
?
price
;
final
Widget
?
platform
;
final
void
Function
()
onTap
;
final
void
Function
()
?
onTap
;
const
ItemProduct
({
Key
key
,
@
required
this
.
image
,
Key
?
key
,
required
this
.
image
,
this
.
height
,
this
.
decoration
,
this
.
margin
,
this
.
rightMargin
,
@
required
this
.
title
,
required
this
.
title
,
this
.
platform
,
this
.
price
,
this
.
onTap
...
...
@@ -46,8 +46,8 @@ class ItemProduct extends StatelessWidget {
image
,
Expanded
(
child:
Container
(
margin:
rightMargin
,
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
title
,
Expanded
(
child:
price
,
flex:
1
,),
platform
Expanded
(
child:
price
!
,
flex:
1
,),
platform
!
],)))
],
),
...
...
lib/widget/pop/index.dart
View file @
3e21f1ca
...
...
@@ -3,7 +3,7 @@ import 'package:price_module/widget/image/image_widget.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
(
context:
context
,
builder:
(
BuildContext
context
)
{
...
...
@@ -56,9 +56,9 @@ Future<T> showPopBottomSheet<T>({BuildContext context,String pageName,Map<String
Widget
_buildShareWidget
(
BuildContext
context
,
String
key
,
{
@
required
String
name
,
@
required
String
title
,
Map
<
String
,
dynamic
>
extras
=
const
{}})
{
{
required
String
name
,
required
String
title
,
Map
<
String
,
dynamic
>
?
extras
=
const
{}})
{
return
Expanded
(
child:
InkWell
(
child:
Column
(
...
...
lib/widget/price/price_item.dart
View file @
3e21f1ca
...
...
@@ -8,12 +8,12 @@ import 'package:common_module/utils/xapp_utils.dart';
class
PriceGridWidget
extends
StatelessWidget
{
final
EdgeInsetsGeometry
padding
;
final
bool
shrinkWrap
;
final
ScrollPhysics
physics
;
final
void
Function
(
int
)
onItemTap
;
final
List
<
ProductItemEntity
>
list
;
final
ScrollPhysics
?
physics
;
final
void
Function
(
int
)
?
onItemTap
;
final
List
<
ProductItemEntity
>
?
list
;
final
bool
isHaoJia
;
const
PriceGridWidget
(
{
Key
key
,
{
Key
?
key
,
this
.
padding
=
const
EdgeInsets
.
all
(
0
),
this
.
shrinkWrap
=
false
,
this
.
physics
,
...
...
@@ -31,15 +31,15 @@ class PriceGridWidget extends StatelessWidget {
staggeredTileBuilder:
(
index
)
=>
StaggeredTile
.
fit
(
2
),
mainAxisSpacing:
8
.
w
,
crossAxisSpacing:
9
.
w
,
itemCount:
list
.
length
,
itemCount:
list
!
.
length
,
itemBuilder:
itemGridBuilder
,
);
}
Widget
itemGridBuilder
(
BuildContext
context
,
int
index
)
{
ProductItemEntity
vo
=
list
[
index
];
ProductItemEntity
vo
=
list
!
[
index
];
return
InkWell
(
onTap:
()
=>
onItemTap
(
index
),
onTap:
()
=>
onItemTap
!
(
index
),
child:
Container
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
...
...
@@ -56,7 +56,7 @@ class PriceGridWidget extends StatelessWidget {
children:
[
ClipRRect
(
child:
CachedNetworkImage
(
imageUrl:
vo
.
itemPic
,
imageUrl:
vo
.
itemPic
!
,
placeholder:
(
BuildContext
c
,
String
s
)
{
return
Image
.
asset
(
'assets/images/placeholder_image.png'
,
...
...
@@ -77,7 +77,7 @@ class PriceGridWidget extends StatelessWidget {
width:
0.5
.
w
,
color:
Color
(
0xFFE9E9E9
)),
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
3
.
w
))),
child:
Text
(
vo
.
platform
,
vo
.
platform
!
,
style:
TextStyle
(
color:
Color
(
0xFF666666
),
fontSize:
10
.
w
,
...
...
@@ -98,19 +98,19 @@ class PriceGridWidget extends StatelessWidget {
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
vo
.
itemTitle
,
vo
.
itemTitle
!
,
maxLines:
2
,
style:
TextStyle
(
fontWeight:
FontWeight
.
w600
,
fontSize:
14
.
w
),
overflow:
TextOverflow
.
ellipsis
,
),
vo
.
descriptionText
.
isEmpty
vo
.
descriptionText
!
.
isEmpty
?
Container
()
:
SizedBox
(
height:
4
.
w
),
vo
.
descriptionText
.
isEmpty
vo
.
descriptionText
!
.
isEmpty
?
Container
()
:
Text
(
vo
.
descriptionText
,
vo
.
descriptionText
!
,
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
...
...
@@ -129,7 +129,7 @@ class PriceGridWidget extends StatelessWidget {
bottomRight:
Radius
.
circular
(
8
.
w
))),
padding:
EdgeInsets
.
symmetric
(
vertical:
1
.
w
,
horizontal:
4
.
w
),
child:
Text
(
vo
.
rebate
,
child:
Text
(
vo
.
rebate
!
,
style:
TextStyle
(
color:
Color
(
0xFFFF8000
),
fontSize:
11
.
w
,
...
...
@@ -143,7 +143,7 @@ class PriceGridWidget extends StatelessWidget {
alignment:
Alignment
.
centerLeft
,
child:
ListView
.
builder
(
itemCount:
vo
.
tags
.
length
>=
1
?
1
:
vo
.
tags
.
length
,
vo
.
tags
!.
length
>=
1
?
1
:
vo
.
tags
!
.
length
,
scrollDirection:
Axis
.
horizontal
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Container
(
...
...
@@ -154,7 +154,7 @@ class PriceGridWidget extends StatelessWidget {
Radius
.
circular
(
2
.
w
))),
padding:
EdgeInsets
.
symmetric
(
horizontal:
2
.
w
),
child:
Text
(
'
${vo.tags[index]}
'
,
child:
Text
(
'
${vo.tags
!
[index]}
'
,
style:
TextStyle
(
color:
Color
(
0xFFB0B0B0
),
fontSize:
11
.
w
,
...
...
@@ -169,7 +169,7 @@ class PriceGridWidget extends StatelessWidget {
),
SizedBox
(
height:
4
.
w
),
Text
(
vo
.
special
,
vo
.
special
!
,
style:
TextStyle
(
color:
Color
(
0xFFFF0400
),
fontSize:
13
.
w
,
...
...
@@ -187,13 +187,13 @@ class PriceGridWidget extends StatelessWidget {
class
PriceListWidget
extends
StatelessWidget
{
final
EdgeInsetsGeometry
padding
;
final
bool
shrinkWrap
;
final
ScrollPhysics
physics
;
final
void
Function
(
ProductItemEntity
,
int
)
onItemTap
;
final
ScrollPhysics
?
physics
;
final
void
Function
(
ProductItemEntity
,
int
)
?
onItemTap
;
final
bool
scroll
;
final
List
<
ProductItemEntity
>
list
;
final
List
<
ProductItemEntity
>
?
list
;
final
bool
isHaoJia
;
const
PriceListWidget
(
{
Key
key
,
{
Key
?
key
,
this
.
padding
=
const
EdgeInsets
.
all
(
0
),
this
.
scroll
=
false
,
this
.
shrinkWrap
=
false
,
...
...
@@ -208,16 +208,16 @@ class PriceListWidget extends StatelessWidget {
shrinkWrap:
shrinkWrap
,
physics:
physics
,
padding:
padding
,
itemCount:
list
.
length
,
itemCount:
list
!
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
ProductItemEntity
itemVo
=
list
[
index
];
ProductItemEntity
itemVo
=
list
!
[
index
];
return
_buildPriceItem
(
index:
index
,
scroll:
scroll
,
itemEntity:
itemVo
,
onTap:
()
{
if
(
onItemTap
!=
null
)
{
onItemTap
(
itemVo
,
index
);
onItemTap
!
(
itemVo
,
index
);
}
},
);
...
...
@@ -226,10 +226,10 @@ class PriceListWidget extends StatelessWidget {
}
Widget
_buildPriceItem
(
{
int
index
,
bool
scroll
,
ProductItemEntity
itemEntity
,
void
Function
()
onTap
})
{
{
required
int
index
,
required
bool
scroll
,
required
ProductItemEntity
itemEntity
,
void
Function
()
?
onTap
})
{
return
InkWell
(
child:
Container
(
decoration:
BoxDecoration
(
...
...
@@ -261,8 +261,8 @@ class PriceListWidget extends StatelessWidget {
///
/// 好价商品条目的标题等信息
///
Widget
_buildItemDetails
({
ProductItemEntity
vo
})
{
String
descriptionText
=
vo
.
descriptionText
;
Widget
_buildItemDetails
({
required
ProductItemEntity
vo
})
{
String
?
descriptionText
=
vo
.
descriptionText
;
if
(
descriptionText
!=
null
&&
descriptionText
.
isNotEmpty
)
{
descriptionText
=
descriptionText
.
replaceAll
(
'
\n
'
,
''
);
descriptionText
=
descriptionText
.
replaceAll
(
'
\r
'
,
''
);
...
...
@@ -333,7 +333,7 @@ class PriceListWidget extends StatelessWidget {
child:
Container
(
alignment:
Alignment
.
centerLeft
,
child:
ListView
.
builder
(
itemCount:
vo
.
tags
.
length
>=
1
?
1
:
vo
.
tags
.
length
,
itemCount:
vo
.
tags
!.
length
>=
1
?
1
:
vo
.
tags
!
.
length
,
scrollDirection:
Axis
.
horizontal
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Container
(
...
...
@@ -344,7 +344,7 @@ class PriceListWidget extends StatelessWidget {
BorderRadius
.
all
(
Radius
.
circular
(
2
.
w
))),
padding:
EdgeInsets
.
symmetric
(
horizontal:
4
.
w
),
alignment:
Alignment
.
center
,
child:
Text
(
'
${vo.tags[index]}
'
,
child:
Text
(
'
${vo.tags
!
[index]}
'
,
style:
TextStyle
(
color:
Color
(
0xFF666666
),
fontSize:
11
.
w
,
...
...
@@ -377,7 +377,7 @@ class PriceListWidget extends StatelessWidget {
/// [scroll] 是否滚动
///
Widget
_buildLeftImage
(
{
@required
String
imageUrl
,
@required
String
source
,
bool
scroll
})
{
{
required
String
?
imageUrl
,
required
String
source
,
required
bool
scroll
})
{
return
Container
(
width:
104
.
w
,
height:
104
.
w
,
...
...
@@ -390,7 +390,7 @@ class PriceListWidget extends StatelessWidget {
package:
'price_module'
,
width:
104
.
w
,
height:
104
.
w
)
:
ClipRRect
(
child:
CachedNetworkImage
(
imageUrl:
imageUrl
,
imageUrl:
imageUrl
!
,
placeholder:
(
BuildContext
c
,
String
s
)
{
return
Image
.
asset
(
'assets/images/placeholder_image.png'
,
...
...
lib/widget/pull/pull_widget.dart
View file @
3e21f1ca
...
...
@@ -2,11 +2,11 @@ import 'package:flutter/cupertino.dart';
import
'package:pull_to_refresh/pull_to_refresh.dart'
;
class
PullWidget
extends
StatelessWidget
{
final
Widget
child
;
final
VoidCallback
onRefresh
;
final
VoidCallback
onLoad
;
final
RefreshController
controller
;
final
ScrollController
scrollController
;
final
Widget
?
child
;
final
VoidCallback
?
onRefresh
;
final
VoidCallback
?
onLoad
;
final
RefreshController
?
controller
;
final
ScrollController
?
scrollController
;
PullWidget
(
{
this
.
child
,
...
...
@@ -21,7 +21,7 @@ class PullWidget extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
return
SmartRefresher
(
scrollController:
scrollController
,
controller:
controller
,
controller:
controller
!
,
enablePullDown:
onRefresh
!=
null
,
enablePullUp:
onLoad
!=
null
,
onRefresh:
onRefresh
,
...
...
lib/widget/tabbar/index.dart
View file @
3e21f1ca
...
...
@@ -5,7 +5,7 @@ import 'package:flutter/widgets.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:
[
Container
(
width:
24
.
w
,
...
...
@@ -24,7 +24,7 @@ Widget buildTabbarButton({@required String title,@required String tabBarType,Tab
class
TabbarWidget
extends
StatefulWidget
{
final
Function
(
TabbarController
)
controller
;
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
_TabbarWidgetState
createState
()
=>
_TabbarWidgetState
();
...
...
@@ -32,8 +32,8 @@ class TabbarWidget extends StatefulWidget {
class
_TabbarWidgetState
extends
State
<
TabbarWidget
>
with
TabbarController
,
SingleTickerProviderStateMixin
{
Animation
<
double
>
_animation
;
AnimationController
_controller
;
late
Animation
<
double
>
_animation
;
late
AnimationController
_controller
;
int
interval
=
200
;
List
<
Image
>
images
=[];
...
...
@@ -78,7 +78,7 @@ class _TabbarWidgetState extends State<TabbarWidget> with TabbarController,Singl
Widget
build
(
BuildContext
context
)
{
return
ValueListenableBuilder
<
int
>(
valueListenable:
index
,
builder:
(
BuildContext
context
,
int
value
,
Widget
child
)
{
builder:
(
BuildContext
context
,
int
value
,
Widget
?
child
)
{
return
images
[
value
];
}
);
...
...
pubspec.yaml
View file @
3e21f1ca
...
...
@@ -6,7 +6,7 @@ homepage: /
publish_to
:
none
environment
:
sdk
:
"
>=2.8.0
<3.0.0"
sdk
:
'
>=2.12.0
<3.0.0'
flutter
:
"
>=1.17.0
<2.0.0"
dependencies
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment