LCOV - code coverage report
Current view: top level - lib/controllers - enter_password.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 17 0.0 %
Date: 2024-09-10 17:47:43 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:cwtch/widgets/passwordfield.dart';
       2             : import 'package:flutter/material.dart';
       3             : import 'package:flutter_gen/gen_l10n/app_localizations.dart';
       4             : 
       5           0 : void showPasswordDialog(BuildContext context, String title, String action, Function(String) onEntered) {
       6           0 :   TextEditingController passwordController = TextEditingController();
       7           0 :   CwtchPasswordField passwordField = CwtchPasswordField(
       8             :       controller: passwordController,
       9           0 :       validator: (passsword) {
      10             :         return null;
      11             :       });
      12             : 
      13             :   // set up the buttons
      14           0 :   Widget cancelButton = ElevatedButton(
      15           0 :     child: Text(AppLocalizations.of(context)!.cancel),
      16           0 :     onPressed: () {
      17           0 :       Navigator.of(context).pop(); // dismiss dialog
      18             :     },
      19             :   );
      20           0 :   Widget continueButton = ElevatedButton(
      21           0 :       child: Text(action),
      22           0 :       onPressed: () {
      23           0 :         onEntered(passwordController.value.text);
      24             :       });
      25             : 
      26             :   // set up the AlertDialog
      27           0 :   AlertDialog alert = AlertDialog(
      28           0 :     title: Text(title),
      29             :     content: passwordField,
      30           0 :     actions: [
      31             :       cancelButton,
      32             :       continueButton,
      33             :     ],
      34             :   );
      35             : 
      36             :   // show the dialog
      37           0 :   showDialog(
      38             :     context: context,
      39           0 :     builder: (BuildContext context) {
      40             :       return alert;
      41             :     },
      42             :   );
      43             : }

Generated by: LCOV version 1.14