Added uniform loading indicator for all screens

This commit is contained in:
Elias Müller 2023-06-11 15:57:40 +02:00
parent de0d82f583
commit 072564fd31
16 changed files with 76 additions and 36 deletions

View File

@ -9,14 +9,17 @@
<option name="modules"> <option name="modules">
<set> <set>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/better_open_file-3.6.4/android" /> <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/better_open_file-3.6.4/android" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/file_picker-5.2.11/android" /> <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/device_info_plus-8.2.2/android" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/flutter_native_splash-2.2.19/android" /> <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/file_picker-5.3.1/android" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.14/android" /> <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/flutter_native_splash-2.3.0/android" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/image_picker_android-0.8.6+11/android" /> <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.15/android" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/image_picker_android-0.8.6+17/android" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/package_info-2.0.2/android" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/path_provider_android-2.0.27/android" /> <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/path_provider_android-2.0.27/android" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/shared_preferences_android-2.1.4/android" /> <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/shared_preferences_android-2.1.4/android" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/sqflite-2.2.8+1/android" /> <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/sqflite-2.2.8+4/android" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_android-6.0.31/android" /> <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/syncfusion_flutter_pdfviewer-21.2.8/android" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_android-6.0.35/android" />
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" /> <option value="$PROJECT_DIR$/app" />
</set> </set>

View File

@ -17,8 +17,8 @@
<option name="url" value="https://repo.maven.apache.org/maven2/" /> <option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository> </remote-repository>
<remote-repository> <remote-repository>
<option name="id" value="Google9" /> <option name="id" value="Google8" />
<option name="name" value="Google9" /> <option name="name" value="Google8" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" /> <option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository> </remote-repository>
<remote-repository> <remote-repository>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="KotlinJpsPluginSettings"> <component name="KotlinJpsPluginSettings">
<option name="version" value="1.6.10" /> <option name="version" value="1.7.22" />
</component> </component>
</project> </project>

View File

@ -4,18 +4,19 @@
<option name="autoReloadType" value="NONE" /> <option name="autoReloadType" value="NONE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="55523c1b-a651-4ecd-b499-9518606f9735" name="Changes" comment=""> <list default="true" id="3a85c1e5-8060-4ece-92bb-103238b65897" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/../.idea/libraries/Dart_Packages.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../.idea/libraries/Dart_Packages.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/gradle.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/gradle.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/gradle.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/gradle.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/jarRepositories.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/jarRepositories.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/jarRepositories.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/jarRepositories.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/kotlinc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/kotlinc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../pubspec.yaml" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" /> <option name="LAST_RESOLUTION" value="IGNORE" />
</component> </component>
<component name="ExecutionTargetManager" SELECTED_TARGET="device_and_snapshot_combo_box_target[/home/elias/.android/avd/Pixel_XL_API_30.avd]" /> <component name="ExecutionTargetManager" SELECTED_TARGET="device_and_snapshot_combo_box_target[/home/elias/.android/avd/Nexus_10_API_30.avd]" />
<component name="ExternalProjectsData"> <component name="ExternalProjectsData">
<projectState path="$PROJECT_DIR$"> <projectState path="$PROJECT_DIR$">
<ProjectState /> <ProjectState />
@ -29,7 +30,7 @@
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
</component> </component>
<component name="ProjectId" id="2PQt9ih7RXI4ANibeGG9zQL3kSX" /> <component name="ProjectId" id="2QyvXwW5ikwP9uWcseM58nPLgSu" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" /> <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState"> <component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
@ -39,6 +40,8 @@
"keyToString": { "keyToString": {
"BundleExportedModule": "android.app", "BundleExportedModule": "android.app",
"ExportBundle.BundlePathForandroid.app": "/home/elias/projects/MarianumMobile/Client/android/app", "ExportBundle.BundlePathForandroid.app": "/home/elias/projects/MarianumMobile/Client/android/app",
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.cidr.known.project.marker": "true", "RunOnceActivity.cidr.known.project.marker": "true",
"cidr.known.project.marker": "true", "cidr.known.project.marker": "true",
"dart.analysis.tool.window.visible": "false", "dart.analysis.tool.window.visible": "false",
@ -114,11 +117,11 @@
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" /> <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager"> <component name="TaskManager">
<task active="true" id="Default" summary="Default task"> <task active="true" id="Default" summary="Default task">
<changelist id="55523c1b-a651-4ecd-b499-9518606f9735" name="Changes" comment="" /> <changelist id="3a85c1e5-8060-4ece-92bb-103238b65897" name="Changes" comment="" />
<created>1683400983746</created> <created>1686338678988</created>
<option name="number" value="Default" /> <option name="number" value="Default" />
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1683400983746</updated> <updated>1686338678988</updated>
</task> </task>
<servers /> <servers />
</component> </component>

View File

@ -5,6 +5,7 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:loader_overlay/loader_overlay.dart'; import 'package:loader_overlay/loader_overlay.dart';
import 'package:marianum_mobile/storage/base/settingsProvider.dart'; import 'package:marianum_mobile/storage/base/settingsProvider.dart';
import 'package:marianum_mobile/widget/loadingSpinner.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../../api/marianumcloud/webdav/queries/listFiles/cacheableFile.dart'; import '../../../api/marianumcloud/webdav/queries/listFiles/cacheableFile.dart';
@ -223,7 +224,7 @@ class _FilesState extends State<Files> {
}, },
child: const Icon(Icons.add), child: const Icon(Icons.add),
), ),
body: data == null ? const Center(child: CircularProgressIndicator()) : data!.files.isEmpty ? const ErrorView(icon: Icons.folder_off_rounded, text: "Der Ordner ist leer") : LoaderOverlay( body: data == null ? const LoadingSpinner() : data!.files.isEmpty ? const ErrorView(icon: Icons.folder_off_rounded, text: "Der Ordner ist leer") : LoaderOverlay(
child: RefreshIndicator( child: RefreshIndicator(
onRefresh: () { onRefresh: () {
_query(); _query();

View File

@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:marianum_mobile/widget/loadingSpinner.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../../../api/mhsl/message/getMessages/getMessagesResponse.dart'; import '../../../../api/mhsl/message/getMessages/getMessagesResponse.dart';
@ -30,7 +31,7 @@ class _MessageState extends State<Message> {
title: const Text("Marianum Message"), title: const Text("Marianum Message"),
), ),
body: Consumer<MessageProps>(builder: (context, value, child) { body: Consumer<MessageProps>(builder: (context, value, child) {
if(value.primaryLoading()) return const Center(child: CircularProgressIndicator()); if(value.primaryLoading()) return const LoadingSpinner();
return RefreshIndicator( return RefreshIndicator(
child: ListView.builder( child: ListView.builder(

View File

@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:marianum_mobile/api/marianumcloud/talk/createRoom/createRoomParams.dart'; import 'package:marianum_mobile/api/marianumcloud/talk/createRoom/createRoomParams.dart';
import 'package:marianum_mobile/widget/confirmDialog.dart'; import 'package:marianum_mobile/widget/confirmDialog.dart';
import 'package:marianum_mobile/widget/loadingSpinner.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../../api/marianumcloud/talk/createRoom/createRoom.dart'; import '../../../api/marianumcloud/talk/createRoom/createRoom.dart';
@ -78,9 +79,7 @@ class _ChatListState extends State<ChatList> {
body: Consumer<ChatListProps>( body: Consumer<ChatListProps>(
builder: (context, data, child) { builder: (context, data, child) {
if(data.primaryLoading()) { if(data.primaryLoading()) return const LoadingSpinner();
return const Center(child: CircularProgressIndicator());
}
latestData = data; latestData = data;

View File

@ -2,6 +2,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:jiffy/jiffy.dart'; import 'package:jiffy/jiffy.dart';
import 'package:loader_overlay/loader_overlay.dart'; import 'package:loader_overlay/loader_overlay.dart';
import 'package:marianum_mobile/widget/loadingSpinner.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../../api/marianumcloud/talk/chat/getChatResponse.dart'; import '../../../api/marianumcloud/talk/chat/getChatResponse.dart';
@ -96,7 +97,7 @@ class _ChatViewState extends State<ChatView> {
) )
), ),
child: LoaderOverlay( child: LoaderOverlay(
child: data.primaryLoading() ? const Center(child: CircularProgressIndicator()) : Column( child: data.primaryLoading() ? const LoadingSpinner() : Column(
children: [ children: [
Expanded( Expanded(
child: ListView( child: ListView(

View File

@ -2,6 +2,7 @@
import 'dart:developer'; import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:marianum_mobile/widget/loadingSpinner.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart'; import 'package:syncfusion_flutter_calendar/calendar.dart';
@ -62,7 +63,7 @@ class _TimetableState extends State<Timetable> {
), ),
body: Consumer<TimetableProps>( body: Consumer<TimetableProps>(
builder: (context, value, child) { builder: (context, value, child) {
if(value.primaryLoading()) return const Placeholder(); if(value.primaryLoading()) return const LoadingSpinner();
GetHolidaysResponse holidays = value.getHolidaysResponse; GetHolidaysResponse holidays = value.getHolidaysResponse;

View File

@ -1,4 +1,6 @@
import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class LoadingSpinner extends StatefulWidget { class LoadingSpinner extends StatefulWidget {
@ -9,21 +11,39 @@ class LoadingSpinner extends StatefulWidget {
} }
class _LoadingSpinnerState extends State<LoadingSpinner> { class _LoadingSpinnerState extends State<LoadingSpinner> {
bool textVisible = false;
late Timer timer;
@override
void initState() {
timer = Timer(const Duration(seconds: 10), () {
setState(() {
textVisible = true;
});
});
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Dialog( return Center(
child: Padding( child: Column(
padding: const EdgeInsets.all(20), mainAxisAlignment: MainAxisAlignment.center,
child: Row( children: [
mainAxisSize: MainAxisSize.min, const CircularProgressIndicator(),
children: [ Visibility(
CircularProgressIndicator( visible: textVisible,
color: Theme.of(context).primaryColor, child: const Text("Bist du mit dem Internet verbunden?"),
), ),
const Padding(padding: EdgeInsets.only(left: 15), child: Text("Daten abrufen...")), ],
],
),
), ),
); );
} }
@override
void dispose() {
timer.cancel();
super.dispose();
}
} }

View File

@ -6,9 +6,13 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <file_selector_linux/file_selector_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h> #include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) { void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);

View File

@ -3,6 +3,7 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
file_selector_linux
url_launcher_linux url_launcher_linux
) )

View File

@ -6,6 +6,7 @@ import FlutterMacOS
import Foundation import Foundation
import device_info_plus import device_info_plus
import file_selector_macos
import package_info import package_info
import path_provider_foundation import path_provider_foundation
import shared_preferences_foundation import shared_preferences_foundation
@ -15,6 +16,7 @@ import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin")) FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))

View File

@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+3 version: 0.0.1+4
environment: environment:
sdk: '>=2.18.4 <3.0.0' sdk: '>=2.18.4 <3.0.0'

View File

@ -6,10 +6,13 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <file_selector_windows/file_selector_windows.h>
#include <syncfusion_pdfviewer_windows/syncfusion_pdfviewer_windows_plugin.h> #include <syncfusion_pdfviewer_windows/syncfusion_pdfviewer_windows_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h> #include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
SyncfusionPdfviewerWindowsPluginRegisterWithRegistrar( SyncfusionPdfviewerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SyncfusionPdfviewerWindowsPlugin")); registry->GetRegistrarForPlugin("SyncfusionPdfviewerWindowsPlugin"));
UrlLauncherWindowsRegisterWithRegistrar( UrlLauncherWindowsRegisterWithRegistrar(

View File

@ -3,6 +3,7 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
file_selector_windows
syncfusion_pdfviewer_windows syncfusion_pdfviewer_windows
url_launcher_windows url_launcher_windows
) )