42 lines
1.0 KiB
Dart
42 lines
1.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_passvault/view_pages/hex_color.dart';
|
|
|
|
class ReusableButton extends StatefulWidget {
|
|
final String text;
|
|
final VoidCallback onPressed;
|
|
final Color color;
|
|
final Color textColor;
|
|
final bool isRounded;
|
|
|
|
ReusableButton({
|
|
required this.text,
|
|
required this.onPressed,
|
|
required this.color,
|
|
this.textColor = Colors.white,
|
|
this.isRounded = true,
|
|
});
|
|
|
|
@override
|
|
State<ReusableButton> createState() => _ReusableButtonState();
|
|
}
|
|
|
|
class _ReusableButtonState extends State<ReusableButton> {
|
|
Color color1 = HexColor("2a47a5");
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ElevatedButton(
|
|
onPressed: widget.onPressed,
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: widget.color.withOpacity(0.9),
|
|
shape: widget.isRounded
|
|
? const StadiumBorder()
|
|
: const RoundedRectangleBorder()),
|
|
child: Text(
|
|
widget.text,
|
|
style: TextStyle(color: widget.textColor),
|
|
),
|
|
);
|
|
}
|
|
}
|