prasule/lib/pw/platformdialog.dart

29 lines
901 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 PlatformDialog extends PlatformWidget<AlertDialog, CupertinoAlertDialog> {
final String title;
final Widget? content;
final List<Widget> actions;
const PlatformDialog(
{super.key, required this.title, this.content, this.actions = const []});
@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,
);
}