Updated feedback to include screenshot and drawings
This commit is contained in:
parent
eb361febf8
commit
7b3c0b4885
@ -1,6 +1,7 @@
|
||||
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:marianum_mobile/api/apiResponse.dart';
|
||||
|
||||
import '../../../apiResponse.dart';
|
||||
|
||||
part 'getParticipantsResponse.g.dart';
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:marianum_mobile/api/apiResponse.dart';
|
||||
|
||||
import '../../../apiResponse.dart';
|
||||
|
||||
part 'getReactionsResponse.g.dart';
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:marianum_mobile/api/apiResponse.dart';
|
||||
|
||||
import '../../../model/accountData.dart';
|
||||
import '../../../model/endpointData.dart';
|
||||
import '../../apiError.dart';
|
||||
import '../../apiParams.dart';
|
||||
import '../../apiRequest.dart';
|
||||
import '../../apiResponse.dart';
|
||||
|
||||
enum TalkApiMethod {
|
||||
get,
|
||||
|
@ -6,12 +6,14 @@ part 'addFeedbackParams.g.dart';
|
||||
class AddFeedbackParams {
|
||||
String user;
|
||||
String feedback;
|
||||
String? screenshot;
|
||||
int appVersion;
|
||||
|
||||
|
||||
AddFeedbackParams({
|
||||
required this.user,
|
||||
required this.feedback,
|
||||
this.screenshot,
|
||||
required this.appVersion,
|
||||
});
|
||||
|
||||
|
@ -10,6 +10,7 @@ AddFeedbackParams _$AddFeedbackParamsFromJson(Map<String, dynamic> json) =>
|
||||
AddFeedbackParams(
|
||||
user: json['user'] as String,
|
||||
feedback: json['feedback'] as String,
|
||||
screenshot: json['screenshot'] as String?,
|
||||
appVersion: json['appVersion'] as int,
|
||||
);
|
||||
|
||||
@ -17,5 +18,6 @@ Map<String, dynamic> _$AddFeedbackParamsToJson(AddFeedbackParams instance) =>
|
||||
<String, dynamic>{
|
||||
'user': instance.user,
|
||||
'feedback': instance.feedback,
|
||||
'screenshot': instance.screenshot,
|
||||
'appVersion': instance.appVersion,
|
||||
};
|
||||
|
@ -1,8 +1,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:localstore/localstore.dart';
|
||||
import 'package:marianum_mobile/api/apiResponse.dart';
|
||||
|
||||
import 'apiResponse.dart';
|
||||
import 'webuntis/webuntisError.dart';
|
||||
|
||||
abstract class RequestCache<T extends ApiResponse?> {
|
||||
|
@ -2,12 +2,14 @@ import 'dart:async';
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:feedback/feedback.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:loader_overlay/loader_overlay.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
|
||||
@ -28,6 +30,7 @@ import 'storage/base/settingsProvider.dart';
|
||||
import 'theming/darkAppTheme.dart';
|
||||
import 'theming/lightAppTheme.dart';
|
||||
import 'view/login/login.dart';
|
||||
import 'view/pages/more/feedback/feedbackForm.dart';
|
||||
import 'widget/placeholderView.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
@ -68,7 +71,12 @@ Future<void> main() async {
|
||||
ChangeNotifierProvider(create: (context) => MessageProps()),
|
||||
ChangeNotifierProvider(create: (context) => HolidaysProps()),
|
||||
],
|
||||
child: const Main(),
|
||||
child: BetterFeedback(
|
||||
themeMode: ThemeMode.dark,
|
||||
feedbackBuilder: (context, callback, scrollController) => FeedbackForm(callback: callback, scrollController: scrollController),
|
||||
localeOverride: const Locale('de'),
|
||||
child: const Main(),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -122,18 +130,20 @@ class _MainState extends State<Main> {
|
||||
themeMode: settings.val().appTheme,
|
||||
theme: LightAppTheme.theme,
|
||||
darkTheme: DarkAppTheme.theme,
|
||||
home: Breaker(
|
||||
breaker: BreakerArea.global,
|
||||
child: Consumer<AccountModel>(
|
||||
builder: (context, accountModel, child) {
|
||||
switch(accountModel.state) {
|
||||
case AccountModelState.loggedIn: return const App();
|
||||
case AccountModelState.loggedOut: return const Login();
|
||||
case AccountModelState.undefined: return const PlaceholderView(icon: Icons.timer, text: "Daten werden geladen");
|
||||
}
|
||||
},
|
||||
)
|
||||
)
|
||||
home: LoaderOverlay(
|
||||
child: Breaker(
|
||||
breaker: BreakerArea.global,
|
||||
child: Consumer<AccountModel>(
|
||||
builder: (context, accountModel, child) {
|
||||
switch(accountModel.state) {
|
||||
case AccountModelState.loggedIn: return const App();
|
||||
case AccountModelState.loggedOut: return const Login();
|
||||
case AccountModelState.undefined: return const PlaceholderView(icon: Icons.timer, text: "Daten werden geladen");
|
||||
}
|
||||
},
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
@ -1,78 +0,0 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
|
||||
import '../../../../api/mhsl/server/feedback/addFeedback.dart';
|
||||
import '../../../../api/mhsl/server/feedback/addFeedbackParams.dart';
|
||||
import '../../../../model/accountData.dart';
|
||||
import '../../../../widget/infoDialog.dart';
|
||||
|
||||
class FeedbackDialog extends StatefulWidget {
|
||||
const FeedbackDialog({super.key});
|
||||
|
||||
@override
|
||||
State<FeedbackDialog> createState() => _FeedbackDialogState();
|
||||
}
|
||||
|
||||
class _FeedbackDialogState extends State<FeedbackDialog> {
|
||||
final TextEditingController _feedbackInput = TextEditingController();
|
||||
String? _error;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
|
||||
title: const Text("Feedback"),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text("Feedback, Anregungen, Ideen, Fehler und Verbesserungen"),
|
||||
const SizedBox(height: 10),
|
||||
const Text("Bitte gib keine geheimen Daten wie z.B. Passwörter weiter.", style: TextStyle(fontSize: 10)),
|
||||
const SizedBox(height: 10),
|
||||
TextField(
|
||||
controller: _feedbackInput,
|
||||
autofocus: true,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
label: Text("Feedback und Verbesserungen")
|
||||
),
|
||||
// style: TextStyle(),
|
||||
// expands: true,
|
||||
minLines: 3,
|
||||
maxLines: 5,
|
||||
),
|
||||
Visibility(
|
||||
visible: _error != null,
|
||||
child: Text("Senden fehlgeschlagen: $_error", style: const TextStyle(color: Colors.red))
|
||||
)
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.of(context).pop(), child: const Text("Abbrechen")),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
AddFeedback(
|
||||
AddFeedbackParams(
|
||||
user: AccountData().getUserSecret(),
|
||||
feedback: _feedbackInput.text,
|
||||
appVersion: int.parse((await PackageInfo.fromPlatform()).buildNumber)
|
||||
)
|
||||
)
|
||||
.run()
|
||||
.then((value) {
|
||||
Navigator.of(context).pop();
|
||||
InfoDialog.show(context, "Danke für dein Feedback!");
|
||||
})
|
||||
.catchError((error, trace) {
|
||||
setState(() {
|
||||
_error = error.toString();
|
||||
});
|
||||
});
|
||||
},
|
||||
child: const Text("Senden"),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
99
lib/view/pages/more/feedback/feedbackForm.dart
Normal file
99
lib/view/pages/more/feedback/feedbackForm.dart
Normal file
@ -0,0 +1,99 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../theming/darkAppTheme.dart';
|
||||
import '../../../../widget/loadingSpinner.dart';
|
||||
|
||||
class FeedbackForm extends StatefulWidget {
|
||||
final Future<void> Function(String, {Map<String, dynamic>? extras}) callback;
|
||||
final ScrollController? scrollController;
|
||||
const FeedbackForm({required this.scrollController, required this.callback, super.key});
|
||||
|
||||
@override
|
||||
State<FeedbackForm> createState() => _FeedbackFormState();
|
||||
}
|
||||
|
||||
class _FeedbackFormState extends State<FeedbackForm> {
|
||||
final TextEditingController _feedbackInput = TextEditingController();
|
||||
bool _textFieldEmpty = false;
|
||||
bool _isSending = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_feedbackInput.addListener(() {
|
||||
setState(() {
|
||||
_textFieldEmpty = _feedbackInput.text.isEmpty;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Theme(
|
||||
data: DarkAppTheme.theme,
|
||||
child: Visibility(
|
||||
visible: !_isSending,
|
||||
replacement: const LoadingSpinner(infoText: "Daten werden ermittelt"),
|
||||
child: SingleChildScrollView(
|
||||
controller: widget.scrollController,
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text("Bitte gib keine geheimen Daten wie z.B. Passwörter weiter!", style: TextStyle(fontSize: 10)),
|
||||
const SizedBox(height: 10),
|
||||
TextField(
|
||||
controller: _feedbackInput,
|
||||
autofocus: true,
|
||||
decoration: InputDecoration(
|
||||
border: const OutlineInputBorder(),
|
||||
label: const Text("Dein Feedback"),
|
||||
errorText: _textFieldEmpty ? "Bitte gib eine Beschreibung an" : null
|
||||
),
|
||||
minLines: 1,
|
||||
maxLines: 2,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
if(_isSending) return;
|
||||
if(_feedbackInput.text.isEmpty) {
|
||||
setState(() {
|
||||
_textFieldEmpty = true;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_isSending = true;
|
||||
});
|
||||
|
||||
widget.callback(_feedbackInput.text);
|
||||
},
|
||||
child: const Text("Senden"),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
const Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
"Feedback, mal süß wie Kuchen, mal sauer wie Gurken, doch immer ein Schlüssel fürs Wachsen und Lernen.",
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Icon(Icons.emoji_objects_outlined)
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
32
lib/view/pages/more/feedback/feedbackSender.dart
Normal file
32
lib/view/pages/more/feedback/feedbackSender.dart
Normal file
@ -0,0 +1,32 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:feedback/feedback.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:loader_overlay/loader_overlay.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
|
||||
import '../../../../api/mhsl/server/feedback/addFeedback.dart';
|
||||
import '../../../../api/mhsl/server/feedback/addFeedbackParams.dart';
|
||||
import '../../../../model/accountData.dart';
|
||||
import '../../../../widget/infoDialog.dart';
|
||||
|
||||
class FeedbackSender {
|
||||
static send(BuildContext context, UserFeedback feedback) async {
|
||||
BetterFeedback.of(context).hide();
|
||||
context.loaderOverlay.show();
|
||||
AddFeedbackParams params = AddFeedbackParams(
|
||||
user: AccountData().getUserSecret(),
|
||||
feedback: feedback.text,
|
||||
screenshot: await compute((message) => base64Encode(message), feedback.screenshot),
|
||||
appVersion: int.parse((await PackageInfo.fromPlatform()).buildNumber)
|
||||
);
|
||||
AddFeedback(params).run().then((value) {
|
||||
InfoDialog.show(context, "Danke für dein Feedback!");
|
||||
context.loaderOverlay.hide();
|
||||
}).catchError((error, trace) {
|
||||
InfoDialog.show(context, error.toString());
|
||||
context.loaderOverlay.hide();
|
||||
});
|
||||
}
|
||||
}
|
@ -1,13 +1,12 @@
|
||||
|
||||
import 'package:feedback/feedback.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:in_app_review/in_app_review.dart';
|
||||
import 'package:marianum_mobile/widget/infoDialog.dart';
|
||||
import 'package:persistent_bottom_nav_bar_v2/persistent-tab-view.dart';
|
||||
|
||||
import '../../widget/ListItem.dart';
|
||||
import '../../widget/centeredLeading.dart';
|
||||
import '../../widget/infoDialog.dart';
|
||||
import '../settings/settings.dart';
|
||||
import 'more/feedback/feedbackDialog.dart';
|
||||
import 'more/feedback/feedbackSender.dart';
|
||||
import 'more/gradeAverages/gradeAverage.dart';
|
||||
import 'more/holidays/holidays.dart';
|
||||
import 'more/message/message.dart';
|
||||
@ -24,7 +23,7 @@ class Overhang extends StatelessWidget {
|
||||
appBar: AppBar(
|
||||
title: const Text("Mehr"),
|
||||
actions: [
|
||||
IconButton(onPressed: () => pushNewScreen(context, screen: const Settings(), withNavBar: false), icon: const Icon(Icons.settings))
|
||||
IconButton(onPressed: () => Navigator.of(context).push(MaterialPageRoute(builder: (context) => const Settings())), icon: const Icon(Icons.settings))
|
||||
],
|
||||
),
|
||||
body: ListView(
|
||||
@ -66,7 +65,9 @@ class Overhang extends StatelessWidget {
|
||||
title: const Text("Du hast eine Idee?"),
|
||||
subtitle: const Text("Fehler und Verbessungsvorschläge"),
|
||||
trailing: const Icon(Icons.arrow_right),
|
||||
onTap: () => showDialog(context: context, barrierDismissible: false, builder: (context) => const FeedbackDialog()),
|
||||
onTap: () {
|
||||
BetterFeedback.of(context).show((UserFeedback feedback) => FeedbackSender.send(context, feedback));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -92,7 +92,6 @@ class _ChatViewState extends State<ChatView> {
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xffefeae2),
|
||||
appBar: ClickableAppBar(
|
||||
onTap: () {
|
||||
TalkNavigator.pushSplitView(context, ChatInfo(widget.room));
|
||||
|
@ -121,7 +121,7 @@ class _ChatTileState extends State<ChatTile> {
|
||||
onTap: () async {
|
||||
setCurrentAsRead();
|
||||
ChatView view = ChatView(room: widget.data, selfId: username, avatar: circleAvatar);
|
||||
TalkNavigator.pushSplitView(context, view, overrideToSingleSubScreen: true);
|
||||
TalkNavigator.pushSplitView(context, view, onSecondaryScreen: true);
|
||||
Provider.of<ChatProps>(context, listen: false).setQueryToken(widget.data.token);
|
||||
},
|
||||
onLongPress: () {
|
||||
|
@ -1,18 +1,17 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_split_view/flutter_split_view.dart';
|
||||
import 'package:persistent_bottom_nav_bar_v2/persistent-tab-view.dart';
|
||||
|
||||
class TalkNavigator {
|
||||
static bool hasSplitViewState(BuildContext context) => context.findAncestorStateOfType<SplitViewState>() != null;
|
||||
static bool isSecondaryVisible(BuildContext context) => hasSplitViewState(context) && SplitView.of(context).isSecondaryVisible;
|
||||
|
||||
static void pushSplitView(BuildContext context, Widget view, {bool overrideToSingleSubScreen = false}) {
|
||||
static void pushSplitView(BuildContext context, Widget view, {bool onSecondaryScreen = false}) {
|
||||
if(isSecondaryVisible(context)) {
|
||||
SplitViewState splitView = SplitView.of(context);
|
||||
overrideToSingleSubScreen ? splitView.setSecondary(view) : splitView.push(view);
|
||||
onSecondaryScreen ? splitView.setSecondary(view) : splitView.push(view);
|
||||
} else {
|
||||
pushNewScreen(context, screen: view, withNavBar: false);
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (context) => view));
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@ import 'package:bottom_sheet/bottom_sheet.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:persistent_bottom_nav_bar_v2/persistent-tab-view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:rrule/rrule.dart';
|
||||
import 'package:syncfusion_flutter_calendar/calendar.dart';
|
||||
@ -103,7 +102,7 @@ class AppointmentDetails {
|
||||
trailing: IconButton(
|
||||
icon: const Icon(Icons.house_outlined),
|
||||
onPressed: () {
|
||||
pushNewScreen(context, withNavBar: false, screen: const Roomplan());
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (context) => const Roomplan()));
|
||||
},
|
||||
),
|
||||
),
|
||||
|
@ -4,7 +4,8 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LoadingSpinner extends StatefulWidget {
|
||||
const LoadingSpinner({super.key});
|
||||
final String? infoText;
|
||||
const LoadingSpinner({this.infoText, super.key});
|
||||
|
||||
@override
|
||||
State<LoadingSpinner> createState() => _LoadingSpinnerState();
|
||||
@ -34,7 +35,13 @@ class _LoadingSpinnerState extends State<LoadingSpinner> {
|
||||
Visibility(
|
||||
visible: !textVisible,
|
||||
replacement: const Icon(Icons.sentiment_dissatisfied_outlined),
|
||||
child: const CircularProgressIndicator(),
|
||||
child: Column(
|
||||
children: [
|
||||
if(widget.infoText != null) Text(widget.infoText!),
|
||||
const SizedBox(height: 10),
|
||||
const CircularProgressIndicator()
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
Visibility(
|
||||
|
@ -97,6 +97,7 @@ dependencies:
|
||||
rrule: ^0.2.16
|
||||
time_range_picker: ^2.2.0
|
||||
in_app_review: ^2.0.8
|
||||
feedback: ^3.0.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Loading…
x
Reference in New Issue
Block a user