logo和名称替换
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgmj/hj_model/splash/domain_source_model.dart';
|
||||
import 'package:hgmj/hj_page/main_page/provider/msg_provider.dart';
|
||||
import 'package:hgmj/hj_page/mine/mine_vip/mine_charge_vip_page.dart';
|
||||
import 'package:hgmj/hj_page/mine/mine_vip/pay_order_source.dart';
|
||||
import 'package:hgmj/tools_base/widget/net_image_widget.dart';
|
||||
import 'package:wydj/hj_model/splash/domain_source_model.dart';
|
||||
import 'package:wydj/hj_page/main_page/provider/msg_provider.dart';
|
||||
import 'package:wydj/hj_page/mine/mine_vip/mine_charge_vip_page.dart';
|
||||
import 'package:wydj/hj_page/mine/mine_vip/pay_order_source.dart';
|
||||
import 'package:wydj/tools_base/widget/net_image_widget.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../tools_base/widget/card_swiper/src/swiper.dart';
|
||||
@@ -31,14 +31,17 @@ class HomeActivityFloat extends StatelessWidget {
|
||||
//预售浮窗:展示判断走项目统一的 canShowEnter,点击进预售页(入口图/动画由 PreSaleEntry 内部处理)
|
||||
if (presale.canShowEnter) const PreSaleEntry(),
|
||||
//支付分层浮窗:有 homePageFlot 图就展示
|
||||
if ((tier?.homePageFlot ?? '').isNotEmpty) _LayeredFloatView(config: tier!),
|
||||
if ((tier?.homePageFlot ?? '').isNotEmpty)
|
||||
_LayeredFloatView(config: tier!),
|
||||
];
|
||||
if (floats.isEmpty) return const SizedBox();
|
||||
|
||||
// 单个直接贴右下角;预售 + 分层并存则轮播
|
||||
return KeyedSubtree(
|
||||
key: homeFloatKey,
|
||||
child: floats.length == 1 ? Align(alignment: Alignment.bottomRight, child: floats.first) : _FloatCarousel(items: floats),
|
||||
child: floats.length == 1
|
||||
? Align(alignment: Alignment.bottomRight, child: floats.first)
|
||||
: _FloatCarousel(items: floats),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -57,7 +60,8 @@ class _LayeredFloatView extends StatelessWidget {
|
||||
return InkWell(
|
||||
enableFeedback: false,
|
||||
//点击跳会员中心,vipID 让其自动选中对应卡
|
||||
onTap: () => Get.to(() => MineChargeVipPage(vipID: config.vipCard, sourcePage: PaySourcePage.homeFloatWindow)),
|
||||
onTap: () => Get.to(() => MineChargeVipPage(
|
||||
vipID: config.vipCard, sourcePage: PaySourcePage.homeFloatWindow)),
|
||||
child: SizedBox(
|
||||
width: 60,
|
||||
height: 66,
|
||||
@@ -65,7 +69,10 @@ class _LayeredFloatView extends StatelessWidget {
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
//分层海报图(后端加密图)
|
||||
NetworkImageLoader(imageUrl: config.homePageFlot ?? '', fit: BoxFit.fill, borderRadius: 0),
|
||||
NetworkImageLoader(
|
||||
imageUrl: config.homePageFlot ?? '',
|
||||
fit: BoxFit.fill,
|
||||
borderRadius: 0),
|
||||
//倒计时文字:监听 tick 每秒刷新(过期自动收起),框由后端图自带,位置不对就调 bottom
|
||||
Positioned(
|
||||
left: 0,
|
||||
@@ -77,7 +84,10 @@ class _LayeredFloatView extends StatelessWidget {
|
||||
? Center(
|
||||
child: Text(
|
||||
'${config.discountHour}:${config.discountMin}:${config.discountSec}',
|
||||
style: const TextStyle(color: Colors.white, fontSize: 8.5, fontWeight: FontWeight.w600),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 8.5,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
@@ -108,7 +118,8 @@ class _FloatCarousel extends StatelessWidget {
|
||||
autoplayDelay: 4000,
|
||||
loop: true,
|
||||
itemCount: items.length,
|
||||
itemBuilder: (_, index) => Align(alignment: Alignment.bottomRight, child: items[index]),
|
||||
itemBuilder: (_, index) =>
|
||||
Align(alignment: Alignment.bottomRight, child: items[index]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hgmj/hj_utils/date_time_util.dart';
|
||||
import 'package:wydj/hj_utils/date_time_util.dart';
|
||||
|
||||
import '../../../config/config.dart';
|
||||
import '../../../hj_model/splash/domain_source_model.dart';
|
||||
@@ -82,7 +82,8 @@ class _HomeFloatBannerState extends State<HomeFloatBanner> {
|
||||
_timer?.cancel();
|
||||
_timer = null;
|
||||
if (_isCountdownActivity) {
|
||||
_timer = Timer.periodic(const Duration(seconds: 1), (_) => _onTimerTick());
|
||||
_timer =
|
||||
Timer.periodic(const Duration(seconds: 1), (_) => _onTimerTick());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +107,8 @@ class _HomeFloatBannerState extends State<HomeFloatBanner> {
|
||||
final start = _parseDate(_banner.startAt);
|
||||
_bottomText.value = switch (_activityStatus()) {
|
||||
_ActStatus.inProgress => '立即参与',
|
||||
_ActStatus.beforeStart => start == null ? '' : _formatCountdown(start.difference(DateTime.now())),
|
||||
_ActStatus.beforeStart =>
|
||||
start == null ? '' : _formatCountdown(start.difference(DateTime.now())),
|
||||
_ActStatus.ended => '',
|
||||
};
|
||||
}
|
||||
@@ -139,7 +141,8 @@ class _HomeFloatBannerState extends State<HomeFloatBanner> {
|
||||
|
||||
// 用新 banner 替换 Config.bannerJumps 里同位置同 id 的旧数据
|
||||
void _updateConfigBanner(BannerJumpEntity banner) {
|
||||
final index = Config.bannerJumps.indexWhere((e) => e.position == _banner.position && e.id == _banner.id);
|
||||
final index = Config.bannerJumps.indexWhere(
|
||||
(e) => e.position == _banner.position && e.id == _banner.id);
|
||||
if (index >= 0) {
|
||||
Config.bannerJumps[index] = banner;
|
||||
}
|
||||
@@ -147,12 +150,14 @@ class _HomeFloatBannerState extends State<HomeFloatBanner> {
|
||||
|
||||
// 活动结束且无下一场:从 Config.bannerJumps 移除当前 banner
|
||||
void _removeConfigBanner() {
|
||||
Config.bannerJumps.removeWhere((e) => e.position == _banner.position && e.id == _banner.id);
|
||||
Config.bannerJumps.removeWhere(
|
||||
(e) => e.position == _banner.position && e.id == _banner.id);
|
||||
}
|
||||
|
||||
// 解析后端时间字符串为本地时间;空值/占位(0001-01-01)/非法格式返回 null
|
||||
DateTime? _parseDate(String? date) {
|
||||
if (date == null || date.isEmpty || date.contains('0001-01-01')) return null;
|
||||
if (date == null || date.isEmpty || date.contains('0001-01-01'))
|
||||
return null;
|
||||
try {
|
||||
return DateTime.parse(date).toLocal();
|
||||
} catch (_) {
|
||||
@@ -174,7 +179,8 @@ class _HomeFloatBannerState extends State<HomeFloatBanner> {
|
||||
String _formatCountdown(Duration duration) {
|
||||
final seconds = duration.inSeconds < 0 ? 0 : duration.inSeconds;
|
||||
final days = seconds ~/ 86400;
|
||||
final time = DateTimeUtil.formatHMS(seconds % 86400, alwaysHour: true); // 当天内 HH:MM:SS
|
||||
final time = DateTimeUtil.formatHMS(seconds % 86400,
|
||||
alwaysHour: true); // 当天内 HH:MM:SS
|
||||
return days > 0 ? '$days天$time' : time;
|
||||
}
|
||||
|
||||
@@ -183,7 +189,8 @@ class _HomeFloatBannerState extends State<HomeFloatBanner> {
|
||||
return InkWell(
|
||||
enableFeedback: false,
|
||||
// 内链可配到会员/金币页,来源统一记首页浮窗
|
||||
onTap: () => pushToPageByLink(_banner.url, sourcePage: PaySourcePage.homeFloatWindow),
|
||||
onTap: () => pushToPageByLink(_banner.url,
|
||||
sourcePage: PaySourcePage.homeFloatWindow),
|
||||
child: SizedBox(
|
||||
width: widget.width,
|
||||
height: widget.height,
|
||||
|
||||
Reference in New Issue
Block a user