generateSecondaryButton static method
String
generateSecondaryButton(
)
Implementation
static String generateSecondaryButton() {
return '''
import 'package:flutter/material.dart';
class SecondaryButton extends StatelessWidget {
final String text;
final VoidCallback? onPressed;
final IconData? icon;
final double? width;
final double height;
final bool isFullWidth;
const SecondaryButton({
Key? key,
required this.text,
this.onPressed,
this.icon,
this.width,
this.height = 56,
this.isFullWidth = false,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return SizedBox(
width: isFullWidth ? double.infinity : width,
height: height,
child: OutlinedButton(
onPressed: onPressed,
style: OutlinedButton.styleFrom(
side: BorderSide(
color: theme.colorScheme.primary,
width: 1.5,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (icon != null) ...[
Icon(icon, size: 20),
const SizedBox(width: 8),
],
Text(
text,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: 0.5,
),
),
],
),
),
);
}
}
''';
}