prasule/lib/pw/platformdialog.dart
2023-12-29 21:39:54 +01:00

31 lines
996 B
Dart

// 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 dialog
class PlatformDialog extends PlatformWidget<AlertDialog, CupertinoAlertDialog> {
const PlatformDialog(
{required this.title, super.key, this.content, this.actions = const [],});
final String title;
final Widget? content;
final List<Widget> actions;
@override
AlertDialog createAndroidWidget(BuildContext context) => AlertDialog(
title: Text(title),
content:
(content != null) ? SingleChildScrollView(child: content) : null,
actions: actions,
);
@override
CupertinoAlertDialog createIosWidget(BuildContext context) =>
CupertinoAlertDialog(
title: Text(title),
content:
(content != null) ? SingleChildScrollView(child: content) : null,
actions: actions,
);
}