[auth] Minor improvements (#3269)

This commit is contained in:
Vishnu Mohandas 2024-09-14 19:48:52 +05:30 committed by GitHub
commit 608234d4ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 28 additions and 20 deletions

View File

@ -20,7 +20,7 @@
"codeIssuerHint": "Issuer",
"codeSecretKeyHint": "Secret Key",
"secret": "Secret",
"account": "Account",
"all": "All",
"advance": "Advance",
"notes": "Notes",
"notesLengthLimit": "Notes can be at most {count} characters long",

View File

@ -10,6 +10,7 @@ class TagChip extends StatelessWidget {
final VoidCallback? onTap;
final TagChipState state;
final TagChipAction action;
final IconData? iconData;
const TagChip({
super.key,
@ -17,11 +18,16 @@ class TagChip extends StatelessWidget {
this.state = TagChipState.unselected,
this.action = TagChipAction.none,
this.onTap,
this.iconData,
});
@override
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final color = state == TagChipState.selected ||
Theme.of(context).brightness == Brightness.dark
? Colors.white
: colorScheme.tagTextUnselectedColor;
return GestureDetector(
onTap: onTap,
@ -51,15 +57,24 @@ class TagChip extends StatelessWidget {
data: MediaQuery.of(context).copyWith(
textScaler: const TextScaler.linear(1),
),
child: Text(
label,
style: TextStyle(
color: state == TagChipState.selected ||
Theme.of(context).brightness == Brightness.dark
? Colors.white
: colorScheme.tagTextUnselectedColor,
fontSize: 14,
),
child: Row(
children: [
if (iconData != null) ...[
Icon(
iconData,
size: 16,
color: color,
),
const SizedBox(width: 8),
],
Text(
label,
style: TextStyle(
color: color,
fontSize: 14,
),
),
],
),
),
if (state == TagChipState.selected &&

View File

@ -306,7 +306,6 @@ class _CodeWidgetState extends State<CodeWidget> {
foregroundColor:
Theme.of(context).colorScheme.inverseBackgroundColor,
icon: Icons.adaptive.share_outlined,
label: l10n.share,
padding: const EdgeInsets.only(left: 4, right: 0),
spacing: 8,
),
@ -337,10 +336,6 @@ class _CodeWidgetState extends State<CodeWidget> {
BlendMode.srcIn,
),
),
const SizedBox(height: 8),
Text(
widget.code.isPinned ? l10n.unpinText : l10n.pinText,
),
],
),
padding: const EdgeInsets.only(left: 4, right: 0),
@ -354,7 +349,6 @@ class _CodeWidgetState extends State<CodeWidget> {
foregroundColor:
Theme.of(context).colorScheme.inverseBackgroundColor,
icon: Icons.edit_outlined,
label: l10n.edit,
padding: const EdgeInsets.only(left: 4, right: 0),
spacing: 8,
),
@ -367,7 +361,6 @@ class _CodeWidgetState extends State<CodeWidget> {
foregroundColor:
Theme.of(context).colorScheme.inverseBackgroundColor,
icon: Icons.restore_outlined,
label: l10n.restore,
padding: const EdgeInsets.only(left: 4, right: 0),
spacing: 8,
),
@ -382,7 +375,6 @@ class _CodeWidgetState extends State<CodeWidget> {
icon: widget.code.isTrashed
? Icons.delete_forever
: Icons.delete,
label: widget.code.isTrashed ? l10n.delete : l10n.trash,
padding: const EdgeInsets.only(left: 0, right: 0),
spacing: 8,
),

View File

@ -390,7 +390,7 @@ class _HomePageState extends State<HomePage> {
itemBuilder: (context, index) {
if (index == 0 && hasNonTrashedCodes) {
return TagChip(
label: "All",
label: l10n.all,
state: selectedTag == "" && _isTrashOpen == false
? TagChipState.selected
: TagChipState.unselected,
@ -404,7 +404,7 @@ class _HomePageState extends State<HomePage> {
}
if (index == itemCount - 1 && hasTrashedCodes) {
return TagChip(
label: '🗑️ Trash',
label: l10n.trash,
state: _isTrashOpen
? TagChipState.selected
: TagChipState.unselected,
@ -414,6 +414,7 @@ class _HomePageState extends State<HomePage> {
setState(() {});
_applyFilteringAndRefresh();
},
iconData: Icons.delete,
);
}
return TagChip(