Skip to content

Commit

Permalink
Fix label and unnecessary loading indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
viplmad committed Feb 5, 2024
1 parent a285225 commit 48c5d75
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
1 change: 1 addition & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"connectString": "Connect",
"failedConnectionString": "Failed connection",
"retryString": "Retry",
"reloadString": "Reload",
"changeRepositoryString": "Change connection settings",
"changeStartGameViewString": "Change start Game View",
"startGameViewString": "Start Game View",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"connectString": "Conectar",
"failedConnectionString": "Conexión fallida",
"retryString": "Reintentar",
"reloadString": "Recargar",
"changeRepositoryString": "Cambiar ajustes de conexión",
"changeStartGameViewString": "Cambiar vista de juegos inicial",
"startGameViewString": "Vista de juegos inicial",
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/detail/item_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ abstract class ItemDetailBody<
}

void reloadItem(BuildContext context) {
BlocProvider.of<K>(context).add(ReloadItem());
BlocProvider.of<K>(context).add(const ReloadItem());
reloadExtraFields(context);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/ui/relation/item_relation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ class _RelationList extends StatelessWidget {
text: headerText,
trailingWidget: IconButton(
icon: const Icon(Icons.refresh),
tooltip: AppLocalizations.of(context)!.retryString,
tooltip: AppLocalizations.of(context)!.reloadString,
onPressed: reload,
),
),
Expand Down
12 changes: 7 additions & 5 deletions logic/lib/bloc/item_detail/item_detail_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ abstract class ItemDetailBloc<T extends PrimaryModel, N extends Object,
Emitter<ItemDetailState> emit,
) async {
if (state is ItemLoaded<T>) {
emit(
ItemLoading(),
);
if (!event.silent) {
emit(
ItemLoading(),
);
}

await _mapAnyLoadToState(emit);
} else if (state is! ItemLoading) {
Expand Down Expand Up @@ -85,11 +87,11 @@ abstract class ItemDetailBloc<T extends PrimaryModel, N extends Object,
}

void _mapFieldUpdatedToEvent(ItemFieldUpdated event) {
add(ReloadItem());
add(const ReloadItem(silent: true));
}

void _mapImageUpdatedToEvent(ItemImageUpdated event) {
add(ReloadItem());
add(const ReloadItem(silent: true));
}

@override
Expand Down
14 changes: 13 additions & 1 deletion logic/lib/bloc/item_detail/item_detail_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,16 @@ abstract class ItemDetailEvent extends Equatable {

class LoadItem extends ItemDetailEvent {}

class ReloadItem extends ItemDetailEvent {}
class ReloadItem extends ItemDetailEvent {
const ReloadItem({this.silent = false});

final bool silent;

@override
List<Object> get props => <Object>[silent];

@override
String toString() => 'ReloadItem { '
'silent: $silent'
' }';
}

0 comments on commit 48c5d75

Please sign in to comment.