show static method
void
show(
- BuildContext context, {
- required List<
Widget> widgets, - required List<
GlobalKey< keys,State< >StatefulWidget> > - required DataModel data,
- required String targetIdentifier,
Implementation
static void show(
BuildContext context, {
required List<Widget> widgets,
required List<GlobalKey> keys,
required DataModel data,
required String targetIdentifier,
}) {
List<StepModel> steps = data.steps;
List<TargetFocus> targets = [];
for (int i = 0; i < keys.length; i++) {
String position = steps[i].position.toString();
targets.add(
TargetFocus(
shape: steps[i].shape.toString().toLowerCase() == "circle"
? ShapeLightFocus.Circle
: ShapeLightFocus.RRect,
identify: targetIdentifier + i.toString(),
keyTarget: keys[i],
alignSkip: position.toString() == "bottom" ||
position.toString() == "bottom-right" ||
position.toString() == "bottom-left"
? Alignment.bottomRight
: position.toString() == "top" ||
position.toString() == "top-right" ||
position.toString() == "top-left"
? Alignment.topRight
: position.toString() == "left"
? Alignment.topRight
: position.toString() == "right"
? Alignment.topLeft
: Alignment.topRight,
enableOverlayTab: true,
contents: [
TargetContent(
padding: EdgeInsets.zero,
customPosition: getCustomPosition(position.toString(), keys[i]),
align: position.toString() == "bottom" ||
position.toString() == "bottom-right" ||
position.toString() == "bottom-left"
? ContentAlign.bottom
: position.toString() == "top" ||
position.toString() == "top-right" ||
position.toString() == "top-left"
? ContentAlign.top
: position.toString() == "left"
? ContentAlign.left
: position.toString() == "right"
? ContentAlign.right
: ContentAlign.custom,
builder: (context, coachMarkController) {
return widgets[i];
},
),
],
),
);
}
initTutorialCoachMark(targets);
tutorialCoachMark.show(context: context);
// switch (data.type) {
// case "material":
// break;
// case "fancy":
// break;
// }
}