Skip to content

Commit

Permalink
Add OverlaySupport.local descrption to README.md (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaMax committed Oct 4, 2023
1 parent 51b3655 commit 134575d
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,50 @@ class IosStyleToast extends StatelessWidget {
```

## Binding to BuildContext

overlay could be binded to BuildContext so it's not shown when we push another route above and is shown again when we pop it.

for it you should use OverlaySupport.local, wrap your screen with it and then use context which is under OverlaySupport.local to showOverlay

```dart OverlaySupport.local example
class OverlaySupportExample extends StatelessWidget {
const OverlaySupportExample({Key key}) : super(key: key);
@override
Widget build(BuildContext upperContext) {
return OverlaySupport.local(
child: Builder(builder: (context) {/// be sure you use this context and not upperContext
return Card(
margin: const EdgeInsets.symmetric(horizontal: 4),
child: SafeArea(
child: ListTile(
leading: SizedBox.fromSize(
size: const Size(40, 40),
child: ClipOval(child: Image.asset('assets/avatar.png'))),
title: Text('Lily MacDonald'),
subtitle: Text('Do you want to see a movie?'),
trailing: IconButton(
icon: Icon(Icons.reply),
onPressed: () {
showOverlayNotification(
context: context,
duration: Duration.zero,
(context) {
return Container();
},
);
},
),
),
),
);
}),
);
}
}
```

## End

if you have some suggestion or advice, please open an issue to let me known.
Expand Down

0 comments on commit 134575d

Please sign in to comment.