mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-28 13:49:05 +01:00
Audit icons: add 1-word hover tooltips
Some checks failed
file-length / file length <= 250 lines (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,dependency-freshness) (push) Has been cancelled
Tests / test (push) Has been cancelled
release-apk / release (APK) (push) Has been cancelled
repo-contract / repo contract (push) Has been cancelled
Some checks failed
file-length / file length <= 250 lines (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,dependency-freshness) (push) Has been cancelled
Tests / test (push) Has been cancelled
release-apk / release (APK) (push) Has been cancelled
repo-contract / repo contract (push) Has been cancelled
Todo: fe70b845
This commit is contained in:
parent
95288a7e83
commit
e3790d41e7
@ -162,6 +162,7 @@ class _GitHubMirrorScreenState extends State<GitHubMirrorScreen>
|
|||||||
// it says nothing about Firebase.
|
// it says nothing about Firebase.
|
||||||
IconButton.outlined(
|
IconButton.outlined(
|
||||||
onPressed: _busy ? null : _testConnection,
|
onPressed: _busy ? null : _testConnection,
|
||||||
|
tooltip: 'Test',
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.network_check,
|
Icons.network_check,
|
||||||
semanticLabel: 'Test GitHub connection',
|
semanticLabel: 'Test GitHub connection',
|
||||||
|
|||||||
@ -47,22 +47,27 @@ List<Widget> logMealAppBarActions({
|
|||||||
}) => [
|
}) => [
|
||||||
...leading,
|
...leading,
|
||||||
IconButton(
|
IconButton(
|
||||||
|
tooltip: 'Body',
|
||||||
icon: const Icon(Icons.monitor_weight, semanticLabel: 'Body'),
|
icon: const Icon(Icons.monitor_weight, semanticLabel: 'Body'),
|
||||||
onPressed: onBody,
|
onPressed: onBody,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
|
tooltip: 'Foods',
|
||||||
icon: const Icon(Icons.restaurant_menu, semanticLabel: 'Food bank'),
|
icon: const Icon(Icons.restaurant_menu, semanticLabel: 'Food bank'),
|
||||||
onPressed: onFoodBank,
|
onPressed: onFoodBank,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
|
tooltip: 'History',
|
||||||
icon: const Icon(Icons.history, semanticLabel: 'History'),
|
icon: const Icon(Icons.history, semanticLabel: 'History'),
|
||||||
onPressed: onHistory,
|
onPressed: onHistory,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
|
tooltip: 'Calendar',
|
||||||
icon: const Icon(Icons.calendar_month, semanticLabel: 'Calendar'),
|
icon: const Icon(Icons.calendar_month, semanticLabel: 'Calendar'),
|
||||||
onPressed: onCalendar,
|
onPressed: onCalendar,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
|
tooltip: 'Sync',
|
||||||
icon: const Icon(Icons.settings, semanticLabel: 'Sync settings'),
|
icon: const Icon(Icons.settings, semanticLabel: 'Sync settings'),
|
||||||
onPressed: onSettings,
|
onPressed: onSettings,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -123,6 +123,7 @@ class MealTimeDropdown extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
|
tooltip: 'Time',
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.schedule,
|
Icons.schedule,
|
||||||
semanticLabel: 'Type or pick an exact time',
|
semanticLabel: 'Type or pick an exact time',
|
||||||
|
|||||||
@ -2,7 +2,7 @@ name: diet_guard_app
|
|||||||
description: "Companion phone app for diet_guard: log meals on the go."
|
description: "Companion phone app for diet_guard: log meals on the go."
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 1.0.192+1
|
version: 1.0.193+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.12.2
|
sdk: ^3.12.2
|
||||||
|
|||||||
27
app/test/log_meal_tooltips_test.dart
Normal file
27
app/test/log_meal_tooltips_test.dart
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import 'package:diet_guard_app/screens/log_meal_actions.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
testWidgets('logMealAppBarActions tooltips name each icon', (tester) async {
|
||||||
|
await tester.pumpWidget(
|
||||||
|
MaterialApp(
|
||||||
|
home: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
actions: logMealAppBarActions(
|
||||||
|
onFoodBank: () {},
|
||||||
|
onHistory: () {},
|
||||||
|
onCalendar: () {},
|
||||||
|
onSettings: () {},
|
||||||
|
onBody: () {},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
for (final label in ['Body', 'Foods', 'History', 'Calendar', 'Sync']) {
|
||||||
|
expect(find.byTooltip(label), findsOneWidget, reason: label);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -5,7 +5,8 @@
|
|||||||
/// A word is two or more letters in a row. Allowed without listing: numbers,
|
/// A word is two or more letters in a row. Allowed without listing: numbers,
|
||||||
/// punctuation, single letters, unit symbols next to a figure ([unitTokens])
|
/// punctuation, single letters, unit symbols next to a figure ([unitTokens])
|
||||||
/// and the method acronyms kept as DOUBT rows (`MET`). Content (food names,
|
/// and the method acronyms kept as DOUBT rows (`MET`). Content (food names,
|
||||||
/// workout labels, typed values) is passed per test as [content].
|
/// workout labels, typed values) is passed per test as [content]. One-word
|
||||||
|
/// tooltips naming an icon are exempt (textgate one-word-tooltip exception).
|
||||||
library;
|
library;
|
||||||
|
|
||||||
import 'package:material_ui/material_ui.dart';
|
import 'package:material_ui/material_ui.dart';
|
||||||
@ -16,11 +17,15 @@ const Set<String> unitTokens = {'kcal', 'kg', 'cm', 'lb', 'st', 'MET'};
|
|||||||
|
|
||||||
final RegExp _word = RegExp('[A-Za-z]{2,}');
|
final RegExp _word = RegExp('[A-Za-z]{2,}');
|
||||||
|
|
||||||
|
/// A one-word tooltip naming an icon (textgate exception, 2026-11-22).
|
||||||
|
final RegExp _oneWordTooltip = RegExp(r'^[A-Za-z][A-Za-z-]{0,19}$');
|
||||||
|
|
||||||
/// Every painted string in the current tree (one per [RichText] / tooltip).
|
/// Every painted string in the current tree (one per [RichText] / tooltip).
|
||||||
List<String> paintedStrings(WidgetTester tester) => [
|
List<String> paintedStrings(WidgetTester tester) => [
|
||||||
for (final w in tester.widgetList<RichText>(find.byType(RichText)))
|
for (final w in tester.widgetList<RichText>(find.byType(RichText)))
|
||||||
w.text.toPlainText(includePlaceholders: false),
|
w.text.toPlainText(includePlaceholders: false),
|
||||||
for (final w in tester.widgetList<Tooltip>(find.byType(Tooltip))) ?w.message,
|
for (final w in tester.widgetList<Tooltip>(find.byType(Tooltip)))
|
||||||
|
if (w.message case final m? when !_oneWordTooltip.hasMatch(m)) m,
|
||||||
];
|
];
|
||||||
|
|
||||||
/// The words in [text] that are neither units nor part of [content].
|
/// The words in [text] that are neither units nor part of [content].
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user