From 0a3e968aecf026a6a2de1ad27299dcc5d58f9484 Mon Sep 17 00:00:00 2001 From: Maximilian Betz <Maximilian.Betz@awi.de> Date: Fri, 25 Mar 2022 13:27:35 +0100 Subject: [PATCH] some more exception handling# --- lib/configuration.dart | 1 + lib/overview.dart | 6 +++--- lib/viewevents.dart | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/configuration.dart b/lib/configuration.dart index fb865d4..25ba7b1 100644 --- a/lib/configuration.dart +++ b/lib/configuration.dart @@ -195,6 +195,7 @@ class _MyHomePageState extends State<Configuration> { HapticFeedback.vibrate(); //TODO: display success user feedback + //TODO: store complete "configuration" } catch (e) { throw Exception('Something went wrong try again'); } diff --git a/lib/overview.dart b/lib/overview.dart index b505824..4601c80 100644 --- a/lib/overview.dart +++ b/lib/overview.dart @@ -13,7 +13,7 @@ class Overview extends StatelessWidget { const SizedBox(height: 10), Expanded( child: ElevatedButton( - child: const Text('Add Event', style: TextStyle(fontSize: 22)), + child: const Text('Add Event', style: TextStyle(fontSize: 36)), onPressed: () { Navigator.pushNamed(context, '/second'); }, @@ -22,7 +22,7 @@ class Overview extends StatelessWidget { const SizedBox(height: 10), Expanded( child: ElevatedButton( - child: const Text('View and Sync', style: TextStyle(fontSize: 22)), + child: const Text('View & Sync', style: TextStyle(fontSize: 36)), onPressed: () { Navigator.pushNamed(context, '/third'); }, @@ -31,7 +31,7 @@ class Overview extends StatelessWidget { const SizedBox(height: 10), Expanded( child: ElevatedButton( - child: const Text('Configuration', style: TextStyle(fontSize: 22)), + child: const Text('Configuration', style: TextStyle(fontSize: 36)), onPressed: () { Navigator.pushNamed(context, '/forth'); }, diff --git a/lib/viewevents.dart b/lib/viewevents.dart index 6943a4d..c8b71ee 100644 --- a/lib/viewevents.dart +++ b/lib/viewevents.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:io'; import 'package:flutter/material.dart'; import 'datamodel.dart'; import 'package:http/http.dart' as http; @@ -57,6 +58,9 @@ class _ViewEvents extends State<ViewEvents> { } _sync_status = 'export success'; } + } on SocketException catch (e) { + _sync_status = 'No connection'; + setState(() {}); } catch (e) { debugPrint('Exception: $e'); _sync_status = '$e'; -- GitLab