feat(client): 切页滑动过渡 + 二级屏返回手势方向修正 + 授权三格横排
- 窄屏切页加方向感知滑入过渡(240ms easeOutCubic + 渐显):tab 间按左右 次序、进二级屏从右滑入、返回从左滑入;桌面无动画。控制器在 initState 创建(惰性 late 到 dispose 才求值会在已卸载树上找 Ticker 崩溃) - 二级屏返回手势方向修正:从左往右滑=退出(iOS 返回习惯),向左滑无响应 - 授权信息三格(状态/到期日/剩余天数)窄屏改横排:间距收窄 + FittedBox 缩放值文本防溢出,桌面不变 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -86,22 +86,16 @@ class _LicensePanelState extends ConsumerState<LicensePanel> {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
// ── 卡1:授权信息(3 cell,自「关于我们」迁入)──
|
||||
// ── 卡1:授权信息(3 cell 横排,窄屏同样横排、间距收窄)──
|
||||
SettingsCard(
|
||||
title: '授权信息',
|
||||
desc: '当前门店的授权状态与有效期,续期时长在现有到期时间上叠加',
|
||||
child: context.isMobile
|
||||
? Column(children: [
|
||||
for (final c in licCells)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 10), child: c),
|
||||
])
|
||||
: Row(children: [
|
||||
for (var i = 0; i < licCells.length; i++) ...[
|
||||
if (i > 0) const SizedBox(width: 14),
|
||||
Expanded(child: licCells[i]),
|
||||
],
|
||||
]),
|
||||
child: Row(children: [
|
||||
for (var i = 0; i < licCells.length; i++) ...[
|
||||
if (i > 0) SizedBox(width: context.isMobile ? 8 : 14),
|
||||
Expanded(child: licCells[i]),
|
||||
],
|
||||
]),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// ── 卡2:在线购买 / 续费(后端 purchase 接口 admin only,
|
||||
@@ -189,7 +183,10 @@ class _LicensePanelState extends ConsumerState<LicensePanel> {
|
||||
/// 原型 .lic-cell(与「关于我们」同款):lk 11 muted + lv 17/700/mono。
|
||||
Widget _licCell(dynamic t, String label, String value, {Color? color}) =>
|
||||
Container(
|
||||
padding: const EdgeInsets.fromLTRB(16, 14, 16, 14),
|
||||
// 窄屏三格横排时收窄内距,值文本按格宽缩放防溢出(如 2026-06-25)
|
||||
padding: context.isMobile
|
||||
? const EdgeInsets.fromLTRB(10, 12, 10, 12)
|
||||
: const EdgeInsets.fromLTRB(16, 14, 16, 14),
|
||||
decoration: BoxDecoration(
|
||||
color: t.bg,
|
||||
border: Border.all(color: t.borderSubtle),
|
||||
@@ -199,15 +196,21 @@ class _LicensePanelState extends ConsumerState<LicensePanel> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: AppDims.fsXs, color: t.muted)),
|
||||
const SizedBox(height: 6),
|
||||
Text(value,
|
||||
style: TextStyle(
|
||||
fontSize: AppDims.fsH2,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontFamily: AppFonts.mono,
|
||||
fontFamilyFallback: AppFonts.monoFallback,
|
||||
color: color ?? t.heading)),
|
||||
FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(value,
|
||||
style: TextStyle(
|
||||
fontSize: AppDims.fsH2,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontFamily: AppFonts.mono,
|
||||
fontFamilyFallback: AppFonts.monoFallback,
|
||||
color: color ?? t.heading)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -130,11 +130,58 @@ class AppShell extends ConsumerStatefulWidget {
|
||||
ConsumerState<AppShell> createState() => _AppShellState();
|
||||
}
|
||||
|
||||
class _AppShellState extends ConsumerState<AppShell> {
|
||||
class _AppShellState extends ConsumerState<AppShell>
|
||||
with SingleTickerProviderStateMixin {
|
||||
final String _loginTime = DateFormat('HH:mm:ss').format(AppStatusBar.clock());
|
||||
bool _forceDialogShown = false;
|
||||
bool _licenseDialogShown = false;
|
||||
|
||||
// ── 窄屏切页滑动过渡:方向感知的一次性滑入(tab 按左右序、进二级从右、返回从左)──
|
||||
// 注意:必须在 initState 创建(惰性 late 若到 dispose 才首次求值,会在已卸载
|
||||
// 的树上找 TickerMode 而崩溃——桌面路径全程不触碰该控制器)。
|
||||
late final AnimationController _slideCtrl;
|
||||
double _slideFrom = 1; // 1=从右滑入,-1=从左滑入
|
||||
String _prevLocation = '';
|
||||
int _prevBranch = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_slideCtrl = AnimationController(
|
||||
vsync: this, duration: const Duration(milliseconds: 240), value: 1);
|
||||
_prevLocation = widget.location;
|
||||
_prevBranch = widget.navigationShell.currentIndex;
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(AppShell old) {
|
||||
super.didUpdateWidget(old);
|
||||
if (widget.location == _prevLocation) return;
|
||||
final oldRoot = _tabRoots.contains(_prevLocation);
|
||||
final newRoot = _tabRoots.contains(widget.location);
|
||||
if (oldRoot && newRoot) {
|
||||
// tab 间切换:按 tab 左右次序定方向
|
||||
final oldPos = _tabForBranch(_prevBranch);
|
||||
final newPos = _tabForBranch(widget.navigationShell.currentIndex);
|
||||
_slideFrom = newPos >= oldPos ? 1 : -1;
|
||||
} else if (newRoot) {
|
||||
_slideFrom = -1; // 退出二级屏 → 从左滑入
|
||||
} else {
|
||||
_slideFrom = 1; // 进入二级屏/更深页 → 从右滑入
|
||||
}
|
||||
_prevLocation = widget.location;
|
||||
_prevBranch = widget.navigationShell.currentIndex;
|
||||
if (MediaQuery.sizeOf(context).width < 600) {
|
||||
_slideCtrl.forward(from: 0);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_slideCtrl.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/// 打开账号菜单(个人设置 / 退出登录)。[anchorContext] = 用户区组件的 context,
|
||||
/// 据其实测宽度让菜单等宽(不溢出内容区)、据其位置把菜单**完整弹到按钮正上方**
|
||||
/// (留 8px 间隙,不遮挡触发器,对齐原型)。
|
||||
@@ -225,8 +272,9 @@ class _AppShellState extends ConsumerState<AppShell> {
|
||||
final isTabRoot = _tabRoots.contains(widget.location);
|
||||
|
||||
// 窄屏横滑手势(2026-07-04 拍板):tab 根左右滑切换相邻 tab(不循环);
|
||||
// 二级屏左滑退出(回来源/我的),右滑无响应。内容区里的横向滚动
|
||||
//(分段 tab / 表格横滚)在手势竞技场中优先,互不冲突。
|
||||
// 二级屏从左往右滑退出(iOS 返回习惯,回来源/我的),向左滑无响应。
|
||||
// 内容区里的横向滚动(分段 tab / 表格横滚)在手势竞技场中优先,互不冲突。
|
||||
// 切页时按方向播放一次性滑入过渡(_slideCtrl,didUpdateWidget 触发)。
|
||||
Widget shellContent = widget.navigationShell;
|
||||
if (isMobile) {
|
||||
shellContent = GestureDetector(
|
||||
@@ -236,14 +284,29 @@ class _AppShellState extends ConsumerState<AppShell> {
|
||||
if (v.abs() < 200) return; // 轻微拖动不触发
|
||||
if (isTabRoot) {
|
||||
final pos = _tabForBranch(widget.navigationShell.currentIndex);
|
||||
final next = v < 0 ? pos + 1 : pos - 1; // 左滑→下一个 tab
|
||||
final next = v < 0 ? pos + 1 : pos - 1; // 向左滑→下一个 tab
|
||||
if (next < 0 || next >= _mobileTabs.length) return;
|
||||
_goBranch(_mobileTabs[next].$3);
|
||||
} else if (v < 0) {
|
||||
_backFromSecondary(); // 左滑退出;右滑无响应
|
||||
} else if (v > 0) {
|
||||
_backFromSecondary(); // 从左往右滑=退出;向左滑无响应
|
||||
}
|
||||
},
|
||||
child: widget.navigationShell,
|
||||
child: AnimatedBuilder(
|
||||
animation: _slideCtrl,
|
||||
builder: (ctx, child) {
|
||||
final p =
|
||||
Curves.easeOutCubic.transform(_slideCtrl.value); // 0→1
|
||||
final w = MediaQuery.sizeOf(ctx).width;
|
||||
return Opacity(
|
||||
opacity: 0.4 + 0.6 * p,
|
||||
child: Transform.translate(
|
||||
offset: Offset(_slideFrom * 0.18 * w * (1 - p), 0),
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: widget.navigationShell,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user