#566 multiline text field when renaming single item
This commit is contained in:
parent
2e0b15787f
commit
89deed98cd
1 changed files with 24 additions and 15 deletions
|
@ -42,21 +42,30 @@ class _RenameEntryDialogState extends State<RenameEntryDialog> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final isRtl = context.isRtl;
|
|
||||||
final extensionSuffixText = '${Unicode.FSI}${entry.extension}${Unicode.PDI}';
|
|
||||||
return AvesDialog(
|
return AvesDialog(
|
||||||
content: TextField(
|
content: Row(
|
||||||
controller: _nameController,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
decoration: InputDecoration(
|
children: [
|
||||||
labelText: context.l10n.renameEntryDialogLabel,
|
Expanded(
|
||||||
// decoration prefix and suffix follow directionality
|
child: TextField(
|
||||||
// but the file extension should always be on the right
|
controller: _nameController,
|
||||||
prefixText: isRtl ? extensionSuffixText : null,
|
decoration: InputDecoration(
|
||||||
suffixText: isRtl ? null : extensionSuffixText,
|
labelText: context.l10n.renameEntryDialogLabel,
|
||||||
),
|
),
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
onChanged: (_) => _validate(),
|
maxLines: null,
|
||||||
onSubmitted: (_) => _submit(context),
|
onChanged: (_) => _validate(),
|
||||||
|
onSubmitted: (_) => _submit(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.only(start: 4, bottom: 12),
|
||||||
|
child: Text(
|
||||||
|
'${Unicode.FSI}${entry.extension}${Unicode.PDI}',
|
||||||
|
style: TextStyle(color: Theme.of(context).hintColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
const CancelButton(),
|
const CancelButton(),
|
||||||
|
@ -78,7 +87,7 @@ class _RenameEntryDialogState extends State<RenameEntryDialog> {
|
||||||
return pContext.join(entry.directory!, '$name${entry.extension}');
|
return pContext.join(entry.directory!, '$name${entry.extension}');
|
||||||
}
|
}
|
||||||
|
|
||||||
String get newName => _nameController.text.trimLeft();
|
String get newName => _nameController.text.trimLeft().replaceAll('\n', '');
|
||||||
|
|
||||||
Future<void> _validate() async {
|
Future<void> _validate() async {
|
||||||
final _newName = newName;
|
final _newName = newName;
|
||||||
|
|
Loading…
Reference in a new issue