Last updated:
0 purchases
flutter click more counter
flutter_click_more_counter #
A counter click event that show message to tell the users that they need to click more to continue.
The case using this lib as same as active the developer mode in Android devices.
Features #
Use this plugin in your Flutter when:
Open something hidden in your app that you don't want user to know it.
You want to open a hidden screen (logs, app information, user information, ...) for tracking
issues when app in release mode.
Getting started #
Add dependency
This plugin using FlutterToast to show message, you need add this dependency as well.
dependencies:
flutter:
sdk: flutter
flutter_click_more_counter: ^1.0.0
fluttertoast: ^8.2.4
copied to clipboard
Add the following imports to your Dart code
import 'package:flutter_click_more_counter/flutter_click_more_counter.dart';
copied to clipboard
Usage #
Create ClickMoreCounter
final clickCounter = ClickMoreCounter();
copied to clipboard
Call function inside your button click event
clickCounter.run(() { });
copied to clipboard
You can choose total click or how many click will display the messages
final clickCounter = ClickMoreCounter(
totalClick: 10, //total number of times needed to click
displayMessageClick: 5, //Number of click to show the message
resetCounterMilliseconds: 3000, //delay time, counter will be reset after [resetCounterMilliseconds]
);
copied to clipboard
Example
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
/// here
final clickCounter = ClickMoreCounter();
/// click event
void onClick() {
/// here
clickCounter.run(() {
showDialog(
useSafeArea: false,
context: context,
builder: (BuildContext context) => const AlertDialog(
title: Text("Flutter Click More Counter"),
content: Text("Hello there"),
));
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Click the button more than 5 times',
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: onClick,
tooltip: 'Click',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
copied to clipboard
Example code #
example demo
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.