60 lines
1.7 KiB
Dart
60 lines
1.7 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
||
|
|
|
||
|
|
import '../../core/theme/design_tokens.dart';
|
||
|
|
import 'app_loading_indicator.dart';
|
||
|
|
|
||
|
|
class AppPullRefreshFeedback extends StatelessWidget {
|
||
|
|
const AppPullRefreshFeedback({
|
||
|
|
super.key,
|
||
|
|
required this.visible,
|
||
|
|
this.label = '正在刷新',
|
||
|
|
this.margin = const EdgeInsets.only(top: AppSpacing.sm),
|
||
|
|
});
|
||
|
|
|
||
|
|
final bool visible;
|
||
|
|
final String label;
|
||
|
|
final EdgeInsetsGeometry margin;
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return IgnorePointer(
|
||
|
|
child: AnimatedOpacity(
|
||
|
|
opacity: visible ? 1 : 0,
|
||
|
|
duration: kThemeAnimationDuration,
|
||
|
|
curve: Curves.easeOut,
|
||
|
|
child: Container(
|
||
|
|
margin: margin,
|
||
|
|
padding: const EdgeInsets.symmetric(
|
||
|
|
horizontal: AppSpacing.md,
|
||
|
|
vertical: AppSpacing.xs,
|
||
|
|
),
|
||
|
|
decoration: BoxDecoration(
|
||
|
|
color: AppColors.white,
|
||
|
|
borderRadius: BorderRadius.circular(AppRadius.full),
|
||
|
|
border: Border.all(color: AppColors.borderSecondary),
|
||
|
|
),
|
||
|
|
child: Row(
|
||
|
|
mainAxisSize: MainAxisSize.min,
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||
|
|
children: [
|
||
|
|
const AppLoadingIndicator(
|
||
|
|
variant: AppLoadingVariant.inline,
|
||
|
|
color: AppColors.blue500,
|
||
|
|
trackColor: AppColors.blue100,
|
||
|
|
),
|
||
|
|
const SizedBox(width: AppSpacing.sm),
|
||
|
|
Text(
|
||
|
|
label,
|
||
|
|
style: Theme.of(context).textTheme.labelSmall?.copyWith(
|
||
|
|
color: AppColors.slate600,
|
||
|
|
fontWeight: FontWeight.w500,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|