hb_check_code

Last updated:

0 purchases

hb_check_code Image
hb_check_code Images
Add to Cart

Description:

hb check code

开发过程中有遇到这种需求,发现网上案例还比较少,所以决定还是自己撸一个。
支持限制尺寸,也可以根据字符长度自适应。
差不多就是长这样子。

Installing #
在你的package's pubspec.yaml中加入
dependencies:
hb_check_code: ^0.0.1
copied to clipboard
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("生成图形验证码"),
),
body: Container(
alignment: Alignment.center,
child: HBCheckCode(
code: code,
)));
}
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.