Nullable title throws error.
kyeshmz opened this issue · 2 comments
kyeshmz commented
Hi thanks for this nice package!
I was wondering what is the intention of a nullable title.
Currently, I have found an edge case where if we use this modal action with no title, it will return a null, which is not caught in the current code, as it expects to have a title.
Do we make title required? or something else?
I can make a PR, let me know.
class MaterialModalActionSheet<T> extends StatelessWidget {
const MaterialModalActionSheet({
super.key,
required this.onPressed,
required this.actions,
this.title,
this.message,
this.materialConfiguration,
this.onWillPop,
});
final ActionCallback<T> onPressed;
final List<SheetAction<T>> actions;
final String? title;
final String? message;
final MaterialModalActionSheetConfiguration? materialConfiguration;
final WillPopCallback? onWillPop;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final colorScheme = theme.colorScheme;
final title = this.title;
final message = this.message;
final materialConfiguration = this.materialConfiguration;
final children = [
if (title != null && message == null)
ListTile(
title: Text(title),
dense: true,
),
if (message != null) ...[
ListTile(
title: Text(title!),
subtitle: Text(message),
),
mono0926 commented
Thanks, fixed: https://pub.dev/packages/adaptive_dialog/changelog#183
It shouldn't throw any errors 🐶
kyeshmz commented
Quick fix! Thank you!