Files
social-app/apps/lib/shared/widgets/app_pull_refresh_feedback.dart
T

62 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
import '../../core/l10n/l10n.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) {
final resolvedLabel = label ?? context.l10n.commonRefreshing;
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(
resolvedLabel,
style: Theme.of(context).textTheme.labelSmall?.copyWith(
color: AppColors.slate600,
fontWeight: FontWeight.w500,
),
),
],
),
),
),
);
}
}