logo和名称替换
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hgmj/assets_tool/images.dart';
|
||||
import 'package:hgmj/tools_base/refresh/pull_refresh.dart'; // 复用 CustomRefreshView 的手感调优
|
||||
import 'package:wydj/assets_tool/images.dart';
|
||||
import 'package:wydj/tools_base/refresh/pull_refresh.dart'; // 复用 CustomRefreshView 的手感调优
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
|
||||
/// 横向列表"拉到底查看更多"组件(手感同上拉加载更多,只是横向)。
|
||||
@@ -37,7 +37,8 @@ class HorizontalLoadMore extends StatefulWidget {
|
||||
|
||||
class _HorizontalLoadMoreState extends State<HorizontalLoadMore> {
|
||||
final RefreshController _refreshCtr = RefreshController();
|
||||
final ValueNotifier<bool> _armed = ValueNotifier(false); // 当前过拉是否已过阈值(驱动 footer 文案 + 触发判定)
|
||||
final ValueNotifier<bool> _armed =
|
||||
ValueNotifier(false); // 当前过拉是否已过阈值(驱动 footer 文案 + 触发判定)
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
@@ -49,7 +50,8 @@ class _HorizontalLoadMoreState extends State<HorizontalLoadMore> {
|
||||
// 拖动中持续更新是否已过阈值(公式同 SmartRefresher footer 的 offset 计算)
|
||||
bool _onScroll(ScrollNotification n) {
|
||||
if (n.metrics.axis != Axis.horizontal) return false;
|
||||
final double overscroll = n.metrics.pixels - n.metrics.maxScrollExtent; // 拉过末尾的距离
|
||||
final double overscroll =
|
||||
n.metrics.pixels - n.metrics.maxScrollExtent; // 拉过末尾的距离
|
||||
_armed.value = overscroll >= widget.triggerDistance;
|
||||
return false;
|
||||
}
|
||||
@@ -92,7 +94,8 @@ class _HorizontalLoadMoreState extends State<HorizontalLoadMore> {
|
||||
builder: (_, armed, ___) => _footer(armed),
|
||||
),
|
||||
),
|
||||
onLoading: () => _refreshCtr.loadComplete(), // 触发已由指针事件把关,这里只复位 footer
|
||||
onLoading: () =>
|
||||
_refreshCtr.loadComplete(), // 触发已由指针事件把关,这里只复位 footer
|
||||
child: widget.child,
|
||||
),
|
||||
),
|
||||
@@ -112,13 +115,15 @@ class _HorizontalLoadMoreState extends State<HorizontalLoadMore> {
|
||||
AnimatedRotation(
|
||||
turns: armed ? 0.5 : 0,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: Image.asset("arrow_right_grey.webp".commonImgPath, width: 18),
|
||||
child:
|
||||
Image.asset("arrow_right_grey.webp".commonImgPath, width: 18),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
armed ? widget.releaseText : widget.idleText,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(color: Color(0x59FFFFFF), fontSize: 10, height: 1.3),
|
||||
style: const TextStyle(
|
||||
color: Color(0x59FFFFFF), fontSize: 10, height: 1.3),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -3,14 +3,15 @@ import 'dart:io';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hgmj/assets_tool/app_colors.dart';
|
||||
import 'package:wydj/assets_tool/app_colors.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
|
||||
// 回弹弹簧:临界阻尼(≈2√(stiffness·mass)=34.6) → 松手快速收回不过冲
|
||||
// 注:实测此调优手感优于 3.16.8 包默认(mass2.2/stiffness150/damping16,欠阻尼、回弹更夸张),
|
||||
// 故采用这套调优值,不复刻 3.16.8 原值
|
||||
// 提成常量供横向的 HorizontalLoadMore 复用,两处手感必须一致,改这里即全改
|
||||
const SpringDescription kRefreshSpring = SpringDescription(mass: 1.5, stiffness: 200, damping: 35);
|
||||
const SpringDescription kRefreshSpring =
|
||||
SpringDescription(mass: 1.5, stiffness: 200, damping: 35);
|
||||
const double kRefreshDragSpeedRatio = 0.91;
|
||||
|
||||
Widget pullYsRefresh({
|
||||
@@ -106,14 +107,19 @@ class _CustomIRefreshViewState extends State<CustomRefreshView> {
|
||||
WaterDropHeader(
|
||||
waterDropColor: AppColors.actionRed,
|
||||
// iOS 刷新菊花用主题色;Android 保持默认 loading
|
||||
refresh: Platform.isIOS ? const CupertinoActivityIndicator(color: AppColors.actionRed) : null,
|
||||
refresh: Platform.isIOS
|
||||
? const CupertinoActivityIndicator(
|
||||
color: AppColors.actionRed)
|
||||
: null,
|
||||
complete: const Text(
|
||||
"刷新完成!",
|
||||
style: TextStyle(color: AppColors.tipTextColor99, fontSize: 12),
|
||||
style: TextStyle(
|
||||
color: AppColors.tipTextColor99, fontSize: 12),
|
||||
),
|
||||
failed: const Text(
|
||||
"刷新失敗!",
|
||||
style: TextStyle(color: AppColors.tipTextColor99, fontSize: 12),
|
||||
style: TextStyle(
|
||||
color: AppColors.tipTextColor99, fontSize: 12),
|
||||
),
|
||||
),
|
||||
footer: widget.footerHeader ??
|
||||
@@ -130,7 +136,8 @@ class _CustomIRefreshViewState extends State<CustomRefreshView> {
|
||||
? const CupertinoActivityIndicator()
|
||||
: const CircularProgressIndicator(
|
||||
strokeWidth: 2.0,
|
||||
valueColor: AlwaysStoppedAnimation(AppColors.actionRed),
|
||||
valueColor:
|
||||
AlwaysStoppedAnimation(AppColors.actionRed),
|
||||
),
|
||||
),
|
||||
textStyle: TextStyle(
|
||||
|
||||
Reference in New Issue
Block a user