Showcase in Flutter

An app’s UI is great when the user can easily navigate and go through the app’s functionality without any problem. One of the best ways to reduce friction and make the user’s experience better is to highlight and showcase the essential and integral parts of your app. This is particularly useful when a user launches your app for the very first time or when there is an important update and new functionality.

Showcaseview is a customizable and simple-to-implement package you can use to show your users the most important features of your Flutter app. With the assistance of the Showcase and ShowCaseWidget , we can showcase the feature in the Flutter application.

Final Application

Showcase in Flutter

As you can see from the demo, the showcase is implemented instantly as you run the application on the main page. And then navigate through the different showcases when the user presses the screen.

https://medium.com/media/110f33962c1d3a98ea5960a75a85a95d/href

Let’s dive in

Step 1: Add the dependencies

First, add the dependencies to pubsec.yaml file

dependencies:
flutter:
sdk: flutter
showcaseview: ^2.0.0+1

Step 2: Add the assets to pubsec.yaml file

assets:
- assets/

Step 3: Run flutter packages get in the root directory

After all the configurations on the YAML file. You need to implement it in your code accordingly.

Before implementing the showcases for individual widgets, you need to wrap the page showing the showcase with a ShowCaseWidget. It consists of the required builder parameter, consisting Builder widget returning our HomePage.

  @override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter ShowCase',
theme: ThemeData(
primaryColor: const Color.fromRGBO(4, 43, 89, 1),
),
debugShowCheckedModeBanner: false,
home: ShowCaseWidget(
builder: Builder(builder: (context) => const HomePage())));
}

Now, create the homepage.dart inside the lib folder.

The ShowCaseWidget needs to know which widgets are to be showcased. Thus you need to define the key for all widgets to be showcased. Our app consists of five widgets we need to bring to the consideration of users when they arrive at the HomePage.

final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
final GlobalKey _first = GlobalKey(); //you can define GlobalKey
final _second = GlobalKey(); //or keep it as final
final _third = GlobalKey();
final _fourth = GlobalKey();
final _fifth = GlobalKey();

To implement and start the showcase when the page starts, we show call the startShowCase method in initState HomePage.

@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback(
(_) => ShowCaseWidget.of(context)
.startShowCase([_first, _second, _third, _fourth, _fifth]),
);
}

WidgetsBinding.instance.addPostFrameCallback() this callback function guarantees that everything is executed accurately during the build.

Presently, if you run the application, our delightful showcase will begin when the page builds. Tap through it until the showcase is done.

Coming down to our Homepage, Inside the build method we return Scaffold and add _scaffoldKey.

@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
......
)}

Our first Showcase will be on AppBar in a hamburger icon. We need to add a key, description, and the child of the Showcase.

leading: Showcase(
key: _first,
description: 'Press here to open drawer',
child: IconButton(
onPressed: () {
_scaffoldKey.currentState!.openDrawer();
},
icon: Icon(
Icons.menu,
color: Theme.of(context).primaryColor,
),
),
),

And then we apply the Second Showcase to the title of the AppBar.

 title: Showcase(
key: _second,
description: 'Subscribe for more videos',
child: const Text(
'Flutter Junction',
style: TextStyle(color: Colors.blue),
)),

Similarly, the third Showcase is on the action widget.

 actions: [
Showcase(
key: _third,
description: 'Press to view Profile',
child: Container(
padding: const EdgeInsets.all(5),
width: 45,
height: 45,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).primaryColor,
),
child: Image.asset('assets/flutterjunction.png'),
),
)
],

Fourth, Showcase would be on the body.

Showcase(
key: _fourth,
description:
'Flutter Junction specializes in youtubing important topics in FLutter ',
child: Image.asset(
"assets/flutterjunction.png",
height: 400,
width: 350,
)),

Lastly, on floatingActionButton:

floatingActionButton: Showcase(
key: _fifth,
title: 'Favorite',
description: 'Click here to add wishlist',
targetShapeBorder: const CircleBorder(),
child: FloatingActionButton(
backgroundColor: Theme.of(context).primaryColor,
onPressed: () {},
child: const Icon(
Icons.favorite,
),
),
),

Conclusion

In this article, I have explained the basic structure of Showcase in Flutter. You can play around with code as per your need and choice. Try creating the new page and apply some Showcase on it. This was a small introduction to Showcase the features of user interaction.

I hope this blog post provides you with enough important and basic information on creating and implementing the showcase in flutter projects. Hope you shall implement the showcase in flutter projects upcoming in the future.

❤ ❤ Thanks for reading this article ❤❤

If you loved the article Clap 👏 .

Also, follow to get updated on exciting articles and projects.

If I got something wrong? Let me know in the comments. I would love to improve.

Let’s get connected

We can be friends. Find on Facebook, Linkedin, Github, Youtube, BuyMeACoffee, and Instagram.

Full code:

GitHub – nbnD/showcase_flutter

Implement Showcase in flutter

Level Up Coding

Thanks for being a part of our community! Before you go:

🚀👉 Join the Level Up talent collective and find an amazing job


Showcase in Flutter was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.


This content originally appeared on Level Up Coding - Medium and was authored by Nabin Dhakal

An app’s UI is great when the user can easily navigate and go through the app’s functionality without any problem. One of the best ways to reduce friction and make the user’s experience better is to highlight and showcase the essential and integral parts of your app. This is particularly useful when a user launches your app for the very first time or when there is an important update and new functionality.

Showcaseview is a customizable and simple-to-implement package you can use to show your users the most important features of your Flutter app. With the assistance of the Showcase and ShowCaseWidget , we can showcase the feature in the Flutter application.

Final Application

Showcase in Flutter

As you can see from the demo, the showcase is implemented instantly as you run the application on the main page. And then navigate through the different showcases when the user presses the screen.

Let’s dive in

Step 1: Add the dependencies

First, add the dependencies to pubsec.yaml file

dependencies:
flutter:
sdk: flutter
showcaseview: ^2.0.0+1

Step 2: Add the assets to pubsec.yaml file

assets:
- assets/

Step 3: Run flutter packages get in the root directory

After all the configurations on the YAML file. You need to implement it in your code accordingly.

Before implementing the showcases for individual widgets, you need to wrap the page showing the showcase with a ShowCaseWidget. It consists of the required builder parameter, consisting Builder widget returning our HomePage.

  @override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter ShowCase',
theme: ThemeData(
primaryColor: const Color.fromRGBO(4, 43, 89, 1),
),
debugShowCheckedModeBanner: false,
home: ShowCaseWidget(
builder: Builder(builder: (context) => const HomePage())));
}

Now, create the homepage.dart inside the lib folder.

The ShowCaseWidget needs to know which widgets are to be showcased. Thus you need to define the key for all widgets to be showcased. Our app consists of five widgets we need to bring to the consideration of users when they arrive at the HomePage.

final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
final GlobalKey _first = GlobalKey(); //you can define GlobalKey
final _second = GlobalKey(); //or keep it as final
final _third = GlobalKey();
final _fourth = GlobalKey();
final _fifth = GlobalKey();

To implement and start the showcase when the page starts, we show call the startShowCase method in initState HomePage.

@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback(
(_) => ShowCaseWidget.of(context)
.startShowCase([_first, _second, _third, _fourth, _fifth]),
);
}

WidgetsBinding.instance.addPostFrameCallback() this callback function guarantees that everything is executed accurately during the build.

Presently, if you run the application, our delightful showcase will begin when the page builds. Tap through it until the showcase is done.

Coming down to our Homepage, Inside the build method we return Scaffold and add _scaffoldKey.

@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
......
)}

Our first Showcase will be on AppBar in a hamburger icon. We need to add a key, description, and the child of the Showcase.

leading: Showcase(
key: _first,
description: 'Press here to open drawer',
child: IconButton(
onPressed: () {
_scaffoldKey.currentState!.openDrawer();
},
icon: Icon(
Icons.menu,
color: Theme.of(context).primaryColor,
),
),
),

And then we apply the Second Showcase to the title of the AppBar.

 title: Showcase(
key: _second,
description: 'Subscribe for more videos',
child: const Text(
'Flutter Junction',
style: TextStyle(color: Colors.blue),
)),

Similarly, the third Showcase is on the action widget.

 actions: [
Showcase(
key: _third,
description: 'Press to view Profile',
child: Container(
padding: const EdgeInsets.all(5),
width: 45,
height: 45,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).primaryColor,
),
child: Image.asset('assets/flutterjunction.png'),
),
)
],

Fourth, Showcase would be on the body.

Showcase(
key: _fourth,
description:
'Flutter Junction specializes in youtubing important topics in FLutter ',
child: Image.asset(
"assets/flutterjunction.png",
height: 400,
width: 350,
)),

Lastly, on floatingActionButton:

floatingActionButton: Showcase(
key: _fifth,
title: 'Favorite',
description: 'Click here to add wishlist',
targetShapeBorder: const CircleBorder(),
child: FloatingActionButton(
backgroundColor: Theme.of(context).primaryColor,
onPressed: () {},
child: const Icon(
Icons.favorite,
),
),
),

Conclusion

In this article, I have explained the basic structure of Showcase in Flutter. You can play around with code as per your need and choice. Try creating the new page and apply some Showcase on it. This was a small introduction to Showcase the features of user interaction.

I hope this blog post provides you with enough important and basic information on creating and implementing the showcase in flutter projects. Hope you shall implement the showcase in flutter projects upcoming in the future.

❤ ❤ Thanks for reading this article ❤❤

If you loved the article Clap 👏 .

Also, follow to get updated on exciting articles and projects.

If I got something wrong? Let me know in the comments. I would love to improve.

Let’s get connected

We can be friends. Find on Facebook, Linkedin, Github, Youtube, BuyMeACoffee, and Instagram.

Full code:

GitHub - nbnD/showcase_flutter

Implement Showcase in flutter

Level Up Coding

Thanks for being a part of our community! Before you go:

🚀👉 Join the Level Up talent collective and find an amazing job


Showcase in Flutter was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.


This content originally appeared on Level Up Coding - Medium and was authored by Nabin Dhakal


Print Share Comment Cite Upload Translate Updates
APA

Nabin Dhakal | Sciencx (2023-01-08T20:14:41+00:00) Showcase in Flutter. Retrieved from https://www.scien.cx/2023/01/08/showcase-in-flutter/

MLA
" » Showcase in Flutter." Nabin Dhakal | Sciencx - Sunday January 8, 2023, https://www.scien.cx/2023/01/08/showcase-in-flutter/
HARVARD
Nabin Dhakal | Sciencx Sunday January 8, 2023 » Showcase in Flutter., viewed ,<https://www.scien.cx/2023/01/08/showcase-in-flutter/>
VANCOUVER
Nabin Dhakal | Sciencx - » Showcase in Flutter. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/01/08/showcase-in-flutter/
CHICAGO
" » Showcase in Flutter." Nabin Dhakal | Sciencx - Accessed . https://www.scien.cx/2023/01/08/showcase-in-flutter/
IEEE
" » Showcase in Flutter." Nabin Dhakal | Sciencx [Online]. Available: https://www.scien.cx/2023/01/08/showcase-in-flutter/. [Accessed: ]
rf:citation
» Showcase in Flutter | Nabin Dhakal | Sciencx | https://www.scien.cx/2023/01/08/showcase-in-flutter/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.