one_time_dialog 0.1.1 copy "one_time_dialog: ^0.1.1" to clipboard
one_time_dialog: ^0.1.1 copied to clipboard

A flutter package for showing a dialog X amount of times to the user. This package uses SharedPreferences to make sure dialogs aren't shown too many times.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:one_time_dialog/one_time_dialog.dart';


void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Example'),
        centerTitle: true,
      ),
      body: new Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          // Reload button.
          new Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              new RaisedButton(onPressed: () => Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => MyHomePage())), child: Text('Reload page!')),
            ],
          ),
          // The dialog
          OneTimeDialog(
            amountOfTimesToShow: 6,
            title: Text('Data policy'),
            content: Text('We are gathering personal data about you!'),
            actions: <Widget>[
              new FlatButton(onPressed: () => Navigator.pop(context), child: Text('OK'))
            ],
            context: context,
            id: 'twafwfwfwwrwarawa',
            offset: 2,
          ),
        ],
      ),
    );
  }
}
0
likes
30
pub points
25%
popularity

Publisher

unverified uploader

A flutter package for showing a dialog X amount of times to the user. This package uses SharedPreferences to make sure dialogs aren't shown too many times.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, shared_preferences

More

Packages that depend on one_time_dialog