41 lines
1.2 KiB
Dart
41 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:game_tracker/core/custom_theme.dart';
|
|
|
|
/// A button widget designed for quick creating matches in the [HomeView]
|
|
/// - [text]: The text to display on the button.
|
|
/// - [onPressed]: The callback to be invoked when the button is pressed.
|
|
class QuickCreateButton extends StatefulWidget {
|
|
const QuickCreateButton({
|
|
super.key,
|
|
required this.text,
|
|
required this.onPressed,
|
|
});
|
|
|
|
/// The text to display on the button.
|
|
final String text;
|
|
|
|
/// The callback to be invoked when the button is pressed.
|
|
final VoidCallback? onPressed;
|
|
|
|
@override
|
|
State<QuickCreateButton> createState() => _QuickCreateButtonState();
|
|
}
|
|
|
|
class _QuickCreateButtonState extends State<QuickCreateButton> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ElevatedButton(
|
|
onPressed: widget.onPressed,
|
|
style: ElevatedButton.styleFrom(
|
|
minimumSize: const Size(140, 45),
|
|
backgroundColor: CustomTheme.primaryColor,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
|
),
|
|
child: Text(
|
|
widget.text,
|
|
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
|
|
),
|
|
);
|
|
}
|
|
}
|