Home > Net >  Button that is limited can be pressed only 10 times a day. Flutter
Button that is limited can be pressed only 10 times a day. Flutter

Time:06-24

Is it also possible to repeat this action (button press) for exp. 10 times a day. So everyday from 10 o’clock u can press the button 10 times. Than u have to wait till 10 o’clock next day?


actions: <Widget>[
            Padding(
              padding: const EdgeInsets.all(8.0),
              child: RaisedButton(
                elevation: 7,
                color: Colors.black26,
                child: Text('Button'),
                onPressed: () {
                  _scaffoldKey.currentState
                      .showSnackBar(SnackBar(content: Text("Welcome")));
                },
              ),
            ),
          ],

CodePudding user response:

Try this package: https://pub.dev/packages/shared_preferences

Then save the counter value and the date in the shared preferences. By tapping the button you can check the values.

  • Related