picture_verification_code 1.0.0
picture_verification_code: ^1.0.0 copied to clipboard

Generate a verification code picture according to the given verification code.

picture_verification_code example #

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'PictureVerificationCode Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: CodeTestPage(),
    );
  }
}

class CodeTestPage extends StatefulWidget {
  @override
  _CodeTestPageState createState() => _CodeTestPageState();
}

class _CodeTestPageState extends State<CodeTestPage> {
  @override
  Widget build(BuildContext context) {
    String code = "";
    for (var i = 0; i < 6; i++) {
      code = code + Random().nextInt(9).toString();
    }
    return Scaffold(
        appBar: AppBar(
          title: Text("图片验证码"),
        ),
        body: Container(
            alignment: Alignment.center,
            child: PictureVerificationCode(
              code: code, backgroundColor: Colors.white,
            )));
  }
}
2
likes
110
pub points
35%
popularity

Generate a verification code picture according to the given verification code.

Repository (GitHub)
View/report issues

Documentation

API reference

License

AGPL-3.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on picture_verification_code