password_credential 0.1.2 copy "password_credential: ^0.1.2" to clipboard
password_credential: ^0.1.2 copied to clipboard

outdated

Access to Credential Management API Password Credential in Web, and Smartlock for Password in Android.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:password_credential/entity/mediation.dart';
import 'package:provider/provider.dart';

import 'model.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(App());
}

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MultiProvider(
        providers: [ChangeNotifierProvider<Model>(create: (_) => Model())],
        child: Consumer<Model>(builder: (context, model, _) {
          return MaterialApp(
              debugShowCheckedModeBanner: false,
              home: Scaffold(body: Builder(builder: (context) {
                void snackbar(String message) {
                  Scaffold.of(context)
                      .showSnackBar(SnackBar(content: Text(message)));
                }

                return SafeArea(
                    child: Column(children: [
                  Container(
                      child: Column(children: [
                        Row(
                          children: [
                            Container(width: 80, child: Text("ID")),
                            Expanded(child: TextField(controller: model.idEdit))
                          ],
                        ),
                        Row(
                          children: [
                            Container(width: 80, child: Text("Password")),
                            Expanded(
                                child:
                                    TextField(controller: model.passwordEdit))
                          ],
                        ),
                      ]),
                      margin: EdgeInsets.only(left: 20, right: 20)),
                  Expanded(
                      child: ListView(children: <Widget>[
                    ListTile(
                      title: Text("Input Dummy ID/Password"),
                      onTap: () async {
                        model.idEdit.text = "my_id";
                        model.passwordEdit.text = "my_password";
                      },
                    ),
                    ListTile(
                      title: Text("Clear Inputs"),
                      onTap: () async {
                        model.idEdit.text = "";
                        model.passwordEdit.text = "";
                      },
                    ),
                    ListTile(
                      title: Text("Store(Silent)"),
                      onTap: () async {
                        try {
                          var result = await model.store(Mediation.Silent);
                          snackbar(result.toString());
                        } catch (e) {
                          snackbar(e.toString());
                        }
                      },
                    ),
                    ListTile(
                      title: Text("Store(Optional)"),
                      onTap: () async {
                        try {
                          var result = await model.store(Mediation.Optional);
                          snackbar(result.toString());
                        } catch (e) {
                          snackbar(e.toString());
                        }
                      },
                    ),
                    ListTile(
                      title: Text("Store(Required)"),
                      onTap: () async {
                        try {
                          var result = await model.store(Mediation.Required);
                          snackbar(result.toString());
                        } catch (e) {
                          snackbar(e.toString());
                        }
                      },
                    ),
                    ListTile(
                      title: Text("Get(Silent)"),
                      onTap: () async {
                        var result = await model.get(Mediation.Silent);
                        snackbar(result.toString());
                      },
                    ),
                    ListTile(
                      title: Text("Get(Optional)"),
                      onTap: () async {
                        var result = await model.get(Mediation.Optional);
                        snackbar(result.toString());
                      },
                    ),
                    ListTile(
                      title: Text("Get(Required)"),
                      onTap: () async {
                        var result = await model.get(Mediation.Required);
                        snackbar(result.toString());
                      },
                    ),
                    ListTile(
                      title: Text("Delete"),
                      onTap: () async {
                        try {
                          await model.delete();
                          snackbar("Done");
                        } catch (e) {
                          snackbar(e.toString());
                        }
                      },
                    ),
                    ListTile(
                      title: Text("hasCredentialFeature"),
                      subtitle: Text(model.hasCredentialFeature.toString()),
                    ),
                    ListTile(
                      title: Text("preventSilentAccess"),
                      onTap: () async {
                        await model.preventSilentAccess();
                        snackbar("Done");
                      },
                    ),
                    ListTile(
                      title: Text("openPlatformCredentialSettings"),
                      onTap: () async {
                        try {
                          await model.openPlatformCredentialSettings();
                          snackbar("Done");
                        } catch (e) {
                          snackbar(e.toString());
                        }
                      },
                    ),
                  ]))
                ]));
              })));
        }));
  }
}
28
likes
0
pub points
82%
popularity

Publisher

verified publisherirgaly.net

Access to Credential Management API Password Credential in Web, and Smartlock for Password in Android.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, flutter_web_plugins

More

Packages that depend on password_credential