2

How would you implement in Flutter a guiding layer on top of an actual screen. Something like this:

enter image description here

Rémi Rousselet
  • 256,336
  • 79
  • 519
  • 432
Victor G
  • 399
  • 2
  • 12

3 Answers3

3

This is not trivial. Here are the required components:

First of all, you have to open a transparent full screen dialog. Alternatively you can directly create an Overlay, though I wouldn't recommend it.

To position the widgets in the overlay correctly, you can use CompositedTransformTarget and CompositedTransformFollower

https://docs.flutter.io/flutter/widgets/CompositedTransformTarget-class.html

boformer
  • 28,207
  • 10
  • 81
  • 66
1

This does not allow a simple answer.

You can use the Highlighter Coach Mark plugin by Marina Kuznetsova.

chemamolins
  • 19,400
  • 5
  • 54
  • 47
0

You can display it as a dialog with the Colors.black.withOpacity() property of the Material widget and have it inside of a GestureDetector so tapping anywhere on the screen will pop back:

static Future<Null> guideDialog(BuildContext context) async {
  return showDialog<Null>(
    context: context,
    builder: (BuildContext context) {
      return new GestureDetector(
        onTap: () {
          Navigator.of(context).pop();
        },
        child: Material(
          color: Colors.black.withOpacity(0.5),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Center(
                child: Text(
                  "(Tap anywhere to dismiss)",
                  style: TextStyle(color: Colors.white),
                ),
              ),
              //your other widgets to guide here 
            ],
          ),
        ),
      );
    },
  );
}
soupjake
  • 3,293
  • 3
  • 17
  • 32
  • The difficulty is about aligning the tips around the actual buttons. – Rémi Rousselet Nov 05 '18 at 12:31
  • Well yes and I can help with that if @Victor G gives more details on how they want it to look but "something like this" wasn't really much to go on. The solution I've provided gives them a template for a guide/walkthrough overlay which they can use to provide their own so I'm not sure why my answer is being downvoted. – soupjake Nov 05 '18 at 13:10
  • Because the shadow is not even necessary. It could be an arrow or such image: https://camo.githubusercontent.com/b84ab25a3c565a712b2d291c4053812d442c478e/68747470733a2f2f73746f726167652e676f6f676c65617069732e636f6d2f6d6174657269616c2d64657369676e2f7075626c6973682f6d6174657269616c5f765f31322f6173736574732f3042346b762d33755a62533171534738796131527562485252526b452f6578742d7061747465726e732d75736572656475636174696f6e2d30312d696e74726f6e6f77772e706e67 – Rémi Rousselet Nov 05 '18 at 13:24
  • But the example they've given does use a shadow so that's why I included it? Yes it could be like that image you provided but "something like this" wasn't much to go on and I've shown them how you could implement a guide/walkthrough overlay. – soupjake Nov 05 '18 at 13:31
  • Yes, I was looking for a more generic approach this is why I wasn't too specific. As the screenshot suggests there should some correspondence between the elements in the two layers (i.e. an arrow pointing to the target control) – Victor G Nov 05 '18 at 23:26