You can implement your own FloatingButton that opens a dialog with a form.
That's my provider to send zendesk ticket
class ZendeskProvider {
const ZendeskProvider({
required HttpProvider httpProvider,
required Environment environment,
}) : _environment = environment,
_httpProvider = httpProvider;
final HttpProvider _httpProvider;
final Environment _environment;
String get _token => _environment.zendeskToken; // your zendesk token here
String get _host => 'https://[YOUR_ACCOUNT].zendesk.com/api/v2/requests.json'; // Your account zendesk host
Future<void> report({
required ReportInfos reportInfos,
}) async {
final response = await _httpProvider.doRequest(HttpRequest.post(
_host,
'',
httpParams: HttpParams(
body: {
'request': {
'comment': {'body': reportInfos.body, 'uploads': []},
'fields': {
'360024868852': reportInfos.reason,
'360048922472': reportInfos.name,
},
'requester': {
'email': reportInfos.email,
'locale_id': 19,
'name': reportInfos.email.split('@')[0],
},
'subject': reportInfos.reason,
'tags': ['${reportInfos.device}_widget'],
'ticket_form_id': null,
'via_id': 48,
},
},
),
)..addHeader({'Authorization': 'Basic $reportInfos.email/token:$_token'}));
if (response.status != HttpStatus.success) {
throw Error();
}
}
}
You can send this request when form submitted.
These are the args I need to send to Zendesk, some of then I get through the form, others, like device, I set with web or mobile.
class ReportInfos {
final String name;
final String email;
final String reason;
final String device;
final String body;
ReportInfos({
required this.name,
required this.email,
required this.reason,
required this.device,
required this.body,
});
}