new & opt.

opt.: input field auto focus
opt.: snippet page top padding
new: setting of editor font size
This commit is contained in:
lollipopkit
2023-08-21 13:54:09 +08:00
parent 6a2191ff92
commit e3f2b211a9
16 changed files with 106 additions and 43 deletions

View File

@@ -18,6 +18,7 @@ class Input extends StatelessWidget {
final bool suggestiion;
final String? errorText;
final Widget? prefix;
final bool autoFocus;
const Input({
super.key,
@@ -36,6 +37,7 @@ class Input extends StatelessWidget {
this.suggestiion = false,
this.errorText,
this.prefix,
this.autoFocus = false,
});
@override
Widget build(BuildContext context) {
@@ -49,6 +51,7 @@ class Input extends StatelessWidget {
onChanged: onChanged,
keyboardType: type,
focusNode: node,
autofocus: autoFocus,
autocorrect: autoCorrect,
enableSuggestions: suggestiion,
decoration: InputDecoration(
@@ -57,7 +60,7 @@ class Input extends StatelessWidget {
icon: icon != null ? Icon(icon) : null,
border: InputBorder.none,
errorText: errorText,
prefix: prefix),
prefix: prefix,),
controller: controller,
obscureText: obscureText,
),

View File

@@ -60,7 +60,7 @@ class TagEditor extends StatelessWidget {
trailing: InkWell(
child: const Icon(Icons.add),
onTap: () {
_showTagDialog(context, tags, onChanged);
_showAddTagDialog(context, tags, onChanged);
},
),
));
@@ -72,7 +72,7 @@ class TagEditor extends StatelessWidget {
final counts = tags.length + suggestionLen + (suggestionLen == 0 ? 0 : 1);
if (counts == 0) return Text(s.tag);
return ConstrainedBox(
constraints: const BoxConstraints(maxHeight: 27),
constraints: const BoxConstraints(maxHeight: _kTagBtnHeight),
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
@@ -101,7 +101,7 @@ class TagEditor extends StatelessWidget {
Text(
'#$tag',
textAlign: TextAlign.center,
style: textSize13,
style: isAdd ? textSize13Grey : textSize13,
textScaleFactor: 1.0,
),
const SizedBox(width: 4.0),
@@ -123,7 +123,7 @@ class TagEditor extends StatelessWidget {
);
}
void _showTagDialog(
void _showAddTagDialog(
BuildContext context,
List<String> tags,
void Function(List<String>)? onChanged,
@@ -133,6 +133,8 @@ class TagEditor extends StatelessWidget {
context: context,
title: Text(s.add),
child: Input(
autoFocus: true,
icon: Icons.tag,
controller: textEditingController,
hint: s.tag,
),
@@ -156,6 +158,8 @@ class TagEditor extends StatelessWidget {
context: context,
title: Text(s.rename),
child: Input(
autoFocus: true,
icon: Icons.abc,
controller: textEditingController,
hint: s.tag,
),