fix for resend, cooldown and a few small fixes
This commit is contained in:
48
frontend/pweb/lib/widgets/resend_link.dart
Normal file
48
frontend/pweb/lib/widgets/resend_link.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class ResendLink extends StatelessWidget {
|
||||
final String label;
|
||||
final VoidCallback onPressed;
|
||||
final bool isDisabled;
|
||||
final bool isLoading;
|
||||
|
||||
const ResendLink({
|
||||
super.key,
|
||||
required this.label,
|
||||
required this.onPressed,
|
||||
this.isDisabled = false,
|
||||
this.isLoading = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final color = theme.colorScheme.primary;
|
||||
final isButtonDisabled = isDisabled || isLoading;
|
||||
|
||||
return TextButton(
|
||||
onPressed: isButtonDisabled ? null : onPressed,
|
||||
style: TextButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: const Size(0, 0),
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
alignment: Alignment.centerLeft,
|
||||
foregroundColor: color,
|
||||
textStyle: theme.textTheme.bodyMedium?.copyWith(
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
child: isLoading
|
||||
? SizedBox(
|
||||
width: 16,
|
||||
height: 16,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: color,
|
||||
),
|
||||
)
|
||||
: Text(label),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user