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 dialog
|
2023-09-08 11:50:21 +02:00
|
|
|
class PlatformDialog extends PlatformWidget<AlertDialog, CupertinoAlertDialog> {
|
2023-12-29 21:39:54 +01:00
|
|
|
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,
|
|
|
|
);
|
|
|
|
}
|