I met this kind of demand in the development process, and found that online cases are still relatively few, so I decided to masturbate one by myself.

Supports limited size and can be customized to the character length. That’s pretty much what it looks like.

Installing

Add it to your package’s pubspec.yaml

Dependencies: hb_check_code: ^ 0.0.1Copy the code

DEMO

import 'dart:math'; import 'package:hb_check_code/hb_check_code.dart'; import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'HBCheckCode 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(" generate graph verification code "),), body: Container(alignment: alignment. Center, child: HBCheckCode( code: code, ))); }}Copy the code