revanced-manager/lib/ui/widgets/patch_text_button.dart

40 lines
1.1 KiB
Dart
Raw Normal View History

2022-08-01 10:38:22 +02:00
import 'package:flutter/material.dart';
2022-08-06 23:35:35 +02:00
import 'package:revanced_manager/constants.dart';
2022-08-01 10:38:22 +02:00
class PatchTextButton extends StatelessWidget {
final String text;
final Function()? onPressed;
final Color borderColor;
final Color backgroundColor;
const PatchTextButton({
Key? key,
required this.text,
this.onPressed,
this.borderColor = const Color(0xff7792BA),
this.backgroundColor = Colors.transparent,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return TextButton(
onPressed: onPressed,
style: Theme.of(context).textButtonTheme.style?.copyWith(
backgroundColor: MaterialStateProperty.all<Color?>(backgroundColor),
side: MaterialStateProperty.all<BorderSide>(
BorderSide(
color: borderColor,
width: 1,
),
),
),
2022-08-01 10:38:22 +02:00
child: Text(
text,
style: interTextStyle.copyWith(
color: backgroundColor == Colors.transparent
? const Color.fromRGBO(119, 146, 186, 1)
: Colors.white),
2022-08-01 10:38:22 +02:00
),
);
}
}