chore: migrate mobile translations accessor (1) (#30667)

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2026-08-11 14:41:11 +05:30 committed by GitHub
parent 235daff561
commit 565fbe4917
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 207 additions and 177 deletions

View file

@ -1,10 +1,10 @@
import 'package:auto_route/auto_route.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/extensions/string_extensions.dart';
import 'package:immich_mobile/generated/translations.g.dart';
import 'package:immich_mobile/routing/router.dart';
import 'package:maplibre_gl/maplibre_gl.dart';
@ -73,11 +73,11 @@ class _LocationPicker extends HookWidget {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("edit_location_dialog_title", style: context.textTheme.titleMedium).tr(),
Text(context.t.edit_location_dialog_title, style: context.textTheme.titleMedium),
Align(
alignment: Alignment.center,
child: TextButton.icon(
icon: const Text("location_picker_choose_on_map").tr(),
icon: Text(context.t.location_picker_choose_on_map),
label: const Icon(Icons.map_outlined, size: 16),
onPressed: onMapTap,
),
@ -85,9 +85,9 @@ class _LocationPicker extends HookWidget {
const SizedBox(height: 12),
_ManualPickerInput(
controller: latitudeController,
decorationText: "latitude",
hintText: "location_picker_latitude_hint",
errorText: "location_picker_latitude_error",
decorationText: context.t.latitude,
hintText: context.t.location_picker_latitude_hint,
errorText: context.t.location_picker_latitude_error,
focusNode: latitiudeFocusNode,
validator: _validateLat,
onUpdated: onLatitudeUpdated,
@ -95,9 +95,9 @@ class _LocationPicker extends HookWidget {
const SizedBox(height: 24),
_ManualPickerInput(
controller: longitudeController,
decorationText: "longitude",
hintText: "location_picker_longitude_hint",
errorText: "location_picker_longitude_error",
decorationText: context.t.longitude,
hintText: context.t.location_picker_longitude_hint,
errorText: context.t.location_picker_longitude_error,
focusNode: longitudeFocusNode,
validator: _validateLong,
onUpdated: onLongitudeEditingCompleted,
@ -109,19 +109,19 @@ class _LocationPicker extends HookWidget {
TextButton(
onPressed: () => ContextHelper(context).pop(),
child: Text(
"cancel",
context.t.cancel,
style: context.textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w600,
color: context.colorScheme.error,
),
).tr(),
),
),
TextButton(
onPressed: () => context.maybePop(latlng),
child: Text(
"action_common_update",
context.t.action_common_update,
style: context.textTheme.bodyMedium?.copyWith(fontWeight: FontWeight.w600, color: context.primaryColor),
).tr(),
),
),
],
);
@ -163,13 +163,13 @@ class _ManualPickerInput extends HookWidget {
textInputAction: TextInputAction.done,
autofocus: false,
decoration: InputDecoration(
labelText: decorationText.tr(),
labelText: decorationText,
labelStyle: TextStyle(fontWeight: FontWeight.bold, color: context.primaryColor),
floatingLabelBehavior: FloatingLabelBehavior.auto,
border: const OutlineInputBorder(),
hintText: hintText.tr(),
hintText: hintText,
hintStyle: const TextStyle(fontWeight: FontWeight.normal, fontSize: 14),
errorText: isValid.value ? null : errorText.tr(),
errorText: isValid.value ? null : errorText,
),
onEditingComplete: onEditingComplete,
keyboardType: const TextInputType.numberWithOptions(decimal: true, signed: true),