TourLabels class Tours
The words on the default tour step card.
The package ships no translations — it has zero dependencies, which rules
out intl and generated ARB lookups. Instead every string on the card is a
value you supply, so it can come from whatever localisation your app
already has:
TourScope(
labels: TourLabels(
skip: context.l10n.tourSkip,
back: context.l10n.tourBack,
next: context.l10n.tourNext,
done: context.l10n.tourDone,
progress: (int step, int length) =>
context.l10n.tourProgress(step, length),
),
child: const MyApp(),
)
progress takes a callback rather than a format string because word order is not universal: "2 of 5", "2 / 5" and "5 中 2" cannot all be produced by substituting into one template.
A step card built with HintTarget.contentBuilder gets the same labels via TourStepInfo.labels, so a custom card can be localised the same way without reaching for a second mechanism.
- Annotations
Constructors
- TourLabels({String skip = 'Skip', String back = 'Back', String next = 'Next', String done = 'Done', TourProgressBuilder progress = _defaultProgress})
-
Creates a set of labels. The defaults are English.
const
Properties
- back → String
-
Returns to the previous step. Hidden on the first step.
final
- done → String
-
Advances past the last step, ending the tour.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- next → String
-
Advances to the next step.
final
- progress → TourProgressBuilder
-
Renders the "2 of 5" counter. Shown only for tours with several steps.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- skip → String
-
Leaves the tour without finishing it. Hidden on the last step.
final
Methods
-
advance(
{required bool isLast}) → String - The label for the advance button on a given step.
-
copyWith(
{String? skip, String? back, String? next, String? done, TourProgressBuilder? progress}) → TourLabels - Returns a copy with the given fields replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override