Skip to content

Commit

Permalink
feat(ui): add animation when the bridge status is loading
Browse files Browse the repository at this point in the history
  • Loading branch information
vareversat committed Apr 16, 2023
1 parent 6fc0812 commit 1c13e65
Show file tree
Hide file tree
Showing 9 changed files with 219 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class ChabanBridgeStatusBloc
mainMessageStatus: mainMessageStatus,
timeMessagePrefix: timeMessagePrefix,
foregroundColor: foregroundColor,
chabanBridgeStatusLifecycle: ChabanBridgeStatusLifecycle.populated,
backgroundColor: backgroundColor));
}

Expand Down
16 changes: 8 additions & 8 deletions lib/bloc/chaban_bridge_status/chaban_bridge_status_state.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
part of 'chaban_bridge_status_bloc.dart';

enum ChabanBridgeStatusLifespan { empty, populated }
enum ChabanBridgeStatusLifecycle { empty, populated }

class ChabanBridgeStatusState extends Equatable {
final ChabanBridgeStatusLifespan chabanBridgeStatusLifespan;
final ChabanBridgeStatusLifecycle chabanBridgeStatusLifecycle;
final AbstractChabanBridgeForecast? currentChabanBridgeForecast;
final AbstractChabanBridgeForecast? previousChabanBridgeForecast;
final Duration durationUntilNextEvent;
Expand All @@ -16,7 +16,7 @@ class ChabanBridgeStatusState extends Equatable {
final Color backgroundColor;

const ChabanBridgeStatusState(
{required this.chabanBridgeStatusLifespan,
{required this.chabanBridgeStatusLifecycle,
required this.currentChabanBridgeForecast,
required this.previousChabanBridgeForecast,
required this.durationUntilNextEvent,
Expand All @@ -29,7 +29,7 @@ class ChabanBridgeStatusState extends Equatable {
required this.backgroundColor});

ChabanBridgeStatusState copyWith(
{ChabanBridgeStatusLifespan? chabanBridgeStatusLifespan,
{ChabanBridgeStatusLifecycle? chabanBridgeStatusLifecycle,
AbstractChabanBridgeForecast? currentChabanBridgeForecast,
AbstractChabanBridgeForecast? previousChabanBridgeForecast,
Duration? durationUntilNextEvent,
Expand All @@ -41,8 +41,8 @@ class ChabanBridgeStatusState extends Equatable {
Color? foregroundColor,
Color? backgroundColor}) {
return ChabanBridgeStatusState(
chabanBridgeStatusLifespan:
chabanBridgeStatusLifespan ?? this.chabanBridgeStatusLifespan,
chabanBridgeStatusLifecycle:
chabanBridgeStatusLifecycle ?? this.chabanBridgeStatusLifecycle,
currentChabanBridgeForecast:
currentChabanBridgeForecast ?? this.currentChabanBridgeForecast,
previousChabanBridgeForecast:
Expand All @@ -63,7 +63,7 @@ class ChabanBridgeStatusState extends Equatable {

@override
List<Object?> get props => [
chabanBridgeStatusLifespan,
chabanBridgeStatusLifecycle,
currentChabanBridgeForecast,
previousChabanBridgeForecast,
durationUntilNextEvent,
Expand All @@ -86,7 +86,7 @@ class ChabanBridgeStatusStateInitial extends ChabanBridgeStatusState {
durationBetweenPreviousAndNextEvent: null,
durationForCloseClosing:
Const.notificationDurationValueDefaultValue,
chabanBridgeStatusLifespan: ChabanBridgeStatusLifespan.empty,
chabanBridgeStatusLifecycle: ChabanBridgeStatusLifecycle.empty,
completionPercentage: 0,
mainMessageStatus: '',
timeMessagePrefix: '',
Expand Down
4 changes: 3 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,7 @@
},
"notificationDayChannelName": "Planned closures",
"leftHanded": "Left handed",
"rightHanded": "Right handed"
"rightHanded": "Right handed",
"statusLoadMessage": "Loading of the bridge's current status",
"loading": "Loading..."
}
4 changes: 3 additions & 1 deletion lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,7 @@
},
"notificationDayChannelName": "Cierres planificados",
"leftHanded": "Zurdo.a",
"rightHanded": "Diestro.a"
"rightHanded": "Diestro.a",
"statusLoadMessage": "Carga del estado actual del puente",
"loading": "Cargando..."
}
4 changes: 3 additions & 1 deletion lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,7 @@
},
"notificationDayChannelName": "Fermetures prévues",
"leftHanded": "Gaucher.ère",
"rightHanded": "Droitier.ère"
"rightHanded": "Droitier.ère",
"statusLoadMessage": "Chargement de l'état actuel du pont",
"loading": "Chargement..."
}
5 changes: 3 additions & 2 deletions lib/screens/chaban_bridge_forecast_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:chabo/misc/no_scaling_animation.dart';
import 'package:chabo/screens/error_screen.dart';
import 'package:chabo/widgets/chaban_bridge_forecast_list.dart';
import 'package:chabo/widgets/chaban_bridge_status_widget.dart';
import 'package:chabo/widgets/custom_circular_progress_indicator.dart';
import 'package:chabo/widgets/floating_actions_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand Down Expand Up @@ -162,8 +163,8 @@ class _ChabanBridgeForecastScreenState
),
);
default:
return const Center(
child: CircularProgressIndicator(),
return CustomCircularProgressIndicator(
message: AppLocalizations.of(context)!.loading,
);
}
},
Expand Down
16 changes: 0 additions & 16 deletions lib/widgets/bottom_loader_widget.dart

This file was deleted.

Loading

0 comments on commit 1c13e65

Please sign in to comment.