makeInformDialog function
Implementation
SimpleDialog makeInformDialog({
required BuildContext context,
required String title,
Widget? child,
String? subtitle2,
String? buttonTitle,
bool negative = false,
bool subtitleCentered = true,
}) {
return SimpleDialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
backgroundColor: Theme.of(context).colorScheme.surface,
contentPadding: const EdgeInsets.all(16),
children: <Widget>[
Text(
title,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.titleLarge?.copyWith(
color: Theme.of(context).colorScheme.onSurface,
),
overflow: title.length > 400 ? TextOverflow.ellipsis : null,
maxLines: title.length > 400 ? 4 : null,
),
const SizedBox(height: 16.0),
if (subtitle2 != null) ...[
const SizedBox(height: 8.0),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Text(
subtitle2,
textAlign: subtitleCentered ? TextAlign.center : TextAlign.start,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Theme.of(context).colorScheme.onSurface,
),
),
),
const SizedBox(height: 24.0),
],
if (child != null)
Padding(
padding: const EdgeInsets.only(bottom: 24, right: 16, left: 16.0),
child: child,
),
DefaultButtonView(
borderRadius: 8.0,
title: buttonTitle ?? 'OK',
customBackgroundColor: negative
? Theme.of(context).colorScheme.error
: null,
callback: () {
Navigator.of(context).pop();
},
),
],
);
}