Skip to content

Commit

Permalink
add hint support
Browse files Browse the repository at this point in the history
  • Loading branch information
TinoGuo committed Oct 20, 2019
1 parent b2ffb34 commit dcfee03
Show file tree
Hide file tree
Showing 2 changed files with 150 additions and 81 deletions.
14 changes: 4 additions & 10 deletions example/lib/main.dart
Expand Up @@ -61,12 +61,6 @@ class _MyHomePageState extends State<MyHomePage> {
/// Default max pin length.
static final int _pinLength = 4;

/// Default Text style.
static const TextStyle _textStyle = TextStyle(
color: Colors.black,
fontSize: 24,
);

/// PinInputTextFormField form-key
final GlobalKey<FormFieldState<String>> _formKey =
GlobalKey<FormFieldState<String>>(debugLabel: '_formkey');
Expand All @@ -77,8 +71,8 @@ class _MyHomePageState extends State<MyHomePage> {

/// Decorate the outside of the Pin.
PinDecoration _pinDecoration = UnderlineDecoration(
textStyle: _textStyle,
enteredColor: Colors.green,
hintText: 'abcd',
);

/// Control whether show the obscureCode.
Expand Down Expand Up @@ -131,37 +125,37 @@ class _MyHomePageState extends State<MyHomePage> {
case PinEntryType.underline:
setState(() {
_pinDecoration = UnderlineDecoration(
textStyle: _textStyle,
enteredColor: Colors.green,
obscureStyle: ObscureStyle(
isTextObscure: _obscureEnable,
obscureText: '😂',
),
hintText: 'abcd',
);
});
break;
case PinEntryType.boxTight:
setState(() {
_pinDecoration = BoxTightDecoration(
textStyle: _textStyle,
solidColor: _solidEnable ? _solidColor : null,
obscureStyle: ObscureStyle(
isTextObscure: _obscureEnable,
obscureText: '👿',
),
hintText: 'abcd',
);
});
break;
case PinEntryType.boxLoose:
setState(() {
_pinDecoration = BoxLooseDecoration(
textStyle: _textStyle,
enteredColor: Colors.green,
solidColor: _solidEnable ? _solidColor : null,
obscureStyle: ObscureStyle(
isTextObscure: _obscureEnable,
obscureText: '☺️',
),
hintText: 'abcd',
);
});
break;
Expand Down

2 comments on commit dcfee03

@TinoGuo
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#21 hint text support

@TinoGuo
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit removed the const text style, and the text style will follow the global theme.

Please sign in to comment.