mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-22 13:02:20 +01:00
Audit icons: add 1-word hover tooltips
Some checks are pending
file-length / file length <= 250 lines (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,dependency-freshness) (push) Waiting to run
Tests / test (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Some checks are pending
file-length / file length <= 250 lines (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,dependency-freshness) (push) Waiting to run
Tests / test (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
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.
|
||||
IconButton.outlined(
|
||||
onPressed: _busy ? null : _testConnection,
|
||||
tooltip: 'Test',
|
||||
icon: const Icon(
|
||||
Icons.network_check,
|
||||
semanticLabel: 'Test GitHub connection',
|
||||
|
||||
@ -47,22 +47,27 @@ List<Widget> logMealAppBarActions({
|
||||
}) => [
|
||||
...leading,
|
||||
IconButton(
|
||||
tooltip: 'Body',
|
||||
icon: const Icon(Icons.monitor_weight, semanticLabel: 'Body'),
|
||||
onPressed: onBody,
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Foods',
|
||||
icon: const Icon(Icons.restaurant_menu, semanticLabel: 'Food bank'),
|
||||
onPressed: onFoodBank,
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'History',
|
||||
icon: const Icon(Icons.history, semanticLabel: 'History'),
|
||||
onPressed: onHistory,
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Calendar',
|
||||
icon: const Icon(Icons.calendar_month, semanticLabel: 'Calendar'),
|
||||
onPressed: onCalendar,
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Sync',
|
||||
icon: const Icon(Icons.settings, semanticLabel: 'Sync settings'),
|
||||
onPressed: onSettings,
|
||||
),
|
||||
|
||||
@ -123,6 +123,7 @@ class MealTimeDropdown extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Time',
|
||||
icon: const Icon(
|
||||
Icons.schedule,
|
||||
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."
|
||||
publish_to: 'none'
|
||||
|
||||
version: 1.0.192+1
|
||||
version: 1.0.193+1
|
||||
|
||||
environment:
|
||||
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,
|
||||
/// punctuation, single letters, unit symbols next to a figure ([unitTokens])
|
||||
/// 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;
|
||||
|
||||
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,}');
|
||||
|
||||
/// 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).
|
||||
List<String> paintedStrings(WidgetTester tester) => [
|
||||
for (final w in tester.widgetList<RichText>(find.byType(RichText)))
|
||||
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].
|
||||
|
||||
Loading…
Reference in New Issue
Block a user