Skip to content

Commit

Permalink
add text input types
Browse files Browse the repository at this point in the history
  • Loading branch information
yang991178 committed Jan 19, 2021
1 parent 0e14fd5 commit b66ca27
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
3 changes: 3 additions & 0 deletions lib/pages/article_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ class ArticlePageState extends State<ArticlePage> {
await Future.delayed(Duration(milliseconds: 300));
}
setState(() { loaded = true; });
if (_target == SourceOpenTarget.Local || _target == SourceOpenTarget.FullContent) {
navigated = true;
}
}
void _onWebpageReady(_) {
if (loaded) navigated = true;
Expand Down
3 changes: 2 additions & 1 deletion lib/pages/settings/services/feedbin_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class _FeedbinPageState extends State<FeedbinPage> {
S.of(context).endpoint,
Utils.testUrl,
initialValue: _endpoint,
inputType: TextInputType.url,
),
));
if (endpoint == null) return;
Expand All @@ -55,7 +56,7 @@ class _FeedbinPageState extends State<FeedbinPage> {
builder: (context) => TextEditorPage(
S.of(context).password,
Utils.notEmpty,
isPassword: true,
inputType: TextInputType.visiblePassword,
),
));
if (password == null) return;
Expand Down
3 changes: 2 additions & 1 deletion lib/pages/settings/services/fever_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class _FeverPageState extends State<FeverPage> {
S.of(context).endpoint,
Utils.testUrl,
initialValue: _endpoint,
inputType: TextInputType.url,
),
));
if (endpoint == null) return;
Expand All @@ -57,7 +58,7 @@ class _FeverPageState extends State<FeverPage> {
builder: (context) => TextEditorPage(
S.of(context).password,
Utils.notEmpty,
isPassword: true,
inputType: TextInputType.visiblePassword,
),
));
if (password == null) return;
Expand Down
3 changes: 2 additions & 1 deletion lib/pages/settings/services/greader_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class _GReaderPageState extends State<GReaderPage> {
S.of(context).endpoint,
Utils.testUrl,
initialValue: _endpoint,
inputType: TextInputType.url,
),
));
if (endpoint == null) return;
Expand All @@ -56,7 +57,7 @@ class _GReaderPageState extends State<GReaderPage> {
builder: (context) => TextEditorPage(
S.of(context).password,
Utils.notEmpty,
isPassword: true,
inputType: TextInputType.visiblePassword,
),
));
if (password == null) return;
Expand Down
3 changes: 2 additions & 1 deletion lib/pages/settings/services/inoreader_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class _InoreaderPageState extends State<InoreaderPage> {
builder: (context) => TextEditorPage(
S.of(context).password,
Utils.notEmpty,
isPassword: true,
inputType: TextInputType.visiblePassword,
),
));
if (password == null) return;
Expand All @@ -68,6 +68,7 @@ class _InoreaderPageState extends State<InoreaderPage> {
"API ID",
Utils.notEmpty,
initialValue: _apiId,
inputType: TextInputType.number,
),
));
if (apiId == null) return;
Expand Down
8 changes: 4 additions & 4 deletions lib/pages/settings/text_editor_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TextEditorPage extends StatefulWidget {
final String initialValue;
final Color navigationBarColor;
final FutureOr<bool> Function(String) validate;
final bool isPassword;
final TextInputType inputType;

TextEditorPage(
this.title,
Expand All @@ -20,7 +20,7 @@ class TextEditorPage extends StatefulWidget {
this.navigationBarColor,
this.saveText,
this.initialValue: "",
this.isPassword: false,
this.inputType,
Key key,
})
: super(key: key);
Expand Down Expand Up @@ -88,8 +88,8 @@ class _TextEditorPage extends State<TextEditorPage> {
clearButtonMode: OverlayVisibilityMode.editing,
readOnly: _validating,
autofocus: true,
obscureText: widget.isPassword,
keyboardType: widget.isPassword ? TextInputType.visiblePassword : null,
obscureText: widget.inputType == TextInputType.visiblePassword,
keyboardType: widget.inputType,
onSubmitted: (v) { _onSave(); },
),
]),
Expand Down

0 comments on commit b66ca27

Please sign in to comment.