pw_edit_field 1.0.1+1 copy "pw_edit_field: ^1.0.1+1" to clipboard
pw_edit_field: ^1.0.1+1 copied to clipboard

outdated

flutter Password input box, pure dart language.Support Android and iOS,No compatibility issues

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:pw_edit_field/pw_edit_field.dart';

import 'package:flutter/foundation.dart';

void main() => runApp(MyApp());

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

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String pw = "";

  TextEditingController _controller = TextEditingController();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[

//●
            TextField(
            ),
            Text("密码 :" + pw),
            SizedBox(
              height: 8,
            ),
            PWEditField(
              textFieldCount: 8,
              textFieldSpace: 5,
              textFieldWidth: 30,
              textFieldHeight: 30,
              obscureText: false,
              textStyle: TextStyle(fontSize: 18),
              keyboardType: TextInputType.number,
              inputFormatters : [WhitelistingTextInputFormatter(RegExp("[0-9]")),],
              focusDecoration: BoxDecoration(
                border:
                    Border(bottom: BorderSide(color: Colors.teal, width: 2)),
              ),
              unFocusDecoration: BoxDecoration(
                border: Border(bottom: BorderSide(color: Colors.red, width: 2)),
              ),
              onInputDone: (pw) {
                this.pw = pw;

                setState(() {});
              },
            ),

            SizedBox(
              height: 8,
            ),
            PWEditField(
              textFieldCount: 6,
              textFieldWidth: 40,
              textFieldHeight: 40,
              inputFormatters : [WhitelistingTextInputFormatter(RegExp("[0-9]")),],
              autoFocus: true,
              onInputDone: (pw) {
                this.pw = pw;
                setState(() {
//                  _text.data = pw;
                });
              },
            ),
            SizedBox(
              height: 8,
            ),
            PWEditField(
            textFieldCount: 6,
            onInputDone: (pw){
              this.pw = pw;
              setState(() {
              });
            },
          ),
            PWEditField(
            textFieldCount: 3,
            controller: _controller,
          ),
            Padding(
              padding: const EdgeInsets.all(8.0),
              child: PWEditField(
                textFieldCount: 8,
                textFieldSpace: 10,
                textFieldWidth: 40,
                textFieldHeight: 20,
                obscureText: false,
                textStyle: TextStyle(fontSize: 15),
                keyboardType: TextInputType.visiblePassword,
                focusDecoration: BoxDecoration(
                  border: Border.all(color: Colors.teal, width: 1),
                  borderRadius: BorderRadius.all(Radius.circular(5)),
                ),
                unFocusDecoration: BoxDecoration(
                  border: Border.all(color: Colors.blueGrey, width: 1),
                  borderRadius: BorderRadius.all(Radius.circular(5)),
                ),
                onInputDone: (pw) {
                  this.pw = pw;
                  setState(() {});
                },
              ),
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
0
pub points
41%
popularity

Publisher

unverified uploader

flutter Password input box, pure dart language.Support Android and iOS,No compatibility issues

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on pw_edit_field