45 lines
1.2 KiB
Dart
45 lines
1.2 KiB
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../../globals.dart';
|
|
|
|
class ReflexButton extends StatelessWidget implements PreferredSizeWidget {
|
|
final Function()? onPressed;
|
|
final String text;
|
|
final bool? isFullWidth;
|
|
final Color? color;
|
|
final Color? textColor;
|
|
|
|
const ReflexButton(
|
|
{Key? key,
|
|
this.onPressed,
|
|
required this.text,
|
|
this.isFullWidth,
|
|
this.color,
|
|
this.textColor})
|
|
: super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ElevatedButton(
|
|
style: ElevatedButton.styleFrom(
|
|
minimumSize: isFullWidth == true
|
|
? const Size.fromHeight(36)
|
|
: const Size(0, 36),
|
|
backgroundColor: color ?? Globals.RP_PRIMARY_COLOR,
|
|
foregroundColor: textColor ?? Colors.white,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(5.0),
|
|
),
|
|
),
|
|
onPressed: onPressed,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Text(text),
|
|
));
|
|
}
|
|
|
|
@override
|
|
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
|
}
|