tasktracker/lib/widgets/oauth_button.dart
2025-10-07 21:54:06 +05:30

67 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class OAuthButton extends StatelessWidget {
final String provider;
final IconData icon;
final VoidCallback onPressed;
const OAuthButton({
super.key,
required this.provider,
required this.icon,
required this.onPressed,
});
Color _getProviderColor() {
switch (provider.toLowerCase()) {
case 'google':
return const Color(0xFF4285F4);
case 'facebook':
return const Color(0xFF1877F2);
case 'github':
return const Color(0xFF333333);
default:
return Colors.grey[600]!;
}
}
@override
Widget build(BuildContext context) {
return OutlinedButton(
onPressed: onPressed,
style: OutlinedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 16),
side: BorderSide(
color: Colors.grey[300]!,
width: 1.5,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
backgroundColor: Colors.white,
foregroundColor: _getProviderColor(),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
icon,
size: 24,
color: _getProviderColor(),
),
const SizedBox(width: 12),
Text(
'Continue with $provider',
style: GoogleFonts.poppins(
fontSize: 16,
fontWeight: FontWeight.w600,
color: _getProviderColor(),
),
),
],
),
);
}
}