password_generate 0.0.3 password_generate: ^0.0.3 copied to clipboard
A new Flutter package to help user in check password strength and help user in generate strong password and check password strength with return a message.
import 'package:flutter/material.dart';
import 'package:password_generate/password_generate.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String password="My Password";
String message="";
final passwordGenerator = PasswordGenerator();
void _generate() {
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Password Generator"),
),
body: Center(
child: Column(
// horizontal).
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextField(
textAlign: TextAlign.center,
onChanged: (String val){
password = val;
},
),
Text(
message,
style: Theme.of(context).textTheme.headline4,
),
ElevatedButton(onPressed: (){
setState(() {
message = passwordGenerator.isPasswordValidWithMessage(password,8);
});
}, child: Text("Generate Password"))
],
),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}