Rain/lib/app/ui/widgets/button.dart

38 lines
933 B
Dart
Raw Normal View History

2023-06-17 20:57:57 +03:00
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class MyTextButton extends StatelessWidget {
const MyTextButton({
super.key,
required this.buttonName,
2023-07-14 20:19:43 +03:00
required this.onPressed,
2025-05-28 17:42:15 +03:00
this.height = 50.0,
2023-06-17 20:57:57 +03:00
});
2025-05-28 17:42:15 +03:00
2023-06-17 20:57:57 +03:00
final String buttonName;
2024-07-24 23:07:35 +03:00
final VoidCallback? onPressed;
2025-05-28 17:42:15 +03:00
final double height;
2023-06-17 20:57:57 +03:00
@override
Widget build(BuildContext context) {
2023-07-14 20:19:43 +03:00
return SizedBox(
2025-05-28 17:42:15 +03:00
height: height,
2023-07-14 20:19:43 +03:00
width: double.infinity,
child: ElevatedButton(
2025-05-28 17:42:15 +03:00
style: _buildButtonStyle(context),
2023-07-14 20:19:43 +03:00
onPressed: onPressed,
2025-03-15 23:40:48 +03:00
child: Text(buttonName, style: context.textTheme.titleMedium),
2023-06-17 20:57:57 +03:00
),
);
}
2025-05-28 17:42:15 +03:00
ButtonStyle _buildButtonStyle(BuildContext context) {
return ButtonStyle(
shadowColor: const WidgetStatePropertyAll(Colors.transparent),
backgroundColor: WidgetStatePropertyAll(
context.theme.colorScheme.secondaryContainer.withAlpha(80),
),
);
}
2023-06-17 20:57:57 +03:00
}