hb_password_input_textfield 0.1.0 hb_password_input_textfield: ^0.1.0 copied to clipboard
密码输入框、验证码输入框,多端支持:iOS、Android、web。支持明文/密文,有2种风格可供选择,并且支持多种UI风格定制,包括密文字符、边框、圆角、颜色、TextStyle等等。
import 'package:flutter/material.dart';
import 'package:hb_password_input_textfield/hb_password_input_textfield.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'HBPasswordInputTextField Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: HBPasswordInputTextFieldPage(),
);
}
}
class HBPasswordInputTextFieldPage extends StatefulWidget {
@override
_HBPasswordInputTextFieldPageState createState() =>
_HBPasswordInputTextFieldPageState();
}
class _HBPasswordInputTextFieldPageState
extends State<HBPasswordInputTextFieldPage> {
// int length = 0;
TextEditingController _controller = TextEditingController();
FocusNode _node = FocusNode();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("HBPasswordInputTextField"),
),
body: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_node.unfocus();
},
child: Container(
margin: EdgeInsets.only(top: 50),
child: HBPasswordInputTextField(
// backgroundColor: Colors.red,
// fillColor: Colors.red,
borderWidth: 0.5,
borderRaiuds: 5,
controller: _controller,
node: _node,
backgroundColor: Colors.red,
obscureText: true,
// obscureTextString: "🤪",
// boxWidth: 50,
// boxHeight: 50,
type: HBPasswordInputTextFieldType.BOXES,
length: 6,
textStyle: TextStyle(fontSize: 20),
onChange: (text) {
print(text);
},
),
)),
);
}
}