showInfoDialog static method
void
showInfoDialog(
- BuildContext context, {
- required GlobalKey<
State< key,StatefulWidget> > - required String shape,
- required String title,
- required String body,
- dynamic onOkPressed()?,
Implementation
static void showInfoDialog(BuildContext context,
{required GlobalKey key,
required String shape,
required String title,
required String body,
Function()? onOkPressed}) {
var isDarkTheme = Theme.of(context).brightness == Brightness.dark;
List<TargetFocus> targets = [];
targets.add(
TargetFocus(
shape: shape.toString().toLowerCase() == "rect"
? ShapeLightFocus.RRect
: ShapeLightFocus.Circle,
identify: "keyDialog",
keyTarget: key,
alignSkip: Alignment.topRight,
enableOverlayTab: true,
contents: [
TargetContent(
align: ContentAlign.bottom,
builder: (context, controller) {
return AlertDialog(
backgroundColor: isDarkTheme ? Colors.black : Colors.white,
title: Text(
title,
),
// backgroundColor: AppTheme.backgroundColor,
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Text(
body,
),
],
),
),
actions: <Widget>[
// TextButton(
// onPressed: () => Navigator.pop(context),
// child: const Text(
// 'Cancel',
// ),
// ),
TextButton(
onPressed: onOkPressed == null
? () {
tutorialCoachMark.finish();
}
: () {
tutorialCoachMark.finish();
onOkPressed();
},
child: const Text(
'OK',
),
),
],
);
},
),
],
),
);
PagePilot.initTutorialCoachMark(targets);
tutorialCoachMark.show(context: context);
}