Commit 6d6dc3e5 authored by 汪林玲's avatar 汪林玲

支持null-safety

parent 88fe4c9a
...@@ -16,7 +16,7 @@ class AppraiseItem extends StatelessWidget { ...@@ -16,7 +16,7 @@ class AppraiseItem extends StatelessWidget {
children: [ children: [
Container( Container(
child: Text( child: Text(
item.comment, item.comment!,
style: TextStyle(color: rgba(48, 38, 0, 1), fontSize: 13.rpx), style: TextStyle(color: rgba(48, 38, 0, 1), fontSize: 13.rpx),
), ),
), ),
...@@ -37,7 +37,7 @@ class _ScoreInfo extends StatelessWidget { ...@@ -37,7 +37,7 @@ class _ScoreInfo extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<InlineSpan> widgets = []; List<InlineSpan> widgets = [];
double score = double.parse(item.star); double score = double.parse(item.star!);
for (int star = 1, len = score.ceil(); star <= len; star++) { for (int star = 1, len = score.ceil(); star <= len; star++) {
widgets.add(WidgetSpan( widgets.add(WidgetSpan(
child: Image.asset( child: Image.asset(
...@@ -72,7 +72,7 @@ class _ScoreInfo extends StatelessWidget { ...@@ -72,7 +72,7 @@ class _ScoreInfo extends StatelessWidget {
child: Text.rich(TextSpan(children: widgets)), child: Text.rich(TextSpan(children: widgets)),
), ),
Container( Container(
child: Text(double.parse(item.star).toStringAsFixed(1), child: Text(double.parse(item.star!).toStringAsFixed(1),
style: TextStyle( style: TextStyle(
color: rgba(255, 128, 0, 1), color: rgba(255, 128, 0, 1),
fontSize: 14.rpx, fontSize: 14.rpx,
...@@ -81,7 +81,7 @@ class _ScoreInfo extends StatelessWidget { ...@@ -81,7 +81,7 @@ class _ScoreInfo extends StatelessWidget {
), ),
Spacer(), Spacer(),
Text( Text(
DateUtil.formatDateStr(item.createTime,format: "yyyy-MM-dd HH:mm:ss"), DateUtil.formatDateStr(item.createTime!,format: "yyyy-MM-dd HH:mm:ss"),
style: TextStyle(color: rgba(153, 153, 153, 1), fontSize: 11.rpx), style: TextStyle(color: rgba(153, 153, 153, 1), fontSize: 11.rpx),
) )
], ],
......
...@@ -5,10 +5,10 @@ import 'package:mvp/mvp.dart'; ...@@ -5,10 +5,10 @@ import 'package:mvp/mvp.dart';
import 'package:life_module/models/filter_model.dart'; import 'package:life_module/models/filter_model.dart';
class FilterArea extends StatefulWidget { class FilterArea extends StatefulWidget {
final FilterModel model; final FilterModel? model;
final Function(bool checked) onTap; final Function(bool checked)? onTap;
final Function() onChange; final Function()? onChange;
final double topOffset; final double? topOffset;
FilterArea({this.model, this.onTap, this.topOffset, this.onChange}); FilterArea({this.model, this.onTap, this.topOffset, this.onChange});
@override @override
State<StatefulWidget> createState() => _FilterAreaState(); State<StatefulWidget> createState() => _FilterAreaState();
...@@ -16,7 +16,7 @@ class FilterArea extends StatefulWidget { ...@@ -16,7 +16,7 @@ class FilterArea extends StatefulWidget {
class _FilterAreaState extends State<FilterArea> { class _FilterAreaState extends State<FilterArea> {
Function() _onChange; Function()? _onChange;
@override @override
void initState() { void initState() {
...@@ -27,19 +27,19 @@ class _FilterAreaState extends State<FilterArea> { ...@@ -27,19 +27,19 @@ class _FilterAreaState extends State<FilterArea> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return QMProvider<FilterModel>.value( return QMProvider<FilterModel>.value(
model: widget.model, model: widget.model!,
builderWidget: (context, model, child) { builderWidget: (context, model, child) {
if (model.isEmpty()) { if (model.isEmpty()) {
return Container( return Container(
height: 48.rpx, height: 48.rpx,
); );
} }
String regionName = ''; String? regionName = '';
if (model.getCheckedTwoRegion() != null && if (model.getCheckedTwoRegion() != null &&
model.getCheckedTwoRegion().name != null) { model.getCheckedTwoRegion()!.name != null) {
regionName = model.getCheckedTwoRegion().name; regionName = model.getCheckedTwoRegion()!.name;
} else if (model.getCheckedOneRegion() != null) { } else if (model.getCheckedOneRegion() != null) {
regionName = model.getCheckedOneRegion().name; regionName = model.getCheckedOneRegion()!.name;
} }
return Container( return Container(
height: 48.rpx, height: 48.rpx,
...@@ -49,11 +49,11 @@ class _FilterAreaState extends State<FilterArea> { ...@@ -49,11 +49,11 @@ class _FilterAreaState extends State<FilterArea> {
child: Row( child: Row(
children: [ children: [
_FilterItem( _FilterItem(
text: model.getCheckedOneCategory().name, text: model.getCheckedOneCategory()!.name,
checked: model.getFilterAreaIndex() == 1, checked: model.getFilterAreaIndex() == 1,
onTap: (checked) { onTap: (checked) {
if (widget.onTap != null) { if (widget.onTap != null) {
widget.onTap(checked); widget.onTap!(checked);
} }
if (checked) { if (checked) {
return; return;
...@@ -62,8 +62,8 @@ class _FilterAreaState extends State<FilterArea> { ...@@ -62,8 +62,8 @@ class _FilterAreaState extends State<FilterArea> {
FilterPanelUtils.show( FilterPanelUtils.show(
topOffset: widget.topOffset, topOffset: widget.topOffset,
items: model.getCategorys(), items: model.getCategorys(),
oneCheckedId: model.getCheckedOneCategory().id, oneCheckedId: model.getCheckedOneCategory()!.id,
twoCheckedId: model.getCheckedTwoCategory().id, twoCheckedId: model.getCheckedTwoCategory()!.id,
context: context, context: context,
model: model, model: model,
onClose: () { onClose: () {
...@@ -74,7 +74,7 @@ class _FilterAreaState extends State<FilterArea> { ...@@ -74,7 +74,7 @@ class _FilterAreaState extends State<FilterArea> {
model.stFilterAreaIndex(0); model.stFilterAreaIndex(0);
model.setCheckedCategory(onwItem, twoItem); model.setCheckedCategory(onwItem, twoItem);
if(_onChange != null){ if(_onChange != null){
_onChange(); _onChange!();
} }
}); });
}, },
...@@ -84,7 +84,7 @@ class _FilterAreaState extends State<FilterArea> { ...@@ -84,7 +84,7 @@ class _FilterAreaState extends State<FilterArea> {
checked: model.getFilterAreaIndex() == 2, checked: model.getFilterAreaIndex() == 2,
onTap: (checked) { onTap: (checked) {
if (widget.onTap != null) { if (widget.onTap != null) {
widget.onTap(checked); widget.onTap!(checked);
} }
if (checked) { if (checked) {
return; return;
...@@ -93,8 +93,8 @@ class _FilterAreaState extends State<FilterArea> { ...@@ -93,8 +93,8 @@ class _FilterAreaState extends State<FilterArea> {
FilterPanelUtils.show( FilterPanelUtils.show(
topOffset: widget.topOffset, topOffset: widget.topOffset,
items: model.getRegions(), items: model.getRegions(),
oneCheckedId: model.getCheckedOneRegion().id, oneCheckedId: model.getCheckedOneRegion()!.id,
twoCheckedId: model.getCheckedTwoRegion().id, twoCheckedId: model.getCheckedTwoRegion()!.id,
context: context, context: context,
model: model, model: model,
onClose: () { onClose: () {
...@@ -105,17 +105,17 @@ class _FilterAreaState extends State<FilterArea> { ...@@ -105,17 +105,17 @@ class _FilterAreaState extends State<FilterArea> {
model.stFilterAreaIndex(0); model.stFilterAreaIndex(0);
model.setCheckedRegion(onwItem, twoItem); model.setCheckedRegion(onwItem, twoItem);
if(_onChange != null){ if(_onChange != null){
_onChange(); _onChange!();
} }
}); });
}, },
), ),
_FilterItem( _FilterItem(
text: model.getCheckedOneSort().name, text: model.getCheckedOneSort()!.name,
checked: model.getFilterAreaIndex() == 3, checked: model.getFilterAreaIndex() == 3,
onTap: (checked) { onTap: (checked) {
if (widget.onTap != null) { if (widget.onTap != null) {
widget.onTap(checked); widget.onTap!(checked);
} }
if (checked) { if (checked) {
return; return;
...@@ -124,8 +124,8 @@ class _FilterAreaState extends State<FilterArea> { ...@@ -124,8 +124,8 @@ class _FilterAreaState extends State<FilterArea> {
FilterPanelUtils.show( FilterPanelUtils.show(
topOffset: widget.topOffset, topOffset: widget.topOffset,
items: model.getSorts(), items: model.getSorts(),
oneCheckedId: model.getCheckedOneSort().id, oneCheckedId: model.getCheckedOneSort()!.id,
twoCheckedId: model.getCheckedTwoSort().id, twoCheckedId: model.getCheckedTwoSort()!.id,
context: context, context: context,
model: model, model: model,
onClose: () { onClose: () {
...@@ -136,7 +136,7 @@ class _FilterAreaState extends State<FilterArea> { ...@@ -136,7 +136,7 @@ class _FilterAreaState extends State<FilterArea> {
model.stFilterAreaIndex(0); model.stFilterAreaIndex(0);
model.setCheckedSort(onwItem, twoItem); model.setCheckedSort(onwItem, twoItem);
if(_onChange != null){ if(_onChange != null){
_onChange(); _onChange!();
} }
}); });
}, },
...@@ -151,8 +151,8 @@ class _FilterAreaState extends State<FilterArea> { ...@@ -151,8 +151,8 @@ class _FilterAreaState extends State<FilterArea> {
class _FilterItem extends StatelessWidget { class _FilterItem extends StatelessWidget {
final bool checked; final bool checked;
final String text; final String? text;
final Function(bool checked) onTap; final Function(bool checked)? onTap;
_FilterItem({this.text, this.onTap, this.checked = false}); _FilterItem({this.text, this.onTap, this.checked = false});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -162,14 +162,14 @@ class _FilterItem extends StatelessWidget { ...@@ -162,14 +162,14 @@ class _FilterItem extends StatelessWidget {
textColor = rgba(255, 128, 0, 1); textColor = rgba(255, 128, 0, 1);
iconColor = textColor; iconColor = textColor;
} }
String clipText = text; String clipText = text!;
if (clipText.length > 5) { if (clipText.length > 5) {
clipText = "${text.substring(0, 5)}..."; clipText = "${text!.substring(0, 5)}...";
} }
return Expanded( return Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
onTap(checked); onTap!(checked);
}, },
child: Container( child: Container(
height: 48.rpx, height: 48.rpx,
......
This diff is collapsed.
...@@ -5,8 +5,8 @@ import 'package:life_repository/life_repository.dart'; ...@@ -5,8 +5,8 @@ import 'package:life_repository/life_repository.dart';
import 'package:common_module/widget/xiaoxiong_base_image_widget/widget.dart'; import 'package:common_module/widget/xiaoxiong_base_image_widget/widget.dart';
class GoodsItem extends StatelessWidget { class GoodsItem extends StatelessWidget {
final ComboItem item; final ComboItem? item;
final Function() onTap; final Function()? onTap;
GoodsItem({this.item, this.onTap}); GoodsItem({this.item, this.onTap});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -28,7 +28,7 @@ class GoodsItem extends StatelessWidget { ...@@ -28,7 +28,7 @@ class GoodsItem extends StatelessWidget {
height: 74.rpx, height: 74.rpx,
width: 74.rpx, width: 74.rpx,
child: XiaoxiongBaseImageWidget( child: XiaoxiongBaseImageWidget(
imageUrl: item.shopImg, imageUrl: item!.shopImg!,
height: 74.rpx, height: 74.rpx,
width: 74.rpx, width: 74.rpx,
), ),
...@@ -61,7 +61,7 @@ class GoodsItem extends StatelessWidget { ...@@ -61,7 +61,7 @@ class GoodsItem extends StatelessWidget {
//、 标题 //、 标题
class _Title extends StatelessWidget { class _Title extends StatelessWidget {
final ComboItem item; final ComboItem? item;
_Title(this.item); _Title(this.item);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -70,7 +70,7 @@ class _Title extends StatelessWidget { ...@@ -70,7 +70,7 @@ class _Title extends StatelessWidget {
child: Row( child: Row(
children: [ children: [
TypeIcon( TypeIcon(
type: int.parse(item.dealType), type: int.parse(item!.dealType!),
), ),
SizedBox( SizedBox(
width: 5.rpx, width: 5.rpx,
...@@ -78,7 +78,7 @@ class _Title extends StatelessWidget { ...@@ -78,7 +78,7 @@ class _Title extends StatelessWidget {
Expanded( Expanded(
child: Container( child: Container(
child: Text( child: Text(
item.itemTitle, item!.itemTitle!,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
...@@ -93,7 +93,7 @@ class _Title extends StatelessWidget { ...@@ -93,7 +93,7 @@ class _Title extends StatelessWidget {
/// 价格信息 /// 价格信息
class _PriceInfo extends StatelessWidget { class _PriceInfo extends StatelessWidget {
final ComboItem item; final ComboItem? item;
_PriceInfo(this.item); _PriceInfo(this.item);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -111,7 +111,7 @@ class _PriceInfo extends StatelessWidget { ...@@ -111,7 +111,7 @@ class _PriceInfo extends StatelessWidget {
), ),
), ),
Text( Text(
item.endPrice, item!.endPrice!,
style: TextStyle( style: TextStyle(
color: rgba(255, 4, 0, 1), color: rgba(255, 4, 0, 1),
fontSize: 16.rpx, fontSize: 16.rpx,
...@@ -121,7 +121,7 @@ class _PriceInfo extends StatelessWidget { ...@@ -121,7 +121,7 @@ class _PriceInfo extends StatelessWidget {
width: 4.rpx, width: 4.rpx,
), ),
Text( Text(
${item.originalPrice}", ${item!.originalPrice}",
style: TextStyle( style: TextStyle(
color: rgba(153, 153, 153, 1), color: rgba(153, 153, 153, 1),
fontSize: 12.rpx, fontSize: 12.rpx,
...@@ -139,7 +139,7 @@ class _PriceInfo extends StatelessWidget { ...@@ -139,7 +139,7 @@ class _PriceInfo extends StatelessWidget {
topRight: Radius.circular(9.rpx), topRight: Radius.circular(9.rpx),
bottomRight: Radius.circular(9.rpx))), bottomRight: Radius.circular(9.rpx))),
child: Text( child: Text(
item.userCommissionText, item!.userCommissionText!,
style: TextStyle( style: TextStyle(
color: rgba(255, 128, 0, 1), fontSize: 11.rpx, height: 1.2), color: rgba(255, 128, 0, 1), fontSize: 11.rpx, height: 1.2),
), ),
...@@ -152,7 +152,7 @@ class _PriceInfo extends StatelessWidget { ...@@ -152,7 +152,7 @@ class _PriceInfo extends StatelessWidget {
/// 定位信息 /// 定位信息
class _LocaionInfo extends StatelessWidget { class _LocaionInfo extends StatelessWidget {
final ComboItem item; final ComboItem? item;
_LocaionInfo(this.item); _LocaionInfo(this.item);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -165,7 +165,7 @@ class _LocaionInfo extends StatelessWidget { ...@@ -165,7 +165,7 @@ class _LocaionInfo extends StatelessWidget {
Container( Container(
constraints: BoxConstraints(maxWidth: 190.rpx), constraints: BoxConstraints(maxWidth: 190.rpx),
child: Text( child: Text(
item.shopTitle, item!.shopTitle!,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
...@@ -182,7 +182,7 @@ class _LocaionInfo extends StatelessWidget { ...@@ -182,7 +182,7 @@ class _LocaionInfo extends StatelessWidget {
),*/ ),*/
Spacer(), Spacer(),
Text( Text(
item.distance, item!.distance!,
style: TextStyle( style: TextStyle(
color: rgba(102, 102, 102, 1), fontSize: 11.rpx, height: 1.2), color: rgba(102, 102, 102, 1), fontSize: 11.rpx, height: 1.2),
), ),
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class LifeImage extends StatelessWidget { class LifeImage extends StatelessWidget {
final String name; final String? name;
final double width; final double? width;
final double height; final double? height;
final Color color; final Color? color;
final BoxFit fit; final BoxFit? fit;
LifeImage({ LifeImage({
Key key, Key? key,
this.name, this.name,
this.width, this.width,
this.height, this.height,
...@@ -17,7 +17,7 @@ class LifeImage extends StatelessWidget { ...@@ -17,7 +17,7 @@ class LifeImage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Image.asset( return Image.asset(
name, name!,
key: key, key: key,
width: width, width: width,
height: height, height: height,
......
...@@ -2,12 +2,12 @@ import 'package:flutter/material.dart'; ...@@ -2,12 +2,12 @@ import 'package:flutter/material.dart';
import 'package:common_module/utils/xapp_utils.dart'; import 'package:common_module/utils/xapp_utils.dart';
class SearchBar extends StatefulWidget { class SearchBar extends StatefulWidget {
final Color inputColor; final Color? inputColor;
final bool enabled; final bool enabled;
final FocusNode focusNode; final FocusNode? focusNode;
final Function(String) onSubmitted; final Function(String)? onSubmitted;
final Function(String) onChanged; final Function(String)? onChanged;
final TextEditingController controller; final TextEditingController? controller;
SearchBar( SearchBar(
{this.enabled = false, {this.enabled = false,
this.inputColor, this.inputColor,
...@@ -42,7 +42,7 @@ class _SearchBarState extends State<SearchBar> { ...@@ -42,7 +42,7 @@ class _SearchBarState extends State<SearchBar> {
: InkWell( : InkWell(
child: _Button(), child: _Button(),
onTap: () { onTap: () {
widget.onSubmitted(widget.controller.text); widget.onSubmitted!(widget.controller!.text);
}, },
), ),
SizedBox( SizedBox(
...@@ -55,11 +55,11 @@ class _SearchBarState extends State<SearchBar> { ...@@ -55,11 +55,11 @@ class _SearchBarState extends State<SearchBar> {
} }
class _TextField extends StatefulWidget { class _TextField extends StatefulWidget {
final bool enabled; final bool? enabled;
final FocusNode focusNode; final FocusNode? focusNode;
final Function(String) onSubmitted; final Function(String)? onSubmitted;
final Function(String) onChanged; final Function(String)? onChanged;
final TextEditingController controller; final TextEditingController? controller;
_TextField( _TextField(
{this.enabled, {this.enabled,
this.focusNode, this.focusNode,
...@@ -78,9 +78,9 @@ class _TextFieldState extends State<_TextField> { ...@@ -78,9 +78,9 @@ class _TextFieldState extends State<_TextField> {
void initState() { void initState() {
super.initState(); super.initState();
if (widget.controller != null) { if (widget.controller != null) {
widget.controller.addListener(() { widget.controller!.addListener(() {
setState(() { setState(() {
showCloseBtn = widget.controller.text.isNotEmpty; showCloseBtn = widget.controller!.text.isNotEmpty;
}); });
}); });
} }
...@@ -163,10 +163,10 @@ class _TextFieldState extends State<_TextField> { ...@@ -163,10 +163,10 @@ class _TextFieldState extends State<_TextField> {
top: 0, top: 0,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
widget.onChanged(""); widget.onChanged!("");
widget.onSubmitted(""); widget.onSubmitted!("");
widget.controller.text = ''; widget.controller!.text = '';
widget.focusNode.requestFocus(); widget.focusNode!.requestFocus();
}, },
child: Container( child: Container(
width: 34.rpx, width: 34.rpx,
......
...@@ -6,8 +6,8 @@ import 'package:life_module/models/filter_model.dart'; ...@@ -6,8 +6,8 @@ import 'package:life_module/models/filter_model.dart';
import 'package:life_repository/life_repository.dart'; import 'package:life_repository/life_repository.dart';
class ShopClassNav extends StatefulWidget { class ShopClassNav extends StatefulWidget {
final FilterModel model; final FilterModel? model;
final Function() onChange; final Function()? onChange;
ShopClassNav({this.model, this.onChange}); ShopClassNav({this.model, this.onChange});
@override @override
State<StatefulWidget> createState() => _ShopClassNavState(); State<StatefulWidget> createState() => _ShopClassNavState();
...@@ -23,14 +23,14 @@ class _ShopClassNavState extends State<ShopClassNav> ...@@ -23,14 +23,14 @@ class _ShopClassNavState extends State<ShopClassNav>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return QMProvider<FilterModel>.value( return QMProvider<FilterModel>.value(
model: widget.model, model: widget.model!,
builderWidget: (context, model, child) { builderWidget: (context, model, child) {
if (model.isEmpty()) { if (model.isEmpty()) {
return Container( return Container(
height: 40.rpx, height: 40.rpx,
); );
} }
List<FilterItemEntity> subs = model.getCheckedOneCategory().subs; List<FilterItemEntity> subs = model.getCheckedOneCategory()!.subs!;
return Container( return Container(
key: ValueKey(subs.map((e) => e.id).join('_')), key: ValueKey(subs.map((e) => e.id).join('_')),
...@@ -40,7 +40,7 @@ class _ShopClassNavState extends State<ShopClassNav> ...@@ -40,7 +40,7 @@ class _ShopClassNavState extends State<ShopClassNav>
child: NotificationListener( child: NotificationListener(
child: NavigationBar( child: NavigationBar(
controller: model.getShopClassNavTabController(), controller: model.getShopClassNavTabController(),
items: subs.map((e) => e.name).toList(), items: subs.map((e) => e.name).toList() as List<String>?,
selectColor: rgba(255, 128, 0, 1), selectColor: rgba(255, 128, 0, 1),
normalColor: rgba(102, 102, 102, 1), normalColor: rgba(102, 102, 102, 1),
selectStyle: TextStyle( selectStyle: TextStyle(
...@@ -51,18 +51,18 @@ class _ShopClassNavState extends State<ShopClassNav> ...@@ -51,18 +51,18 @@ class _ShopClassNavState extends State<ShopClassNav>
), ),
isScrollable: true, isScrollable: true,
onChange: (index) { onChange: (index) {
if (subs[index] == model.getCheckedTwoCategory()) { if (subs[index!] == model.getCheckedTwoCategory()) {
return; return;
} }
model.setCheckedCategory( model.setCheckedCategory(
model.getCheckedOneCategory(), subs[index]); model.getCheckedOneCategory(), subs[index]);
widget.onChange(); widget.onChange!();
}, },
indicatorSize: TabBarIndicatorSize.label, indicatorSize: TabBarIndicatorSize.label,
indicator: RoundRectIndicator( indicator: RoundRectIndicator(
color: Colors.transparent, height: 0, marginBottom: 0), color: Colors.transparent, height: 0, marginBottom: 0),
), ),
onNotification: (e) { onNotification: (dynamic e) {
return true; return true;
}, },
), ),
......
...@@ -5,8 +5,8 @@ import 'package:life_repository/life_repository.dart'; ...@@ -5,8 +5,8 @@ import 'package:life_repository/life_repository.dart';
import 'package:common_module/widget/xiaoxiong_base_image_widget/widget.dart'; import 'package:common_module/widget/xiaoxiong_base_image_widget/widget.dart';
class ShopItem extends StatelessWidget { class ShopItem extends StatelessWidget {
final RestaurantItem item; final RestaurantItem? item;
final Function() onTap; final Function()? onTap;
ShopItem({this.item, this.onTap}); ShopItem({this.item, this.onTap});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -30,7 +30,7 @@ class ShopItem extends StatelessWidget { ...@@ -30,7 +30,7 @@ class ShopItem extends StatelessWidget {
height: 74.rpx, height: 74.rpx,
width: 74.rpx, width: 74.rpx,
child: XiaoxiongBaseImageWidget( child: XiaoxiongBaseImageWidget(
imageUrl: item.shopImg, imageUrl: item!.shopImg!,
height: 74.rpx, height: 74.rpx,
width: 74.rpx, width: 74.rpx,
), ),
...@@ -67,7 +67,7 @@ class ShopItem extends StatelessWidget { ...@@ -67,7 +67,7 @@ class ShopItem extends StatelessWidget {
/// 标题 /// 标题
class _Title extends StatelessWidget { class _Title extends StatelessWidget {
final RestaurantItem item; final RestaurantItem? item;
_Title(this.item); _Title(this.item);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -78,7 +78,7 @@ class _Title extends StatelessWidget { ...@@ -78,7 +78,7 @@ class _Title extends StatelessWidget {
Expanded( Expanded(
child: Container( child: Container(
child: Text( child: Text(
item.shopTitle, item!.shopTitle!,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
...@@ -93,11 +93,11 @@ class _Title extends StatelessWidget { ...@@ -93,11 +93,11 @@ class _Title extends StatelessWidget {
/// 评分和销量信息 /// 评分和销量信息
class _ScoreInfo extends StatelessWidget { class _ScoreInfo extends StatelessWidget {
final RestaurantItem item; final RestaurantItem? item;
_ScoreInfo(this.item); _ScoreInfo(this.item);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var showStarScore = item.showStarScore; var showStarScore = item!.showStarScore!;
List<InlineSpan> widgets = []; List<InlineSpan> widgets = [];
double score = double.parse(showStarScore); double score = double.parse(showStarScore);
for (int star = 1, len = score.ceil(); star <= len; star++) { for (int star = 1, len = score.ceil(); star <= len; star++) {
...@@ -123,7 +123,7 @@ class _ScoreInfo extends StatelessWidget { ...@@ -123,7 +123,7 @@ class _ScoreInfo extends StatelessWidget {
width: 2.rpx, width: 2.rpx,
))); )));
widgets.add(TextSpan( widgets.add(TextSpan(
text: double.parse(item.commentScore).toStringAsFixed(1), text: double.parse(item!.commentScore!).toStringAsFixed(1),
style: TextStyle( style: TextStyle(
color: rgba(255, 128, 0, 1), color: rgba(255, 128, 0, 1),
fontSize: 14.rpx, fontSize: 14.rpx,
...@@ -147,7 +147,7 @@ class _ScoreInfo extends StatelessWidget { ...@@ -147,7 +147,7 @@ class _ScoreInfo extends StatelessWidget {
), ),
Spacer(), Spacer(),
Text( Text(
${item.avgPrice}/人", ${item!.avgPrice}/人",
style: TextStyle(color: rgba(102, 102, 102, 1), fontSize: 11.rpx), style: TextStyle(color: rgba(102, 102, 102, 1), fontSize: 11.rpx),
) )
], ],
...@@ -158,7 +158,7 @@ class _ScoreInfo extends StatelessWidget { ...@@ -158,7 +158,7 @@ class _ScoreInfo extends StatelessWidget {
/// 地址信息 /// 地址信息
class _LocaionInfo extends StatelessWidget { class _LocaionInfo extends StatelessWidget {
final RestaurantItem item; final RestaurantItem? item;
_LocaionInfo(this.item); _LocaionInfo(this.item);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -168,12 +168,12 @@ class _LocaionInfo extends StatelessWidget { ...@@ -168,12 +168,12 @@ class _LocaionInfo extends StatelessWidget {
child: Row( child: Row(
children: [ children: [
Text( Text(
item.categoryName, item!.categoryName!,
style: TextStyle(color: rgba(102, 102, 102, 1), fontSize: 11.rpx), style: TextStyle(color: rgba(102, 102, 102, 1), fontSize: 11.rpx),
), ),
Spacer(), Spacer(),
Text( Text(
"${item.regionName}${item.distance}", "${item!.regionName}${item!.distance}",
style: TextStyle(color: rgba(102, 102, 102, 1), fontSize: 11.rpx), style: TextStyle(color: rgba(102, 102, 102, 1), fontSize: 11.rpx),
) )
], ],
...@@ -183,11 +183,11 @@ class _LocaionInfo extends StatelessWidget { ...@@ -183,11 +183,11 @@ class _LocaionInfo extends StatelessWidget {
} }
class _GoodList extends StatelessWidget { class _GoodList extends StatelessWidget {
final RestaurantItem item; final RestaurantItem? item;
_GoodList(this.item); _GoodList(this.item);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<Widget> items = item.itemList.map((e) { List<Widget> items = item!.itemList!.map((e) {
return _GoodItem(e); return _GoodItem(e);
}).toList(); }).toList();
return Container( return Container(
...@@ -210,7 +210,7 @@ class _GoodItem extends StatelessWidget { ...@@ -210,7 +210,7 @@ class _GoodItem extends StatelessWidget {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
TypeIcon(type: int.parse(item.dealType)), TypeIcon(type: int.parse(item.dealType!)),
SizedBox( SizedBox(
width: 6.rpx, width: 6.rpx,
), ),
...@@ -221,7 +221,7 @@ class _GoodItem extends StatelessWidget { ...@@ -221,7 +221,7 @@ class _GoodItem extends StatelessWidget {
Expanded( Expanded(
child: Container( child: Container(
child: Text( child: Text(
item.itemTitle, item.itemTitle!,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 1, maxLines: 1,
style: TextStyle(color: rgba(51, 51, 51, 1), fontSize: 12.rpx), style: TextStyle(color: rgba(51, 51, 51, 1), fontSize: 12.rpx),
...@@ -252,7 +252,7 @@ class _PriceInfo extends StatelessWidget { ...@@ -252,7 +252,7 @@ class _PriceInfo extends StatelessWidget {
), ),
), ),
Text( Text(
item.endPrice, item.endPrice!,
style: TextStyle( style: TextStyle(
color: rgba(255, 4, 0, 1), color: rgba(255, 4, 0, 1),
fontSize: 14.rpx, fontSize: 14.rpx,
......
...@@ -8,18 +8,18 @@ import 'package:common_module/utils/list_model_status_utils.dart'; ...@@ -8,18 +8,18 @@ import 'package:common_module/utils/list_model_status_utils.dart';
import 'package:common_module/utils/xapp_utils.dart'; import 'package:common_module/utils/xapp_utils.dart';
class ShopList extends StatelessWidget { class ShopList extends StatelessWidget {
final ShopListModel model; final ShopListModel? model;
final Function(ShopItemEntity) onTap; final Function(ShopItemEntity)? onTap;
final Function() onReset; final Function()? onReset;
ShopList({this.model, this.onTap, this.onReset}); ShopList({this.model, this.onTap, this.onReset});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SliverPadding( return SliverPadding(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
sliver: QMProvider<ShopListModel>.value( sliver: QMProvider<ShopListModel>.value(
model: model, model: model!,
builderWidget: (context, model, child) { builderWidget: (context, model, child) {
Widget statusWidget = ListModelStatusUtils.getInstance().form( Widget? statusWidget = ListModelStatusUtils.getInstance()!.form(
failText: "没有搜到结果~", failText: "没有搜到结果~",
btnText: "恢复默认", btnText: "恢复默认",
paddingTop: 30.rpx, paddingTop: 30.rpx,
...@@ -43,19 +43,19 @@ class ShopList extends StatelessWidget { ...@@ -43,19 +43,19 @@ class ShopList extends StatelessWidget {
return SliverList( return SliverList(
delegate: SliverChildBuilderDelegate( delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) { (BuildContext context, int index) {
var item = model.getList()[index]; ShopItemEntity item = model.getList()[index];
if (item.type == 0) { if (item.type == 0) {
return ShopItem( return ShopItem(
item: item.restaurant, item: item.restaurant,
onTap: () { onTap: () {
onTap(item); onTap!(item);
}, },
); );
} }
return GoodsItem( return GoodsItem(
item: item.combo, item: item.combo,
onTap: () { onTap: () {
onTap(item); onTap!(item);
}, },
); );
}, },
......
...@@ -5,13 +5,13 @@ import 'package:life_module/models/filter_model.dart'; ...@@ -5,13 +5,13 @@ import 'package:life_module/models/filter_model.dart';
import 'package:mvp/mvp.dart'; import 'package:mvp/mvp.dart';
class ShopTypeNav extends StatelessWidget { class ShopTypeNav extends StatelessWidget {
final FilterModel model; final FilterModel? model;
final Function() onChange; final Function()? onChange;
ShopTypeNav({this.model, this.onChange}); ShopTypeNav({this.model, this.onChange});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return QMProvider<FilterModel>.value( return QMProvider<FilterModel>.value(
model: model, model: model!,
builderWidget: (context, model, child) { builderWidget: (context, model, child) {
if (model.isEmpty()) { if (model.isEmpty()) {
return Container( return Container(
...@@ -25,7 +25,7 @@ class ShopTypeNav extends StatelessWidget { ...@@ -25,7 +25,7 @@ class ShopTypeNav extends StatelessWidget {
color: rgba(245, 245, 245, 1), color: rgba(245, 245, 245, 1),
child: DefaultTabController( child: DefaultTabController(
length: 2, length: 2,
initialIndex: model.getShopTypeNavIndex(), initialIndex: model.getShopTypeNavIndex()!,
child: NavigationBar( child: NavigationBar(
items: ["优惠店铺", "优惠套餐"], items: ["优惠店铺", "优惠套餐"],
selectColor: rgba(48, 38, 0, 1), selectColor: rgba(48, 38, 0, 1),
...@@ -46,7 +46,7 @@ class ShopTypeNav extends StatelessWidget { ...@@ -46,7 +46,7 @@ class ShopTypeNav extends StatelessWidget {
marginBottom: 6.rpx), marginBottom: 6.rpx),
onChange: (index) { onChange: (index) {
model.setShopTypeNavIndex(index); model.setShopTypeNavIndex(index);
onChange(); onChange!();
}, },
), ),
), ),
......
import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mvp/mvp.dart'; import 'package:mvp/mvp.dart';
...@@ -8,45 +10,45 @@ class FilterModel extends BaseModel { ...@@ -8,45 +10,45 @@ class FilterModel extends BaseModel {
List<FilterItemEntity> _categorys = []; List<FilterItemEntity> _categorys = [];
List<FilterItemEntity> _sorts = []; List<FilterItemEntity> _sorts = [];
FilterItemEntity _checkedOneRegion; FilterItemEntity? _checkedOneRegion;
FilterItemEntity _checkedOneCategory; FilterItemEntity? _checkedOneCategory;
FilterItemEntity _checkedOneSort; FilterItemEntity? _checkedOneSort;
FilterItemEntity _checkedTwoRegion; FilterItemEntity? _checkedTwoRegion;
FilterItemEntity _checkedTwoCategory; FilterItemEntity? _checkedTwoCategory;
FilterItemEntity _checkedTwoSort; FilterItemEntity? _checkedTwoSort;
// 筛选区域选中的索引 // 筛选区域选中的索引
int _filterAreaIndex = 0; int _filterAreaIndex = 0;
// 二级类目控制器 // 二级类目控制器
TabController _shopClassNavTabController; TabController? _shopClassNavTabController;
int _shopTypeNavIndex = 0; int? _shopTypeNavIndex = 0;
// 搜索关键词 // 搜索关键词
String _keywords; String? _keywords;
Future<void> getFilterList(String cid) async { Future<void> getFilterList(String cid) async {
FilterObject object = await FilterArepository.get().getFilterList(cid); FilterObject object = await (FilterArepository.get().getFilterList(cid) as FutureOr<FilterObject>);
_regions = object.regions; _regions = object.regions;
_categorys = object.categorys; _categorys = object.categorys;
_sorts = object.sorts; _sorts = object.sorts;
if (_regions.length > 0) { if (_regions.length > 0) {
_checkedOneRegion = _regions[0]; _checkedOneRegion = _regions[0];
if (_checkedOneRegion.subs.length > 0) { if (_checkedOneRegion!.subs!.length > 0) {
_checkedTwoRegion = _checkedOneRegion.subs[0]; _checkedTwoRegion = _checkedOneRegion!.subs![0];
} }
} }
if (_categorys.length > 0) { if (_categorys.length > 0) {
_checkedOneCategory = _categorys[0]; _checkedOneCategory = _categorys[0];
if (_checkedOneCategory.subs.length > 0) { if (_checkedOneCategory!.subs!.length > 0) {
_checkedTwoCategory = _checkedOneCategory.subs[0]; _checkedTwoCategory = _checkedOneCategory!.subs![0];
_shopClassNavTabController = TabController( _shopClassNavTabController = TabController(
length: _checkedOneCategory.subs.length, vsync: ScrollableState()); length: _checkedOneCategory!.subs!.length, vsync: ScrollableState());
} }
} }
if (_sorts.length > 0) { if (_sorts.length > 0) {
_checkedOneSort = _sorts[0]; _checkedOneSort = _sorts[0];
if (_checkedOneSort.subs.length > 0) { if (_checkedOneSort!.subs!.length > 0) {
_checkedTwoSort = _checkedOneSort.subs[0]; _checkedTwoSort = _checkedOneSort!.subs![0];
} }
} }
...@@ -66,7 +68,7 @@ class FilterModel extends BaseModel { ...@@ -66,7 +68,7 @@ class FilterModel extends BaseModel {
notifyListeners(); notifyListeners();
} }
FilterItemEntity getCheckedOneRegion() { FilterItemEntity? getCheckedOneRegion() {
return _checkedOneRegion; return _checkedOneRegion;
} }
...@@ -76,17 +78,17 @@ class FilterModel extends BaseModel { ...@@ -76,17 +78,17 @@ class FilterModel extends BaseModel {
notifyListeners(); notifyListeners();
} }
FilterItemEntity getCheckedOneCategory() { FilterItemEntity? getCheckedOneCategory() {
return _checkedOneCategory; return _checkedOneCategory;
} }
void setCheckedCategory(FilterItemEntity c1, FilterItemEntity c2) { void setCheckedCategory(FilterItemEntity? c1, FilterItemEntity c2) {
var oldCheckedOneCategory = _checkedOneCategory; var oldCheckedOneCategory = _checkedOneCategory;
_checkedOneCategory = c1; _checkedOneCategory = c1;
_checkedTwoCategory = c2; _checkedTwoCategory = c2;
int index = 0; int index = 0;
if (c2 != null && c1.subs.length > 0) { if (c2 != null && c1!.subs!.length > 0) {
index = c1.subs.indexWhere((item) => item.id == c2.id); index = c1.subs!.indexWhere((item) => item.id == c2.id);
} }
if (c1 != oldCheckedOneCategory) { if (c1 != oldCheckedOneCategory) {
int oIndex = 0; int oIndex = 0;
...@@ -96,21 +98,21 @@ class FilterModel extends BaseModel { ...@@ -96,21 +98,21 @@ class FilterModel extends BaseModel {
} }
_shopClassNavTabController = TabController( _shopClassNavTabController = TabController(
length: c1.subs.length, length: c1!.subs!.length,
initialIndex: oIndex, initialIndex: oIndex,
vsync: ScrollableState()); vsync: ScrollableState());
notifyListeners(); notifyListeners();
Future.delayed(Duration(milliseconds: 300)).then((value) { Future.delayed(Duration(milliseconds: 300)).then((value) {
_shopClassNavTabController.animateTo(index); _shopClassNavTabController!.animateTo(index);
}); });
} else { } else {
_shopClassNavTabController.animateTo(index); _shopClassNavTabController!.animateTo(index);
} }
} }
void resetShopClassNavController() {} void resetShopClassNavController() {}
FilterItemEntity getCheckedOneSort() { FilterItemEntity? getCheckedOneSort() {
return _checkedOneSort; return _checkedOneSort;
} }
...@@ -120,18 +122,18 @@ class FilterModel extends BaseModel { ...@@ -120,18 +122,18 @@ class FilterModel extends BaseModel {
notifyListeners(); notifyListeners();
} }
FilterItemEntity getCheckedTwoRegion() { FilterItemEntity? getCheckedTwoRegion() {
if (_checkedTwoRegion == null) { if (_checkedTwoRegion == null) {
return FilterItemEntity(null, null, []); return FilterItemEntity(null, null, []);
} }
return _checkedTwoRegion; return _checkedTwoRegion;
} }
FilterItemEntity getCheckedTwoCategory() { FilterItemEntity? getCheckedTwoCategory() {
return _checkedTwoCategory; return _checkedTwoCategory;
} }
FilterItemEntity getCheckedTwoSort() { FilterItemEntity? getCheckedTwoSort() {
if (_checkedTwoSort == null) { if (_checkedTwoSort == null) {
return FilterItemEntity(null, null, []); return FilterItemEntity(null, null, []);
} }
...@@ -150,19 +152,19 @@ class FilterModel extends BaseModel { ...@@ -150,19 +152,19 @@ class FilterModel extends BaseModel {
return _sorts; return _sorts;
} }
TabController getShopClassNavTabController() { TabController? getShopClassNavTabController() {
return _shopClassNavTabController; return _shopClassNavTabController;
} }
int getShopTypeNavIndex() { int? getShopTypeNavIndex() {
return _shopTypeNavIndex; return _shopTypeNavIndex;
} }
void setShopTypeNavIndex(int index) { void setShopTypeNavIndex(int? index) {
_shopTypeNavIndex = index; _shopTypeNavIndex = index;
} }
String getKeywords() { String? getKeywords() {
return _keywords; return _keywords;
} }
...@@ -174,8 +176,8 @@ class FilterModel extends BaseModel { ...@@ -174,8 +176,8 @@ class FilterModel extends BaseModel {
if (_regions.length > 0) { if (_regions.length > 0) {
FilterItemEntity onwItem = _regions[0]; FilterItemEntity onwItem = _regions[0];
FilterItemEntity twoItem; FilterItemEntity twoItem;
if (onwItem.subs != null && onwItem.subs.length > 0) { if (onwItem.subs != null && onwItem.subs!.length > 0) {
twoItem = onwItem.subs[0]; twoItem = onwItem.subs![0];
} else { } else {
twoItem = FilterItemEntity(null, null, []); twoItem = FilterItemEntity(null, null, []);
} }
...@@ -185,8 +187,8 @@ class FilterModel extends BaseModel { ...@@ -185,8 +187,8 @@ class FilterModel extends BaseModel {
if (_categorys.length > 0) { if (_categorys.length > 0) {
FilterItemEntity onwItem = _categorys[0]; FilterItemEntity onwItem = _categorys[0];
FilterItemEntity twoItem; FilterItemEntity twoItem;
if (onwItem.subs != null && onwItem.subs.length > 0) { if (onwItem.subs != null && onwItem.subs!.length > 0) {
twoItem = onwItem.subs[0]; twoItem = onwItem.subs![0];
} else { } else {
twoItem = FilterItemEntity(null, null, []); twoItem = FilterItemEntity(null, null, []);
} }
...@@ -196,8 +198,8 @@ class FilterModel extends BaseModel { ...@@ -196,8 +198,8 @@ class FilterModel extends BaseModel {
if (_sorts.length > 0) { if (_sorts.length > 0) {
FilterItemEntity onwItem = _sorts[0]; FilterItemEntity onwItem = _sorts[0];
FilterItemEntity twoItem; FilterItemEntity twoItem;
if (onwItem.subs != null && onwItem.subs.length > 0) { if (onwItem.subs != null && onwItem.subs!.length > 0) {
twoItem = onwItem.subs[0]; twoItem = onwItem.subs![0];
} else { } else {
twoItem = FilterItemEntity(null, null, []); twoItem = FilterItemEntity(null, null, []);
} }
......
...@@ -2,16 +2,16 @@ import 'package:mvp/mvp.dart'; ...@@ -2,16 +2,16 @@ import 'package:mvp/mvp.dart';
import 'package:life_repository/life_repository.dart'; import 'package:life_repository/life_repository.dart';
class ShopListModel extends BaseListModel<ShopItemEntity> { class ShopListModel extends BaseListModel<ShopItemEntity> {
String _cityId; String? _cityId;
String _lat; String? _lat;
String _lng; String? _lng;
String _firstCateId; String? _firstCateId;
String _keywords = ''; String _keywords = '';
String _secondCateId; late String _secondCateId;
String _regionId; String? _regionId;
String _sortType; String? _sortType;
// 0 优惠店铺,1 优惠套餐 // 0 优惠店铺,1 优惠套餐
int _shopTypeNavIndex = 0; int? _shopTypeNavIndex = 0;
@override @override
Future<List<ShopItemEntity>> request() { Future<List<ShopItemEntity>> request() {
...@@ -21,41 +21,41 @@ class ShopListModel extends BaseListModel<ShopItemEntity> { ...@@ -21,41 +21,41 @@ class ShopListModel extends BaseListModel<ShopItemEntity> {
Future<List<ShopItemEntity>> _find() { Future<List<ShopItemEntity>> _find() {
if (_shopTypeNavIndex == 0) { if (_shopTypeNavIndex == 0) {
return ShopListRepository.get().findRestaurantList( return ShopListRepository.get().findRestaurantList(
_cityId, _cityId!,
_lat, _lat!,
_lng, _lng!,
getPage().toString(), getPage().toString(),
_firstCateId, _firstCateId!,
_keywords, _keywords,
_secondCateId, _secondCateId,
_regionId, _regionId!,
_sortType); _sortType!);
} }
return ShopListRepository.get().findComboList( return ShopListRepository.get().findComboList(
_cityId, _cityId!,
_lat, _lat!,
_lng, _lng!,
getPage().toString(), getPage().toString(),
_firstCateId, _firstCateId!,
_keywords, _keywords,
_secondCateId, _secondCateId,
_regionId, _regionId!,
_sortType); _sortType!);
} }
void setCityId(String cid) { void setCityId(String? cid) {
_cityId = cid; _cityId = cid;
} }
void setLat(String lat) { void setLat(String? lat) {
_lat = lat; _lat = lat;
} }
void setLng(String lng) { void setLng(String? lng) {
_lng = lng; _lng = lng;
} }
void setFirstCateId(String firstCateId) { void setFirstCateId(String? firstCateId) {
_firstCateId = firstCateId; _firstCateId = firstCateId;
} }
...@@ -71,15 +71,15 @@ class ShopListModel extends BaseListModel<ShopItemEntity> { ...@@ -71,15 +71,15 @@ class ShopListModel extends BaseListModel<ShopItemEntity> {
_secondCateId = secondCateId; _secondCateId = secondCateId;
} }
void setRegionId(String regionId) { void setRegionId(String? regionId) {
_regionId = regionId; _regionId = regionId;
} }
void setSortType(String sortType) { void setSortType(String? sortType) {
_sortType = sortType; _sortType = sortType;
} }
void setShopTypeNavIndex(int index) { void setShopTypeNavIndex(int? index) {
_shopTypeNavIndex = index; _shopTypeNavIndex = index;
} }
} }
...@@ -33,12 +33,12 @@ class Res { ...@@ -33,12 +33,12 @@ class Res {
/// 转换定位数据 /// 转换定位数据
/// [entity] 当前获取到的定位数据 /// [entity] 当前获取到的定位数据
/// ///
static Future<LocationEntity> convertLocation({LocationEntity entity,String location}) async{ static Future<LocationEntity> convertLocation({LocationEntity? entity,String? location}) async{
dynamic idata = await AMapRepository.get().geocodeAddress(key: Res.aWebMapKey, location: location); dynamic idata = await AMapRepository.get().geocodeAddress(key: Res.aWebMapKey, location: location);
if(idata['status'] == '1' && idata['regeocode'] != null){ if(idata['status'] == '1' && idata['regeocode'] != null){
if(idata['regeocode'] != null){ if(idata['regeocode'] != null){
idata = idata['regeocode']; idata = idata['regeocode'];
entity.address = idata['formatted_address']; entity!.address = idata['formatted_address'];
if(idata['addressComponent'] != null){ if(idata['addressComponent'] != null){
idata = idata['addressComponent']; idata = idata['addressComponent'];
entity.city = idata['city']; entity.city = idata['city'];
......
import 'package:common_module/utils/store_utils.dart'; import 'package:common_module/utils/store_utils.dart';
class SearchHistoryUtils { class SearchHistoryUtils {
static SearchHistoryUtils _instance; static SearchHistoryUtils? _instance;
static SearchHistoryUtils getInstance() { static SearchHistoryUtils? getInstance() {
if (_instance == null) { if (_instance == null) {
_instance = new SearchHistoryUtils(); _instance = new SearchHistoryUtils();
} }
...@@ -15,7 +15,7 @@ class SearchHistoryUtils { ...@@ -15,7 +15,7 @@ class SearchHistoryUtils {
if (s == null || s.isEmpty) { if (s == null || s.isEmpty) {
return; return;
} }
var words = StoreUtils.getInstance().getForKey( var words = StoreUtils.getInstance()!.getForKey(
key: key, key: key,
defaultValue:[] defaultValue:[]
); );
...@@ -27,11 +27,11 @@ class SearchHistoryUtils { ...@@ -27,11 +27,11 @@ class SearchHistoryUtils {
if (words.length > 20) { if (words.length > 20) {
words = words.sublist(0, 20); words = words.sublist(0, 20);
} }
StoreUtils.getInstance().setKV(key: key, value: words); StoreUtils.getInstance()!.setKV(key: key, value: words);
} }
List<String> getWords() { List<String> getWords() {
var words = StoreUtils.getInstance().getForKey( var words = StoreUtils.getInstance()!.getForKey(
key: key, key: key,
); );
if (words == null) { if (words == null) {
...@@ -41,6 +41,6 @@ class SearchHistoryUtils { ...@@ -41,6 +41,6 @@ class SearchHistoryUtils {
} }
void clear() { void clear() {
StoreUtils.getInstance().setKV(key: key, value: []); StoreUtils.getInstance()!.setKV(key: key, value: []);
} }
} }
...@@ -4,9 +4,9 @@ import 'package:common_module/utils/xapp_utils.dart'; ...@@ -4,9 +4,9 @@ import 'package:common_module/utils/xapp_utils.dart';
import 'package:life_module/components/life_image.dart'; import 'package:life_module/components/life_image.dart';
class BuyLoadingDialogUtils { class BuyLoadingDialogUtils {
static BuyLoadingDialogUtils _instance; static BuyLoadingDialogUtils? _instance;
static BuyLoadingDialogUtils getInstance() { static BuyLoadingDialogUtils? getInstance() {
if (_instance == null) { if (_instance == null) {
_instance = new BuyLoadingDialogUtils._(); _instance = new BuyLoadingDialogUtils._();
} }
...@@ -21,14 +21,14 @@ class BuyLoadingDialogUtils { ...@@ -21,14 +21,14 @@ class BuyLoadingDialogUtils {
} }
class LoadingDialog { class LoadingDialog {
Route route; Route? route;
LoadingDialog() { LoadingDialog() {
route = _LoadingDialogRouter(_LoadingDialog()); route = _LoadingDialogRouter(_LoadingDialog());
BoostNavigator.instance.appState.topContainer.navigator.push(route); BoostNavigator.instance.appState!.topContainer!.navigator!.push(route!);
} }
void close() { void close() {
if (route != null && route.navigator != null) { if (route != null && route!.navigator != null) {
route.navigator.pop(route); route!.navigator!.pop(route);
} }
} }
} }
......
...@@ -4,20 +4,20 @@ import 'package:life_repository/life_repository.dart'; ...@@ -4,20 +4,20 @@ import 'package:life_repository/life_repository.dart';
import 'package:life_module/models/filter_model.dart'; import 'package:life_module/models/filter_model.dart';
class FilterPanelUtils { class FilterPanelUtils {
static OverlayEntry overlayEntry; static OverlayEntry? overlayEntry;
static show({ static show({
@required BuildContext context, required BuildContext context,
@required FilterModel model, required FilterModel model,
@required List<FilterItemEntity> items, required List<FilterItemEntity> items,
@required String oneCheckedId, required String? oneCheckedId,
Function() onChange, Function()? onChange,
double topOffset, double? topOffset,
String twoCheckedId, String? twoCheckedId,
Function() onClose, Function()? onClose,
Function(FilterItemEntity onwItem, FilterItemEntity twoItem) onConfirm, Function(FilterItemEntity onwItem, FilterItemEntity twoItem)? onConfirm,
}) { }) {
close(); close();
OverlayState overlayState = Overlay.of(context); OverlayState overlayState = Overlay.of(context)!;
overlayEntry = new OverlayEntry(builder: (context) { overlayEntry = new OverlayEntry(builder: (context) {
return FilterPanel( return FilterPanel(
...@@ -28,21 +28,21 @@ class FilterPanelUtils { ...@@ -28,21 +28,21 @@ class FilterPanelUtils {
twoCheckedId: twoCheckedId, twoCheckedId: twoCheckedId,
onClose: () { onClose: () {
close(); close();
onClose(); onClose!();
}, },
onConfirm: (onwItem, twoItem) { onConfirm: (onwItem, twoItem) {
close(); close();
onConfirm(onwItem, twoItem); onConfirm!(onwItem!, twoItem!);
}, },
onChange:onChange, onChange:onChange,
); );
}); });
overlayState.insert(overlayEntry); overlayState.insert(overlayEntry!);
} }
static void close() { static void close() {
if (overlayEntry != null) { if (overlayEntry != null) {
overlayEntry.remove(); overlayEntry!.remove();
overlayEntry = null; overlayEntry = null;
} }
} }
......
...@@ -20,23 +20,23 @@ import 'package:common_module/utils/system_share_utils.dart'; ...@@ -20,23 +20,23 @@ import 'package:common_module/utils/system_share_utils.dart';
import 'package:common_module/utils/clipboard_utils.dart'; import 'package:common_module/utils/clipboard_utils.dart';
class ShareDialogUtils { class ShareDialogUtils {
static ShareDialogUtils _instance; static ShareDialogUtils? _instance;
static ShareDialogUtils getInstance() { static ShareDialogUtils? getInstance() {
if (_instance == null) { if (_instance == null) {
_instance = new ShareDialogUtils(); _instance = new ShareDialogUtils();
} }
return _instance; return _instance;
} }
void show({BuildContext context, ShopInfo shopInfo, String firstCateId}) { void show({required BuildContext context, ShopInfo? shopInfo, String? firstCateId}) {
var route = _LoadingDialogRouter(_Dialog(shopInfo, firstCateId)); var route = _LoadingDialogRouter(_Dialog(shopInfo, firstCateId));
Navigator.of(context).push(route); Navigator.of(context).push(route);
} }
} }
class _Dialog extends StatefulWidget { class _Dialog extends StatefulWidget {
final ShopInfo shopInfo; final ShopInfo? shopInfo;
final String firstCateId; final String? firstCateId;
_Dialog(this.shopInfo, this.firstCateId); _Dialog(this.shopInfo, this.firstCateId);
@override @override
State<StatefulWidget> createState() => _DialogState(); State<StatefulWidget> createState() => _DialogState();
...@@ -49,8 +49,8 @@ class _DialogState extends State<_Dialog> { ...@@ -49,8 +49,8 @@ class _DialogState extends State<_Dialog> {
_Item(2, "assets/wechat2.png", "微信好友") _Item(2, "assets/wechat2.png", "微信好友")
]; ];
GlobalKey globalKey = GlobalKey(); GlobalKey globalKey = GlobalKey();
String shareUrl; String? shareUrl;
ShopInfo get shopInfo => widget.shopInfo; ShopInfo? get shopInfo => widget.shopInfo;
@override @override
void initState() { void initState() {
...@@ -59,8 +59,8 @@ class _DialogState extends State<_Dialog> { ...@@ -59,8 +59,8 @@ class _DialogState extends State<_Dialog> {
} }
void getShareUrl() async { void getShareUrl() async {
String url = await ShopInfoRepository.get() String? url = await ShopInfoRepository.get()
.getShareUrl(widget.shopInfo.shopId, widget.firstCateId); .getShareUrl(widget.shopInfo!.shopId!, widget.firstCateId!);
setState(() { setState(() {
shareUrl = url; shareUrl = url;
}); });
...@@ -97,10 +97,10 @@ class _DialogState extends State<_Dialog> { ...@@ -97,10 +97,10 @@ class _DialogState extends State<_Dialog> {
FlutterNativeToast.showToast('请稍后'); FlutterNativeToast.showToast('请稍后');
return; return;
} }
String copyText = '''店铺名称: ${shopInfo.shopTitle} String copyText = '''店铺名称: ${shopInfo!.shopTitle}
评分: ${shopInfo.commentScore} 评分: ${shopInfo!.commentScore}
人均: ${shopInfo.avgPrice} 人均: ${shopInfo!.avgPrice}
地址: ${shopInfo.address} 地址: ${shopInfo!.address}
—————————————————— ——————————————————
$shareUrl $shareUrl
'''; ''';
...@@ -111,34 +111,34 @@ $shareUrl ...@@ -111,34 +111,34 @@ $shareUrl
if (e.id == 0) { if (e.id == 0) {
var _permission = var _permission =
Platform.isIOS ? Permission.photos : Permission.storage; Platform.isIOS ? Permission.photos : Permission.storage;
var permission = await PermissionUtils.getInstance() var permission = await PermissionUtils.getInstance()!
.has(permissions: [_permission]); .has(permissions: [_permission]);
var status = permission[_permission]; var status = permission[_permission];
if (status != PermissionUtilsStatus.granted) { if (status != PermissionUtilsStatus.granted) {
bool confirm = await Modal.showModal( bool confirm = await (Modal.showModal(
title: "温馨提示", title: "温馨提示",
msg: "为给您提供更好的服务,使用此功能前需获取您的储存权限", msg: "为给您提供更好的服务,使用此功能前需获取您的储存权限",
cancelBtnText: '拒绝', cancelBtnText: '拒绝',
confirmBtnText: '同意'); confirmBtnText: '同意') as FutureOr<bool>);
if (!confirm) { if (!confirm) {
return; return;
} }
if (status == PermissionUtilsStatus.permanentlyDenied) { if (status == PermissionUtilsStatus.permanentlyDenied) {
PermissionUtils.getInstance().openAppSetting(); PermissionUtils.getInstance()!.openAppSetting();
return; return;
} }
permission = await PermissionUtils.getInstance() permission = await PermissionUtils.getInstance()!
.request(permissions: [_permission]); .request(permissions: [_permission]);
status = permission[_permission]; status = permission[_permission];
if (status != PermissionUtilsStatus.granted) { if (status != PermissionUtilsStatus.granted) {
return; return;
} }
} }
await FlutterAlbumSave.saveImageToAlbum(file.path, null); await FlutterAlbumSave.saveImageToAlbum(file.path, '小熊有好货');
Navigator.of(context).pop(); Navigator.of(context).pop();
} else { } else {
SystemShareUtils.getInstance().shareImage(file.path); SystemShareUtils.getInstance()!.shareImage(file.path);
} }
} else { } else {
Navigator.of(context).pop(); Navigator.of(context).pop();
...@@ -174,7 +174,7 @@ $shareUrl ...@@ -174,7 +174,7 @@ $shareUrl
height: 222.rpx, height: 222.rpx,
width: 222.rpx, width: 222.rpx,
child: CachedNetworkImage( child: CachedNetworkImage(
imageUrl: widget.shopInfo.shopImg, imageUrl: widget.shopInfo!.shopImg!,
height: 222.rpx, height: 222.rpx,
width: 222.rpx, width: 222.rpx,
fit: BoxFit.cover, fit: BoxFit.cover,
...@@ -186,7 +186,7 @@ $shareUrl ...@@ -186,7 +186,7 @@ $shareUrl
Container( Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text( child: Text(
widget.shopInfo.shopTitle, widget.shopInfo!.shopTitle!,
style: TextStyle( style: TextStyle(
color: rgba(48, 38, 0, 1), color: rgba(48, 38, 0, 1),
fontSize: 12.rpx, fontSize: 12.rpx,
...@@ -218,7 +218,7 @@ $shareUrl ...@@ -218,7 +218,7 @@ $shareUrl
); );
} }
return QrImage( return QrImage(
data: shareUrl, data: shareUrl!,
version: QrVersions.auto, version: QrVersions.auto,
size: 84.rpx, size: 84.rpx,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
...@@ -359,9 +359,9 @@ $shareUrl ...@@ -359,9 +359,9 @@ $shareUrl
Future<File> widgetToImage() async { Future<File> widgetToImage() async {
Completer completer = Completer<File>(); Completer completer = Completer<File>();
RenderRepaintBoundary render = globalKey.currentContext.findRenderObject(); RenderRepaintBoundary render = globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary;
ui.Image image = await render.toImage(pixelRatio: 2.0); ui.Image image = await render.toImage(pixelRatio: 2.0);
ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png); ByteData byteData = await (image.toByteData(format: ui.ImageByteFormat.png) as FutureOr<ByteData>);
var imgData = byteData.buffer.asUint8List(); var imgData = byteData.buffer.asUint8List();
String sTempDir = (await getTemporaryDirectory()).path; String sTempDir = (await getTemporaryDirectory()).path;
bool isDirExist = await Directory(sTempDir).exists(); bool isDirExist = await Directory(sTempDir).exists();
...@@ -372,7 +372,7 @@ $shareUrl ...@@ -372,7 +372,7 @@ $shareUrl
File file = File(sTempDir + "/widget_image_$time.png"); File file = File(sTempDir + "/widget_image_$time.png");
file = await file.writeAsBytes(imgData,mode:FileMode.writeOnly,flush: true); file = await file.writeAsBytes(imgData,mode:FileMode.writeOnly,flush: true);
completer.complete(file); completer.complete(file);
return completer.future; return completer.future as FutureOr<File>;
} }
} }
......
...@@ -11,8 +11,8 @@ import 'package:azlistview/azlistview.dart'; ...@@ -11,8 +11,8 @@ import 'package:azlistview/azlistview.dart';
import 'entity/city_model.dart'; import 'entity/city_model.dart';
class CityPage extends StatefulWidget { class CityPage extends StatefulWidget {
final Map<String, dynamic> param; final Map<String, dynamic>? param;
const CityPage({Key key, this.param}) : super(key: key); const CityPage({Key? key, this.param}) : super(key: key);
@override @override
_CityPageState createState() => _CityPageState(); _CityPageState createState() => _CityPageState();
...@@ -21,18 +21,18 @@ class CityPage extends StatefulWidget { ...@@ -21,18 +21,18 @@ class CityPage extends StatefulWidget {
class _CityPageState extends State<CityPage> { class _CityPageState extends State<CityPage> {
List<CityModel> citysList = List<CityModel>.empty(growable: true); List<CityModel> citysList = List<CityModel>.empty(growable: true);
ValueNotifier<SearchCityInfo> listenable = ValueNotifier<SearchCityInfo?> listenable =
ValueNotifier<SearchCityInfo>(null); ValueNotifier<SearchCityInfo?>(null);
String _currentCity = ''; String? _currentCity = '';
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (widget.param != null && widget.param['currentCity'] != null) { if (widget.param != null && widget.param!['currentCity'] != null) {
_currentCity = widget.param['currentCity'] as String; _currentCity = widget.param!['currentCity'] as String?;
} }
if (_currentCity.isNotEmpty) { if (_currentCity!.isNotEmpty) {
citysList.add( citysList.add(
CityModel( CityModel(
type: 0, type: 0,
...@@ -62,12 +62,12 @@ class _CityPageState extends State<CityPage> { ...@@ -62,12 +62,12 @@ class _CityPageState extends State<CityPage> {
}); });
} }
void _handleList({@required List<CityModel> list}) { void _handleList({required List<CityModel> list}) {
if (list.isEmpty) return; if (list.isEmpty) return;
for (int i = 0, length = list.length; i < length; i++) { for (int i = 0, length = list.length; i < length; i++) {
CityModel model = list[i]; CityModel model = list[i];
if (model.type == -1) { if (model.type == -1) {
String pinyin = model.namePinyin; String pinyin = model.namePinyin!;
String tag = pinyin.substring(0, 1).toUpperCase(); String tag = pinyin.substring(0, 1).toUpperCase();
list[i].namePinyin = pinyin; list[i].namePinyin = pinyin;
if (RegExp('[A-Z]').hasMatch(tag)) { if (RegExp('[A-Z]').hasMatch(tag)) {
...@@ -91,7 +91,7 @@ class _CityPageState extends State<CityPage> { ...@@ -91,7 +91,7 @@ class _CityPageState extends State<CityPage> {
backgroundColor: Color(0xFFF5F5F5), backgroundColor: Color(0xFFF5F5F5),
appBar: buildAppBar(title: '选择城市',onPressed:(){ appBar: buildAppBar(title: '选择城市',onPressed:(){
NavigateUtils.pop(arguments:{}); NavigateUtils.pop(arguments:{});
}), }) as PreferredSizeWidget?,
body: _buildBody(), body: _buildBody(),
); );
} }
...@@ -111,7 +111,7 @@ class _CityPageState extends State<CityPage> { ...@@ -111,7 +111,7 @@ class _CityPageState extends State<CityPage> {
Expanded( Expanded(
child: buildAzListViewWidget( child: buildAzListViewWidget(
notifier: listenable, notifier: listenable,
onCityTap: (String city) { onCityTap: (String? city) {
NavigateUtils.pop(arguments: {'city': city}); NavigateUtils.pop(arguments: {'city': city});
}, },
reEnteTap: () { reEnteTap: () {
...@@ -127,7 +127,7 @@ class _CityPageState extends State<CityPage> { ...@@ -127,7 +127,7 @@ class _CityPageState extends State<CityPage> {
void onChangedText(String text) { void onChangedText(String text) {
Iterable<CityModel> citys = citysList Iterable<CityModel> citys = citysList
.where((ele) => (ele.type == 0 || ele.name.indexOf(text) > -1)); .where((ele) => (ele.type == 0 || ele.name!.indexOf(text) > -1));
listenable.value = SearchCityInfo( listenable.value = SearchCityInfo(
isSearch: text.isNotEmpty, isSearch: text.isNotEmpty,
citys: List<CityModel>.from(citys), citys: List<CityModel>.from(citys),
......
...@@ -6,7 +6,7 @@ import 'package:life_module/util/resource.dart'; ...@@ -6,7 +6,7 @@ import 'package:life_module/util/resource.dart';
import 'package:life_module/views/city/entity/city_model.dart'; import 'package:life_module/views/city/entity/city_model.dart';
import 'package:common_module/utils/xapp_utils.dart'; import 'package:common_module/utils/xapp_utils.dart';
Widget buildAppBar({String title = '',void Function() onPressed}) { Widget buildAppBar({String title = '',void Function()? onPressed}) {
return AppBar( return AppBar(
backgroundColor: Colors.white, backgroundColor: Colors.white,
elevation: 0.1, elevation: 0.1,
...@@ -38,14 +38,14 @@ Widget buildAppBar({String title = '',void Function() onPressed}) { ...@@ -38,14 +38,14 @@ Widget buildAppBar({String title = '',void Function() onPressed}) {
/// [onCityTap] 点击提交 /// [onCityTap] 点击提交
/// ///
Widget buildSearchWidget({ Widget buildSearchWidget({
String city, String? city,
String hintText, String? hintText,
void Function(String) onChanged, void Function(String)? onChanged,
void Function(String) onSubmitted, void Function(String)? onSubmitted,
void Function() onCityTap, void Function()? onCityTap,
void Function() onEnterCity, void Function()? onEnterCity,
bool enabled = true, bool enabled = true,
TextEditingController controller, TextEditingController? controller,
}) { }) {
Widget _child = Container( Widget _child = Container(
decoration: BoxDecoration( decoration: BoxDecoration(
...@@ -125,7 +125,7 @@ Widget buildSearchWidget({ ...@@ -125,7 +125,7 @@ Widget buildSearchWidget({
child: _child, child: _child,
), ),
onTap: () { onTap: () {
onEnterCity(); onEnterCity!();
}, },
); );
} }
...@@ -135,12 +135,12 @@ Widget buildSearchWidget({ ...@@ -135,12 +135,12 @@ Widget buildSearchWidget({
/// ///
/// ///
Widget buildLocationsWidget({ Widget buildLocationsWidget({
@required String title, required String title,
@required Widget action, required Widget action,
bool isLoading = false, bool isLoading = false,
List<dynamic> list = const [], List<dynamic>? list = const [],
Widget bottom, Widget? bottom,
void Function(Map<String, dynamic>) onAddressTap, void Function(Map<String, dynamic>)? onAddressTap,
EdgeInsetsGeometry padding = const EdgeInsets.symmetric(horizontal: 13), EdgeInsetsGeometry padding = const EdgeInsets.symmetric(horizontal: 13),
}) { }) {
if (list == null || list.isEmpty) { if (list == null || list.isEmpty) {
...@@ -204,7 +204,7 @@ Widget buildLocationsWidget({ ...@@ -204,7 +204,7 @@ Widget buildLocationsWidget({
), ),
color: Colors.white, color: Colors.white,
), ),
onTap: () => onAddressTap(data), onTap: () => onAddressTap!(data),
); );
}, },
), ),
...@@ -213,7 +213,7 @@ Widget buildLocationsWidget({ ...@@ -213,7 +213,7 @@ Widget buildLocationsWidget({
); );
} }
Widget buildCurrentLocationsWidget({String title = '', void Function() onTap}) { Widget buildCurrentLocationsWidget({String title = '', void Function()? onTap}) {
return InkWell( return InkWell(
onTap: onTap, onTap: onTap,
child: Container( child: Container(
...@@ -247,10 +247,10 @@ Widget buildCurrentLocationsWidget({String title = '', void Function() onTap}) { ...@@ -247,10 +247,10 @@ Widget buildCurrentLocationsWidget({String title = '', void Function() onTap}) {
/// ///
/// ///
Widget buildCityWidget({ Widget buildCityWidget({
@required List<String> citys, required List<String?> citys,
bool current = false, bool current = false,
EdgeInsetsGeometry padding = const EdgeInsets.only(left: 13), EdgeInsetsGeometry padding = const EdgeInsets.only(left: 13),
void Function(String) onCityTap, void Function(String)? onCityTap,
}) { }) {
return GridView.builder( return GridView.builder(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
...@@ -267,7 +267,7 @@ Widget buildCityWidget({ ...@@ -267,7 +267,7 @@ Widget buildCityWidget({
childAspectRatio: 3.1, childAspectRatio: 3.1,
), ),
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
String city = citys[index]; String city = citys[index]!;
Widget _child = Text( Widget _child = Text(
city, city,
style: TextStyle(color: Color(0xFF302600), fontSize: 13), style: TextStyle(color: Color(0xFF302600), fontSize: 13),
...@@ -308,14 +308,14 @@ Widget buildCityWidget({ ...@@ -308,14 +308,14 @@ Widget buildCityWidget({
/// ///
/// ///
Widget buildAzListViewWidget({ Widget buildAzListViewWidget({
@required ValueNotifier<SearchCityInfo> notifier, required ValueNotifier<SearchCityInfo?> notifier,
@required Function(String) onCityTap, required Function(String?) onCityTap,
@required Function() reEnteTap, required Function() reEnteTap,
}) { }) {
return ValueListenableBuilder( return ValueListenableBuilder(
valueListenable: notifier, valueListenable: notifier,
builder: (BuildContext context, SearchCityInfo cityInfo, Widget child) { builder: (BuildContext context, SearchCityInfo? cityInfo, Widget? child) {
if (cityInfo.isSearch && cityInfo.citys.length == 1) { if (cityInfo!.isSearch! && cityInfo.citys!.length == 1) {
return Column( return Column(
children: [ children: [
Container( Container(
...@@ -330,7 +330,7 @@ Widget buildAzListViewWidget({ ...@@ -330,7 +330,7 @@ Widget buildAzListViewWidget({
), ),
), ),
buildCityWidget( buildCityWidget(
citys: cityInfo.citys[0].citys, citys: cityInfo.citys![0].citys!,
current: true, current: true,
onCityTap: onCityTap, onCityTap: onCityTap,
), ),
...@@ -380,29 +380,29 @@ Widget buildAzListViewWidget({ ...@@ -380,29 +380,29 @@ Widget buildAzListViewWidget({
); );
} }
return AzListView( return AzListView(
data: cityInfo.citys, data: cityInfo.citys!,
itemCount: cityInfo.citys.length, itemCount: cityInfo.citys!.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
CityModel model = cityInfo.citys[index]; CityModel model = cityInfo.citys![index];
if (model.type == 0) { if (model.type == 0) {
//0当前城市 //0当前城市
return buildCityWidget( return buildCityWidget(
citys: model.citys, citys: model.citys!,
current: true, current: true,
onCityTap: onCityTap, onCityTap: onCityTap,
); );
} else if (model.type == 1) { } else if (model.type == 1) {
//热门城市 //热门城市
return buildCityWidget( return buildCityWidget(
citys: model.citys, citys: model.citys!,
current: false, current: false,
onCityTap: onCityTap, onCityTap: onCityTap,
); );
} }
Text textWidget; Text textWidget;
if (cityInfo.isSearch) { if (cityInfo.isSearch!) {
List<TextSpan> childs = model.name.split("").map((s) { List<TextSpan> childs = model.name!.split("").map((s) {
bool isKeyWordChar = cityInfo.keywords.indexOf(s) > -1; bool isKeyWordChar = cityInfo.keywords.indexOf(s) > -1;
return TextSpan( return TextSpan(
text: s, text: s,
...@@ -419,7 +419,7 @@ Widget buildAzListViewWidget({ ...@@ -419,7 +419,7 @@ Widget buildAzListViewWidget({
); );
} else { } else {
textWidget = Text( textWidget = Text(
model.name, model.name!,
style: TextStyle(color: Color(0xFF302600), fontSize: 13), style: TextStyle(color: Color(0xFF302600), fontSize: 13),
); );
} }
...@@ -428,7 +428,7 @@ Widget buildAzListViewWidget({ ...@@ -428,7 +428,7 @@ Widget buildAzListViewWidget({
child: Container( child: Container(
color: Colors.white, color: Colors.white,
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: (cityInfo.isSearch && index == 1) ? 12 : 0, top: (cityInfo.isSearch! && index == 1) ? 12 : 0,
), ),
child: Column( child: Column(
children: [ children: [
...@@ -450,7 +450,7 @@ Widget buildAzListViewWidget({ ...@@ -450,7 +450,7 @@ Widget buildAzListViewWidget({
); );
}, },
susItemBuilder: (BuildContext context, int index) { susItemBuilder: (BuildContext context, int index) {
CityModel model = cityInfo.citys[index]; CityModel model = cityInfo.citys![index];
if (model.type == 0) { if (model.type == 0) {
return Container( return Container(
padding: EdgeInsets.only(left: 13.0), padding: EdgeInsets.only(left: 13.0),
......
import 'package:azlistview/azlistview.dart'; import 'package:azlistview/azlistview.dart';
import 'package:flutter/foundation.dart';
class SearchCityInfo { class SearchCityInfo {
List<CityModel> citys; List<CityModel>? citys;
bool isSearch = false; bool? isSearch = false;
String keywords; String keywords;
SearchCityInfo({ SearchCityInfo({
this.citys, this.citys,
...@@ -17,14 +16,14 @@ class SearchCityInfo { ...@@ -17,14 +16,14 @@ class SearchCityInfo {
/// type = 1 热门城市 /// type = 1 热门城市
/// ///
class CityModel extends ISuspensionBean { class CityModel extends ISuspensionBean {
String name; String? name;
String tagIndex; String? tagIndex;
String namePinyin; String? namePinyin;
int type = -1; int type = -1;
List<String> citys; List<String?>? citys;
CityModel({ CityModel({
@required this.name, required this.name,
this.tagIndex, this.tagIndex,
this.namePinyin, this.namePinyin,
this.type = -1, this.type = -1,
...@@ -36,5 +35,5 @@ class CityModel extends ISuspensionBean { ...@@ -36,5 +35,5 @@ class CityModel extends ISuspensionBean {
namePinyin = json['pinyin']; namePinyin = json['pinyin'];
@override @override
String getSuspensionTag() => tagIndex; String getSuspensionTag() => tagIndex!;
} }
import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'package:amaps_location/location.dart'; import 'package:amaps_location/location.dart';
...@@ -16,23 +17,23 @@ import 'package:modal/modal.dart'; ...@@ -16,23 +17,23 @@ import 'package:modal/modal.dart';
import 'package:common_module/utils/loading_dialog_utils.dart'; import 'package:common_module/utils/loading_dialog_utils.dart';
class LifeLocationPage extends StatefulWidget { class LifeLocationPage extends StatefulWidget {
final Map<String, dynamic> param; final Map<String, dynamic>? param;
const LifeLocationPage({Key key, this.param}) : super(key: key); const LifeLocationPage({Key? key, this.param}) : super(key: key);
@override @override
_LifeLocationPageState createState() => _LifeLocationPageState(); _LifeLocationPageState createState() => _LifeLocationPageState();
} }
class _LifeLocationPageState extends State<LifeLocationPage> { class _LifeLocationPageState extends State<LifeLocationPage> {
///当前城市 ///当前城市
String _currentCity; String? _currentCity;
String _mCurrentCity; String? _mCurrentCity;
List<dynamic> _historyLocations; List<dynamic>? _historyLocations;
//附近位置 //附近位置
List<dynamic> _nearbyLocations = List<dynamic>.empty(growable: true); List<dynamic> _nearbyLocations = List<dynamic>.empty(growable: true);
List<MapTipEntity> _searchTips; List<MapTipEntity>? _searchTips;
LocationEntity _currentLocationEntity; LocationEntity? _currentLocationEntity;
@override @override
...@@ -48,7 +49,7 @@ class _LifeLocationPageState extends State<LifeLocationPage> { ...@@ -48,7 +49,7 @@ class _LifeLocationPageState extends State<LifeLocationPage> {
appBar: buildAppBar( appBar: buildAppBar(
title: '选择定位地址', title: '选择定位地址',
onPressed:(){ onPressed:(){
Map<String,dynamic> arguments; late Map<String,dynamic> arguments;
if(_currentLocationEntity != null){ if(_currentLocationEntity != null){
arguments = { arguments = {
'address': _currentLocationEntity?.address, 'address': _currentLocationEntity?.address,
...@@ -59,7 +60,7 @@ class _LifeLocationPageState extends State<LifeLocationPage> { ...@@ -59,7 +60,7 @@ class _LifeLocationPageState extends State<LifeLocationPage> {
} }
NavigateUtils.pop(arguments:arguments); NavigateUtils.pop(arguments:arguments);
} }
), ) as PreferredSizeWidget?,
body: _buildBody(), body: _buildBody(),
); );
} }
...@@ -68,16 +69,16 @@ class _LifeLocationPageState extends State<LifeLocationPage> { ...@@ -68,16 +69,16 @@ class _LifeLocationPageState extends State<LifeLocationPage> {
return Column( return Column(
children: [ children: [
buildSearchWidget( buildSearchWidget(
enabled: !(_currentCity == null || _currentCity.isEmpty), enabled: !(_currentCity == null || _currentCity!.isEmpty),
city: _currentCity ?? '加载中...', city: _currentCity ?? '加载中...',
hintText: (_currentCity == null || _currentCity.isEmpty) hintText: (_currentCity == null || _currentCity!.isEmpty)
? '请输入城市名称' ? '请输入城市名称'
: '在$_currentCity内搜索', : '在$_currentCity内搜索',
onCityTap: () { onCityTap: () {
pushCity(); pushCity();
}, },
onEnterCity: () { onEnterCity: () {
if (_currentCity == null || _currentCity.isEmpty) { if (_currentCity == null || _currentCity!.isEmpty) {
pushCity(); pushCity();
} }
}, },
...@@ -86,7 +87,7 @@ class _LifeLocationPageState extends State<LifeLocationPage> { ...@@ -86,7 +87,7 @@ class _LifeLocationPageState extends State<LifeLocationPage> {
}, },
), ),
Expanded( Expanded(
child: (_searchTips == null || _searchTips.isEmpty) child: (_searchTips == null || _searchTips!.isEmpty)
? CustomScrollView( ? CustomScrollView(
slivers: [ slivers: [
//获取当前定位按钮 //获取当前定位按钮
...@@ -147,10 +148,10 @@ class _LifeLocationPageState extends State<LifeLocationPage> { ...@@ -147,10 +148,10 @@ class _LifeLocationPageState extends State<LifeLocationPage> {
], ],
) )
: ListView.builder( : ListView.builder(
itemCount: _searchTips.length, itemCount: _searchTips!.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
MapTipEntity entity = _searchTips[index]; MapTipEntity entity = _searchTips![index];
List<TextSpan> childs = entity.name.split("").map((s) { List<TextSpan> childs = entity.name!.split("").map((s) {
bool isKeyWordChar = this.searchKeywords.indexOf(s) > -1; bool isKeyWordChar = this.searchKeywords.indexOf(s) > -1;
return TextSpan( return TextSpan(
text: s, text: s,
...@@ -207,17 +208,17 @@ class _LifeLocationPageState extends State<LifeLocationPage> { ...@@ -207,17 +208,17 @@ class _LifeLocationPageState extends State<LifeLocationPage> {
); );
} }
void popAddress({Map<String, dynamic> arguments}) { void popAddress({required Map<String, dynamic> arguments}) {
NavigateUtils.pop(arguments: arguments).then( NavigateUtils.pop(arguments: arguments).then(
(value) { (value) {
_historyLocations.removeWhere( _historyLocations!.removeWhere(
(item) => item['name'] == arguments['name'], (item) => item['name'] == arguments['name'],
); );
_historyLocations.insert(0, arguments); _historyLocations!.insert(0, arguments);
if (_historyLocations.length > 5) { if (_historyLocations!.length > 5) {
_historyLocations.removeAt(5); _historyLocations!.removeAt(5);
} }
StoreUtils.getInstance().setKV( StoreUtils.getInstance()!.setKV(
key: Res.historyLocation, key: Res.historyLocation,
value: _historyLocations, value: _historyLocations,
); );
...@@ -227,7 +228,7 @@ class _LifeLocationPageState extends State<LifeLocationPage> { ...@@ -227,7 +228,7 @@ class _LifeLocationPageState extends State<LifeLocationPage> {
String searchKeywords = ''; String searchKeywords = '';
void searchForKeywordsTips({String keywords}) async { void searchForKeywordsTips({required String keywords}) async {
AMapRepository.get() AMapRepository.get()
.inputSearchTips( .inputSearchTips(
key: Res.aWebMapKey, key: Res.aWebMapKey,
...@@ -252,7 +253,7 @@ class _LifeLocationPageState extends State<LifeLocationPage> { ...@@ -252,7 +253,7 @@ class _LifeLocationPageState extends State<LifeLocationPage> {
void pushCity() { void pushCity() {
Map<String, dynamic> arguments = {}; Map<String, dynamic> arguments = {};
if (_mCurrentCity != null && _mCurrentCity.isNotEmpty) { if (_mCurrentCity != null && _mCurrentCity!.isNotEmpty) {
arguments['currentCity'] = _mCurrentCity; arguments['currentCity'] = _mCurrentCity;
} }
NavigateUtils.push( NavigateUtils.push(
...@@ -260,7 +261,7 @@ class _LifeLocationPageState extends State<LifeLocationPage> { ...@@ -260,7 +261,7 @@ class _LifeLocationPageState extends State<LifeLocationPage> {
arguments: arguments, arguments: arguments,
).then((value) { ).then((value) {
if (value is Map && value['city'] != null) { if (value is Map && value['city'] != null) {
String _city = value['city']; String? _city = value['city'];
setState(() { setState(() {
_currentCity = _city; _currentCity = _city;
}); });
...@@ -281,12 +282,12 @@ class _LifeLocationPageState extends State<LifeLocationPage> { ...@@ -281,12 +282,12 @@ class _LifeLocationPageState extends State<LifeLocationPage> {
/// 如果有定位权限则读取定位权限 /// 如果有定位权限则读取定位权限
/// 否则使用网络定位显示城市 /// 否则使用网络定位显示城市
/// ///
bool enable = await AmapsLocation.create().isOpenGPS(); bool? enable = await AmapsLocation.create()!.isOpenGPS();
bool has = await LocationPermissionUtils.getInstance().hasPermission(); bool has = await LocationPermissionUtils.getInstance()!.hasPermission();
if (has && enable) { if (has && enable!) {
//有定位权限 //有定位权限
var loading = LoadingDialogUtils.getInstance().show(); var loading = LoadingDialogUtils.getInstance()!.show();
AmapsLocation.create() AmapsLocation.create()!
.getLocation( .getLocation(
apiKey: Platform.isIOS ? Res.aIOSMapKey : Res.aAndroidMapKey) apiKey: Platform.isIOS ? Res.aIOSMapKey : Res.aAndroidMapKey)
.then( .then(
...@@ -328,16 +329,16 @@ class _LifeLocationPageState extends State<LifeLocationPage> { ...@@ -328,16 +329,16 @@ class _LifeLocationPageState extends State<LifeLocationPage> {
if (isInit) { if (isInit) {
ipConfigAddress(); ipConfigAddress();
} else { } else {
if (enable) { if (enable!) {
//有GPS //有GPS
bool confirm = await Modal.showModal( bool confirm = await (Modal.showModal(
title: "温馨提示", title: "温馨提示",
msg: "为给您提供更好的服务,需获取您的位置权限", msg: "为给您提供更好的服务,需获取您的位置权限",
cancelBtnText: '拒绝', cancelBtnText: '拒绝',
confirmBtnText: '同意'); confirmBtnText: '同意') as FutureOr<bool>);
if (confirm) { if (confirm) {
bool has = bool has =
await LocationPermissionUtils.getInstance().reqPermission(); await LocationPermissionUtils.getInstance()!.reqPermission();
if (has) { if (has) {
startLocation(isInit: false, isCurrent: isCurrent); startLocation(isInit: false, isCurrent: isCurrent);
} }
...@@ -346,13 +347,13 @@ class _LifeLocationPageState extends State<LifeLocationPage> { ...@@ -346,13 +347,13 @@ class _LifeLocationPageState extends State<LifeLocationPage> {
} }
} else { } else {
//没有GPS //没有GPS
bool confirm = await Modal.showModal( bool confirm = await (Modal.showModal(
title: "温馨提示", title: "温馨提示",
msg: "为给您提供更好的服务,需获取您的位置权限", msg: "为给您提供更好的服务,需获取您的位置权限",
cancelBtnText: '拒绝', cancelBtnText: '拒绝',
confirmBtnText: '同意'); confirmBtnText: '同意') as FutureOr<bool>);
if (confirm) { if (confirm) {
AmapsLocation.create().enableGPS().then((value) {}); AmapsLocation.create()!.enableGPS().then((value) {});
} }
} }
} }
...@@ -361,7 +362,7 @@ class _LifeLocationPageState extends State<LifeLocationPage> { ...@@ -361,7 +362,7 @@ class _LifeLocationPageState extends State<LifeLocationPage> {
bool startLocationLoading = false; bool startLocationLoading = false;
void queryNearbyInfo({@required String location}) { void queryNearbyInfo({required String location}) {
setState(() { setState(() {
startLocationLoading = true; startLocationLoading = true;
}); });
...@@ -411,8 +412,8 @@ class _LifeLocationPageState extends State<LifeLocationPage> { ...@@ -411,8 +412,8 @@ class _LifeLocationPageState extends State<LifeLocationPage> {
/// ///
void getHistoryLocations() { void getHistoryLocations() {
_historyLocations = _historyLocations =
StoreUtils.getInstance().getForKey(key: Res.historyLocation); StoreUtils.getInstance()!.getForKey(key: Res.historyLocation);
if (_historyLocations == null || _historyLocations.isEmpty) { if (_historyLocations == null || _historyLocations!.isEmpty) {
_historyLocations = List<dynamic>.empty(growable: true); _historyLocations = List<dynamic>.empty(growable: true);
} }
} }
......
...@@ -22,7 +22,7 @@ class IAction extends BaseAction<Model> { ...@@ -22,7 +22,7 @@ class IAction extends BaseAction<Model> {
void _init() async { void _init() async {
setModel(Model()); setModel(Model());
await getModel().findPermission(); await getModel()!.findPermission();
initLocation(); initLocation();
await getAppNavModel().getAppNavList(); await getAppNavModel().getAppNavList();
await getMiniBannerModel().getActivityConfigList(); await getMiniBannerModel().getActivityConfigList();
...@@ -30,23 +30,23 @@ class IAction extends BaseAction<Model> { ...@@ -30,23 +30,23 @@ class IAction extends BaseAction<Model> {
void initLocation() async{ void initLocation() async{
// 没有定位权限,用ip定位 // 没有定位权限,用ip定位
bool isFirstLifeLocation = StoreUtils.getInstance().getForKey(key:'is_first_life_location2'); bool? isFirstLifeLocation = StoreUtils.getInstance()!.getForKey(key:'is_first_life_location2');
if(isFirstLifeLocation == null){ if(isFirstLifeLocation == null){
StoreUtils.getInstance().setKV(key:'is_first_life_location2', value: true); StoreUtils.getInstance()!.setKV(key:'is_first_life_location2', value: true);
await getModel().reqPermission(); await getModel()!.reqPermission();
initLocation(); initLocation();
}else if (!getModel().getHasPermission()) { }else if (!getModel()!.getHasPermission()!) {
getModel().ipConfigAddress().then((value) => initData()); getModel()!.ipConfigAddress().then((value) => initData());
} else { } else {
getModel().getLocation().then((value){ getModel()!.getLocation().then((value){
initData(); initData();
}); });
} }
} }
Future<void> initData() async { Future<void> initData() async {
await getModel().findCityId(); await getModel()!.findCityId();
String cityId = getModel().getCityId(); String? cityId = getModel()!.getCityId();
print('===========> cityId:$cityId'); print('===========> cityId:$cityId');
if (cityId != null && cityId.isNotEmpty) { if (cityId != null && cityId.isNotEmpty) {
await getSecKillModel().findDisplay(cityId); await getSecKillModel().findDisplay(cityId);
...@@ -56,7 +56,7 @@ class IAction extends BaseAction<Model> { ...@@ -56,7 +56,7 @@ class IAction extends BaseAction<Model> {
} }
Future<void> refreshShopList() async { Future<void> refreshShopList() async {
var loading = LoadingDialogUtils.getInstance().show(); var loading = LoadingDialogUtils.getInstance()!.show();
Future.delayed(Duration(seconds: 2)).then((value) { Future.delayed(Duration(seconds: 2)).then((value) {
if (loading != null) { if (loading != null) {
loading.close(); loading.close();
...@@ -65,22 +65,22 @@ class IAction extends BaseAction<Model> { ...@@ -65,22 +65,22 @@ class IAction extends BaseAction<Model> {
try { try {
getShopListModel() getShopListModel()
.setShopTypeNavIndex(getFilterModel().getShopTypeNavIndex()); .setShopTypeNavIndex(getFilterModel().getShopTypeNavIndex());
getShopListModel().setCityId(getModel().getCityId()); getShopListModel().setCityId(getModel()!.getCityId());
getShopListModel().setLat(getModel().getLatitude()); getShopListModel().setLat(getModel()!.getLatitude());
getShopListModel().setLng(getModel().getLongitude()); getShopListModel().setLng(getModel()!.getLongitude());
getShopListModel() getShopListModel()
.setFirstCateId(getFilterModel().getCheckedOneCategory().id); .setFirstCateId(getFilterModel().getCheckedOneCategory()!.id);
getShopListModel() getShopListModel()
.setSecondCateId(getFilterModel().getCheckedTwoCategory().id ?? ""); .setSecondCateId(getFilterModel().getCheckedTwoCategory()!.id ?? "");
if (getFilterModel().getCheckedTwoRegion().id == null) { if (getFilterModel().getCheckedTwoRegion()!.id == null) {
getShopListModel() getShopListModel()
.setRegionId(getFilterModel().getCheckedOneRegion().id); .setRegionId(getFilterModel().getCheckedOneRegion()!.id);
} else { } else {
getShopListModel() getShopListModel()
.setRegionId(getFilterModel().getCheckedTwoRegion().id); .setRegionId(getFilterModel().getCheckedTwoRegion()!.id);
} }
getShopListModel().setSortType(getFilterModel().getCheckedOneSort().id); getShopListModel().setSortType(getFilterModel().getCheckedOneSort()!.id);
getShopListModel().clear(); getShopListModel().clear();
getShopListModel().scrollTop(); getShopListModel().scrollTop();
await getShopListModel().refresh(); await getShopListModel().refresh();
...@@ -91,7 +91,7 @@ class IAction extends BaseAction<Model> { ...@@ -91,7 +91,7 @@ class IAction extends BaseAction<Model> {
} }
void refresh() async { void refresh() async {
String cityId = getModel().getCityId(); String? cityId = getModel()!.getCityId();
try { try {
await getAppNavModel().getAppNavList(); await getAppNavModel().getAppNavList();
await getMiniBannerModel().getActivityConfigList(); await getMiniBannerModel().getActivityConfigList();
......
...@@ -9,16 +9,16 @@ import 'package:life_module/utils/activity_config_tap_utils.dart'; ...@@ -9,16 +9,16 @@ import 'package:life_module/utils/activity_config_tap_utils.dart';
/// 钻石位 /// 钻石位
class DiamondBit extends StatelessWidget { class DiamondBit extends StatelessWidget {
final IAction iAction; final IAction? iAction;
final ValueNotifier<double> scrollIndex = ValueNotifier(0.0); final ValueNotifier<double> scrollIndex = ValueNotifier(0.0);
DiamondBit({Key key, this.iAction}) : super(key: key); DiamondBit({Key? key, this.iAction}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SliverToBoxAdapter( return SliverToBoxAdapter(
child: QMProvider<AppNavModel>.value( child: QMProvider<AppNavModel>.value(
model: iAction.getAppNavModel(), model: iAction!.getAppNavModel(),
builderWidget: (context, model, child) { builderWidget: (context, model, child) {
if (model.getList().length == 0) { if (model.getList().length == 0) {
return SizedBox(); return SizedBox();
...@@ -40,7 +40,7 @@ class DiamondBit extends StatelessWidget { ...@@ -40,7 +40,7 @@ class DiamondBit extends StatelessWidget {
ValueListenableBuilder<double>( ValueListenableBuilder<double>(
valueListenable: scrollIndex, valueListenable: scrollIndex,
builder: builder:
(BuildContext context, dynamic value, Widget child) { (BuildContext context, dynamic value, Widget? child) {
return _DiamondBitWidgetPagination( return _DiamondBitWidgetPagination(
offset: value, itemCount: model.getList().length); offset: value, itemCount: model.getList().length);
}, },
...@@ -79,7 +79,7 @@ class _DiamondGrid extends StatelessWidget { ...@@ -79,7 +79,7 @@ class _DiamondGrid extends StatelessWidget {
var item = items[index]; var item = items[index];
return InkWell( return InkWell(
onTap: () { onTap: () {
AppTapConfigUtils.getInstance().activityConfigTap(item.toJson()); AppTapConfigUtils.getInstance()!.activityConfigTap(item.toJson());
}, },
child: Container( child: Container(
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
...@@ -92,7 +92,7 @@ class _DiamondGrid extends StatelessWidget { ...@@ -92,7 +92,7 @@ class _DiamondGrid extends StatelessWidget {
width: 40.rpx, width: 40.rpx,
height: 40.rpx, height: 40.rpx,
child: XiaoxiongBaseImageWidget( child: XiaoxiongBaseImageWidget(
imageUrl: item.iconUrl, imageUrl: item.iconUrl!,
width: 40.rpx, width: 40.rpx,
height: 40.rpx, height: 40.rpx,
fit: BoxFit.cover, fit: BoxFit.cover,
...@@ -102,7 +102,7 @@ class _DiamondGrid extends StatelessWidget { ...@@ -102,7 +102,7 @@ class _DiamondGrid extends StatelessWidget {
height: 2.rpx, height: 2.rpx,
), ),
Text( Text(
item.name, item.name!,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
height: 1.3846153846153, height: 1.3846153846153,
...@@ -123,15 +123,15 @@ class _DiamondGrid extends StatelessWidget { ...@@ -123,15 +123,15 @@ class _DiamondGrid extends StatelessWidget {
/// 指示器 /// 指示器
class _DiamondBitWidgetPagination extends StatelessWidget { class _DiamondBitWidgetPagination extends StatelessWidget {
final double offset; final double? offset;
final int itemCount; final int? itemCount;
_DiamondBitWidgetPagination({Key key, this.offset, this.itemCount}) _DiamondBitWidgetPagination({Key? key, this.offset, this.itemCount})
: super(key: key); : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (itemCount == 10 || itemCount <= 5) { if (itemCount == 10 || itemCount! <= 5) {
return SizedBox(); return SizedBox();
} }
return Container( return Container(
......
...@@ -7,12 +7,12 @@ import 'package:life_module/utils/activity_config_tap_utils.dart'; ...@@ -7,12 +7,12 @@ import 'package:life_module/utils/activity_config_tap_utils.dart';
// assets/close_btn_black.png // assets/close_btn_black.png
class FloatBanner extends StatelessWidget { class FloatBanner extends StatelessWidget {
final MiniBannerModel model; final MiniBannerModel? model;
FloatBanner({this.model}); FloatBanner({this.model});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return QMProvider<MiniBannerModel>.value( return QMProvider<MiniBannerModel>.value(
model: model, model: model!,
builderWidget: (context, model, child) { builderWidget: (context, model, child) {
if (model.getFloatBannerEntity() == null) { if (model.getFloatBannerEntity() == null) {
return SizedBox(); return SizedBox();
...@@ -28,7 +28,7 @@ class FloatBanner extends StatelessWidget { ...@@ -28,7 +28,7 @@ class FloatBanner extends StatelessWidget {
top: 10.rpx, top: 10.rpx,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
AppTapConfigUtils.getInstance().activityConfigTap(model.getFloatBannerEntity().toJson()); AppTapConfigUtils.getInstance()!.activityConfigTap(model.getFloatBannerEntity()!.toJson());
model.removeFloatBannerEntity(true); model.removeFloatBannerEntity(true);
}, },
child: Container( child: Container(
...@@ -37,7 +37,7 @@ class FloatBanner extends StatelessWidget { ...@@ -37,7 +37,7 @@ class FloatBanner extends StatelessWidget {
//padding: EdgeInsets.symmetric(horizontal: 9.rpx), //padding: EdgeInsets.symmetric(horizontal: 9.rpx),
margin: EdgeInsets.only(top: 6.rpx, bottom: 6.rpx), margin: EdgeInsets.only(top: 6.rpx, bottom: 6.rpx),
child: XiaoxiongBaseImageWidget( child: XiaoxiongBaseImageWidget(
imageUrl: model.getFloatBannerEntity().imgUrl, imageUrl: model.getFloatBannerEntity()!.imgUrl!,
height: 76.rpx, height: 76.rpx,
fit: BoxFit.contain, fit: BoxFit.contain,
placeholder:(BuildContext context, String data){ placeholder:(BuildContext context, String data){
......
...@@ -6,13 +6,13 @@ import 'package:common_module/widget/xiaoxiong_base_image_widget/widget.dart'; ...@@ -6,13 +6,13 @@ import 'package:common_module/widget/xiaoxiong_base_image_widget/widget.dart';
import 'package:life_module/utils/activity_config_tap_utils.dart'; import 'package:life_module/utils/activity_config_tap_utils.dart';
class MiniBanner extends StatelessWidget { class MiniBanner extends StatelessWidget {
final MiniBannerModel model; final MiniBannerModel? model;
MiniBanner({this.model}); MiniBanner({this.model});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SliverToBoxAdapter( return SliverToBoxAdapter(
child: QMProvider<MiniBannerModel>.value( child: QMProvider<MiniBannerModel>.value(
model: model, model: model!,
builderWidget: (context, model, child) { builderWidget: (context, model, child) {
if (model.getList().length == 0) { if (model.getList().length == 0) {
return SizedBox(); return SizedBox();
...@@ -22,7 +22,7 @@ class MiniBanner extends StatelessWidget { ...@@ -22,7 +22,7 @@ class MiniBanner extends StatelessWidget {
return Expanded( return Expanded(
child: InkWell( child: InkWell(
onTap: () { onTap: () {
AppTapConfigUtils.getInstance().activityConfigTap(e.toJson()); AppTapConfigUtils.getInstance()!.activityConfigTap(e.toJson());
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric(horizontal: 4.rpx), padding: EdgeInsets.symmetric(horizontal: 4.rpx),
...@@ -31,7 +31,7 @@ class MiniBanner extends StatelessWidget { ...@@ -31,7 +31,7 @@ class MiniBanner extends StatelessWidget {
child: Container( child: Container(
height: 50.rpx, height: 50.rpx,
child: XiaoxiongBaseImageWidget( child: XiaoxiongBaseImageWidget(
imageUrl: e.imgUrl, imageUrl: e.imgUrl!,
height: 50.rpx, height: 50.rpx,
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
......
...@@ -15,21 +15,21 @@ import 'package:common_module/utils/navigate_utils.dart'; ...@@ -15,21 +15,21 @@ import 'package:common_module/utils/navigate_utils.dart';
import 'package:life_module/route/index.dart'; import 'package:life_module/route/index.dart';
class ScrollBody extends StatefulWidget { class ScrollBody extends StatefulWidget {
final IAction iAction; final IAction? iAction;
final String isAuditMode; final String? isAuditMode;
final Function(double offset) onScroll; final Function(double offset)? onScroll;
final ScrollController controller; final ScrollController? controller;
ScrollBody({this.onScroll, this.iAction, this.controller,this.isAuditMode}); ScrollBody({this.onScroll, this.iAction, this.controller,this.isAuditMode});
@override @override
State<StatefulWidget> createState() => _ScrollBodyState(); State<StatefulWidget> createState() => _ScrollBodyState();
} }
class _ScrollBodyState extends State<ScrollBody> { class _ScrollBodyState extends State<ScrollBody> {
ScrollController get controller => widget.controller; ScrollController? get controller => widget.controller;
void initState() { void initState() {
super.initState(); super.initState();
controller.addListener(() { controller!.addListener(() {
widget.onScroll(controller.offset); widget.onScroll!(controller!.offset);
}); });
} }
...@@ -37,12 +37,12 @@ class _ScrollBodyState extends State<ScrollBody> { ...@@ -37,12 +37,12 @@ class _ScrollBodyState extends State<ScrollBody> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return PullWidget( return PullWidget(
headerInsertIndex: 1, headerInsertIndex: 1,
controller: widget.iAction.getShopListModel().getRefreshController(), controller: widget.iAction!.getShopListModel().getRefreshController(),
onLoad: () { onLoad: () {
widget.iAction.getShopListModel().getData(); widget.iAction!.getShopListModel().getData();
}, },
onRefresh: () { onRefresh: () {
widget.iAction.getShopListModel().refresh(); widget.iAction!.getShopListModel().refresh();
}, },
child: CustomScrollView( child: CustomScrollView(
controller: controller, controller: controller,
...@@ -58,7 +58,7 @@ class _ScrollBodyState extends State<ScrollBody> { ...@@ -58,7 +58,7 @@ class _ScrollBodyState extends State<ScrollBody> {
iAction: widget.iAction, iAction: widget.iAction,
), ),
MiniBanner( MiniBanner(
model: widget.iAction.getMiniBannerModel(), model: widget.iAction!.getMiniBannerModel(),
), ),
SliverPersistentHeader( SliverPersistentHeader(
pinned: false, pinned: false,
...@@ -66,9 +66,9 @@ class _ScrollBodyState extends State<ScrollBody> { ...@@ -66,9 +66,9 @@ class _ScrollBodyState extends State<ScrollBody> {
minHeight: 37.rpx, minHeight: 37.rpx,
maxHeight: 37.rpx, maxHeight: 37.rpx,
child: ShopTypeNav( child: ShopTypeNav(
model: widget.iAction.getFilterModel(), model: widget.iAction!.getFilterModel(),
onChange: () { onChange: () {
widget.iAction.refreshShopList(); widget.iAction!.refreshShopList();
}, },
))), ))),
SliverPersistentHeader( SliverPersistentHeader(
...@@ -78,11 +78,11 @@ class _ScrollBodyState extends State<ScrollBody> { ...@@ -78,11 +78,11 @@ class _ScrollBodyState extends State<ScrollBody> {
maxHeight: 48.rpx, maxHeight: 48.rpx,
child: FilterArea( child: FilterArea(
topOffset: 81.rpx - 37.rpx, topOffset: 81.rpx - 37.rpx,
model: widget.iAction.getFilterModel(), model: widget.iAction!.getFilterModel(),
onTap: (c) { onTap: (c) {
var _context = var _context =
widget.iAction.getShopListModel().getContext(); widget.iAction!.getShopListModel().getContext()!;
RenderSliver renderSliver = _context RenderSliver? renderSliver = _context
.findAncestorRenderObjectOfType<RenderSliver>(); .findAncestorRenderObjectOfType<RenderSliver>();
if (renderSliver != null && if (renderSliver != null &&
renderSliver.constraints.overlap <= 0) { renderSliver.constraints.overlap <= 0) {
...@@ -90,7 +90,7 @@ class _ScrollBodyState extends State<ScrollBody> { ...@@ -90,7 +90,7 @@ class _ScrollBodyState extends State<ScrollBody> {
} }
}, },
onChange: () { onChange: () {
widget.iAction.refreshShopList(); widget.iAction!.refreshShopList();
}, },
))), ))),
SliverPersistentHeader( SliverPersistentHeader(
...@@ -99,17 +99,17 @@ class _ScrollBodyState extends State<ScrollBody> { ...@@ -99,17 +99,17 @@ class _ScrollBodyState extends State<ScrollBody> {
minHeight: 40.rpx, minHeight: 40.rpx,
maxHeight: 40.rpx, maxHeight: 40.rpx,
child: ShopClassNav( child: ShopClassNav(
model: widget.iAction.getFilterModel(), model: widget.iAction!.getFilterModel(),
onChange: () { onChange: () {
widget.iAction.refreshShopList(); widget.iAction!.refreshShopList();
}, },
))), ))),
ShopList( ShopList(
model: widget.iAction.getShopListModel(), model: widget.iAction!.getShopListModel(),
onReset: () { onReset: () {
widget.iAction.getFilterModel().reset(); widget.iAction!.getFilterModel().reset();
widget.iAction.refreshShopList(); widget.iAction!.refreshShopList();
}, },
onTap: (item) { onTap: (item) {
NavigateUtils.push( NavigateUtils.push(
...@@ -117,16 +117,16 @@ class _ScrollBodyState extends State<ScrollBody> { ...@@ -117,16 +117,16 @@ class _ScrollBodyState extends State<ScrollBody> {
arguments: { arguments: {
'isAuditMode':widget.isAuditMode, 'isAuditMode':widget.isAuditMode,
'shopId': item.combo != null 'shopId': item.combo != null
? item.combo.shopId ? item.combo!.shopId
: item.restaurant.shopId, : item.restaurant!.shopId,
'lat': widget.iAction.getModel().getLatitude(), 'lat': widget.iAction!.getModel()!.getLatitude(),
'lng': widget.iAction.getModel().getLongitude(), 'lng': widget.iAction!.getModel()!.getLongitude(),
'firstCateId': widget.iAction 'firstCateId': widget.iAction!
.getFilterModel() .getFilterModel()
.getCheckedOneCategory() .getCheckedOneCategory()!
.id, .id,
'itemId': item.combo != null ? item.combo.dealId : "", 'itemId': item.combo != null ? item.combo!.dealId : "",
"cityName": widget.iAction.getModel().getCity() "cityName": widget.iAction!.getModel()!.getCity()
}, },
isNative: false, isNative: false,
); );
......
...@@ -11,8 +11,8 @@ import '../actions/action.dart'; ...@@ -11,8 +11,8 @@ import '../actions/action.dart';
import 'package:common_module/utils/map_utils.dart'; import 'package:common_module/utils/map_utils.dart';
class SearchArea extends StatefulWidget { class SearchArea extends StatefulWidget {
final IAction iAction; final IAction? iAction;
final ValueNotifier<double> scrollOffset; final ValueNotifier<double>? scrollOffset;
SearchArea({this.scrollOffset, this.iAction}); SearchArea({this.scrollOffset, this.iAction});
@override @override
State<StatefulWidget> createState() => _SearchAreaState(); State<StatefulWidget> createState() => _SearchAreaState();
...@@ -28,11 +28,11 @@ class _SearchAreaState extends State<SearchArea> { ...@@ -28,11 +28,11 @@ class _SearchAreaState extends State<SearchArea> {
return Container( return Container(
child: QMProvider<Model>.value( child: QMProvider<Model>.value(
model: widget.iAction.getModel(), model: widget.iAction!.getModel()!,
builderWidget: (context, model, child) { builderWidget: (context, model, child) {
return ValueListenableBuilder<double>( return ValueListenableBuilder<double>(
valueListenable: widget.scrollOffset, valueListenable: widget.scrollOffset!,
builder: (BuildContext context, dynamic offset, Widget child) { builder: (BuildContext context, dynamic offset, Widget? child) {
double opacity = 1; double opacity = 1;
if (offset >= maxOffset) { if (offset >= maxOffset) {
...@@ -41,7 +41,7 @@ class _SearchAreaState extends State<SearchArea> { ...@@ -41,7 +41,7 @@ class _SearchAreaState extends State<SearchArea> {
offset = maxOffset; offset = maxOffset;
} else if (offset > 0) { } else if (offset > 0) {
// 滚动范围>0 // 滚动范围>0
opacity = 1 - offset / maxOffset; opacity = 1 - offset / maxOffset as double;
} else if (offset < 0) { } else if (offset < 0) {
// 滚动范围小于0 // 滚动范围小于0
offset = 0.0; offset = 0.0;
...@@ -73,12 +73,12 @@ class _SearchAreaState extends State<SearchArea> { ...@@ -73,12 +73,12 @@ class _SearchAreaState extends State<SearchArea> {
NavigateUtils.push( NavigateUtils.push(
path: RouteCityPath.LIFE_SEARCH_PAGE.path(), path: RouteCityPath.LIFE_SEARCH_PAGE.path(),
arguments: { arguments: {
'cityId': widget.iAction.getModel().getCityId(), 'cityId': widget.iAction!.getModel()!.getCityId(),
'latitude': 'latitude':
widget.iAction.getModel().getLatitude(), widget.iAction!.getModel()!.getLatitude(),
'longitude': 'longitude':
widget.iAction.getModel().getLongitude(), widget.iAction!.getModel()!.getLongitude(),
'cityName': widget.iAction.getModel().getCity(), 'cityName': widget.iAction!.getModel()!.getCity(),
}, },
isNative: false, isNative: false,
); );
...@@ -92,7 +92,7 @@ class _SearchAreaState extends State<SearchArea> { ...@@ -92,7 +92,7 @@ class _SearchAreaState extends State<SearchArea> {
), ),
]; ];
if (!model.getHasPermission()) { if (!model.getHasPermission()!) {
items.add(Positioned( items.add(Positioned(
top: 37.rpx, top: 37.rpx,
right: 13.rpx, right: 13.rpx,
...@@ -118,12 +118,12 @@ class _SearchAreaState extends State<SearchArea> { ...@@ -118,12 +118,12 @@ class _SearchAreaState extends State<SearchArea> {
/// 定位按钮 /// 定位按钮
class _Locaion extends StatelessWidget { class _Locaion extends StatelessWidget {
final IAction iAction; final IAction? iAction;
_Locaion({this.iAction}); _Locaion({this.iAction});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return QMProvider<Model>.value( return QMProvider<Model>.value(
model: iAction.getModel(), model: iAction!.getModel()!,
builderWidget: (context, model, child) { builderWidget: (context, model, child) {
return InkWell( return InkWell(
child: Container( child: Container(
...@@ -181,14 +181,14 @@ class _Locaion extends StatelessWidget { ...@@ -181,14 +181,14 @@ class _Locaion extends StatelessWidget {
var location = result['location'].split(','); var location = result['location'].split(',');
var _latitude = '${location[1]}'; var _latitude = '${location[1]}';
var _longitude = '${location[0]}'; var _longitude = '${location[0]}';
List<num> arr = MapUtils.getInstance().gcj02ToGps84( List<num> arr = MapUtils.getInstance()!.gcj02ToGps84(
double.parse(_latitude), double.parse(_longitude)); double.parse(_latitude), double.parse(_longitude));
_latitude = '${arr[0]}'; _latitude = '${arr[0]}';
_longitude = '${arr[1]}'; _longitude = '${arr[1]}';
model.setLocationInfo(result['cityname'] ?? result['city'], model.setLocationInfo(result['cityname'] ?? result['city'],
result['name'], _latitude, _longitude); result['name'], _latitude, _longitude);
await iAction.initData(); await iAction!.initData();
iAction.getModel().findPermission(); iAction!.getModel()!.findPermission();
}, },
); );
}); });
...@@ -197,7 +197,7 @@ class _Locaion extends StatelessWidget { ...@@ -197,7 +197,7 @@ class _Locaion extends StatelessWidget {
/// 气泡 /// 气泡
class _Bubble extends StatelessWidget { class _Bubble extends StatelessWidget {
final IAction iAction; final IAction? iAction;
_Bubble(this.iAction); _Bubble(this.iAction);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -230,9 +230,9 @@ class _Bubble extends StatelessWidget { ...@@ -230,9 +230,9 @@ class _Bubble extends StatelessWidget {
children: [ children: [
InkWell( InkWell(
onTap: () async { onTap: () async {
await iAction.getModel().reqPermission(); await iAction!.getModel()!.reqPermission();
if (iAction.getModel().getHasPermission()) { if (iAction!.getModel()!.getHasPermission()!) {
iAction.initLocation(); iAction!.initLocation();
} }
}, },
child: Container( child: Container(
...@@ -260,7 +260,7 @@ class _Bubble extends StatelessWidget { ...@@ -260,7 +260,7 @@ class _Bubble extends StatelessWidget {
), ),
), ),
onTap: () { onTap: () {
iAction.getModel().setPermission(); iAction!.getModel()!.setPermission();
}, },
) )
], ],
......
This diff is collapsed.
...@@ -7,7 +7,7 @@ const String _SHOP_KEY_ = "__life_float_banner__"; ...@@ -7,7 +7,7 @@ const String _SHOP_KEY_ = "__life_float_banner__";
class MiniBannerModel extends BaseModel { class MiniBannerModel extends BaseModel {
List<ActivityConfigEntity> _list = []; List<ActivityConfigEntity> _list = [];
ActivityConfigEntity floatBanner; ActivityConfigEntity? floatBanner;
Future<void> getActivityConfigList() async { Future<void> getActivityConfigList() async {
_list = await AppNavRepository.get().getActivityConfigList("20"); _list = await AppNavRepository.get().getActivityConfigList("20");
...@@ -23,12 +23,12 @@ class MiniBannerModel extends BaseModel { ...@@ -23,12 +23,12 @@ class MiniBannerModel extends BaseModel {
return _list; return _list;
} }
ActivityConfigEntity getFloatBannerEntity() { ActivityConfigEntity? getFloatBannerEntity() {
if (floatBanner != null) { if (floatBanner != null) {
String type = floatBanner.showType; String? type = floatBanner!.showType;
if (type != '2') { if (type != '2') {
String dateStr = StoreUtils.getInstance() String? dateStr = StoreUtils.getInstance()!
.getForKey(key: "$_SHOP_KEY_${floatBanner.id}"); .getForKey(key: "$_SHOP_KEY_${floatBanner!.id}");
if (type == '1' && dateStr != null) { if (type == '1' && dateStr != null) {
return null; return null;
} }
...@@ -46,8 +46,8 @@ class MiniBannerModel extends BaseModel { ...@@ -46,8 +46,8 @@ class MiniBannerModel extends BaseModel {
if (floatBanner != null) { if (floatBanner != null) {
String nowDateStr = String nowDateStr =
DateUtil.formatDate(DateTime.now(), format: "yyyyMMdd"); DateUtil.formatDate(DateTime.now(), format: "yyyyMMdd");
StoreUtils.getInstance() StoreUtils.getInstance()!
.setKV(key: "$_SHOP_KEY_${floatBanner.id}", value: nowDateStr); .setKV(key: "$_SHOP_KEY_${floatBanner!.id}", value: nowDateStr);
if (!show) { if (!show) {
floatBanner = null; floatBanner = null;
notifyListeners(); notifyListeners();
......
import 'dart:async';
import 'package:common_module/utils/map_utils.dart'; import 'package:common_module/utils/map_utils.dart';
import 'package:mvp/mvp.dart'; import 'package:mvp/mvp.dart';
import 'package:life_repository/life_repository.dart'; import 'package:life_repository/life_repository.dart';
...@@ -6,27 +8,27 @@ import 'package:common_module/utils/amap_utils.dart'; ...@@ -6,27 +8,27 @@ import 'package:common_module/utils/amap_utils.dart';
import 'package:modal/modal.dart'; import 'package:modal/modal.dart';
class Model extends BaseModel { class Model extends BaseModel {
bool _hasPermission = false; bool? _hasPermission = false;
String _address = ''; String? _address = '';
String _city = ''; String? _city = '';
String _cityId = ''; String? _cityId = '';
String _latitude = ''; String _latitude = '';
String _longitude = ''; String _longitude = '';
bool _isClickCitySelect = false; bool _isClickCitySelect = false;
Future<void> findCityId() async { Future<void> findCityId() async {
_cityId = await CityRepository.get().getCityId(_city); _cityId = await CityRepository.get().getCityId(_city!);
} }
Future<void> getLocation() async { Future<void> getLocation() async {
LocationEntity location = await AmapUtils.getInstance().getLocation(); LocationEntity location = await AmapUtils.getInstance()!.getLocation();
if((location?.address??'').isEmpty){ if((location?.address??'').isEmpty){
String myLocation = '${location.longitude},${location.latitude}'; String myLocation = '${location.longitude},${location.latitude}';
location = await Res.convertLocation(entity:location,location:myLocation); location = await Res.convertLocation(entity:location,location:myLocation);
} }
_latitude = location.latitude.toString(); _latitude = location.latitude.toString();
_longitude = location.longitude.toString(); _longitude = location.longitude.toString();
List<num> arr = MapUtils.getInstance() List<num> arr = MapUtils.getInstance()!
.gcj02ToGps84(double.parse(_latitude), double.parse(_longitude)); .gcj02ToGps84(double.parse(_latitude), double.parse(_longitude));
_latitude = '${arr[0]}'; _latitude = '${arr[0]}';
_longitude = '${arr[1]}'; _longitude = '${arr[1]}';
...@@ -38,11 +40,11 @@ class Model extends BaseModel { ...@@ -38,11 +40,11 @@ class Model extends BaseModel {
Future<void> ipConfigAddress() async { Future<void> ipConfigAddress() async {
var res = await AMapRepository.get().ipConfigAddress(key: Res.aWebMapKey); var res = await AMapRepository.get().ipConfigAddress(key: Res.aWebMapKey);
List<String> rectangles = res.rectangle.split(new RegExp(r";|,")); List<String> rectangles = res.rectangle!.split(new RegExp(r";|,"));
if (rectangles.length > 1) { if (rectangles.length > 1) {
_latitude = rectangles[1]; _latitude = rectangles[1];
_longitude = rectangles[0]; _longitude = rectangles[0];
List<num> arr = MapUtils.getInstance() List<num> arr = MapUtils.getInstance()!
.gcj02ToGps84(double.parse(_latitude), double.parse(_longitude)); .gcj02ToGps84(double.parse(_latitude), double.parse(_longitude));
_latitude = '${arr[0]}'; _latitude = '${arr[0]}';
_longitude = '${arr[1]}'; _longitude = '${arr[1]}';
...@@ -53,36 +55,36 @@ class Model extends BaseModel { ...@@ -53,36 +55,36 @@ class Model extends BaseModel {
} }
Future<void> findPermission() async { Future<void> findPermission() async {
_hasPermission = await AmapUtils.getInstance().hasPermission(); _hasPermission = await AmapUtils.getInstance()!.hasPermission();
if (_hasPermission) { if (_hasPermission!) {
_hasPermission = await AmapUtils.getInstance().isOpenGPS; _hasPermission = await AmapUtils.getInstance()!.isOpenGPS;
} }
notifyListeners(); notifyListeners();
} }
Future<void> reqPermission() async { Future<void> reqPermission() async {
bool confirm = await Modal.showModal( bool confirm = await (Modal.showModal(
title: "温馨提示", title: "温馨提示",
msg: "为给您提供更好的服务,需获取您的位置权限", msg: "为给您提供更好的服务,需获取您的位置权限",
cancelBtnText: '拒绝', cancelBtnText: '拒绝',
confirmBtnText: '同意'); confirmBtnText: '同意') as FutureOr<bool>);
if (!confirm) { if (!confirm) {
return; return;
} }
_hasPermission = await AmapUtils.getInstance().reqPermission(); _hasPermission = await AmapUtils.getInstance()!.reqPermission();
if (_hasPermission) { if (_hasPermission!) {
_hasPermission = await AmapUtils.getInstance().isOpenGPS; _hasPermission = await AmapUtils.getInstance()!.isOpenGPS;
if (!_hasPermission) { if (!_hasPermission!) {
confirm = await Modal.showModal( confirm = await (Modal.showModal(
title: "温馨提示", title: "温馨提示",
msg: "为给您提供更好的服务,请打开GPS", msg: "为给您提供更好的服务,请打开GPS",
cancelBtnText: '拒绝', cancelBtnText: '拒绝',
confirmBtnText: '同意'); confirmBtnText: '同意') as FutureOr<bool>);
if (!confirm) { if (!confirm) {
return; return;
} }
_hasPermission = await AmapUtils.getInstance().enableGPS(); _hasPermission = await AmapUtils.getInstance()!.enableGPS();
} }
} }
notifyListeners(); notifyListeners();
...@@ -93,12 +95,12 @@ class Model extends BaseModel { ...@@ -93,12 +95,12 @@ class Model extends BaseModel {
notifyListeners(); notifyListeners();
} }
bool getHasPermission() { bool? getHasPermission() {
return _hasPermission; return _hasPermission;
} }
void setLocationInfo( void setLocationInfo(
String city, String address, String latitude, String longitude) { String? city, String? address, String latitude, String longitude) {
_city = city; _city = city;
_address = address; _address = address;
_latitude = latitude; _latitude = latitude;
...@@ -114,11 +116,11 @@ class Model extends BaseModel { ...@@ -114,11 +116,11 @@ class Model extends BaseModel {
this._address = name; this._address = name;
} }
String getCityId() { String? getCityId() {
return _cityId; return _cityId;
} }
String getCity() { String? getCity() {
return _city; return _city;
} }
......
...@@ -11,7 +11,7 @@ import 'package:common_module/widget/scroll_top_fixed_widget/widget.dart'; ...@@ -11,7 +11,7 @@ import 'package:common_module/widget/scroll_top_fixed_widget/widget.dart';
class LifeWidget extends StatefulWidget { class LifeWidget extends StatefulWidget {
final String isAuditMode; final String isAuditMode;
LifeWidget({Key key,@required this.isAuditMode}) : super(key: key); LifeWidget({Key? key,required this.isAuditMode}) : super(key: key);
@override @override
State<StatefulWidget> createState() => _LifeState(); State<StatefulWidget> createState() => _LifeState();
} }
...@@ -94,7 +94,7 @@ class _LifeState extends BaseUmengPageViewItemState<LifeWidget> ...@@ -94,7 +94,7 @@ class _LifeState extends BaseUmengPageViewItemState<LifeWidget>
child: ValueListenableBuilder<bool>( child: ValueListenableBuilder<bool>(
valueListenable: floatBannerNotifier, valueListenable: floatBannerNotifier,
builder: (BuildContext context, bool isScrollTStop, builder: (BuildContext context, bool isScrollTStop,
Widget child) { Widget? child) {
return AnimatedContainer( return AnimatedContainer(
duration: Duration(milliseconds: 100), duration: Duration(milliseconds: 100),
transform: Matrix4.translationValues( transform: Matrix4.translationValues(
...@@ -116,15 +116,15 @@ class _LifeState extends BaseUmengPageViewItemState<LifeWidget> ...@@ -116,15 +116,15 @@ class _LifeState extends BaseUmengPageViewItemState<LifeWidget>
@override @override
void onResume() async { void onResume() async {
super.onResume(); super.onResume();
if (!iAction.getModel().getHasPermission() && if (!iAction.getModel()!.getHasPermission()! &&
!iAction.getModel().isClickCitySelect()) { !iAction.getModel()!.isClickCitySelect()) {
await iAction.getModel().findPermission(); await iAction.getModel()!.findPermission();
if (iAction.getModel().getHasPermission()) { if (iAction.getModel()!.getHasPermission()!) {
iAction.initLocation(); iAction.initLocation();
} }
} }
if (iAction.getModel().isClickCitySelect()) { if (iAction.getModel()!.isClickCitySelect()) {
iAction.getModel().setIsClickCitySelect(false); iAction.getModel()!.setIsClickCitySelect(false);
} }
} }
......
...@@ -5,10 +5,10 @@ import 'package:life_module/models/shop_list_model.dart'; ...@@ -5,10 +5,10 @@ import 'package:life_module/models/shop_list_model.dart';
import 'package:common_module/utils/loading_dialog_utils.dart'; import 'package:common_module/utils/loading_dialog_utils.dart';
class IAction extends BaseAction<Model> { class IAction extends BaseAction<Model> {
String _cityId = ''; String? _cityId = '';
String _latitude = ''; String? _latitude = '';
String _longitude = ''; String? _longitude = '';
String _cityName = ''; String? _cityName = '';
FilterModel _filterModel = FilterModel(); FilterModel _filterModel = FilterModel();
ShopListModel _shopListModel = ShopListModel(); ShopListModel _shopListModel = ShopListModel();
...@@ -22,13 +22,13 @@ class IAction extends BaseAction<Model> { ...@@ -22,13 +22,13 @@ class IAction extends BaseAction<Model> {
void _init() async { void _init() async {
setModel(Model(_cityId, _latitude, _longitude, _cityName)); setModel(Model(_cityId, _latitude, _longitude, _cityName));
if (_cityId != null && _cityId.isNotEmpty) { if (_cityId != null && _cityId!.isNotEmpty) {
await getFilterModel().getFilterList(_cityId); await getFilterModel().getFilterList(_cityId!);
} }
} }
Future<void> refreshShopList() async { Future<void> refreshShopList() async {
var loading = LoadingDialogUtils.getInstance().show(); var loading = LoadingDialogUtils.getInstance()!.show();
Future.delayed(Duration(seconds: 2)).then((value) { Future.delayed(Duration(seconds: 2)).then((value) {
if (loading != null) { if (loading != null) {
loading.close(); loading.close();
...@@ -37,24 +37,24 @@ class IAction extends BaseAction<Model> { ...@@ -37,24 +37,24 @@ class IAction extends BaseAction<Model> {
try { try {
getShopListModel() getShopListModel()
.setShopTypeNavIndex(getFilterModel().getShopTypeNavIndex()); .setShopTypeNavIndex(getFilterModel().getShopTypeNavIndex());
getShopListModel().setCityId(getModel().getCityId()); getShopListModel().setCityId(getModel()!.getCityId());
getShopListModel().setLat(getModel().getLatitude()); getShopListModel().setLat(getModel()!.getLatitude());
getShopListModel().setLng(getModel().getLongitude()); getShopListModel().setLng(getModel()!.getLongitude());
getShopListModel() getShopListModel()
.setFirstCateId(getFilterModel().getCheckedOneCategory().id); .setFirstCateId(getFilterModel().getCheckedOneCategory()!.id);
getShopListModel() getShopListModel()
.setSecondCateId(getFilterModel().getCheckedTwoCategory().id ?? ""); .setSecondCateId(getFilterModel().getCheckedTwoCategory()!.id ?? "");
if (getFilterModel().getCheckedTwoRegion().id == null) { if (getFilterModel().getCheckedTwoRegion()!.id == null) {
getShopListModel() getShopListModel()
.setRegionId(getFilterModel().getCheckedOneRegion().id); .setRegionId(getFilterModel().getCheckedOneRegion()!.id);
} else { } else {
getShopListModel() getShopListModel()
.setRegionId(getFilterModel().getCheckedTwoRegion().id); .setRegionId(getFilterModel().getCheckedTwoRegion()!.id);
} }
getShopListModel().setSortType(getFilterModel().getCheckedOneSort().id); getShopListModel().setSortType(getFilterModel().getCheckedOneSort()!.id);
getShopListModel().clear(); getShopListModel().clear();
await getShopListModel().refresh(); await getShopListModel().refresh();
getModel().notifyListeners(); getModel()!.notifyListeners();
} catch (e) {} } catch (e) {}
if (loading != null) { if (loading != null) {
loading.close(); loading.close();
...@@ -62,7 +62,7 @@ class IAction extends BaseAction<Model> { ...@@ -62,7 +62,7 @@ class IAction extends BaseAction<Model> {
} }
void refresh() async { void refresh() async {
String cityId = getModel().getCityId(); String? cityId = getModel()!.getCityId();
if (cityId != null && if (cityId != null &&
cityId.isNotEmpty && cityId.isNotEmpty &&
......
...@@ -14,14 +14,14 @@ import 'package:life_module/route/index.dart'; ...@@ -14,14 +14,14 @@ import 'package:life_module/route/index.dart';
import 'package:common_module/utils/xapp_utils.dart'; import 'package:common_module/utils/xapp_utils.dart';
class ScrollBody extends StatefulWidget { class ScrollBody extends StatefulWidget {
final IAction iAction; final IAction? iAction;
ScrollBody(this.iAction); ScrollBody(this.iAction);
@override @override
State<StatefulWidget> createState() => _ScrollBodyState(); State<StatefulWidget> createState() => _ScrollBodyState();
} }
class _ScrollBodyState extends State<ScrollBody> { class _ScrollBodyState extends State<ScrollBody> {
IAction get iAction => widget.iAction; IAction? get iAction => widget.iAction;
@override @override
void initState() { void initState() {
...@@ -32,16 +32,16 @@ class _ScrollBodyState extends State<ScrollBody> { ...@@ -32,16 +32,16 @@ class _ScrollBodyState extends State<ScrollBody> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
child: QMProvider.value( child: QMProvider.value(
model: iAction.getShopListModel(), model: iAction!.getShopListModel(),
builderWidget: (context, model, child) { builderWidget: (context, dynamic model, child) {
return PullWidget( return PullWidget(
headerInsertIndex: 3, headerInsertIndex: 3,
controller:iAction.getShopListModel().getRefreshController(), controller:iAction!.getShopListModel().getRefreshController(),
onLoad: () { onLoad: () {
iAction.getShopListModel().getData(); iAction!.getShopListModel().getData();
}, },
onRefresh: () { onRefresh: () {
iAction.getShopListModel().refresh(); iAction!.getShopListModel().refresh();
}, },
child: CustomScrollView( child: CustomScrollView(
slivers: [ slivers: [
...@@ -51,9 +51,9 @@ class _ScrollBodyState extends State<ScrollBody> { ...@@ -51,9 +51,9 @@ class _ScrollBodyState extends State<ScrollBody> {
minHeight: 37.rpx, minHeight: 37.rpx,
maxHeight: 37.rpx, maxHeight: 37.rpx,
child: ShopTypeNav( child: ShopTypeNav(
model: iAction.getFilterModel(), model: iAction!.getFilterModel(),
onChange: () { onChange: () {
iAction.refreshShopList(); iAction!.refreshShopList();
}, },
), ),
), ),
...@@ -66,11 +66,11 @@ class _ScrollBodyState extends State<ScrollBody> { ...@@ -66,11 +66,11 @@ class _ScrollBodyState extends State<ScrollBody> {
maxHeight: 48.rpx, maxHeight: 48.rpx,
child: FilterArea( child: FilterArea(
topOffset: 81.rpx - 37.rpx, topOffset: 81.rpx - 37.rpx,
model: widget.iAction.getFilterModel(), model: widget.iAction!.getFilterModel(),
onTap: (c) { onTap: (c) {
var _context = var _context =
widget.iAction.getShopListModel().getContext(); widget.iAction!.getShopListModel().getContext()!;
RenderSliver renderSliver = _context RenderSliver? renderSliver = _context
.findAncestorRenderObjectOfType<RenderSliver>(); .findAncestorRenderObjectOfType<RenderSliver>();
if (renderSliver != null && if (renderSliver != null &&
renderSliver.constraints.overlap <= 0) { renderSliver.constraints.overlap <= 0) {
...@@ -78,7 +78,7 @@ class _ScrollBodyState extends State<ScrollBody> { ...@@ -78,7 +78,7 @@ class _ScrollBodyState extends State<ScrollBody> {
} }
}, },
onChange: () { onChange: () {
widget.iAction.refreshShopList(); widget.iAction!.refreshShopList();
}, },
))), ))),
SliverPersistentHeader( SliverPersistentHeader(
...@@ -87,20 +87,20 @@ class _ScrollBodyState extends State<ScrollBody> { ...@@ -87,20 +87,20 @@ class _ScrollBodyState extends State<ScrollBody> {
minHeight: 40.rpx, minHeight: 40.rpx,
maxHeight: 40.rpx, maxHeight: 40.rpx,
child: ShopClassNav( child: ShopClassNav(
model: widget.iAction.getFilterModel(), model: widget.iAction!.getFilterModel(),
onChange: () { onChange: () {
widget.iAction.refreshShopList(); widget.iAction!.refreshShopList();
}, },
))), ))),
Builder( Builder(
builder: (context) { builder: (context) {
Widget statusWidget = Widget? statusWidget =
ListModelStatusUtils.getInstance().form( ListModelStatusUtils.getInstance()!.form(
model: model, model: model,
onTap: () { onTap: () {
iAction.refresh(); iAction!.refresh();
}); });
if (statusWidget != null) { if (statusWidget != null) {
return SliverToBoxAdapter( return SliverToBoxAdapter(
...@@ -108,33 +108,33 @@ class _ScrollBodyState extends State<ScrollBody> { ...@@ -108,33 +108,33 @@ class _ScrollBodyState extends State<ScrollBody> {
); );
} }
return ShopList( return ShopList(
model: iAction.getShopListModel(), model: iAction!.getShopListModel(),
onReset: () { onReset: () {
widget.iAction.getFilterModel().reset(); widget.iAction!.getFilterModel().reset();
widget.iAction.refreshShopList(); widget.iAction!.refreshShopList();
}, },
onTap: (item) { onTap: (item) {
NavigateUtils.push( NavigateUtils.push(
path: LIFE_SHOP_PAGE, path: LIFE_SHOP_PAGE,
arguments: { arguments: {
'shopId': item.combo != null 'shopId': item.combo != null
? item.combo.shopId ? item.combo!.shopId
: item.restaurant.shopId, : item.restaurant!.shopId,
'lat': widget.iAction 'lat': widget.iAction!
.getModel() .getModel()!
.getLatitude(), .getLatitude(),
'lng': widget.iAction 'lng': widget.iAction!
.getModel() .getModel()!
.getLongitude(), .getLongitude(),
'firstCateId': widget.iAction 'firstCateId': widget.iAction!
.getFilterModel() .getFilterModel()
.getCheckedOneCategory() .getCheckedOneCategory()!
.id, .id,
'itemId': item.combo != null 'itemId': item.combo != null
? item.combo.dealId ? item.combo!.dealId
: "", : "",
"cityName": widget.iAction "cityName": widget.iAction!
.getModel() .getModel()!
.getCityName() .getCityName()
}, },
isNative: false, isNative: false,
......
...@@ -4,19 +4,19 @@ import 'package:life_module/components/life_image.dart'; ...@@ -4,19 +4,19 @@ import 'package:life_module/components/life_image.dart';
import '../../../util/search_history_utils.dart'; import '../../../util/search_history_utils.dart';
class SearchHistory extends StatefulWidget { class SearchHistory extends StatefulWidget {
final Function(String) onTap; final Function(String)? onTap;
SearchHistory({this.onTap}); SearchHistory({this.onTap});
@override @override
State<StatefulWidget> createState() => SearchHistoryState(); State<StatefulWidget> createState() => SearchHistoryState();
} }
class SearchHistoryState extends State<SearchHistory> { class SearchHistoryState extends State<SearchHistory> {
Function(String) get onTap => widget.onTap; Function(String)? get onTap => widget.onTap;
List<String> words = []; List<String> words = [];
@override @override
void initState() { void initState() {
super.initState(); super.initState();
words = SearchHistoryUtils.getInstance().getWords(); words = SearchHistoryUtils.getInstance()!.getWords();
} }
@override @override
...@@ -42,7 +42,7 @@ class SearchHistoryState extends State<SearchHistory> { ...@@ -42,7 +42,7 @@ class SearchHistoryState extends State<SearchHistory> {
), ),
), ),
onTap: () { onTap: () {
onTap(e); onTap!(e);
}, },
); );
}).toList(); }).toList();
...@@ -75,7 +75,7 @@ class SearchHistoryState extends State<SearchHistory> { ...@@ -75,7 +75,7 @@ class SearchHistoryState extends State<SearchHistory> {
setState(() { setState(() {
words = []; words = [];
}); });
SearchHistoryUtils.getInstance().clear(); SearchHistoryUtils.getInstance()!.clear();
}, },
child: Container( child: Container(
height: 21.rpx, height: 21.rpx,
......
...@@ -3,9 +3,9 @@ import 'package:common_module/utils/xapp_utils.dart'; ...@@ -3,9 +3,9 @@ import 'package:common_module/utils/xapp_utils.dart';
import 'package:life_repository/life_repository.dart'; import 'package:life_repository/life_repository.dart';
class SearchTips extends StatelessWidget { class SearchTips extends StatelessWidget {
final String keywords; final String? keywords;
final List<SearchTipsItem> items; final List<SearchTipsItem>? items;
final Function(SearchTipsItem) onTap; final Function(SearchTipsItem)? onTap;
SearchTips({this.items, this.keywords, this.onTap}); SearchTips({this.items, this.keywords, this.onTap});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -13,12 +13,12 @@ class SearchTips extends StatelessWidget { ...@@ -13,12 +13,12 @@ class SearchTips extends StatelessWidget {
color: Colors.white, color: Colors.white,
child: ListView.builder( child: ListView.builder(
padding: EdgeInsets.symmetric(horizontal: 13.rpx), padding: EdgeInsets.symmetric(horizontal: 13.rpx),
itemCount: items.length, itemCount: items!.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
var item = items[index]; var item = items![index];
List<String> names = item.name.split(""); List<String> names = item.name!.split("");
List<TextSpan> childs = names.map((s) { List<TextSpan> childs = names.map((s) {
bool isKeyWordChar = keywords.indexOf(s) > -1; bool isKeyWordChar = keywords!.indexOf(s) > -1;
return TextSpan( return TextSpan(
text: s, text: s,
style: TextStyle( style: TextStyle(
...@@ -40,7 +40,7 @@ class SearchTips extends StatelessWidget { ...@@ -40,7 +40,7 @@ class SearchTips extends StatelessWidget {
), ),
), ),
onTap: () { onTap: () {
onTap(item); onTap!(item);
}, },
); );
}), }),
......
...@@ -3,44 +3,44 @@ import 'dart:async'; ...@@ -3,44 +3,44 @@ import 'dart:async';
import 'package:life_repository/life_repository.dart'; import 'package:life_repository/life_repository.dart';
class Model extends BaseModel { class Model extends BaseModel {
String _cityId = ''; String? _cityId = '';
String _latitude = ''; String? _latitude = '';
String _longitude = ''; String? _longitude = '';
String keywords = ''; String keywords = '';
String _cityName; String? _cityName;
Timer _searchTipsTimer; Timer? _searchTipsTimer;
List<SearchTipsItem> _searchTipsList = []; List<SearchTipsItem> _searchTipsList = [];
Model(this._cityId, this._latitude, this._longitude, this._cityName); Model(this._cityId, this._latitude, this._longitude, this._cityName);
String getCityId() { String? getCityId() {
return _cityId; return _cityId;
} }
String getLatitude() { String? getLatitude() {
return _latitude; return _latitude;
} }
String getLongitude() { String? getLongitude() {
return _longitude; return _longitude;
} }
void findSearchTips(String firstCateId, String words) { void findSearchTips(String? firstCateId, String words) {
keywords = words; keywords = words;
if (keywords.isEmpty) { if (keywords.isEmpty) {
clearSearchTipsList(); clearSearchTipsList();
} }
if (_searchTipsTimer != null && _searchTipsTimer.isActive) { if (_searchTipsTimer != null && _searchTipsTimer!.isActive) {
_searchTipsTimer.cancel(); _searchTipsTimer!.cancel();
_searchTipsTimer = null; _searchTipsTimer = null;
} }
_searchTipsTimer = _searchTipsTimer =
Timer.periodic(Duration(milliseconds: 500), (timer) async { Timer.periodic(Duration(milliseconds: 500), (timer) async {
_searchTipsTimer.cancel(); _searchTipsTimer!.cancel();
_searchTipsTimer = null; _searchTipsTimer = null;
List<SearchTipsItem> list = await FilterArepository.get().findSearchTips( List<SearchTipsItem> list = await FilterArepository.get().findSearchTips(
_cityId, _latitude, _longitude, firstCateId, keywords); _cityId!, _latitude!, _longitude!, firstCateId!, keywords);
if (keywords != null && keywords.isNotEmpty) { if (keywords != null && keywords.isNotEmpty) {
_searchTipsList = list; _searchTipsList = list;
notifyListeners(); notifyListeners();
...@@ -62,7 +62,7 @@ class Model extends BaseModel { ...@@ -62,7 +62,7 @@ class Model extends BaseModel {
return keywords; return keywords;
} }
String getCityName() { String? getCityName() {
return _cityName; return _cityName;
} }
} }
...@@ -3,6 +3,7 @@ import 'package:common_module/utils/xapp_utils.dart'; ...@@ -3,6 +3,7 @@ import 'package:common_module/utils/xapp_utils.dart';
import 'package:common_module/components/i_app_bar.dart'; import 'package:common_module/components/i_app_bar.dart';
import 'package:life_module/components/search_bar.dart'; import 'package:life_module/components/search_bar.dart';
import 'package:life_module/utils/filter_panel_utils.dart'; import 'package:life_module/utils/filter_panel_utils.dart';
import 'package:life_module/views/search/models/model.dart';
import './actions/action.dart'; import './actions/action.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:mvp/providers/provider.dart'; import 'package:mvp/providers/provider.dart';
...@@ -12,25 +13,20 @@ import './components/search_history.dart'; ...@@ -12,25 +13,20 @@ import './components/search_history.dart';
import '../../util/search_history_utils.dart'; import '../../util/search_history_utils.dart';
class LifeSearchPage extends StatefulWidget { class LifeSearchPage extends StatefulWidget {
final Map<String, dynamic> param; final Map<String, dynamic>? param;
LifeSearchPage({this.param}); LifeSearchPage({this.param});
@override @override
State<StatefulWidget> createState() => _SearchPageState(); State<StatefulWidget> createState() => _SearchPageState();
} }
class _SearchPageState extends State<LifeSearchPage> class _SearchPageState extends State<LifeSearchPage> with TickerProviderStateMixin {
with TickerProviderStateMixin { IAction? iAction;
IAction iAction;
FocusNode focusNode = FocusNode(); FocusNode focusNode = FocusNode();
TextEditingController controller = TextEditingController(); TextEditingController controller = TextEditingController();
@override @override
void initState() { void initState() {
super.initState(); super.initState();
iAction = IAction(widget.param!['cityId'], widget.param!['latitude'],widget.param!['longitude'],widget.param!['cityName']);
iAction = IAction(widget.param['cityId'], widget.param['latitude'],
widget.param['longitude'],
widget.param['cityName']);
Future.delayed(Duration(milliseconds: 300)).then((value) { Future.delayed(Duration(milliseconds: 300)).then((value) {
focusNode.requestFocus(); focusNode.requestFocus();
}); });
...@@ -50,13 +46,13 @@ class _SearchPageState extends State<LifeSearchPage> ...@@ -50,13 +46,13 @@ class _SearchPageState extends State<LifeSearchPage>
focusNode: focusNode, focusNode: focusNode,
controller: controller, controller: controller,
onChanged: (s) { onChanged: (s) {
if (iAction.getFilterModel().getCheckedOneCategory() != null) { if (iAction!.getFilterModel().getCheckedOneCategory() != null) {
iAction.getModel().findSearchTips( iAction!.getModel()!.findSearchTips(
iAction.getFilterModel().getCheckedOneCategory().id, s); iAction!.getFilterModel().getCheckedOneCategory()!.id, s);
} }
if (s.isEmpty) { if (s.isEmpty) {
iAction.getShopListModel().setKeywords(""); iAction!.getShopListModel().setKeywords("");
iAction.getShopListModel().clear(); iAction!.getShopListModel().clear();
} }
}, },
onSubmitted: (s) { onSubmitted: (s) {
...@@ -65,20 +61,20 @@ class _SearchPageState extends State<LifeSearchPage> ...@@ -65,20 +61,20 @@ class _SearchPageState extends State<LifeSearchPage>
), ),
), ),
), ),
body: ActionProvider( body: ActionProvider<Model,IAction>(
action: iAction, action: iAction!,
builder: (context, model) { builder: (context, model) {
if (iAction.getModel().getSearchTipsList().length > 0) { if (iAction!.getModel()!.getSearchTipsList().length > 0) {
return SearchTips( return SearchTips(
items: iAction.getModel().getSearchTipsList(), items: iAction!.getModel()!.getSearchTipsList(),
keywords: iAction.getModel().getKeywords(), keywords: iAction!.getModel()!.getKeywords(),
onTap: (item) { onTap: (item) {
controller.text = item.name; controller.text = item.name!;
iAction.getModel().clearSearchTipsList(); iAction!.getModel()!.clearSearchTipsList();
search(item.name); search(item.name!);
}, },
); );
} else if (iAction.getShopListModel().getKeywords().isNotEmpty) { } else if (iAction!.getShopListModel().getKeywords().isNotEmpty) {
return ScrollBody(iAction); return ScrollBody(iAction);
} }
return SearchHistory( return SearchHistory(
...@@ -99,14 +95,14 @@ class _SearchPageState extends State<LifeSearchPage> ...@@ -99,14 +95,14 @@ class _SearchPageState extends State<LifeSearchPage>
void search(String wrods) { void search(String wrods) {
controller.text = wrods; controller.text = wrods;
iAction.getModel().clearSearchTipsList(); iAction!.getModel()!.clearSearchTipsList();
SearchHistoryUtils.getInstance().push(wrods); SearchHistoryUtils.getInstance()!.push(wrods);
focusNode.unfocus(); focusNode.unfocus();
iAction.getShopListModel().setKeywords(wrods); iAction!.getShopListModel().setKeywords(wrods);
if (wrods.isNotEmpty) { if (wrods.isNotEmpty) {
iAction.refresh(); iAction!.refresh();
} else { } else {
iAction.getShopListModel().clear(); iAction!.getShopListModel().clear();
} }
} }
} }
...@@ -4,14 +4,14 @@ import '../models/model.dart'; ...@@ -4,14 +4,14 @@ import '../models/model.dart';
import '../models/banner_model.dart'; import '../models/banner_model.dart';
class IAction extends BaseAction<Model> { class IAction extends BaseAction<Model> {
String _cityId; String? _cityId;
String _showId; String? _showId;
String _lat; String? _lat;
String _lng; String? _lng;
String _cityName; String? _cityName;
SecKillModel _killModel; SecKillModel? _killModel;
BannerModel _bannerModel; BannerModel? _bannerModel;
IAction(this._cityId, this._showId, this._lat, this._lng, this._cityName); IAction(this._cityId, this._showId, this._lat, this._lng, this._cityName);
...@@ -24,50 +24,50 @@ class IAction extends BaseAction<Model> { ...@@ -24,50 +24,50 @@ class IAction extends BaseAction<Model> {
} }
void init() async { void init() async {
await getModel().findSeckillSession(_cityId); await getModel()!.findSeckillSession(_cityId!);
if (_showId == null || _showId.isEmpty) { if (_showId == null || _showId!.isEmpty) {
_showId = getModel().getSeckillSessionList()[0].id; _showId = getModel()!.getSeckillSessionList()[0].id;
} }
getSecKillModel().setShowId(_showId); getSecKillModel()!.setShowId(_showId);
getSecKillModel().setCityId(_cityId); getSecKillModel()!.setCityId(_cityId);
getSecKillModel().setLat(_lat); getSecKillModel()!.setLat(_lat);
getSecKillModel().setLng(_lng); getSecKillModel()!.setLng(_lng);
refresh(); refresh();
getModel().findPermission(); getModel()!.findPermission();
} }
void refresh() async { void refresh() async {
await getBannerModel().getActivityConfigList(); await getBannerModel()!.getActivityConfigList();
await getSecKillModel().refresh(); await getSecKillModel()!.refresh();
} }
void setShowId(String id) { void setShowId(String id) {
_showId = id; _showId = id;
getSecKillModel().setShowId(id); getSecKillModel()!.setShowId(id);
getSecKillModel().clear(); getSecKillModel()!.clear();
getSecKillModel().refresh(); getSecKillModel()!.refresh();
} }
void setLocaltionInfo(String cityId, String lat, String lng) { void setLocaltionInfo(String? cityId, String lat, String lng) {
_cityId = cityId; _cityId = cityId;
_lat = lat; _lat = lat;
_lng = lng; _lng = lng;
_showId = null; _showId = null;
getSecKillModel().clear(); getSecKillModel()!.clear();
getModel().getSeckillSessionList().clear(); getModel()!.getSeckillSessionList().clear();
getModel().notifyListeners(); getModel()!.notifyListeners();
init(); init();
} }
String getCityName() { String? getCityName() {
return _cityName; return _cityName;
} }
SecKillModel getSecKillModel() { SecKillModel? getSecKillModel() {
return _killModel; return _killModel;
} }
BannerModel getBannerModel() { BannerModel? getBannerModel() {
return _bannerModel; return _bannerModel;
} }
} }
...@@ -7,15 +7,15 @@ import 'package:life_module/utils/activity_config_tap_utils.dart'; ...@@ -7,15 +7,15 @@ import 'package:life_module/utils/activity_config_tap_utils.dart';
import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:flutter_swiper/flutter_swiper.dart';
class AdBanner extends StatelessWidget { class AdBanner extends StatelessWidget {
final BannerModel model; final BannerModel? model;
AdBanner(this.model); AdBanner(this.model);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ValueNotifier<int> scrollIndex = ValueNotifier<int>(0); ValueNotifier<int?> scrollIndex = ValueNotifier<int?>(0);
return SliverToBoxAdapter( return SliverToBoxAdapter(
child: QMProvider<BannerModel>.value( child: QMProvider<BannerModel>.value(
model: model, model: model!,
builderWidget: (context, model, child) { builderWidget: (context, model, child) {
if (model.getList().length == 0) { if (model.getList().length == 0) {
return SizedBox(); return SizedBox();
...@@ -35,7 +35,7 @@ class AdBanner extends StatelessWidget { ...@@ -35,7 +35,7 @@ class AdBanner extends StatelessWidget {
model.getList().length > 1, model.getList().length > 1,
onTap: (index) { onTap: (index) {
var item = model.getList()[index]; var item = model.getList()[index];
AppTapConfigUtils.getInstance().activityConfigTap(item.toJson()); AppTapConfigUtils.getInstance()!.activityConfigTap(item.toJson());
}, },
onIndexChanged: (index) { onIndexChanged: (index) {
scrollIndex.value = index; scrollIndex.value = index;
...@@ -43,7 +43,7 @@ class AdBanner extends StatelessWidget { ...@@ -43,7 +43,7 @@ class AdBanner extends StatelessWidget {
itemBuilder: (context, index) { itemBuilder: (context, index) {
var item = model.getList()[index]; var item = model.getList()[index];
return XiaoxiongBaseImageWidget( return XiaoxiongBaseImageWidget(
imageUrl: item.imgUrl, imageUrl: item.imgUrl!,
height: 90.rpx, height: 90.rpx,
fit: BoxFit.cover, fit: BoxFit.cover,
); );
...@@ -69,8 +69,8 @@ class AdBanner extends StatelessWidget { ...@@ -69,8 +69,8 @@ class AdBanner extends StatelessWidget {
/// 指示器 /// 指示器
class _SecKillPagination extends StatelessWidget { class _SecKillPagination extends StatelessWidget {
final int length; final int? length;
final ValueNotifier<int> scrollIndex; final ValueNotifier<int?>? scrollIndex;
_SecKillPagination({this.scrollIndex, this.length}); _SecKillPagination({this.scrollIndex, this.length});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -79,12 +79,12 @@ class _SecKillPagination extends StatelessWidget { ...@@ -79,12 +79,12 @@ class _SecKillPagination extends StatelessWidget {
height: 4.rpx, height: 4.rpx,
); );
} }
return ValueListenableBuilder<int>( return ValueListenableBuilder<int?>(
valueListenable: scrollIndex, valueListenable: scrollIndex!,
builder: (BuildContext context, dynamic offset, Widget child) { builder: (BuildContext context, dynamic offset, Widget? child) {
List<Widget> items = List.generate((length).ceil(), (index) { List<Widget> items = List.generate(length!.ceil(), (index) {
Color color = rgba(255, 255, 255, 0.5); Color color = rgba(255, 255, 255, 0.5);
if (index == scrollIndex.value) { if (index == scrollIndex!.value) {
color = rgba(255, 255, 255, 1); color = rgba(255, 255, 255, 1);
} }
return Container( return Container(
......
...@@ -12,16 +12,16 @@ import '../../../utils/buy_loading_dialog_utils.dart'; ...@@ -12,16 +12,16 @@ import '../../../utils/buy_loading_dialog_utils.dart';
import 'package:common_module/utils/image_preview_utils.dart'; import 'package:common_module/utils/image_preview_utils.dart';
class GoodsItems extends StatelessWidget { class GoodsItems extends StatelessWidget {
final IAction iAction; final IAction? iAction;
GoodsItems(this.iAction); GoodsItems(this.iAction);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SliverPadding( return SliverPadding(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
sliver: QMProvider<SecKillModel>.value( sliver: QMProvider<SecKillModel>.value(
model: iAction.getSecKillModel(), model: iAction!.getSecKillModel()!,
builderWidget: (context, model, child) { builderWidget: (context, model, child) {
Widget statusWidget = ListModelStatusUtils.getInstance().form( Widget? statusWidget = ListModelStatusUtils.getInstance()!.form(
model: model, model: model,
onTap: () { onTap: () {
model.refresh(); model.refresh();
...@@ -48,9 +48,9 @@ class GoodsItems extends StatelessWidget { ...@@ -48,9 +48,9 @@ class GoodsItems extends StatelessWidget {
} }
class _GoodsItem extends StatelessWidget { class _GoodsItem extends StatelessWidget {
final SecKillGoods item; final SecKillGoods? item;
final bool enabled; final bool enabled;
final IAction iAction; final IAction? iAction;
_GoodsItem({this.enabled = false, this.item, this.iAction}); _GoodsItem({this.enabled = false, this.item, this.iAction});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -73,8 +73,8 @@ class _GoodsItem extends StatelessWidget { ...@@ -73,8 +73,8 @@ class _GoodsItem extends StatelessWidget {
onTap: () { onTap: () {
ImagePreviewUtils.showIndex( ImagePreviewUtils.showIndex(
context: context, context: context,
images: [item.itemPic], images: [item!.itemPic!],
heroTag: item.itemPic); heroTag: item!.itemPic);
}, },
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(8.rpx), borderRadius: BorderRadius.circular(8.rpx),
...@@ -82,7 +82,7 @@ class _GoodsItem extends StatelessWidget { ...@@ -82,7 +82,7 @@ class _GoodsItem extends StatelessWidget {
height: 90.rpx, height: 90.rpx,
width: 90.rpx, width: 90.rpx,
child: XiaoxiongBaseImageWidget( child: XiaoxiongBaseImageWidget(
imageUrl: item.itemPic, imageUrl: item!.itemPic!,
height: 90.rpx, height: 90.rpx,
width: 90.rpx, width: 90.rpx,
fit: BoxFit.cover, fit: BoxFit.cover,
...@@ -131,7 +131,7 @@ class _GoodsItem extends StatelessWidget { ...@@ -131,7 +131,7 @@ class _GoodsItem extends StatelessWidget {
/// 标题 /// 标题
class _Title extends StatelessWidget { class _Title extends StatelessWidget {
final SecKillGoods item; final SecKillGoods? item;
_Title(this.item); _Title(this.item);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -142,7 +142,7 @@ class _Title extends StatelessWidget { ...@@ -142,7 +142,7 @@ class _Title extends StatelessWidget {
Expanded( Expanded(
child: Container( child: Container(
child: Text( child: Text(
item.itemTitle, item!.itemTitle!,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
...@@ -160,7 +160,7 @@ class _Title extends StatelessWidget { ...@@ -160,7 +160,7 @@ class _Title extends StatelessWidget {
} }
class _Commission extends StatelessWidget { class _Commission extends StatelessWidget {
final SecKillGoods item; final SecKillGoods? item;
_Commission(this.item); _Commission(this.item);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -174,7 +174,7 @@ class _Commission extends StatelessWidget { ...@@ -174,7 +174,7 @@ class _Commission extends StatelessWidget {
topRight: Radius.circular(9.rpx), topRight: Radius.circular(9.rpx),
bottomRight: Radius.circular(9.rpx))), bottomRight: Radius.circular(9.rpx))),
child: Text( child: Text(
item.userCommissionText, item!.userCommissionText!,
style: TextStyle( style: TextStyle(
color: rgba(255, 128, 0, 1), fontSize: 11.rpx, height: 1.2), color: rgba(255, 128, 0, 1), fontSize: 11.rpx, height: 1.2),
), ),
...@@ -184,7 +184,7 @@ class _Commission extends StatelessWidget { ...@@ -184,7 +184,7 @@ class _Commission extends StatelessWidget {
/// 价格信息 /// 价格信息
class _PriceInfo extends StatelessWidget { class _PriceInfo extends StatelessWidget {
final SecKillGoods item; final SecKillGoods? item;
_PriceInfo(this.item); _PriceInfo(this.item);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -201,7 +201,7 @@ class _PriceInfo extends StatelessWidget { ...@@ -201,7 +201,7 @@ class _PriceInfo extends StatelessWidget {
), ),
), ),
Text( Text(
item.endPrice, item!.endPrice!,
style: TextStyle( style: TextStyle(
color: rgba(255, 4, 0, 1), fontSize: 18.rpx, height: 1.2.rpx), color: rgba(255, 4, 0, 1), fontSize: 18.rpx, height: 1.2.rpx),
), ),
...@@ -219,7 +219,7 @@ class _PriceInfo extends StatelessWidget { ...@@ -219,7 +219,7 @@ class _PriceInfo extends StatelessWidget {
width: 4.rpx, width: 4.rpx,
), ),
Text( Text(
${item.originalPrice}", ${item!.originalPrice}",
style: TextStyle( style: TextStyle(
color: rgba(153, 153, 153, 1), color: rgba(153, 153, 153, 1),
fontSize: 11.rpx, fontSize: 11.rpx,
...@@ -233,11 +233,11 @@ class _PriceInfo extends StatelessWidget { ...@@ -233,11 +233,11 @@ class _PriceInfo extends StatelessWidget {
/// 马上抢 /// 马上抢
class _BuyBtn extends StatelessWidget { class _BuyBtn extends StatelessWidget {
final SecKillGoods item; final SecKillGoods? item;
_BuyBtn(this.item); _BuyBtn(this.item);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
bool enabled = item.isRedirect == '2'; bool enabled = item!.isRedirect == '2';
return Positioned( return Positioned(
right: 0, right: 0,
bottom: 0, bottom: 0,
...@@ -246,13 +246,13 @@ class _BuyBtn extends StatelessWidget { ...@@ -246,13 +246,13 @@ class _BuyBtn extends StatelessWidget {
child: InkWell( child: InkWell(
onTap: () { onTap: () {
if (enabled) { if (enabled) {
XAppUtils.getInstance().toast(item.menuText); XAppUtils.getInstance()!.toast(item!.menuText!);
return; return;
} }
var loading = BuyLoadingDialogUtils.getInstance().show(); var loading = BuyLoadingDialogUtils.getInstance()!.show();
Future.delayed(Duration(seconds: 1)).then((value) { Future.delayed(Duration(seconds: 1)).then((value) {
loading.close(); loading.close();
MeituanUtils.getInstance().openByUrl(item.couponUrl); MeituanUtils.getInstance()!.openByUrl(item!.couponUrl!);
}); });
}, },
child: Container( child: Container(
...@@ -267,7 +267,7 @@ class _BuyBtn extends StatelessWidget { ...@@ -267,7 +267,7 @@ class _BuyBtn extends StatelessWidget {
colors: [rgba(255, 128, 0, 1), rgba(255, 4, 0, 1)]), colors: [rgba(255, 128, 0, 1), rgba(255, 4, 0, 1)]),
borderRadius: BorderRadius.circular(20.rpx)), borderRadius: BorderRadius.circular(20.rpx)),
child: Text( child: Text(
item.menuText, item!.menuText!,
style: TextStyle( style: TextStyle(
color: rgba(255, 255, 255, 1), color: rgba(255, 255, 255, 1),
fontSize: 13.rpx, fontSize: 13.rpx,
...@@ -281,13 +281,13 @@ class _BuyBtn extends StatelessWidget { ...@@ -281,13 +281,13 @@ class _BuyBtn extends StatelessWidget {
/// 进度 /// 进度
class _Progress extends StatelessWidget { class _Progress extends StatelessWidget {
final SecKillGoods item; final SecKillGoods? item;
_Progress(this.item); _Progress(this.item);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double maxWidth = 154.rpx; double maxWidth = 154.rpx;
double whiteTextWidth = 45.rpx; double whiteTextWidth = 45.rpx;
double soldPercent = double.parse(item.soldPercent.replaceAll('%', '')); double soldPercent = double.parse(item!.soldPercent!.replaceAll('%', ''));
double p = soldPercent / 100 * maxWidth; double p = soldPercent / 100 * maxWidth;
bool showWhiteText = p >= whiteTextWidth; bool showWhiteText = p >= whiteTextWidth;
return Container( return Container(
...@@ -304,7 +304,7 @@ class _Progress extends StatelessWidget { ...@@ -304,7 +304,7 @@ class _Progress extends StatelessWidget {
child: showWhiteText child: showWhiteText
? SizedBox() ? SizedBox()
: Text( : Text(
"已抢${item.soldPercent}", "已抢${item!.soldPercent}",
style: TextStyle( style: TextStyle(
color: rgba(153, 153, 153, 1), color: rgba(153, 153, 153, 1),
fontSize: 9.rpx, fontSize: 9.rpx,
...@@ -325,7 +325,7 @@ class _Progress extends StatelessWidget { ...@@ -325,7 +325,7 @@ class _Progress extends StatelessWidget {
child: !showWhiteText child: !showWhiteText
? SizedBox() ? SizedBox()
: Text( : Text(
"已抢${item.soldPercent}", "已抢${item!.soldPercent}",
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
color: Colors.white, fontSize: 9.rpx, height: 1.rpx), color: Colors.white, fontSize: 9.rpx, height: 1.rpx),
...@@ -339,8 +339,8 @@ class _Progress extends StatelessWidget { ...@@ -339,8 +339,8 @@ class _Progress extends StatelessWidget {
/// 地址信息 /// 地址信息
class _LocaionInfo extends StatelessWidget { class _LocaionInfo extends StatelessWidget {
final SecKillGoods item; final SecKillGoods? item;
final IAction iAction; final IAction? iAction;
_LocaionInfo(this.item, this.iAction); _LocaionInfo(this.item, this.iAction);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -362,7 +362,7 @@ class _LocaionInfo extends StatelessWidget { ...@@ -362,7 +362,7 @@ class _LocaionInfo extends StatelessWidget {
Container( Container(
constraints: BoxConstraints(maxWidth: 260.rpx), constraints: BoxConstraints(maxWidth: 260.rpx),
child: Text( child: Text(
item.address, item!.address!,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
...@@ -378,7 +378,7 @@ class _LocaionInfo extends StatelessWidget { ...@@ -378,7 +378,7 @@ class _LocaionInfo extends StatelessWidget {
),*/ ),*/
Spacer(), Spacer(),
Text( Text(
item.distance, item!.distance!,
style: TextStyle( style: TextStyle(
color: rgba(153, 153, 153, 1), color: rgba(153, 153, 153, 1),
fontSize: 12.rpx, fontSize: 12.rpx,
......
...@@ -7,8 +7,8 @@ import 'package:common_module/utils/loading_dialog_utils.dart'; ...@@ -7,8 +7,8 @@ import 'package:common_module/utils/loading_dialog_utils.dart';
import 'package:common_module/base/base_route_widget_state.dart'; import 'package:common_module/base/base_route_widget_state.dart';
class LocaltionTips extends StatefulWidget { class LocaltionTips extends StatefulWidget {
final Model model; final Model? model;
final Function(String cityId, String lat, String lon) onLocationChange; final Function(String? cityId, String lat, String lon)? onLocationChange;
LocaltionTips({this.model, this.onLocationChange}); LocaltionTips({this.model, this.onLocationChange});
@override @override
...@@ -16,10 +16,10 @@ class LocaltionTips extends StatefulWidget { ...@@ -16,10 +16,10 @@ class LocaltionTips extends StatefulWidget {
} }
class LocaltionTipsState extends BaseRouteWeigetState<LocaltionTips> { class LocaltionTipsState extends BaseRouteWeigetState<LocaltionTips> {
Model get model => widget.model; Model? get model => widget.model;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (model.hasPermission()) { if (model!.hasPermission()!) {
return SliverToBoxAdapter( return SliverToBoxAdapter(
child: SizedBox(), child: SizedBox(),
); );
...@@ -52,7 +52,7 @@ class LocaltionTipsState extends BaseRouteWeigetState<LocaltionTips> { ...@@ -52,7 +52,7 @@ class LocaltionTipsState extends BaseRouteWeigetState<LocaltionTips> {
), ),
InkWell( InkWell(
onTap: () async { onTap: () async {
await model.reqPermission(); await model!.reqPermission();
hasPermission(); hasPermission();
}, },
child: Container( child: Container(
...@@ -72,7 +72,7 @@ class LocaltionTipsState extends BaseRouteWeigetState<LocaltionTips> { ...@@ -72,7 +72,7 @@ class LocaltionTipsState extends BaseRouteWeigetState<LocaltionTips> {
)), )),
InkWell( InkWell(
onTap: () { onTap: () {
model.setPermission(); model!.setPermission();
}, },
child: Container( child: Container(
width: 17.rpx, width: 17.rpx,
...@@ -91,17 +91,17 @@ class LocaltionTipsState extends BaseRouteWeigetState<LocaltionTips> { ...@@ -91,17 +91,17 @@ class LocaltionTipsState extends BaseRouteWeigetState<LocaltionTips> {
} }
void hasPermission() async { void hasPermission() async {
if (model.hasPermission()) { if (model!.hasPermission()!) {
var loading = LoadingDialogUtils.getInstance().show(); var loading = LoadingDialogUtils.getInstance()!.show();
try { try {
var location = await model.getLocation(); var location = await model!.getLocation();
if((location?.address??'').isEmpty){ if((location?.address??'').isEmpty){
String myLocation = '${location.longitude},${location.latitude}'; String myLocation = '${location.longitude},${location.latitude}';
location = await Res.convertLocation(entity:location,location:myLocation); location = await Res.convertLocation(entity:location,location:myLocation);
} }
var cityId = await model.findCityId(location.city); var cityId = await model!.findCityId(location.city!);
loading.close(); loading.close();
widget.onLocationChange(cityId, location.latitude.toString(), widget.onLocationChange!(cityId, location.latitude.toString(),
location.longitude.toString()); location.longitude.toString());
} catch (e) { } catch (e) {
loading.close(); loading.close();
...@@ -112,8 +112,8 @@ class LocaltionTipsState extends BaseRouteWeigetState<LocaltionTips> { ...@@ -112,8 +112,8 @@ class LocaltionTipsState extends BaseRouteWeigetState<LocaltionTips> {
@override @override
void onResume() async { void onResume() async {
super.onResume(); super.onResume();
if (!model.hasPermission()) { if (!model!.hasPermission()!) {
await model.findPermission(); await model!.findPermission();
hasPermission(); hasPermission();
} }
} }
......
...@@ -6,9 +6,9 @@ import 'package:mvp/mvp.dart'; ...@@ -6,9 +6,9 @@ import 'package:mvp/mvp.dart';
import '../models/sec_kill_model.dart'; import '../models/sec_kill_model.dart';
class Times extends StatefulWidget { class Times extends StatefulWidget {
final IAction iAction; final IAction? iAction;
final List<SeckillSession> times; final List<SeckillSession>? times;
final Function(String tid) onChange; final Function(String? tid)? onChange;
Times({this.iAction, this.times, this.onChange}); Times({this.iAction, this.times, this.onChange});
@override @override
State<StatefulWidget> createState() => _TimesState(); State<StatefulWidget> createState() => _TimesState();
...@@ -24,7 +24,7 @@ class _TimesState extends State<Times> { ...@@ -24,7 +24,7 @@ class _TimesState extends State<Times> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return QMProvider<SecKillModel>.value( return QMProvider<SecKillModel>.value(
model: widget.iAction.getSecKillModel(), model: widget.iAction!.getSecKillModel()!,
builderWidget: (context, module, child) { builderWidget: (context, module, child) {
return Container( return Container(
height: 64.rpx, height: 64.rpx,
...@@ -36,17 +36,17 @@ class _TimesState extends State<Times> { ...@@ -36,17 +36,17 @@ class _TimesState extends State<Times> {
padding: EdgeInsets.symmetric(horizontal: 9.rpx), padding: EdgeInsets.symmetric(horizontal: 9.rpx),
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemBuilder: (context, i) { itemBuilder: (context, i) {
var item = widget.times[i]; var item = widget.times![i];
Color timeColor = rgba(48, 38, 0, 1); Color timeColor = rgba(48, 38, 0, 1);
Color statusColor = rgba(102, 102, 102, 1); Color statusColor = rgba(102, 102, 102, 1);
double timeSize = 20.rpx; double timeSize = 20.rpx;
List<String> timeArr = item.text.split("-"); List<String> timeArr = item.text!.split("-");
String timeText = timeArr[0]; String? timeText = timeArr[0];
String statusText = item.statusText; String statusText = item.statusText!;
bool isSelected = bool isSelected =
widget.iAction.getSecKillModel().getShowId() == item.id; widget.iAction!.getSecKillModel()!.getShowId() == item.id;
if (isSelected) { if (isSelected) {
timeColor = Colors.white; timeColor = Colors.white;
statusColor = Colors.white; statusColor = Colors.white;
...@@ -64,15 +64,15 @@ class _TimesState extends State<Times> { ...@@ -64,15 +64,15 @@ class _TimesState extends State<Times> {
return InkWell( return InkWell(
onTap: () { onTap: () {
if (widget.iAction.getSecKillModel().getShowId() == item.id) { if (widget.iAction!.getSecKillModel()!.getShowId() == item.id) {
return; return;
} }
if (widget.iAction.getSecKillModel().viewState != if (widget.iAction!.getSecKillModel()!.viewState !=
ViewState.idle) { ViewState.idle) {
return; return;
} }
widget.onChange(item.id); widget.onChange!(item.id);
}, },
child: Container( child: Container(
width: 100.rpx, width: 100.rpx,
...@@ -98,7 +98,7 @@ class _TimesState extends State<Times> { ...@@ -98,7 +98,7 @@ class _TimesState extends State<Times> {
Container( Container(
height: 18.rpx, height: 18.rpx,
child: Text( child: Text(
timeText, timeText!,
style: TextStyle( style: TextStyle(
color: timeColor, color: timeColor,
fontSize: timeSize, fontSize: timeSize,
...@@ -123,7 +123,7 @@ class _TimesState extends State<Times> { ...@@ -123,7 +123,7 @@ class _TimesState extends State<Times> {
), ),
); );
}, },
itemCount: widget.times.length, itemCount: widget.times!.length,
), ),
); );
}, },
......
import 'dart:async';
import 'package:mvp/mvp.dart'; import 'package:mvp/mvp.dart';
import 'package:common_module/utils/amap_utils.dart'; import 'package:common_module/utils/amap_utils.dart';
import 'package:modal/modal.dart'; import 'package:modal/modal.dart';
import 'package:life_repository/life_repository.dart'; import 'package:life_repository/life_repository.dart';
class Model extends BaseModel { class Model extends BaseModel {
bool _hasPermission = true; bool? _hasPermission = true;
List<SeckillSession> _seckillSessionList = []; List<SeckillSession> _seckillSessionList = [];
Future<void> findPermission() async { Future<void> findPermission() async {
_hasPermission = await AmapUtils.getInstance().hasPermission(); _hasPermission = await AmapUtils.getInstance()!.hasPermission();
if (_hasPermission) { if (_hasPermission!) {
_hasPermission = await AmapUtils.getInstance().isOpenGPS; _hasPermission = await AmapUtils.getInstance()!.isOpenGPS;
} }
notifyListeners(); notifyListeners();
} }
bool hasPermission() { bool? hasPermission() {
return _hasPermission; return _hasPermission;
} }
...@@ -29,10 +31,10 @@ class Model extends BaseModel { ...@@ -29,10 +31,10 @@ class Model extends BaseModel {
} }
Future<LocationEntity> getLocation() { Future<LocationEntity> getLocation() {
return AmapUtils.getInstance().getLocation(); return AmapUtils.getInstance()!.getLocation();
} }
Future<String> findCityId(String city) async { Future<String?> findCityId(String city) async {
return CityRepository.get().getCityId(city); return CityRepository.get().getCityId(city);
} }
...@@ -43,28 +45,28 @@ class Model extends BaseModel { ...@@ -43,28 +45,28 @@ class Model extends BaseModel {
} }
Future<void> reqPermission() async { Future<void> reqPermission() async {
bool confirm = await Modal.showModal( bool confirm = await (Modal.showModal(
title: "温馨提示", title: "温馨提示",
msg: "为给您提供更好的服务,需获取您的位置权限", msg: "为给您提供更好的服务,需获取您的位置权限",
cancelBtnText: '拒绝', cancelBtnText: '拒绝',
confirmBtnText: '同意'); confirmBtnText: '同意') as FutureOr<bool>);
if (!confirm) { if (!confirm) {
return; return;
} }
_hasPermission = await AmapUtils.getInstance().reqPermission(); _hasPermission = await AmapUtils.getInstance()!.reqPermission();
if (_hasPermission) { if (_hasPermission!) {
_hasPermission = await AmapUtils.getInstance().isOpenGPS; _hasPermission = await AmapUtils.getInstance()!.isOpenGPS;
if (!_hasPermission) { if (!_hasPermission!) {
confirm = await Modal.showModal( confirm = await (Modal.showModal(
title: "温馨提示", title: "温馨提示",
msg: "为给您提供更好的服务,请打开GPS", msg: "为给您提供更好的服务,请打开GPS",
cancelBtnText: '拒绝', cancelBtnText: '拒绝',
confirmBtnText: '同意'); confirmBtnText: '同意') as FutureOr<bool>);
if (!confirm) { if (!confirm) {
return; return;
} }
_hasPermission = await AmapUtils.getInstance().enableGPS(); _hasPermission = await AmapUtils.getInstance()!.enableGPS();
} }
} }
notifyListeners(); notifyListeners();
......
...@@ -2,10 +2,10 @@ import 'package:mvp/mvp.dart'; ...@@ -2,10 +2,10 @@ import 'package:mvp/mvp.dart';
import 'package:life_repository/life_repository.dart'; import 'package:life_repository/life_repository.dart';
class SecKillModel extends BaseListModel<SecKillGoods> { class SecKillModel extends BaseListModel<SecKillGoods> {
String _cityId; String? _cityId;
String _showId; String? _showId;
String _lat; String? _lat;
String _lng; String? _lng;
SecKillModel(this._cityId, this._showId, this._lat, this._lng); SecKillModel(this._cityId, this._showId, this._lat, this._lng);
...@@ -13,28 +13,28 @@ class SecKillModel extends BaseListModel<SecKillGoods> { ...@@ -13,28 +13,28 @@ class SecKillModel extends BaseListModel<SecKillGoods> {
Future<List<SecKillGoods>> request() async { Future<List<SecKillGoods>> request() async {
viewState = ViewState.busy; viewState = ViewState.busy;
var res = await SecKillRepository.get() var res = await SecKillRepository.get()
.findSeckillGoodsList(_cityId, _showId, _lat, _lng, getPage()); .findSeckillGoodsList(_cityId!, _showId!, _lat!, _lng!, getPage());
viewState = ViewState.idle; viewState = ViewState.idle;
return res; return res;
} }
void setShowId(String id) { void setShowId(String? id) {
_showId = id; _showId = id;
} }
String getShowId() { String? getShowId() {
return _showId; return _showId;
} }
void setCityId(String cityId) { void setCityId(String? cityId) {
_cityId = cityId; _cityId = cityId;
} }
void setLat(String lat) { void setLat(String? lat) {
_lat = lat; _lat = lat;
} }
void setLng(String lng) { void setLng(String? lng) {
_lng = lng; _lng = lng;
} }
......
...@@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; ...@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:common_module/components/i_app_bar.dart'; import 'package:common_module/components/i_app_bar.dart';
import 'package:common_module/utils/xapp_utils.dart'; import 'package:common_module/utils/xapp_utils.dart';
import 'package:life_module/components/life_image.dart'; import 'package:life_module/components/life_image.dart';
import 'package:life_module/views/sec_kill/models/model.dart';
import './components/times.dart'; import './components/times.dart';
import './components/ad_banner.dart'; import './components/ad_banner.dart';
import './components/localtion_tips.dart'; import './components/localtion_tips.dart';
...@@ -12,21 +13,21 @@ import 'package:common_module/widget/pull_widget/widget.dart'; ...@@ -12,21 +13,21 @@ import 'package:common_module/widget/pull_widget/widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
class LifeSecKillPage extends StatefulWidget { class LifeSecKillPage extends StatefulWidget {
final Map<String, dynamic> param; final Map<String, dynamic>? param;
LifeSecKillPage({this.param}); LifeSecKillPage({this.param});
@override @override
State<StatefulWidget> createState() => _LifeSecKillPageState(); State<StatefulWidget> createState() => _LifeSecKillPageState();
} }
class _LifeSecKillPageState extends State<LifeSecKillPage> { class _LifeSecKillPageState extends State<LifeSecKillPage> {
String get tid => widget.param['tid']; String? get tid => widget.param!['tid'];
IAction iAction; IAction? iAction;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
iAction = IAction(widget.param['cityId'], tid, widget.param['lat'], iAction = IAction(widget.param!['cityId'], tid, widget.param!['lat'],
widget.param['lng'], widget.param['cityName']); widget.param!['lng'], widget.param!['cityName']);
} }
@override @override
...@@ -46,10 +47,10 @@ class _LifeSecKillPageState extends State<LifeSecKillPage> { ...@@ -46,10 +47,10 @@ class _LifeSecKillPageState extends State<LifeSecKillPage> {
), ),
), ),
), ),
body: ActionProvider( body: ActionProvider<Model,IAction>(
action: iAction, action: iAction!,
builder: (context, child) { builder: (context, child) {
if (iAction.getModel().getSeckillSessionList().length == 0) { if (iAction!.getModel()!.getSeckillSessionList().length == 0) {
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
child: CupertinoActivityIndicator(radius: 10.rpx), child: CupertinoActivityIndicator(radius: 10.rpx),
...@@ -59,28 +60,28 @@ class _LifeSecKillPageState extends State<LifeSecKillPage> { ...@@ -59,28 +60,28 @@ class _LifeSecKillPageState extends State<LifeSecKillPage> {
children: [ children: [
Times( Times(
iAction: iAction, iAction: iAction,
times: iAction.getModel().getSeckillSessionList(), times: iAction!.getModel()!.getSeckillSessionList(),
onChange: (tid) { onChange: (tid) {
iAction.setShowId(tid); iAction!.setShowId(tid!);
}, },
), ),
Expanded( Expanded(
child: Container( child: Container(
child: PullWidget( child: PullWidget(
controller: iAction.getSecKillModel().getRefreshController(), controller: iAction!.getSecKillModel()!.getRefreshController(),
onLoad: () { onLoad: () {
iAction.getSecKillModel().getData(); iAction!.getSecKillModel()!.getData();
}, },
onRefresh: () { onRefresh: () {
iAction.refresh(); iAction!.refresh();
}, },
child: CustomScrollView( child: CustomScrollView(
slivers: [ slivers: [
AdBanner(iAction.getBannerModel()), AdBanner(iAction!.getBannerModel()),
LocaltionTips( LocaltionTips(
model: iAction.getModel(), model: iAction!.getModel(),
onLocationChange: (cityId, lat, lon) { onLocationChange: (cityId, lat, lon) {
iAction.setLocaltionInfo(cityId, lat, lon); iAction!.setLocaltionInfo(cityId, lat, lon);
}, },
), ),
SliverToBoxAdapter( SliverToBoxAdapter(
......
...@@ -3,15 +3,15 @@ import '../models/model.dart'; ...@@ -3,15 +3,15 @@ import '../models/model.dart';
import '../models/outer_info_model.dart'; import '../models/outer_info_model.dart';
class IAction extends BaseAction<Model> { class IAction extends BaseAction<Model> {
String shopId; String? shopId;
String lat; String? lat;
String lng; String? lng;
String firstCateId; String? firstCateId;
String itemId; String? itemId;
final String _cityName; final String? _cityName;
OuterInfoModel _outerInfoModel; OuterInfoModel? _outerInfoModel;
Function() load; Function()? load;
IAction(this.shopId, this.lat, this.lng, this.firstCateId, this.itemId, IAction(this.shopId, this.lat, this.lng, this.firstCateId, this.itemId,
this._cityName); this._cityName);
...@@ -23,10 +23,10 @@ class IAction extends BaseAction<Model> { ...@@ -23,10 +23,10 @@ class IAction extends BaseAction<Model> {
} }
void init() async { void init() async {
await getModel().findShopDetail(); await getModel()!.findShopDetail();
await getOuterInfoModel().findShopOuterInfo(); await getOuterInfoModel()!.findShopOuterInfo();
if (load != null) { if (load != null) {
load(); load!();
} }
} }
...@@ -34,11 +34,11 @@ class IAction extends BaseAction<Model> { ...@@ -34,11 +34,11 @@ class IAction extends BaseAction<Model> {
load = cb; load = cb;
} }
String getFirstCateId() { String? getFirstCateId() {
return firstCateId; return firstCateId;
} }
OuterInfoModel getOuterInfoModel() { OuterInfoModel? getOuterInfoModel() {
return _outerInfoModel; return _outerInfoModel;
} }
} }
...@@ -6,12 +6,12 @@ import 'package:mvp/mvp.dart'; ...@@ -6,12 +6,12 @@ import 'package:mvp/mvp.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
class AppraiseItems extends StatelessWidget { class AppraiseItems extends StatelessWidget {
final OuterInfoModel model; final OuterInfoModel? model;
AppraiseItems(this.model); AppraiseItems(this.model);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return QMProvider<OuterInfoModel>.value( return QMProvider<OuterInfoModel>.value(
model: model, model: model!,
builderWidget: (context, model, child) { builderWidget: (context, model, child) {
if (model.getShopOuterInfoEntity() == null) { if (model.getShopOuterInfoEntity() == null) {
return SliverToBoxAdapter( return SliverToBoxAdapter(
...@@ -24,7 +24,7 @@ class AppraiseItems extends StatelessWidget { ...@@ -24,7 +24,7 @@ class AppraiseItems extends StatelessWidget {
)); ));
} }
var list = model.getShopOuterInfoEntity().commentItemEntitys; var list = model.getShopOuterInfoEntity()!.commentItemEntitys;
if (list.length == 0) { if (list.length == 0) {
return SliverToBoxAdapter( return SliverToBoxAdapter(
child: Container( child: Container(
......
...@@ -14,7 +14,7 @@ class FooterExplain extends StatelessWidget { ...@@ -14,7 +14,7 @@ class FooterExplain extends StatelessWidget {
InkWell( InkWell(
onTap: () { onTap: () {
Map<String, dynamic> map = {'redirect_type': '11'}; Map<String, dynamic> map = {'redirect_type': '11'};
AppTapConfigUtils.getInstance().activityConfigTap(map); AppTapConfigUtils.getInstance()!.activityConfigTap(map);
}, },
child: Container( child: Container(
padding: EdgeInsets.only(top: 12.rpx, bottom: 4.rpx), padding: EdgeInsets.only(top: 12.rpx, bottom: 4.rpx),
......
...@@ -9,7 +9,7 @@ import '../../../utils/buy_loading_dialog_utils.dart'; ...@@ -9,7 +9,7 @@ import '../../../utils/buy_loading_dialog_utils.dart';
import 'package:common_module/utils/image_preview_utils.dart'; import 'package:common_module/utils/image_preview_utils.dart';
class GoodsItems extends StatelessWidget { class GoodsItems extends StatelessWidget {
final Model model; final Model? model;
GoodsItems(this.model); GoodsItems(this.model);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -19,22 +19,22 @@ class GoodsItems extends StatelessWidget { ...@@ -19,22 +19,22 @@ class GoodsItems extends StatelessWidget {
return _GoodsItem( return _GoodsItem(
isFirst: index == 0, isFirst: index == 0,
isLast: index == 1, isLast: index == 1,
item: model.getShopInfoEntity().shopCouponItems[index], item: model!.getShopInfoEntity()!.shopCouponItems![index],
); );
}, },
childCount: model.getShopInfoEntity().shopCouponItems.length, childCount: model!.getShopInfoEntity()!.shopCouponItems!.length,
)); ));
} }
} }
class _GoodsItem extends StatelessWidget { class _GoodsItem extends StatelessWidget {
final bool isFirst; final bool? isFirst;
final bool isLast; final bool? isLast;
final ShopCouponItem item; final ShopCouponItem? item;
_GoodsItem({this.isFirst, this.isLast, this.item}); _GoodsItem({this.isFirst, this.isLast, this.item});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double top = isFirst ? 16.rpx : 12.rpx; double top = isFirst! ? 16.rpx : 12.rpx;
return Container( return Container(
height: 90.rpx + top, height: 90.rpx + top,
...@@ -42,7 +42,7 @@ class _GoodsItem extends StatelessWidget { ...@@ -42,7 +42,7 @@ class _GoodsItem extends StatelessWidget {
left: 12.rpx, right: 12.rpx, top: top, bottom: 16.rpx), left: 12.rpx, right: 12.rpx, top: top, bottom: 16.rpx),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.vertical(bottom: Radius.circular(isLast ? 8.rpx : 0))), borderRadius: BorderRadius.vertical(bottom: Radius.circular(isLast! ? 8.rpx : 0))),
child: Row( child: Row(
children: [ children: [
InkWell( InkWell(
...@@ -52,7 +52,7 @@ class _GoodsItem extends StatelessWidget { ...@@ -52,7 +52,7 @@ class _GoodsItem extends StatelessWidget {
height: 74.rpx, height: 74.rpx,
width: 74.rpx, width: 74.rpx,
child: XiaoxiongBaseImageWidget( child: XiaoxiongBaseImageWidget(
imageUrl: item.itemImg, imageUrl: item!.itemImg!,
height: 74.rpx, height: 74.rpx,
width: 74.rpx, width: 74.rpx,
fit: BoxFit.cover, fit: BoxFit.cover,
...@@ -61,8 +61,8 @@ class _GoodsItem extends StatelessWidget { ...@@ -61,8 +61,8 @@ class _GoodsItem extends StatelessWidget {
onTap: () { onTap: () {
ImagePreviewUtils.showIndex( ImagePreviewUtils.showIndex(
context: context, context: context,
images: [item.itemImg], images: [item!.itemImg!],
heroTag: item.itemImg); heroTag: item!.itemImg);
}, },
), ),
SizedBox( SizedBox(
...@@ -100,7 +100,7 @@ class _GoodsItem extends StatelessWidget { ...@@ -100,7 +100,7 @@ class _GoodsItem extends StatelessWidget {
/// 标题 /// 标题
class _Title extends StatelessWidget { class _Title extends StatelessWidget {
final ShopCouponItem item; final ShopCouponItem? item;
_Title(this.item); _Title(this.item);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -109,7 +109,7 @@ class _Title extends StatelessWidget { ...@@ -109,7 +109,7 @@ class _Title extends StatelessWidget {
child: Row( child: Row(
children: [ children: [
TypeIcon( TypeIcon(
type: int.parse(item.dealType), type: int.parse(item!.dealType!),
), ),
SizedBox( SizedBox(
width: 4.rpx, width: 4.rpx,
...@@ -117,7 +117,7 @@ class _Title extends StatelessWidget { ...@@ -117,7 +117,7 @@ class _Title extends StatelessWidget {
Expanded( Expanded(
child: Container( child: Container(
child: Text( child: Text(
item.itemTitle, item!.itemTitle!,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
...@@ -135,11 +135,11 @@ class _Title extends StatelessWidget { ...@@ -135,11 +135,11 @@ class _Title extends StatelessWidget {
} }
class _Commission extends StatelessWidget { class _Commission extends StatelessWidget {
final ShopCouponItem item; final ShopCouponItem? item;
_Commission(this.item); _Commission(this.item);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (double.parse(item.userCommission) == 0) { if (double.parse(item!.userCommission!) == 0) {
Container(height: 18.rpx); Container(height: 18.rpx);
} }
return Container( return Container(
...@@ -152,7 +152,7 @@ class _Commission extends StatelessWidget { ...@@ -152,7 +152,7 @@ class _Commission extends StatelessWidget {
topRight: Radius.circular(9.rpx), topRight: Radius.circular(9.rpx),
bottomRight: Radius.circular(9.rpx))), bottomRight: Radius.circular(9.rpx))),
child: Text( child: Text(
item.userCommissionText, item!.userCommissionText!,
style: TextStyle( style: TextStyle(
color: rgba(255, 128, 0, 1), fontSize: 11.rpx, height: 1.2), color: rgba(255, 128, 0, 1), fontSize: 11.rpx, height: 1.2),
), ),
...@@ -162,7 +162,7 @@ class _Commission extends StatelessWidget { ...@@ -162,7 +162,7 @@ class _Commission extends StatelessWidget {
/// 价格信息 /// 价格信息
class _PriceInfo extends StatelessWidget { class _PriceInfo extends StatelessWidget {
final ShopCouponItem item; final ShopCouponItem? item;
_PriceInfo(this.item); _PriceInfo(this.item);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -179,7 +179,7 @@ class _PriceInfo extends StatelessWidget { ...@@ -179,7 +179,7 @@ class _PriceInfo extends StatelessWidget {
), ),
), ),
Text( Text(
item.endPrice, item!.endPrice!,
style: TextStyle( style: TextStyle(
color: rgba(255, 4, 0, 1), color: rgba(255, 4, 0, 1),
fontSize: 16.rpx, fontSize: 16.rpx,
...@@ -189,7 +189,7 @@ class _PriceInfo extends StatelessWidget { ...@@ -189,7 +189,7 @@ class _PriceInfo extends StatelessWidget {
width: 4.rpx, width: 4.rpx,
), ),
Text( Text(
${item.originalPrice}", ${item!.originalPrice}",
style: TextStyle( style: TextStyle(
color: rgba(153, 153, 153, 1), color: rgba(153, 153, 153, 1),
fontSize: 12.rpx, fontSize: 12.rpx,
...@@ -204,7 +204,7 @@ class _PriceInfo extends StatelessWidget { ...@@ -204,7 +204,7 @@ class _PriceInfo extends StatelessWidget {
color: rgba(255, 128, 0, 0.06), color: rgba(255, 128, 0, 0.06),
borderRadius: BorderRadius.circular(34.rpx)), borderRadius: BorderRadius.circular(34.rpx)),
child: Text( child: Text(
"${item.discountPercent}折", "${item!.discountPercent}折",
style: TextStyle( style: TextStyle(
color: rgba(255, 128, 0, 1), fontSize: 11.rpx, height: 1.rpx), color: rgba(255, 128, 0, 1), fontSize: 11.rpx, height: 1.rpx),
), ),
...@@ -216,7 +216,7 @@ class _PriceInfo extends StatelessWidget { ...@@ -216,7 +216,7 @@ class _PriceInfo extends StatelessWidget {
} }
class _BuyBtn extends StatelessWidget { class _BuyBtn extends StatelessWidget {
final ShopCouponItem item; final ShopCouponItem? item;
_BuyBtn(this.item); _BuyBtn(this.item);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -241,10 +241,10 @@ class _BuyBtn extends StatelessWidget { ...@@ -241,10 +241,10 @@ class _BuyBtn extends StatelessWidget {
), ),
), ),
onTap: () { onTap: () {
var loading = BuyLoadingDialogUtils.getInstance().show(); var loading = BuyLoadingDialogUtils.getInstance()!.show();
Future.delayed(Duration(seconds: 1)).then((value) { Future.delayed(Duration(seconds: 1)).then((value) {
loading.close(); loading.close();
MeituanUtils.getInstance().openByUrl(item.couponUrl); MeituanUtils.getInstance()!.openByUrl(item!.couponUrl!);
}); });
}, },
); );
......
...@@ -4,8 +4,8 @@ import 'package:navigation_bar/navigation_bar.dart'; ...@@ -4,8 +4,8 @@ import 'package:navigation_bar/navigation_bar.dart';
import 'package:life_module/components/persistent_header_delegate.dart'; import 'package:life_module/components/persistent_header_delegate.dart';
class NavBar extends StatelessWidget { class NavBar extends StatelessWidget {
final TabController controller; final TabController? controller;
final Function(int) onChange; final Function(int)? onChange;
NavBar({this.controller, this.onChange}); NavBar({this.controller, this.onChange});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
......
...@@ -7,7 +7,7 @@ import 'package:flutter/cupertino.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter/cupertino.dart';
import 'package:common_module/utils/image_preview_utils.dart'; import 'package:common_module/utils/image_preview_utils.dart';
class Recommend extends StatelessWidget { class Recommend extends StatelessWidget {
final OuterInfoModel model; final OuterInfoModel? model;
Recommend(this.model); Recommend(this.model);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -19,7 +19,7 @@ class Recommend extends StatelessWidget { ...@@ -19,7 +19,7 @@ class Recommend extends StatelessWidget {
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.vertical(bottom: Radius.circular(8.rpx))), borderRadius: BorderRadius.vertical(bottom: Radius.circular(8.rpx))),
child: QMProvider<OuterInfoModel>.value( child: QMProvider<OuterInfoModel>.value(
model: model, model: model!,
builderWidget: (context, model, child) { builderWidget: (context, model, child) {
if (model.getShopOuterInfoEntity() == null) { if (model.getShopOuterInfoEntity() == null) {
return Container( return Container(
...@@ -29,7 +29,7 @@ class Recommend extends StatelessWidget { ...@@ -29,7 +29,7 @@ class Recommend extends StatelessWidget {
), ),
); );
} }
if (model.getShopOuterInfoEntity().recommendItemEntitys.length == 0) { if (model.getShopOuterInfoEntity()!.recommendItemEntitys.length == 0) {
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsets.only(bottom: 15.rpx, top: 10.rpx), padding: EdgeInsets.only(bottom: 15.rpx, top: 10.rpx),
...@@ -44,13 +44,13 @@ class Recommend extends StatelessWidget { ...@@ -44,13 +44,13 @@ class Recommend extends StatelessWidget {
); );
} }
List<Widget> items = List<Widget> items =
model.getShopOuterInfoEntity().recommendItemEntitys.map((e) { model.getShopOuterInfoEntity()!.recommendItemEntitys.map((e) {
return Expanded( return Expanded(
child: InkWell( child: InkWell(
onTap: () { onTap: () {
ImagePreviewUtils.showIndex( ImagePreviewUtils.showIndex(
context: context, context: context,
images: [e.itemPic], images: [e.itemPic!],
heroTag: e.itemPic); heroTag: e.itemPic);
}, },
child: Container( child: Container(
...@@ -60,11 +60,11 @@ class Recommend extends StatelessWidget { ...@@ -60,11 +60,11 @@ class Recommend extends StatelessWidget {
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(8.rpx), borderRadius: BorderRadius.circular(8.rpx),
child: Hero( child: Hero(
tag: e.itemPic, tag: e.itemPic!,
child: XiaoxiongBaseImageWidget( child: XiaoxiongBaseImageWidget(
height: 75.rpx, height: 75.rpx,
width: 100.rpx, width: 100.rpx,
imageUrl: e.itemPic, imageUrl: e.itemPic!,
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
)), )),
...@@ -75,7 +75,7 @@ class Recommend extends StatelessWidget { ...@@ -75,7 +75,7 @@ class Recommend extends StatelessWidget {
height: 17.rpx, height: 17.rpx,
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Text( child: Text(
e.itemTitle, e.itemTitle!,
style: TextStyle( style: TextStyle(
color: rgba(48, 38, 0, 1), color: rgba(48, 38, 0, 1),
fontSize: 12.rpx, fontSize: 12.rpx,
......
...@@ -9,7 +9,7 @@ import 'package:common_module/utils/audit_mode_utils.dart'; ...@@ -9,7 +9,7 @@ import 'package:common_module/utils/audit_mode_utils.dart';
import 'package:common_module/utils/image_preview_utils.dart'; import 'package:common_module/utils/image_preview_utils.dart';
class ShopInfo extends StatelessWidget { class ShopInfo extends StatelessWidget {
final Model model; final Model? model;
ShopInfo(this.model); ShopInfo(this.model);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -26,7 +26,7 @@ class ShopInfo extends StatelessWidget { ...@@ -26,7 +26,7 @@ class ShopInfo extends StatelessWidget {
height: 12.rpx, height: 12.rpx,
), ),
_Location(model), _Location(model),
AuditModeUtils.getInstance().isAuditMode() AuditModeUtils.getInstance()!.isAuditMode()
? SizedBox() ? SizedBox()
: Container( : Container(
height: 48.rpx, height: 48.rpx,
...@@ -44,7 +44,7 @@ class ShopInfo extends StatelessWidget { ...@@ -44,7 +44,7 @@ class ShopInfo extends StatelessWidget {
/// 店铺展示信息 /// 店铺展示信息
class _ShopInfo extends StatelessWidget { class _ShopInfo extends StatelessWidget {
final Model model; final Model? model;
_ShopInfo(this.model); _ShopInfo(this.model);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -56,7 +56,7 @@ class _ShopInfo extends StatelessWidget { ...@@ -56,7 +56,7 @@ class _ShopInfo extends StatelessWidget {
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
padding: EdgeInsets.only(top: 12.rpx, bottom: 10.rpx), padding: EdgeInsets.only(top: 12.rpx, bottom: 10.rpx),
child: Text( child: Text(
model.getShopInfoEntity().shopInfo.shopTitle, model!.getShopInfoEntity()!.shopInfo!.shopTitle!,
style: TextStyle( style: TextStyle(
color: rgba(48, 38, 0, 1), fontSize: 18.rpx, height: 1.rpx,fontWeight:FontWeight.w600), color: rgba(48, 38, 0, 1), fontSize: 18.rpx, height: 1.rpx,fontWeight:FontWeight.w600),
), ),
...@@ -72,7 +72,7 @@ class _ShopInfo extends StatelessWidget { ...@@ -72,7 +72,7 @@ class _ShopInfo extends StatelessWidget {
height: 80.rpx, height: 80.rpx,
width: 80.rpx, width: 80.rpx,
child: XiaoxiongBaseImageWidget( child: XiaoxiongBaseImageWidget(
imageUrl: model.getShopInfoEntity().shopInfo.shopImg, imageUrl: model!.getShopInfoEntity()!.shopInfo!.shopImg!,
height: 80.rpx, height: 80.rpx,
width: 80.rpx, width: 80.rpx,
fit: BoxFit.cover, fit: BoxFit.cover,
...@@ -81,8 +81,8 @@ class _ShopInfo extends StatelessWidget { ...@@ -81,8 +81,8 @@ class _ShopInfo extends StatelessWidget {
onTap: () { onTap: () {
ImagePreviewUtils.showIndex( ImagePreviewUtils.showIndex(
context: context, context: context,
images: [model.getShopInfoEntity().shopInfo.shopImg], images: [model!.getShopInfoEntity()!.shopInfo!.shopImg!],
heroTag: model.getShopInfoEntity().shopInfo.shopImg); heroTag: model!.getShopInfoEntity()!.shopInfo!.shopImg);
}, },
), ),
SizedBox( SizedBox(
...@@ -100,7 +100,7 @@ class _ShopInfo extends StatelessWidget { ...@@ -100,7 +100,7 @@ class _ShopInfo extends StatelessWidget {
Container( Container(
height: 16.rpx, height: 16.rpx,
child: Text( child: Text(
${model.getShopInfoEntity().shopInfo.avgPrice}/人", ${model!.getShopInfoEntity()!.shopInfo!.avgPrice}/人",
style: TextStyle( style: TextStyle(
color: rgba(102, 102, 102, 1), color: rgba(102, 102, 102, 1),
fontSize: 11.rpx), fontSize: 11.rpx),
...@@ -124,7 +124,7 @@ class _ShopInfo extends StatelessWidget { ...@@ -124,7 +124,7 @@ class _ShopInfo extends StatelessWidget {
Container( Container(
height: 16.rpx, height: 16.rpx,
child: Text( child: Text(
"营业时间 ${model.getShopInfoEntity().shopInfo.businessTime}", "营业时间 ${model!.getShopInfoEntity()!.shopInfo!.businessTime}",
style: TextStyle( style: TextStyle(
color: rgba(48, 38, 0, 1), fontSize: 12.rpx), color: rgba(48, 38, 0, 1), fontSize: 12.rpx),
), ),
...@@ -144,11 +144,11 @@ class _ShopInfo extends StatelessWidget { ...@@ -144,11 +144,11 @@ class _ShopInfo extends StatelessWidget {
/// 评分和距离信息 /// 评分和距离信息
class _ScoreInfo extends StatelessWidget { class _ScoreInfo extends StatelessWidget {
final Model model; final Model? model;
_ScoreInfo(this.model); _ScoreInfo(this.model);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var showStarScore = model.getShopInfoEntity().shopInfo.showStarScore; var showStarScore = model!.getShopInfoEntity()!.shopInfo!.showStarScore!;
List<InlineSpan> widgets = []; List<InlineSpan> widgets = [];
double score = double.parse(showStarScore); double score = double.parse(showStarScore);
for (int star = 1, len = score.ceil(); star <= len; star++) { for (int star = 1, len = score.ceil(); star <= len; star++) {
...@@ -185,7 +185,7 @@ class _ScoreInfo extends StatelessWidget { ...@@ -185,7 +185,7 @@ class _ScoreInfo extends StatelessWidget {
), ),
Container( Container(
child: Text( child: Text(
double.parse(model.getShopInfoEntity().shopInfo.commentScore) double.parse(model!.getShopInfoEntity()!.shopInfo!.commentScore!)
.toStringAsFixed(1), .toStringAsFixed(1),
style: TextStyle( style: TextStyle(
color: rgba(255, 128, 0, 1), color: rgba(255, 128, 0, 1),
...@@ -195,7 +195,7 @@ class _ScoreInfo extends StatelessWidget { ...@@ -195,7 +195,7 @@ class _ScoreInfo extends StatelessWidget {
), ),
Spacer(), Spacer(),
Text( Text(
model.getShopInfoEntity().shopInfo.distance, model!.getShopInfoEntity()!.shopInfo!.distance!,
style: TextStyle(color: rgba(102, 102, 102, 1), fontSize: 11.rpx), style: TextStyle(color: rgba(102, 102, 102, 1), fontSize: 11.rpx),
) )
], ],
...@@ -206,7 +206,7 @@ class _ScoreInfo extends StatelessWidget { ...@@ -206,7 +206,7 @@ class _ScoreInfo extends StatelessWidget {
/// 位置信息 /// 位置信息
class _Location extends StatelessWidget { class _Location extends StatelessWidget {
final Model model; final Model? model;
_Location(this.model); _Location(this.model);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -225,7 +225,7 @@ class _Location extends StatelessWidget { ...@@ -225,7 +225,7 @@ class _Location extends StatelessWidget {
Expanded( Expanded(
child: Container( child: Container(
child: Text( child: Text(
model.getShopInfoEntity().shopInfo.address, model!.getShopInfoEntity()!.shopInfo!.address!,
style: TextStyle(color: rgba(48, 38, 0, 1), fontSize: 12.rpx), style: TextStyle(color: rgba(48, 38, 0, 1), fontSize: 12.rpx),
), ),
), ),
...@@ -236,7 +236,7 @@ class _Location extends StatelessWidget { ...@@ -236,7 +236,7 @@ class _Location extends StatelessWidget {
InkWell( InkWell(
onTap: () { onTap: () {
ClipboardUtils.copyText( ClipboardUtils.copyText(
model.getShopInfoEntity().shopInfo.address); model!.getShopInfoEntity()!.shopInfo!.address!);
FlutterNativeToast.showToast('门店地址已复制'); FlutterNativeToast.showToast('门店地址已复制');
}, },
child: Container( child: Container(
......
import 'dart:async';
import 'package:mvp/mvp.dart'; import 'package:mvp/mvp.dart';
import 'package:life_repository/life_repository.dart'; import 'package:life_repository/life_repository.dart';
class Model extends BaseModel { class Model extends BaseModel {
final String _cityName; final String? _cityName;
final String _shopId; final String? _shopId;
final String _lat; final String? _lat;
final String _lng; final String? _lng;
final String _itemId; final String? _itemId;
ShopInfoEntity _shopInfoEntity; ShopInfoEntity? _shopInfoEntity;
Model(this._shopId, this._lat, this._lng, this._cityName, this._itemId); Model(this._shopId, this._lat, this._lng, this._cityName, this._itemId);
Future<void> findShopDetail() async { Future<void> findShopDetail() async {
var data = var data =
await ShopInfoRepository.get().findShopDetail(_shopId, _lat, _lng); await (ShopInfoRepository.get().findShopDetail(_shopId!, _lat!, _lng!) as FutureOr<ShopInfoEntity>);
var list = data.shopCouponItems; var list = data.shopCouponItems;
if (_itemId != null && _itemId.isNotEmpty) { if (_itemId != null && _itemId!.isNotEmpty) {
try { try {
var index = list.indexWhere((item) { var index = list!.indexWhere((item) {
return item.dealId == _itemId; return item.dealId == _itemId;
}); });
if (index > -1) { if (index > -1) {
...@@ -29,11 +30,11 @@ class Model extends BaseModel { ...@@ -29,11 +30,11 @@ class Model extends BaseModel {
notifyListeners(); notifyListeners();
} }
ShopInfoEntity getShopInfoEntity() { ShopInfoEntity? getShopInfoEntity() {
return _shopInfoEntity; return _shopInfoEntity;
} }
String getCityName() { String? getCityName() {
return _cityName; return _cityName;
} }
} }
...@@ -2,18 +2,18 @@ import 'package:mvp/mvp.dart'; ...@@ -2,18 +2,18 @@ import 'package:mvp/mvp.dart';
import 'package:life_repository/life_repository.dart'; import 'package:life_repository/life_repository.dart';
class OuterInfoModel extends BaseModel { class OuterInfoModel extends BaseModel {
final String _shopId; final String? _shopId;
final String _firstCateId; final String? _firstCateId;
ShopOuterInfoEntity _outerInfoEntity; ShopOuterInfoEntity? _outerInfoEntity;
OuterInfoModel(this._shopId, this._firstCateId); OuterInfoModel(this._shopId, this._firstCateId);
Future<void> findShopOuterInfo() async { Future<void> findShopOuterInfo() async {
_outerInfoEntity = _outerInfoEntity =
await ShopInfoRepository.get().findShopOuterInfo(_shopId, _firstCateId); await ShopInfoRepository.get().findShopOuterInfo(_shopId!, _firstCateId!);
notifyListeners(); notifyListeners();
} }
ShopOuterInfoEntity getShopOuterInfoEntity() { ShopOuterInfoEntity? getShopOuterInfoEntity() {
return _outerInfoEntity; return _outerInfoEntity;
} }
} }
...@@ -16,7 +16,7 @@ import '../../utils/share_dialog_utils.dart'; ...@@ -16,7 +16,7 @@ import '../../utils/share_dialog_utils.dart';
import 'components/appraise_items.dart'; import 'components/appraise_items.dart';
class LifeShopPage extends StatefulWidget { class LifeShopPage extends StatefulWidget {
final Map<String, dynamic> param; final Map<String, dynamic>? param;
LifeShopPage({this.param}); LifeShopPage({this.param});
@override @override
State<StatefulWidget> createState() => _LifeShopPageState(); State<StatefulWidget> createState() => _LifeShopPageState();
...@@ -24,29 +24,29 @@ class LifeShopPage extends StatefulWidget { ...@@ -24,29 +24,29 @@ class LifeShopPage extends StatefulWidget {
class _LifeShopPageState extends State<LifeShopPage> class _LifeShopPageState extends State<LifeShopPage>
with TickerProviderStateMixin { with TickerProviderStateMixin {
TabController tabController; TabController? tabController;
IAction iAction; late IAction iAction;
ScrollController controller = ScrollController(); ScrollController controller = ScrollController();
GlobalKey globalKey1 = GlobalKey(); GlobalKey globalKey1 = GlobalKey();
GlobalKey globalKey2 = GlobalKey(); GlobalKey globalKey2 = GlobalKey();
GlobalKey globalKey3 = GlobalKey(); GlobalKey globalKey3 = GlobalKey();
double offset1; double? offset1;
double offset2; late double offset2;
double offset3; late double offset3;
bool isTap = false; bool isTap = false;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
var param = widget.param; var param = widget.param!;
iAction = IAction(param['shopId'], param['lat'], param['lng'], iAction = IAction(param['shopId'], param['lat'], param['lng'],
param['firstCateId'], param['itemId'], param['cityName']); param['firstCateId'], param['itemId'], param['cityName']);
iAction.onLoad(() { iAction.onLoad(() {
Future.delayed(Duration(milliseconds: 500)).then((value) { Future.delayed(Duration(milliseconds: 500)).then((value) {
RenderBox renderBox1 = globalKey1.currentContext.findRenderObject(); RenderBox renderBox1 = globalKey1.currentContext!.findRenderObject() as RenderBox;
RenderBox renderBox2 = globalKey2.currentContext.findRenderObject(); RenderBox renderBox2 = globalKey2.currentContext!.findRenderObject() as RenderBox;
RenderBox renderBox3 = globalKey3.currentContext.findRenderObject(); RenderBox renderBox3 = globalKey3.currentContext!.findRenderObject() as RenderBox;
offset1 = renderBox1.localToGlobal(Offset(0, 0)).dy; offset1 = renderBox1.localToGlobal(Offset(0, 0)).dy;
offset2 = renderBox2.localToGlobal(Offset(0, 0)).dy; offset2 = renderBox2.localToGlobal(Offset(0, 0)).dy;
offset3 = renderBox3.localToGlobal(Offset(0, 0)).dy; offset3 = renderBox3.localToGlobal(Offset(0, 0)).dy;
...@@ -60,11 +60,11 @@ class _LifeShopPageState extends State<LifeShopPage> ...@@ -60,11 +60,11 @@ class _LifeShopPageState extends State<LifeShopPage>
var size = MediaQuery.of(context).padding; var size = MediaQuery.of(context).padding;
var offset = controller.offset + 104.rpx + size.top; var offset = controller.offset + 104.rpx + size.top;
if (offset >= offset3) { if (offset >= offset3) {
tabController.animateTo(2); tabController!.animateTo(2);
} else if (offset >= offset2) { } else if (offset >= offset2) {
tabController.animateTo(1); tabController!.animateTo(1);
} else { } else {
tabController.animateTo(0); tabController!.animateTo(0);
} }
}); });
} }
...@@ -76,7 +76,7 @@ class _LifeShopPageState extends State<LifeShopPage> ...@@ -76,7 +76,7 @@ class _LifeShopPageState extends State<LifeShopPage>
appBar: IAppBar( appBar: IAppBar(
title: "全部优惠", title: "全部优惠",
color: Colors.white, color: Colors.white,
actions:AuditModeUtils.getInstance().isAuditMode()?null:[ actions:AuditModeUtils.getInstance()!.isAuditMode()?null:[
InkWell( InkWell(
child: Container( child: Container(
width: 54.rpx, width: 54.rpx,
...@@ -88,13 +88,13 @@ class _LifeShopPageState extends State<LifeShopPage> ...@@ -88,13 +88,13 @@ class _LifeShopPageState extends State<LifeShopPage>
), ),
), ),
onTap: () { onTap: () {
if (iAction.getModel().getShopInfoEntity() == null) { if (iAction.getModel()!.getShopInfoEntity() == null) {
return; return;
} }
ShareDialogUtils.getInstance().show( ShareDialogUtils.getInstance()!.show(
context: context, context: context,
firstCateId: iAction.getFirstCateId(), firstCateId: iAction.getFirstCateId(),
shopInfo: iAction.getModel().getShopInfoEntity().shopInfo); shopInfo: iAction.getModel()!.getShopInfoEntity()!.shopInfo);
}, },
) )
], ],
...@@ -102,7 +102,7 @@ class _LifeShopPageState extends State<LifeShopPage> ...@@ -102,7 +102,7 @@ class _LifeShopPageState extends State<LifeShopPage>
body: ActionProvider( body: ActionProvider(
action: iAction, action: iAction,
builder: (context, child) { builder: (context, child) {
if (iAction.getModel().getShopInfoEntity() == null) { if (iAction.getModel()!.getShopInfoEntity() == null) {
return Container( return Container(
padding: EdgeInsets.only(top: 100.rpx), padding: EdgeInsets.only(top: 100.rpx),
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
...@@ -123,13 +123,13 @@ class _LifeShopPageState extends State<LifeShopPage> ...@@ -123,13 +123,13 @@ class _LifeShopPageState extends State<LifeShopPage>
isTap = true; isTap = true;
if (index == 0) { if (index == 0) {
await Scrollable.ensureVisible( await Scrollable.ensureVisible(
globalKey1.currentContext); globalKey1.currentContext!);
} else if (index == 1) { } else if (index == 1) {
await Scrollable.ensureVisible( await Scrollable.ensureVisible(
globalKey2.currentContext); globalKey2.currentContext!);
} else if (index == 2) { } else if (index == 2) {
await Scrollable.ensureVisible( await Scrollable.ensureVisible(
globalKey3.currentContext); globalKey3.currentContext!);
} }
isTap = false; isTap = false;
}, },
......
...@@ -6,7 +6,7 @@ homepage: / ...@@ -6,7 +6,7 @@ homepage: /
publish_to: none publish_to: none
environment: environment:
sdk: ">=2.7.0 <3.0.0" sdk: '>=2.12.0 <3.0.0'
flutter: ">=1.17.0" flutter: ">=1.17.0"
dependencies: dependencies:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment