prasule/lib/pw/platformdialog.dart

32 lines
996 B
Dart
Raw Normal View History

// 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';
/// A [PlatformWidget] implementation of a dialog
2023-09-08 11:50:21 +02:00
class PlatformDialog extends PlatformWidget<AlertDialog, CupertinoAlertDialog> {
const PlatformDialog(
{required this.title, super.key, this.content, this.actions = const [],});
2023-09-08 11:50:21 +02:00
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,
);
}