Skip to content

Commit 1f20db8

Browse files
feat: 🚀 created a showcaseView and overlay manager classes to handle showcaseView widget functionality independently (#518)
* feat: 🚀 created a showcaseView and overlay manager class to handle showcaseView widget functionality independently
1 parent ca32350 commit 1f20db8

34 files changed

+2045
-950
lines changed

README.md

Lines changed: 193 additions & 161 deletions
Large diffs are not rendered by default.

example/lib/detailscreen.dart

Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -11,107 +11,107 @@ class Detail extends StatefulWidget {
1111
class _DetailState extends State<Detail> {
1212
final GlobalKey _one = GlobalKey();
1313
BuildContext? myContext;
14+
final scopeName = "_detailsScreen";
1415

1516
@override
1617
void initState() {
1718
super.initState();
19+
// This is optional but if you need different configuration in
20+
// ShowcaseView then you can register new ShowcaseView
21+
ShowcaseView.register(scope: scopeName);
1822
WidgetsBinding.instance.addPostFrameCallback(
19-
(_) => Future.delayed(const Duration(milliseconds: 200), () {
20-
ShowCaseWidget.of(myContext!).startShowCase([_one]);
21-
}),
23+
(_) => ShowcaseView.getNamed(scopeName).startShowCase(
24+
[_one],
25+
delay: const Duration(milliseconds: 200),
26+
),
2227
);
2328
}
2429

2530
@override
2631
Widget build(BuildContext context) {
27-
return ShowCaseWidget(
28-
builder: (context) {
29-
myContext = context;
30-
return Scaffold(
31-
appBar: AppBar(
32-
backgroundColor: Colors.transparent,
33-
elevation: 0,
34-
leading: IconButton(
35-
icon: const Icon(
36-
Icons.arrow_back,
37-
color: Colors.black,
38-
),
39-
onPressed: () {
40-
Navigator.pop(context);
41-
},
42-
),
32+
return Scaffold(
33+
appBar: AppBar(
34+
backgroundColor: Colors.transparent,
35+
elevation: 0,
36+
leading: IconButton(
37+
icon: const Icon(
38+
Icons.arrow_back,
39+
color: Colors.black,
4340
),
44-
body: Padding(
45-
padding: const EdgeInsets.all(16),
46-
child: ListView(
47-
children: <Widget>[
48-
Showcase(
49-
key: _one,
50-
title: 'Title',
51-
description: 'Desc',
52-
child: InkWell(
53-
onTap: () {},
54-
child: const Text(
55-
'Flutter Notification',
56-
style: TextStyle(
57-
fontSize: 25,
58-
fontWeight: FontWeight.w600,
59-
),
60-
),
41+
onPressed: () {
42+
Navigator.pop(context);
43+
},
44+
),
45+
),
46+
body: Padding(
47+
padding: const EdgeInsets.all(16),
48+
child: ListView(
49+
children: <Widget>[
50+
Showcase(
51+
key: _one,
52+
title: 'Title',
53+
description: 'Desc',
54+
child: InkWell(
55+
onTap: () {},
56+
child: const Text(
57+
'Flutter Notification',
58+
style: TextStyle(
59+
fontSize: 25,
60+
fontWeight: FontWeight.w600,
6161
),
6262
),
63-
const SizedBox(
64-
height: 16,
65-
),
66-
const Text(
67-
'Hi, you have new Notification from flutter group, open '
68-
'slack and check it out',
69-
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
70-
),
71-
const SizedBox(
72-
height: 16,
63+
),
64+
),
65+
const SizedBox(
66+
height: 16,
67+
),
68+
const Text(
69+
'Hi, you have new Notification from flutter group, open '
70+
'slack and check it out',
71+
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
72+
),
73+
const SizedBox(
74+
height: 16,
75+
),
76+
RichText(
77+
text: const TextSpan(
78+
style: TextStyle(
79+
fontWeight: FontWeight.w400,
80+
color: Colors.black,
7381
),
74-
RichText(
75-
text: const TextSpan(
82+
children: [
83+
TextSpan(text: 'Hi team,\n\n'),
84+
TextSpan(
85+
text: 'As some of you know, we’re moving to Slack for '
86+
'our internal team communications. Slack is a '
87+
'messaging app where we can talk, share files, '
88+
'and work together. It also connects with tools '
89+
'we already use, like [add your examples here], '
90+
'plus 900+ other apps.\n\n',
91+
),
92+
TextSpan(
93+
text: 'Why are we moving to Slack?\n\n',
7694
style: TextStyle(
77-
fontWeight: FontWeight.w400,
95+
fontWeight: FontWeight.w600,
7896
color: Colors.black,
7997
),
80-
children: [
81-
TextSpan(text: 'Hi team,\n\n'),
82-
TextSpan(
83-
text: 'As some of you know, we’re moving to Slack for '
84-
'our internal team communications. Slack is a '
85-
'messaging app where we can talk, share files, '
86-
'and work together. It also connects with tools '
87-
'we already use, like [add your examples here], '
88-
'plus 900+ other apps.\n\n',
89-
),
90-
TextSpan(
91-
text: 'Why are we moving to Slack?\n\n',
92-
style: TextStyle(
93-
fontWeight: FontWeight.w600,
94-
color: Colors.black,
95-
),
96-
),
97-
TextSpan(
98-
text: 'We want to use the best communication tools to '
99-
'make our lives easier and be more productive. '
100-
'Having everything in one place will help us '
101-
'work together better and faster, rather than '
102-
'jumping around between emails, IMs, texts and '
103-
'a bunch of other programs. Everything you share '
104-
'in Slack is automatically indexed and archived, '
105-
'creating a searchable archive of all our work.',
106-
),
107-
],
10898
),
109-
),
110-
],
99+
TextSpan(
100+
text: 'We want to use the best communication tools to '
101+
'make our lives easier and be more productive. '
102+
'Having everything in one place will help us '
103+
'work together better and faster, rather than '
104+
'jumping around between emails, IMs, texts and '
105+
'a bunch of other programs. Everything you share '
106+
'in Slack is automatically indexed and archived, '
107+
'creating a searchable archive of all our work.',
108+
),
109+
],
110+
),
111111
),
112-
),
113-
);
114-
},
112+
],
113+
),
114+
),
115115
);
116116
}
117117
}

0 commit comments

Comments
 (0)