2022-08-01 10:38:22 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2022-08-16 15:06:56 +02:00
|
|
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
2022-08-06 23:35:35 +02:00
|
|
|
import 'package:revanced_manager/constants.dart';
|
2022-08-16 15:06:56 +02:00
|
|
|
import 'package:revanced_manager/theme.dart';
|
2022-08-01 10:38:22 +02:00
|
|
|
|
|
|
|
class PatchTextButton extends StatelessWidget {
|
|
|
|
final String text;
|
2022-08-18 16:33:33 +02:00
|
|
|
final Function() onPressed;
|
2022-08-01 10:38:22 +02:00
|
|
|
final Color borderColor;
|
|
|
|
final Color backgroundColor;
|
2022-09-01 12:16:14 +02:00
|
|
|
|
2022-08-01 10:38:22 +02:00
|
|
|
const PatchTextButton({
|
|
|
|
Key? key,
|
|
|
|
required this.text,
|
2022-08-18 16:33:33 +02:00
|
|
|
required this.onPressed,
|
2022-08-01 10:38:22 +02:00
|
|
|
this.borderColor = const Color(0xff7792BA),
|
|
|
|
this.backgroundColor = Colors.transparent,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return TextButton(
|
|
|
|
onPressed: onPressed,
|
2022-08-12 11:42:43 +02:00
|
|
|
style: Theme.of(context).textButtonTheme.style?.copyWith(
|
2022-08-16 15:06:56 +02:00
|
|
|
backgroundColor: MaterialStateProperty.all<Color?>(backgroundColor),
|
|
|
|
side: MaterialStateProperty.all<BorderSide>(
|
|
|
|
BorderSide(
|
|
|
|
color: borderColor,
|
|
|
|
width: 1,
|
2022-08-12 11:42:43 +02:00
|
|
|
),
|
|
|
|
),
|
2022-08-16 15:06:56 +02:00
|
|
|
padding: MaterialStateProperty.all<EdgeInsetsGeometry>(
|
|
|
|
const EdgeInsets.symmetric(
|
|
|
|
horizontal: 16,
|
|
|
|
vertical: 4,
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
child: I18nText(text,
|
|
|
|
child: Text(
|
|
|
|
'',
|
2022-08-19 15:04:40 +02:00
|
|
|
style: kInterTextStyle.copyWith(
|
2022-08-16 15:06:56 +02:00
|
|
|
color: backgroundColor == Colors.transparent
|
|
|
|
? const Color.fromRGBO(119, 146, 186, 1)
|
|
|
|
: isDark
|
|
|
|
? Colors.black
|
|
|
|
: Colors.white,
|
|
|
|
),
|
|
|
|
)),
|
2022-08-01 10:38:22 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|