50 lines
1.4 KiB
Dart
50 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
class CustomButton extends StatelessWidget {
|
|
final String text;
|
|
final VoidCallback onPressed;
|
|
final bool isLoading;
|
|
|
|
const CustomButton({
|
|
super.key,
|
|
this.isLoading = false,
|
|
required this.text,
|
|
required this.onPressed,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
width: double.infinity,
|
|
padding: EdgeInsets.symmetric(vertical:isLoading?0: 16, horizontal: 8),
|
|
child: ElevatedButton(
|
|
style: ElevatedButton.styleFrom(
|
|
foregroundColor: Colors.white,
|
|
backgroundColor: const Color(0xFF004791),
|
|
padding: EdgeInsets.symmetric(horizontal: 32, vertical:isLoading?0: 16),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(30),
|
|
),
|
|
),
|
|
onPressed: onPressed,
|
|
child: isLoading
|
|
? const CircularProgressIndicator(
|
|
strokeWidth: 1,color: Colors.white,
|
|
valueColor: AlwaysStoppedAnimation<Color>(Colors.blueGrey),
|
|
)
|
|
: Text(
|
|
text,
|
|
style: GoogleFonts.getFont(
|
|
'Roboto',
|
|
fontWeight: FontWeight.w400,
|
|
fontSize: 20,
|
|
height: 1,
|
|
letterSpacing: -0.2,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|