33 lines
910 B
Dart
33 lines
910 B
Dart
// SPDX-FileCopyrightText: (C) 2024 Matyáš Caras
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
// ignore_for_file: public_member_api_docs
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:prasule/pw/platformwidget.dart';
|
|
|
|
/// A [PlatformWidget] implementation of a text field
|
|
class PlatformButton extends PlatformWidget<TextButton, CupertinoButton> {
|
|
const PlatformButton({
|
|
required this.text,
|
|
required this.onPressed,
|
|
super.key,
|
|
this.style,
|
|
});
|
|
final String text;
|
|
final void Function()? onPressed;
|
|
final ButtonStyle? style;
|
|
|
|
@override
|
|
TextButton createAndroidWidget(BuildContext context) => TextButton(
|
|
onPressed: onPressed,
|
|
style: style,
|
|
child: Text(text),
|
|
);
|
|
|
|
@override
|
|
CupertinoButton createIosWidget(BuildContext context) =>
|
|
CupertinoButton(onPressed: onPressed, child: Text(text));
|
|
}
|