prasule/lib/pw/platformbutton.dart

23 lines
701 B
Dart
Raw Normal View History

2023-09-08 11:50:21 +02:00
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:prasule/pw/platformwidget.dart';
class PlatformButton extends PlatformWidget<TextButton, CupertinoButton> {
final String text;
final void Function()? onPressed;
2023-12-25 19:54:30 +01:00
final ButtonStyle? style;
2023-09-08 11:50:21 +02:00
const PlatformButton(
2023-12-25 19:54:30 +01:00
{super.key, required this.text, required this.onPressed, this.style});
2023-09-08 11:50:21 +02:00
@override
2023-12-25 19:54:30 +01:00
TextButton createAndroidWidget(BuildContext context) => TextButton(
onPressed: onPressed,
style: style,
child: Text(text),
);
2023-09-08 11:50:21 +02:00
@override
CupertinoButton createIosWidget(BuildContext context) =>
CupertinoButton(onPressed: onPressed, child: Text(text));
}