Browse Source

Add error handling screen to view station page

master
Kenneth Bruen 2 years ago
parent
commit
da983871e2
Signed by: kbruen
GPG Key ID: C1980A470C3EE5B1
  1. 2
      lib/pages/station_arrdep_page/view_station/view_station.dart
  2. 36
      lib/pages/station_arrdep_page/view_station/view_station_material.dart

2
lib/pages/station_arrdep_page/view_station/view_station.dart

@ -51,6 +51,8 @@ abstract class ViewStationPageShared extends StatelessWidget {
static const departsTo = 'Pleacă către';
static const departedTo = 'A plecat către';
static const cancelledDeparture = 'Anulat - către';
static const errorText = 'A apărut o eroare';
static const retryText = 'Reîncearcă';
final ViewStationPageTab tab;
final void Function(ViewStationPageTab) setTab;

36
lib/pages/station_arrdep_page/view_station/view_station_material.dart

@ -27,7 +27,41 @@ class ViewStationPageMaterial extends ViewStationPageShared {
body: snapshot.state == RefreshFutureBuilderState.waiting
? const Loading(text: ViewStationPageShared.loadingText,)
: snapshot.state == RefreshFutureBuilderState.error
? Container()
? Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(
Icons.error_outline,
size: 32,
color: Colors.red,
),
const Text(
ViewStationPageShared.errorText,
style: TextStyle(
inherit: true,
fontSize: 32,
),
),
Text(
snapshot.error.toString(),
style: Theme.of(context).textTheme.bodySmall,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () {
refresh();
},
child: const Text(ViewStationPageShared.retryText),
),
),
],
),
),
)
: CustomScrollView(
slivers: [
SliverToBoxAdapter(child: SafeArea(left: false, bottom: false, right: false,child: Container(),),),

Loading…
Cancel
Save