mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-30 18:32:34 +01:00
38 lines
849 B
Dart
38 lines
849 B
Dart
//@dart=2.12
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:fluffychat/utils/platform_infos.dart';
|
|
|
|
class AdaptiveFlatButton extends StatelessWidget {
|
|
final String label;
|
|
final Color? textColor;
|
|
final void Function()? onPressed;
|
|
|
|
const AdaptiveFlatButton({
|
|
Key? key,
|
|
required this.label,
|
|
this.textColor,
|
|
this.onPressed,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (PlatformInfos.isCupertinoStyle) {
|
|
return CupertinoDialogAction(
|
|
onPressed: onPressed,
|
|
textStyle: textColor != null ? TextStyle(color: textColor) : null,
|
|
child: Text(label),
|
|
);
|
|
}
|
|
return TextButton(
|
|
onPressed: onPressed,
|
|
child: Text(
|
|
label,
|
|
style: TextStyle(color: textColor),
|
|
),
|
|
);
|
|
}
|
|
}
|