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.
32 lines
769 B
Dart
32 lines
769 B
Dart
5 years ago
|
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,
|
||
|
);
|
||
|
}
|
||
|
}
|