2
0
mirror of https://gitlab.com/famedly/fluffychat.git synced 2024-12-20 03:52:35 +01:00
fluffychat/lib/components/dialogs/adaptive_flat_button.dart
Christian Pauly 9e5fb7075d fix: Format
2020-12-08 15:55:42 +01:00

33 lines
770 B
Dart

import 'package:fluffychat/utils/platform_infos.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class AdaptiveFlatButton extends StatelessWidget {
final Widget child;
final Color textColor;
final Function onPressed;
const AdaptiveFlatButton({
Key key,
this.child,
this.textColor,
this.onPressed,
}) : super(key: key);
@override
Widget build(BuildContext context) {
if (PlatformInfos.isCupertinoStyle) {
return CupertinoDialogAction(
child: child,
onPressed: onPressed,
textStyle: textColor != null ? TextStyle(color: textColor) : null,
);
}
return FlatButton(
child: child,
textColor: textColor,
onPressed: onPressed,
);
}
}