fix: show store previews fullscreen
This commit is contained in:
parent
a800a0f941
commit
b5cb66997b
@ -56,12 +56,10 @@ class _StoreChatboxPageState
|
|||||||
Widget buildItem(StoreListResBean res) {
|
Widget buildItem(StoreListResBean res) {
|
||||||
return SCStoreGridItemCard(
|
return SCStoreGridItemCard(
|
||||||
res: res.res,
|
res: res.res,
|
||||||
selected: res.isSelecte,
|
|
||||||
discount: disCount,
|
discount: disCount,
|
||||||
coverHeight: 45.w,
|
coverHeight: 45.w,
|
||||||
previewWidth: 88.w,
|
previewWidth: 88.w,
|
||||||
previewHeight: 58.w,
|
previewHeight: 58.w,
|
||||||
onPreviewTap: () => _togglePreview(res),
|
|
||||||
onDetailsTap: () => _showDetail(res.res),
|
onDetailsTap: () => _showDetail(res.res),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -100,15 +98,6 @@ class _StoreChatboxPageState
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _togglePreview(StoreListResBean res) {
|
|
||||||
final shouldSelect = !res.isSelecte;
|
|
||||||
for (var value in items) {
|
|
||||||
value.isSelecte = false;
|
|
||||||
}
|
|
||||||
res.isSelecte = shouldSelect;
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class StoreListResBean {
|
class StoreListResBean {
|
||||||
|
|||||||
@ -53,7 +53,6 @@ class StoreDataCardPageState
|
|||||||
final res = item;
|
final res = item;
|
||||||
return SCStoreGridItemCard(
|
return SCStoreGridItemCard(
|
||||||
res: res.res,
|
res: res.res,
|
||||||
selected: res.isSelecte,
|
|
||||||
discount: disCount,
|
discount: disCount,
|
||||||
previewKind: SCStoreItemPreviewKind.dataCard,
|
previewKind: SCStoreItemPreviewKind.dataCard,
|
||||||
coverWidth: 72.w,
|
coverWidth: 72.w,
|
||||||
@ -63,7 +62,6 @@ class StoreDataCardPageState
|
|||||||
coverFit: BoxFit.cover,
|
coverFit: BoxFit.cover,
|
||||||
previewFit: BoxFit.cover,
|
previewFit: BoxFit.cover,
|
||||||
coverBorderRadius: BorderRadius.circular(6.w),
|
coverBorderRadius: BorderRadius.circular(6.w),
|
||||||
onPreviewTap: () => _togglePreview(res),
|
|
||||||
onDetailsTap: () => _showDetail(res.res),
|
onDetailsTap: () => _showDetail(res.res),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -99,15 +97,6 @@ class StoreDataCardPageState
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _togglePreview(StoreDataCardListResBean res) {
|
|
||||||
final shouldSelect = !res.isSelecte;
|
|
||||||
for (final value in items) {
|
|
||||||
value.isSelecte = false;
|
|
||||||
}
|
|
||||||
res.isSelecte = shouldSelect;
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class StoreDataCardListResBean {
|
class StoreDataCardListResBean {
|
||||||
|
|||||||
@ -55,10 +55,8 @@ class _StoreHeaddressPageState
|
|||||||
Widget buildItem(StoreListResBean res) {
|
Widget buildItem(StoreListResBean res) {
|
||||||
return SCStoreGridItemCard(
|
return SCStoreGridItemCard(
|
||||||
res: res.res,
|
res: res.res,
|
||||||
selected: res.isSelecte,
|
|
||||||
discount: disCount,
|
discount: disCount,
|
||||||
previewKind: SCStoreItemPreviewKind.avatarFrame,
|
previewKind: SCStoreItemPreviewKind.avatarFrame,
|
||||||
onPreviewTap: () => _togglePreview(res),
|
|
||||||
onDetailsTap: () => _showDetail(res.res),
|
onDetailsTap: () => _showDetail(res.res),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -97,15 +95,6 @@ class _StoreHeaddressPageState
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _togglePreview(StoreListResBean res) {
|
|
||||||
final shouldSelect = !res.isSelecte;
|
|
||||||
for (var value in items) {
|
|
||||||
value.isSelecte = false;
|
|
||||||
}
|
|
||||||
res.isSelecte = shouldSelect;
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class StoreListResBean {
|
class StoreListResBean {
|
||||||
|
|||||||
@ -56,9 +56,7 @@ class _StoreMountainsPageState
|
|||||||
Widget buildItem(StoreListResBean res) {
|
Widget buildItem(StoreListResBean res) {
|
||||||
return SCStoreGridItemCard(
|
return SCStoreGridItemCard(
|
||||||
res: res.res,
|
res: res.res,
|
||||||
selected: res.isSelecte,
|
|
||||||
discount: disCount,
|
discount: disCount,
|
||||||
onPreviewTap: () => _togglePreview(res),
|
|
||||||
onDetailsTap: () => _showDetail(res.res),
|
onDetailsTap: () => _showDetail(res.res),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -97,13 +95,4 @@ class _StoreMountainsPageState
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _togglePreview(StoreListResBean res) {
|
|
||||||
final shouldSelect = !res.isSelecte;
|
|
||||||
for (var value in items) {
|
|
||||||
value.isSelecte = false;
|
|
||||||
}
|
|
||||||
res.isSelecte = shouldSelect;
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,10 +57,8 @@ class _StoreThemePagePageState
|
|||||||
Widget buildItem(StoreListResBean res) {
|
Widget buildItem(StoreListResBean res) {
|
||||||
return SCStoreGridItemCard(
|
return SCStoreGridItemCard(
|
||||||
res: res.res,
|
res: res.res,
|
||||||
selected: res.isSelecte,
|
|
||||||
discount: disCount,
|
discount: disCount,
|
||||||
coverBorderRadius: BorderRadius.all(Radius.circular(8.w)),
|
coverBorderRadius: BorderRadius.all(Radius.circular(8.w)),
|
||||||
onPreviewTap: () => _togglePreview(res),
|
|
||||||
onDetailsTap: () => _showDetail(res.res),
|
onDetailsTap: () => _showDetail(res.res),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -99,13 +97,4 @@ class _StoreThemePagePageState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _togglePreview(StoreListResBean res) {
|
|
||||||
final shouldSelect = !res.isSelecte;
|
|
||||||
for (var value in items) {
|
|
||||||
value.isSelecte = false;
|
|
||||||
}
|
|
||||||
res.isSelecte = shouldSelect;
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:yumi/app/constants/sc_global_config.dart';
|
import 'package:yumi/app/constants/sc_global_config.dart';
|
||||||
import 'package:yumi/app_localizations.dart';
|
import 'package:yumi/app_localizations.dart';
|
||||||
import 'package:yumi/shared/business_logic/models/res/store_list_res.dart';
|
import 'package:yumi/shared/business_logic/models/res/store_list_res.dart';
|
||||||
@ -16,6 +17,7 @@ const Color _kStoreBagSkeletonShellStrong = Color(0xFF1A4A41);
|
|||||||
const Color _kStoreBagSkeletonBoneBase = Color(0xFF2B5C53);
|
const Color _kStoreBagSkeletonBoneBase = Color(0xFF2B5C53);
|
||||||
const Color _kStoreBagSkeletonBoneHighlight = Color(0xFF5F8177);
|
const Color _kStoreBagSkeletonBoneHighlight = Color(0xFF5F8177);
|
||||||
const Color _kStoreBagSkeletonBorder = Color(0x66D8B57B);
|
const Color _kStoreBagSkeletonBorder = Color(0x66D8B57B);
|
||||||
|
const String _kStoreItemPreviewDialogTag = "storeItemFullScreenPreview";
|
||||||
|
|
||||||
enum SCStoreItemPreviewKind { resource, avatarFrame, dataCard }
|
enum SCStoreItemPreviewKind { resource, avatarFrame, dataCard }
|
||||||
|
|
||||||
@ -107,9 +109,7 @@ class SCStoreGridItemCard extends StatelessWidget {
|
|||||||
const SCStoreGridItemCard({
|
const SCStoreGridItemCard({
|
||||||
super.key,
|
super.key,
|
||||||
required this.res,
|
required this.res,
|
||||||
required this.selected,
|
|
||||||
required this.discount,
|
required this.discount,
|
||||||
required this.onPreviewTap,
|
|
||||||
required this.onDetailsTap,
|
required this.onDetailsTap,
|
||||||
this.previewKind = SCStoreItemPreviewKind.resource,
|
this.previewKind = SCStoreItemPreviewKind.resource,
|
||||||
this.coverWidth,
|
this.coverWidth,
|
||||||
@ -122,9 +122,7 @@ class SCStoreGridItemCard extends StatelessWidget {
|
|||||||
});
|
});
|
||||||
|
|
||||||
final StoreListRes res;
|
final StoreListRes res;
|
||||||
final bool selected;
|
|
||||||
final double discount;
|
final double discount;
|
||||||
final VoidCallback onPreviewTap;
|
|
||||||
final VoidCallback onDetailsTap;
|
final VoidCallback onDetailsTap;
|
||||||
final SCStoreItemPreviewKind previewKind;
|
final SCStoreItemPreviewKind previewKind;
|
||||||
final double? coverWidth;
|
final double? coverWidth;
|
||||||
@ -147,17 +145,12 @@ class SCStoreGridItemCard extends StatelessWidget {
|
|||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color:
|
color:
|
||||||
selected
|
SCGlobalConfig.businessLogicStrategy
|
||||||
? const Color(0xff18F2B1).withValues(alpha: 0.1)
|
.getStoreItemBackgroundColor(),
|
||||||
: SCGlobalConfig.businessLogicStrategy
|
|
||||||
.getStoreItemBackgroundColor(),
|
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color:
|
color:
|
||||||
selected
|
SCGlobalConfig.businessLogicStrategy
|
||||||
? SCGlobalConfig.businessLogicStrategy
|
.getStoreItemUnselectedBorderColor(),
|
||||||
.getStoreItemSelectedBorderColor()
|
|
||||||
: SCGlobalConfig.businessLogicStrategy
|
|
||||||
.getStoreItemUnselectedBorderColor(),
|
|
||||||
width: 1.w,
|
width: 1.w,
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.all(Radius.circular(8.w)),
|
borderRadius: BorderRadius.all(Radius.circular(8.w)),
|
||||||
@ -174,7 +167,7 @@ class SCStoreGridItemCard extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
_buildPreviewTapArea(),
|
_buildPreviewTapArea(context),
|
||||||
SizedBox(height: 8.w),
|
SizedBox(height: 8.w),
|
||||||
_buildPriceRow(amount, firstPrice),
|
_buildPriceRow(amount, firstPrice),
|
||||||
],
|
],
|
||||||
@ -186,21 +179,45 @@ class SCStoreGridItemCard extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildPreviewTapArea() {
|
Widget _buildPreviewTapArea(BuildContext context) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
behavior: HitTestBehavior.opaque,
|
behavior: HitTestBehavior.opaque,
|
||||||
onTap: onPreviewTap,
|
onTap: () => _showFullScreenPreview(context),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height:
|
height:
|
||||||
previewHeight ??
|
previewHeight ??
|
||||||
coverHeight ??
|
coverHeight ??
|
||||||
(previewKind == SCStoreItemPreviewKind.avatarFrame ? 64.w : 62.w),
|
(previewKind == SCStoreItemPreviewKind.avatarFrame ? 64.w : 62.w),
|
||||||
child: Center(child: selected ? _buildPreview() : _buildCover()),
|
child: Center(child: _buildCover()),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _showFullScreenPreview(BuildContext context) {
|
||||||
|
SmartDialog.show(
|
||||||
|
tag: _kStoreItemPreviewDialogTag,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
animationType: SmartAnimationType.fade,
|
||||||
|
maskColor: Colors.transparent,
|
||||||
|
builder: (_) {
|
||||||
|
final size = MediaQuery.sizeOf(context);
|
||||||
|
return GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
|
onTap: () => SmartDialog.dismiss(tag: _kStoreItemPreviewDialogTag),
|
||||||
|
child: Container(
|
||||||
|
width: size.width,
|
||||||
|
height: size.height,
|
||||||
|
color: Colors.black.withValues(alpha: 0.86),
|
||||||
|
child: Center(
|
||||||
|
child: IgnorePointer(child: _buildFullScreenPreview(size)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildCover() {
|
Widget _buildCover() {
|
||||||
Widget child = netImage(
|
Widget child = netImage(
|
||||||
url: res.propsResources?.cover ?? "",
|
url: res.propsResources?.cover ?? "",
|
||||||
@ -214,22 +231,23 @@ class SCStoreGridItemCard extends StatelessWidget {
|
|||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildPreview() {
|
Widget _buildFullScreenPreview(Size screenSize) {
|
||||||
switch (previewKind) {
|
switch (previewKind) {
|
||||||
case SCStoreItemPreviewKind.avatarFrame:
|
case SCStoreItemPreviewKind.avatarFrame:
|
||||||
return head(
|
return head(
|
||||||
url: AccountStorage().getCurrentUser()?.userProfile?.userAvatar ?? "",
|
url: AccountStorage().getCurrentUser()?.userProfile?.userAvatar ?? "",
|
||||||
width: previewWidth ?? 64.w,
|
width: screenSize.width * 0.58,
|
||||||
height: previewHeight ?? 64.w,
|
height: screenSize.width * 0.58,
|
||||||
headdress: res.propsResources?.sourceUrl,
|
headdress: res.propsResources?.sourceUrl,
|
||||||
headdressCover: res.propsResources?.cover,
|
headdressCover: res.propsResources?.cover,
|
||||||
);
|
);
|
||||||
case SCStoreItemPreviewKind.dataCard:
|
case SCStoreItemPreviewKind.dataCard:
|
||||||
|
final width = screenSize.width * 0.84;
|
||||||
return ClipRRect(
|
return ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(6.w),
|
borderRadius: BorderRadius.circular(14.w),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: previewWidth ?? 88.w,
|
width: width,
|
||||||
height: previewHeight ?? 58.w,
|
height: width * 0.66,
|
||||||
child: SCDataCardResourceView(
|
child: SCDataCardResourceView(
|
||||||
resource: res.propsResources,
|
resource: res.propsResources,
|
||||||
fit: previewFit,
|
fit: previewFit,
|
||||||
@ -238,8 +256,8 @@ class SCStoreGridItemCard extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
case SCStoreItemPreviewKind.resource:
|
case SCStoreItemPreviewKind.resource:
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: previewWidth ?? 72.w,
|
width: screenSize.width * 0.86,
|
||||||
height: previewHeight ?? 62.w,
|
height: screenSize.height * 0.42,
|
||||||
child: SCDataCardResourceView(
|
child: SCDataCardResourceView(
|
||||||
resource: res.propsResources,
|
resource: res.propsResources,
|
||||||
fit: previewFit,
|
fit: previewFit,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user