You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
825 B
Dart
35 lines
825 B
Dart
4 years ago
|
import 'package:fluffychat/utils/platform_infos.dart';
|
||
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
class AdaptiveFlatButton extends StatelessWidget {
|
||
4 years ago
|
final String label;
|
||
4 years ago
|
final Color textColor;
|
||
|
final Function onPressed;
|
||
|
|
||
|
const AdaptiveFlatButton({
|
||
|
Key key,
|
||
4 years ago
|
@required this.label,
|
||
4 years ago
|
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,
|
||
4 years ago
|
child: Text(label),
|
||
4 years ago
|
);
|
||
|
}
|
||
4 years ago
|
return TextButton(
|
||
4 years ago
|
onPressed: onPressed,
|
||
4 years ago
|
child: Text(
|
||
|
label,
|
||
|
style: TextStyle(color: textColor),
|
||
|
),
|
||
4 years ago
|
);
|
||
|
}
|
||
4 years ago
|
}
|