2023-12-29 21:39:54 +01:00
|
|
|
// ignore_for_file: public_member_api_docs
|
|
|
|
|
2023-09-08 11:50:21 +02:00
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:prasule/pw/platformwidget.dart';
|
|
|
|
|
2023-12-29 21:39:54 +01:00
|
|
|
/// A [PlatformWidget] implementation of a text field
|
2023-09-08 11:50:21 +02:00
|
|
|
class PlatformButton extends PlatformWidget<TextButton, CupertinoButton> {
|
2023-12-29 21:39:54 +01:00
|
|
|
const PlatformButton({
|
|
|
|
required this.text,
|
|
|
|
required this.onPressed,
|
|
|
|
super.key,
|
|
|
|
this.style,
|
|
|
|
});
|
2023-09-08 11:50:21 +02:00
|
|
|
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
|
|
|
|
|
|
|
@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));
|
|
|
|
}
|