feat(feedback): implement user feedback collection system with email reporting
Backend: - Add user_feedback table with RLS policy - Create feedback submission API (multipart/form-data) - Implement xlsx report generation with embedded images - Add scheduled email delivery via Feishu SMTP - Create HTML email templates (daily_report, no_feedback) Frontend: - Add feedback screen with type selection and image picker - Support anonymous submission via skipAuth flag - Collect device info and app version Protocol: - Document feedback API contract and error codes - Update http-error-codes.md with FEEDBACK_* codes
This commit is contained in:
@@ -20,6 +20,10 @@ class ApiClient {
|
||||
_dio.interceptors.add(
|
||||
InterceptorsWrapper(
|
||||
onRequest: (options, handler) async {
|
||||
if (options.extra['skipAuth'] == true) {
|
||||
handler.next(options);
|
||||
return;
|
||||
}
|
||||
final token = await tokenProvider();
|
||||
if (token != null && token.isNotEmpty) {
|
||||
options.headers['Authorization'] = 'Bearer $token';
|
||||
|
||||
@@ -73,16 +73,16 @@ class HomeScreen extends StatefulWidget {
|
||||
class _HomeScreenState extends State<HomeScreen> {
|
||||
MainTab _currentTab = MainTab.home;
|
||||
late final InviteRepository _inviteRepository;
|
||||
late final ApiClient _apiClient;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final inviteApi = InviteApi(
|
||||
apiClient: ApiClient(
|
||||
baseUrl: appDependencies.backendUrl,
|
||||
tokenProvider: widget.sessionStore.getToken,
|
||||
),
|
||||
_apiClient = ApiClient(
|
||||
baseUrl: appDependencies.backendUrl,
|
||||
tokenProvider: widget.sessionStore.getToken,
|
||||
);
|
||||
final inviteApi = InviteApi(apiClient: _apiClient);
|
||||
_inviteRepository = InviteRepositoryImpl(inviteApi: inviteApi);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_tryShowWelcomeDialog();
|
||||
@@ -135,6 +135,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
settings: widget.profileSettings,
|
||||
coinBalance: widget.coinBalance,
|
||||
inviteRepository: _inviteRepository,
|
||||
apiClient: _apiClient,
|
||||
onLocaleChanged: widget.onLocaleChanged,
|
||||
onSettingsChanged: widget.onProfileSettingsChanged,
|
||||
onSaveProfile: widget.onSaveProfile,
|
||||
@@ -563,6 +564,7 @@ class _ProfileTab extends StatelessWidget {
|
||||
required this.settings,
|
||||
required this.coinBalance,
|
||||
required this.inviteRepository,
|
||||
required this.apiClient,
|
||||
required this.onLocaleChanged,
|
||||
required this.onSettingsChanged,
|
||||
required this.onSaveProfile,
|
||||
@@ -575,6 +577,7 @@ class _ProfileTab extends StatelessWidget {
|
||||
final ProfileSettingsV1 settings;
|
||||
final int coinBalance;
|
||||
final InviteRepository inviteRepository;
|
||||
final ApiClient apiClient;
|
||||
final Future<void> Function(String languageTag) onLocaleChanged;
|
||||
final Future<void> Function(ProfileSettingsV1 settings) onSettingsChanged;
|
||||
final Future<ProfileSettingsV1> Function(ProfileSettingsV1 updated)
|
||||
@@ -590,6 +593,7 @@ class _ProfileTab extends StatelessWidget {
|
||||
settings: settings,
|
||||
coinBalance: coinBalance,
|
||||
inviteRepository: inviteRepository,
|
||||
apiClient: apiClient,
|
||||
onInterfaceLanguageChanged: onLocaleChanged,
|
||||
onSettingsChanged: onSettingsChanged,
|
||||
onSaveProfile: onSaveProfile,
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
|
||||
import '../../../../core/logging/logger.dart';
|
||||
import '../../../../core/network/api_problem.dart';
|
||||
import '../../../../data/network/api_client.dart';
|
||||
import '../models/feedback.dart';
|
||||
|
||||
class FeedbackApi {
|
||||
FeedbackApi({required ApiClient apiClient}) : _apiClient = apiClient;
|
||||
|
||||
final ApiClient _apiClient;
|
||||
final Logger _logger = getLogger('features.settings.feedback_api');
|
||||
|
||||
Future<void> submitFeedback({
|
||||
required FeedbackType type,
|
||||
required String content,
|
||||
required DeviceInfo deviceInfo,
|
||||
required String appVersion,
|
||||
required String osVersion,
|
||||
required List<XFile> images,
|
||||
required bool isAnonymous,
|
||||
}) async {
|
||||
final typeName = switch (type) {
|
||||
FeedbackType.bug => 'bug',
|
||||
FeedbackType.suggestion => 'suggestion',
|
||||
FeedbackType.other => 'other',
|
||||
};
|
||||
|
||||
final formData = FormData.fromMap({
|
||||
'feedback_type': typeName,
|
||||
'content': content,
|
||||
'device_info':
|
||||
'{"platform":"${deviceInfo.platform}","model":"${deviceInfo.model}"}',
|
||||
'app_version': appVersion,
|
||||
'os_version': osVersion,
|
||||
});
|
||||
|
||||
for (final image in images) {
|
||||
formData.files.add(
|
||||
MapEntry(
|
||||
'images',
|
||||
await MultipartFile.fromFile(image.path, filename: image.name),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final options = isAnonymous
|
||||
? Options(extra: {'skipAuth': true})
|
||||
: Options();
|
||||
|
||||
try {
|
||||
await _apiClient.rawDio.post<void>(
|
||||
'/api/v1/feedback',
|
||||
data: formData,
|
||||
options: options,
|
||||
);
|
||||
} on DioException catch (error, stackTrace) {
|
||||
_logger.error(
|
||||
message: 'Submit feedback failed',
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
throw _mapProblem(error);
|
||||
}
|
||||
}
|
||||
|
||||
ApiProblem _mapProblem(DioException error) {
|
||||
final status = error.response?.statusCode ?? 500;
|
||||
final data = error.response?.data;
|
||||
if (data is Map<String, dynamic>) {
|
||||
return ApiProblem(
|
||||
status: status,
|
||||
title: (data['title'] as String?) ?? 'Request failed',
|
||||
detail: (data['detail'] as String?) ?? '',
|
||||
code: data['code'] as String?,
|
||||
);
|
||||
}
|
||||
return ApiProblem(
|
||||
status: status,
|
||||
title: 'Network error',
|
||||
detail: error.message ?? 'Request failed',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
enum FeedbackType { bug, suggestion, other }
|
||||
|
||||
class DeviceInfo {
|
||||
const DeviceInfo({required this.platform, required this.model});
|
||||
|
||||
final String platform;
|
||||
final String model;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
|
||||
import '../apis/feedback_api.dart';
|
||||
import '../models/feedback.dart';
|
||||
|
||||
abstract class FeedbackRepository {
|
||||
Future<void> submitFeedback({
|
||||
required FeedbackType type,
|
||||
required String content,
|
||||
required DeviceInfo deviceInfo,
|
||||
required String appVersion,
|
||||
required String osVersion,
|
||||
required List<XFile> images,
|
||||
required bool isAnonymous,
|
||||
});
|
||||
}
|
||||
|
||||
class FeedbackRepositoryImpl implements FeedbackRepository {
|
||||
FeedbackRepositoryImpl({required FeedbackApi feedbackApi})
|
||||
: _feedbackApi = feedbackApi;
|
||||
|
||||
final FeedbackApi _feedbackApi;
|
||||
|
||||
@override
|
||||
Future<void> submitFeedback({
|
||||
required FeedbackType type,
|
||||
required String content,
|
||||
required DeviceInfo deviceInfo,
|
||||
required String appVersion,
|
||||
required String osVersion,
|
||||
required List<XFile> images,
|
||||
required bool isAnonymous,
|
||||
}) {
|
||||
return _feedbackApi.submitFeedback(
|
||||
type: type,
|
||||
content: content,
|
||||
deviceInfo: deviceInfo,
|
||||
appVersion: appVersion,
|
||||
osVersion: osVersion,
|
||||
images: images,
|
||||
isAnonymous: isAnonymous,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,389 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
import '../../../../core/logging/logger.dart';
|
||||
import '../../../../data/network/api_client.dart';
|
||||
import '../../../../l10n/app_localizations.dart';
|
||||
import '../../../../shared/theme/design_tokens.dart';
|
||||
import '../../../../shared/widgets/toast/toast.dart';
|
||||
import '../../../../shared/widgets/toast/toast_type.dart';
|
||||
import '../../data/apis/feedback_api.dart';
|
||||
import '../../data/models/feedback.dart';
|
||||
import '../../data/repositories/feedback_repository.dart';
|
||||
|
||||
class FeedbackScreen extends StatefulWidget {
|
||||
const FeedbackScreen({super.key, required this.apiClient});
|
||||
|
||||
final ApiClient apiClient;
|
||||
|
||||
@override
|
||||
State<FeedbackScreen> createState() => _FeedbackScreenState();
|
||||
}
|
||||
|
||||
class _FeedbackScreenState extends State<FeedbackScreen> {
|
||||
final Logger _logger = getLogger('features.settings.feedback_screen');
|
||||
final ImagePicker _imagePicker = ImagePicker();
|
||||
final TextEditingController _contentController = TextEditingController();
|
||||
|
||||
FeedbackType _selectedType = FeedbackType.bug;
|
||||
List<XFile> _selectedImages = [];
|
||||
bool _isAnonymous = false;
|
||||
bool _isSubmitting = false;
|
||||
|
||||
static const int _maxImages = 3;
|
||||
static const int _maxContentSize = 500;
|
||||
static const int _maxImageSizeBytes = 5 * 1024 * 1024;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_contentController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: colors.surfaceContainerLow,
|
||||
appBar: AppBar(
|
||||
title: Text(l10n.feedbackTitle),
|
||||
centerTitle: true,
|
||||
backgroundColor: colors.surfaceContainerLow,
|
||||
surfaceTintColor: colors.surfaceContainerLow,
|
||||
),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
AppSpacing.lg,
|
||||
AppSpacing.md,
|
||||
AppSpacing.lg,
|
||||
AppSpacing.xxl,
|
||||
),
|
||||
children: [
|
||||
Text(
|
||||
l10n.feedbackTypeLabel,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
SegmentedButton<FeedbackType>(
|
||||
showSelectedIcon: false,
|
||||
segments: [
|
||||
ButtonSegment(
|
||||
value: FeedbackType.bug,
|
||||
label: Text(l10n.feedbackTypeBug),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: FeedbackType.suggestion,
|
||||
label: Text(l10n.feedbackTypeSuggestion),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: FeedbackType.other,
|
||||
label: Text(l10n.feedbackTypeOther),
|
||||
),
|
||||
],
|
||||
selected: {_selectedType},
|
||||
onSelectionChanged: (selection) {
|
||||
setState(() {
|
||||
_selectedType = selection.first;
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(height: AppSpacing.xl),
|
||||
Text(
|
||||
l10n.feedbackContentLabel,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
TextField(
|
||||
controller: _contentController,
|
||||
maxLines: 8,
|
||||
maxLength: _maxContentSize,
|
||||
decoration: InputDecoration(
|
||||
hintText: l10n.feedbackContentHint,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(AppRadius.md),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: AppSpacing.xl),
|
||||
Text(
|
||||
l10n.feedbackImagesLabel,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: AppSpacing.sm),
|
||||
_buildImagePickerRow(colors),
|
||||
const SizedBox(height: AppSpacing.xl),
|
||||
CheckboxListTile(
|
||||
value: _isAnonymous,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_isAnonymous = value ?? false;
|
||||
});
|
||||
},
|
||||
title: Text(l10n.feedbackAnonymousLabel),
|
||||
subtitle: Text(
|
||||
l10n.feedbackAnonymousHint,
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.bodySmall?.copyWith(color: colors.onSurfaceVariant),
|
||||
),
|
||||
contentPadding: EdgeInsets.zero,
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
),
|
||||
const SizedBox(height: AppSpacing.xl),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: FilledButton(
|
||||
onPressed: _isSubmitting ? null : _submit,
|
||||
child: _isSubmitting
|
||||
? SizedBox(
|
||||
height: 20,
|
||||
width: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: colors.onPrimary,
|
||||
),
|
||||
)
|
||||
: Text(l10n.feedbackSubmit),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildImagePickerRow(ColorScheme colors) {
|
||||
return Wrap(
|
||||
spacing: AppSpacing.sm,
|
||||
runSpacing: AppSpacing.sm,
|
||||
children: [
|
||||
..._selectedImages.asMap().entries.map((entry) {
|
||||
final index = entry.key;
|
||||
final file = entry.value;
|
||||
return Stack(
|
||||
children: [
|
||||
Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(AppRadius.md),
|
||||
border: Border.all(color: colors.outlineVariant),
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: kIsWeb
|
||||
? Image.network(
|
||||
file.path,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (_, e, _) =>
|
||||
const Icon(Icons.broken_image),
|
||||
)
|
||||
: Image.file(
|
||||
File(file.path),
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (_, e, _) =>
|
||||
const Icon(Icons.broken_image),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 4,
|
||||
right: 4,
|
||||
child: GestureDetector(
|
||||
onTap: () => _removeImage(index),
|
||||
child: Container(
|
||||
width: 22,
|
||||
height: 22,
|
||||
decoration: BoxDecoration(
|
||||
color: colors.error,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(Icons.close, size: 14, color: colors.onError),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
if (_selectedImages.length < _maxImages)
|
||||
GestureDetector(
|
||||
onTap: _pickImage,
|
||||
child: Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(AppRadius.md),
|
||||
border: Border.all(color: colors.outlineVariant),
|
||||
color: colors.surfaceContainerHighest,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add_photo_alternate_outlined,
|
||||
color: colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _pickImage() async {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
if (_selectedImages.length >= _maxImages) {
|
||||
Toast.show(context, l10n.feedbackTooManyImages, type: ToastType.warning);
|
||||
return;
|
||||
}
|
||||
XFile? picked;
|
||||
try {
|
||||
picked = await _imagePicker.pickImage(
|
||||
source: ImageSource.gallery,
|
||||
maxWidth: 1920,
|
||||
imageQuality: 85,
|
||||
requestFullMetadata: false,
|
||||
);
|
||||
} catch (error, stackTrace) {
|
||||
_logger.error(
|
||||
message: 'Image picker failed',
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (picked == null || !mounted) return;
|
||||
|
||||
final fileSize = await picked.length();
|
||||
if (fileSize > _maxImageSizeBytes) {
|
||||
if (!mounted) return;
|
||||
Toast.show(context, l10n.feedbackImageTooLarge, type: ToastType.warning);
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_selectedImages = [..._selectedImages, picked!];
|
||||
});
|
||||
}
|
||||
|
||||
void _removeImage(int index) {
|
||||
setState(() {
|
||||
_selectedImages = List.from(_selectedImages)..removeAt(index);
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _submit() async {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final content = _contentController.text.trim();
|
||||
|
||||
if (content.isEmpty) {
|
||||
Toast.show(
|
||||
context,
|
||||
l10n.feedbackContentRequired,
|
||||
type: ToastType.warning,
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (content.length > _maxContentSize) {
|
||||
Toast.show(context, l10n.feedbackContentTooLong, type: ToastType.warning);
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_isSubmitting = true;
|
||||
});
|
||||
|
||||
try {
|
||||
final feedbackApi = FeedbackApi(apiClient: widget.apiClient);
|
||||
final repository = FeedbackRepositoryImpl(feedbackApi: feedbackApi);
|
||||
|
||||
await repository.submitFeedback(
|
||||
type: _selectedType,
|
||||
content: content,
|
||||
deviceInfo: await _collectDeviceInfo(),
|
||||
appVersion: await _appVersion(),
|
||||
osVersion: await _osVersion(),
|
||||
images: _selectedImages,
|
||||
isAnonymous: _isAnonymous,
|
||||
);
|
||||
|
||||
if (!mounted) return;
|
||||
Toast.show(context, l10n.feedbackSuccess, type: ToastType.success);
|
||||
Navigator.of(context).pop();
|
||||
} catch (error, stackTrace) {
|
||||
_logger.error(
|
||||
message: 'Submit feedback failed',
|
||||
error: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
if (!mounted) return;
|
||||
Toast.show(context, l10n.errorRequestGeneric, type: ToastType.error);
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_isSubmitting = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<DeviceInfo> _collectDeviceInfo() async {
|
||||
final deviceInfo = DeviceInfoPlugin();
|
||||
if (Platform.isAndroid) {
|
||||
final android = await deviceInfo.androidInfo;
|
||||
return DeviceInfo(
|
||||
platform: 'android',
|
||||
model: '${android.brand} ${android.model}',
|
||||
);
|
||||
} else if (Platform.isIOS) {
|
||||
final ios = await deviceInfo.iosInfo;
|
||||
return DeviceInfo(platform: 'ios', model: _iosDeviceName(ios));
|
||||
}
|
||||
return DeviceInfo(platform: defaultTargetPlatform.name, model: 'unknown');
|
||||
}
|
||||
|
||||
String _iosDeviceName(IosDeviceInfo ios) {
|
||||
final machine = ios.utsname.machine;
|
||||
final deviceName = _iosDeviceMapping[machine] ?? machine;
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
static const Map<String, String> _iosDeviceMapping = {
|
||||
'iPhone13,2': 'iPhone 12',
|
||||
'iPhone13,3': 'iPhone 12 Pro',
|
||||
'iPhone13,4': 'iPhone 12 Pro Max',
|
||||
'iPhone14,2': 'iPhone 13 Pro',
|
||||
'iPhone14,3': 'iPhone 13 Pro Max',
|
||||
'iPhone14,4': 'iPhone 13 mini',
|
||||
'iPhone14,5': 'iPhone 13',
|
||||
'iPhone15,2': 'iPhone 14 Pro',
|
||||
'iPhone15,3': 'iPhone 14 Pro Max',
|
||||
'iPhone14,7': 'iPhone 14',
|
||||
'iPhone14,8': 'iPhone 14 Plus',
|
||||
'iPhone15,4': 'iPhone 15',
|
||||
'iPhone15,5': 'iPhone 15 Plus',
|
||||
'iPhone16,1': 'iPhone 15 Pro',
|
||||
'iPhone16,2': 'iPhone 15 Pro Max',
|
||||
'iPhone17,1': 'iPhone 16 Pro',
|
||||
'iPhone17,2': 'iPhone 16 Pro Max',
|
||||
'iPhone17,3': 'iPhone 16',
|
||||
'iPhone17,4': 'iPhone 16 Plus',
|
||||
};
|
||||
|
||||
Future<String> _appVersion() async {
|
||||
final info = await PackageInfo.fromPlatform();
|
||||
return '${info.version}+${info.buildNumber}';
|
||||
}
|
||||
|
||||
Future<String> _osVersion() async {
|
||||
final deviceInfo = DeviceInfoPlugin();
|
||||
if (Platform.isAndroid) {
|
||||
final android = await deviceInfo.androidInfo;
|
||||
return 'Android ${android.version.release} (API ${android.version.sdkInt})';
|
||||
} else if (Platform.isIOS) {
|
||||
final ios = await deviceInfo.iosInfo;
|
||||
return 'iOS ${ios.systemVersion}';
|
||||
}
|
||||
return defaultTargetPlatform.name;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../data/network/api_client.dart';
|
||||
import '../../../../l10n/app_localizations.dart';
|
||||
import '../../../../shared/theme/design_tokens.dart';
|
||||
import '../../../../shared/widgets/app_modal_dialog.dart';
|
||||
@@ -9,6 +10,7 @@ import '../../data/repositories/invite_repository.dart';
|
||||
import 'account_delete_screen.dart';
|
||||
import '../widgets/settings_section_widgets.dart';
|
||||
import 'coin_center_screen.dart';
|
||||
import 'feedback_screen.dart';
|
||||
import 'general_settings_screen.dart';
|
||||
import 'invite_screen.dart';
|
||||
import 'legal_center_screen.dart';
|
||||
@@ -21,6 +23,7 @@ class SettingsScreen extends StatefulWidget {
|
||||
required this.settings,
|
||||
required this.coinBalance,
|
||||
required this.inviteRepository,
|
||||
required this.apiClient,
|
||||
required this.onInterfaceLanguageChanged,
|
||||
required this.onSettingsChanged,
|
||||
required this.onUploadAvatar,
|
||||
@@ -33,6 +36,7 @@ class SettingsScreen extends StatefulWidget {
|
||||
final ProfileSettingsV1 settings;
|
||||
final int coinBalance;
|
||||
final InviteRepository inviteRepository;
|
||||
final ApiClient apiClient;
|
||||
final Future<void> Function(String languageTag) onInterfaceLanguageChanged;
|
||||
final Future<void> Function(ProfileSettingsV1 settings) onSettingsChanged;
|
||||
final Future<ProfileSettingsV1> Function(String filePath) onUploadAvatar;
|
||||
@@ -125,6 +129,23 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: AppSpacing.xl),
|
||||
SettingsGroupCard(
|
||||
children: [
|
||||
SettingsMenuTile(
|
||||
icon: Icons.feedback_outlined,
|
||||
title: l10n.settingsFeedbackTitle,
|
||||
tint: colors.primary,
|
||||
background: colors.surfaceContainerHighest,
|
||||
showDivider: false,
|
||||
onTap: () => Navigator.of(context).push<void>(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => FeedbackScreen(apiClient: widget.apiClient),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SettingsGroupCard(
|
||||
children: [
|
||||
SettingsMenuTile(
|
||||
|
||||
@@ -487,5 +487,23 @@
|
||||
"settingsDoNotSellTitle": "Personalized Ads",
|
||||
"settingsDoNotSellDescription": "When off, your personal info won't be used for ad recommendations",
|
||||
"settingsDoNotSellEnabled": "Off",
|
||||
"settingsDoNotSellDisabled": "On"
|
||||
"settingsDoNotSellDisabled": "On",
|
||||
"settingsFeedbackTitle": "Feedback",
|
||||
"feedbackTitle": "Feedback",
|
||||
"feedbackTypeLabel": "Feedback Type",
|
||||
"feedbackTypeBug": "Bug",
|
||||
"feedbackTypeSuggestion": "Suggestion",
|
||||
"feedbackTypeOther": "Other",
|
||||
"feedbackContentLabel": "Content",
|
||||
"feedbackContentHint": "Please describe your issue or suggestion in detail...",
|
||||
"feedbackImagesLabel": "Add Screenshots (max 3)",
|
||||
"feedbackAnonymousLabel": "Do not upload my personal information",
|
||||
"feedbackAnonymousHint": "If checked, your user ID will not be collected. Device info will still be collected for troubleshooting.",
|
||||
"feedbackSubmit": "Submit Feedback",
|
||||
"feedbackSubmitting": "Submitting...",
|
||||
"feedbackSuccess": "Thank you for your feedback. We will process it soon.",
|
||||
"feedbackContentRequired": "Please enter feedback content",
|
||||
"feedbackContentTooLong": "Feedback content cannot exceed 500 characters",
|
||||
"feedbackTooManyImages": "Maximum 3 images allowed",
|
||||
"feedbackImageTooLarge": "Image size cannot exceed 5MB"
|
||||
}
|
||||
|
||||
@@ -2324,6 +2324,114 @@ abstract class AppLocalizations {
|
||||
/// In zh, this message translates to:
|
||||
/// **'已开启'**
|
||||
String get settingsDoNotSellDisabled;
|
||||
|
||||
/// No description provided for @settingsFeedbackTitle.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'意见反馈'**
|
||||
String get settingsFeedbackTitle;
|
||||
|
||||
/// No description provided for @feedbackTitle.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'意见反馈'**
|
||||
String get feedbackTitle;
|
||||
|
||||
/// No description provided for @feedbackTypeLabel.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'反馈类型'**
|
||||
String get feedbackTypeLabel;
|
||||
|
||||
/// No description provided for @feedbackTypeBug.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'问题反馈'**
|
||||
String get feedbackTypeBug;
|
||||
|
||||
/// No description provided for @feedbackTypeSuggestion.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'功能建议'**
|
||||
String get feedbackTypeSuggestion;
|
||||
|
||||
/// No description provided for @feedbackTypeOther.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'其他'**
|
||||
String get feedbackTypeOther;
|
||||
|
||||
/// No description provided for @feedbackContentLabel.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'反馈内容'**
|
||||
String get feedbackContentLabel;
|
||||
|
||||
/// No description provided for @feedbackContentHint.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'请详细描述您的问题或建议...'**
|
||||
String get feedbackContentHint;
|
||||
|
||||
/// No description provided for @feedbackImagesLabel.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'添加截图(最多3张)'**
|
||||
String get feedbackImagesLabel;
|
||||
|
||||
/// No description provided for @feedbackAnonymousLabel.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'不上传我的个人信息'**
|
||||
String get feedbackAnonymousLabel;
|
||||
|
||||
/// No description provided for @feedbackAnonymousHint.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'勾选后将不采集您的用户ID,仅采集设备信息用于问题排查'**
|
||||
String get feedbackAnonymousHint;
|
||||
|
||||
/// No description provided for @feedbackSubmit.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'提交反馈'**
|
||||
String get feedbackSubmit;
|
||||
|
||||
/// No description provided for @feedbackSubmitting.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'提交中...'**
|
||||
String get feedbackSubmitting;
|
||||
|
||||
/// No description provided for @feedbackSuccess.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'感谢您的反馈,我们会尽快处理'**
|
||||
String get feedbackSuccess;
|
||||
|
||||
/// No description provided for @feedbackContentRequired.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'请输入反馈内容'**
|
||||
String get feedbackContentRequired;
|
||||
|
||||
/// No description provided for @feedbackContentTooLong.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'反馈内容不能超过500字'**
|
||||
String get feedbackContentTooLong;
|
||||
|
||||
/// No description provided for @feedbackTooManyImages.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'最多只能上传3张图片'**
|
||||
String get feedbackTooManyImages;
|
||||
|
||||
/// No description provided for @feedbackImageTooLarge.
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'图片大小不能超过5MB'**
|
||||
String get feedbackImageTooLarge;
|
||||
}
|
||||
|
||||
class _AppLocalizationsDelegate
|
||||
|
||||
@@ -1224,4 +1224,62 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get settingsDoNotSellDisabled => 'On';
|
||||
|
||||
@override
|
||||
String get settingsFeedbackTitle => 'Feedback';
|
||||
|
||||
@override
|
||||
String get feedbackTitle => 'Feedback';
|
||||
|
||||
@override
|
||||
String get feedbackTypeLabel => 'Feedback Type';
|
||||
|
||||
@override
|
||||
String get feedbackTypeBug => 'Bug';
|
||||
|
||||
@override
|
||||
String get feedbackTypeSuggestion => 'Suggestion';
|
||||
|
||||
@override
|
||||
String get feedbackTypeOther => 'Other';
|
||||
|
||||
@override
|
||||
String get feedbackContentLabel => 'Content';
|
||||
|
||||
@override
|
||||
String get feedbackContentHint =>
|
||||
'Please describe your issue or suggestion in detail...';
|
||||
|
||||
@override
|
||||
String get feedbackImagesLabel => 'Add Screenshots (max 3)';
|
||||
|
||||
@override
|
||||
String get feedbackAnonymousLabel => 'Do not upload my personal information';
|
||||
|
||||
@override
|
||||
String get feedbackAnonymousHint =>
|
||||
'If checked, your user ID will not be collected. Device info will still be collected for troubleshooting.';
|
||||
|
||||
@override
|
||||
String get feedbackSubmit => 'Submit Feedback';
|
||||
|
||||
@override
|
||||
String get feedbackSubmitting => 'Submitting...';
|
||||
|
||||
@override
|
||||
String get feedbackSuccess =>
|
||||
'Thank you for your feedback. We will process it soon.';
|
||||
|
||||
@override
|
||||
String get feedbackContentRequired => 'Please enter feedback content';
|
||||
|
||||
@override
|
||||
String get feedbackContentTooLong =>
|
||||
'Feedback content cannot exceed 500 characters';
|
||||
|
||||
@override
|
||||
String get feedbackTooManyImages => 'Maximum 3 images allowed';
|
||||
|
||||
@override
|
||||
String get feedbackImageTooLarge => 'Image size cannot exceed 5MB';
|
||||
}
|
||||
|
||||
@@ -1171,6 +1171,60 @@ class AppLocalizationsZh extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get settingsDoNotSellDisabled => '已开启';
|
||||
|
||||
@override
|
||||
String get settingsFeedbackTitle => '意见反馈';
|
||||
|
||||
@override
|
||||
String get feedbackTitle => '意见反馈';
|
||||
|
||||
@override
|
||||
String get feedbackTypeLabel => '反馈类型';
|
||||
|
||||
@override
|
||||
String get feedbackTypeBug => '问题反馈';
|
||||
|
||||
@override
|
||||
String get feedbackTypeSuggestion => '功能建议';
|
||||
|
||||
@override
|
||||
String get feedbackTypeOther => '其他';
|
||||
|
||||
@override
|
||||
String get feedbackContentLabel => '反馈内容';
|
||||
|
||||
@override
|
||||
String get feedbackContentHint => '请详细描述您的问题或建议...';
|
||||
|
||||
@override
|
||||
String get feedbackImagesLabel => '添加截图(最多3张)';
|
||||
|
||||
@override
|
||||
String get feedbackAnonymousLabel => '不上传我的个人信息';
|
||||
|
||||
@override
|
||||
String get feedbackAnonymousHint => '勾选后将不采集您的用户ID,仅采集设备信息用于问题排查';
|
||||
|
||||
@override
|
||||
String get feedbackSubmit => '提交反馈';
|
||||
|
||||
@override
|
||||
String get feedbackSubmitting => '提交中...';
|
||||
|
||||
@override
|
||||
String get feedbackSuccess => '感谢您的反馈,我们会尽快处理';
|
||||
|
||||
@override
|
||||
String get feedbackContentRequired => '请输入反馈内容';
|
||||
|
||||
@override
|
||||
String get feedbackContentTooLong => '反馈内容不能超过500字';
|
||||
|
||||
@override
|
||||
String get feedbackTooManyImages => '最多只能上传3张图片';
|
||||
|
||||
@override
|
||||
String get feedbackImageTooLarge => '图片大小不能超过5MB';
|
||||
}
|
||||
|
||||
/// The translations for Chinese, using the Han script (`zh_Hant`).
|
||||
@@ -2096,4 +2150,58 @@ class AppLocalizationsZhHant extends AppLocalizationsZh {
|
||||
|
||||
@override
|
||||
String get settingsDoNotSellDisabled => '已開啟';
|
||||
|
||||
@override
|
||||
String get settingsFeedbackTitle => '意見回饋';
|
||||
|
||||
@override
|
||||
String get feedbackTitle => '意見回饋';
|
||||
|
||||
@override
|
||||
String get feedbackTypeLabel => '回饋類型';
|
||||
|
||||
@override
|
||||
String get feedbackTypeBug => '問題回饋';
|
||||
|
||||
@override
|
||||
String get feedbackTypeSuggestion => '功能建議';
|
||||
|
||||
@override
|
||||
String get feedbackTypeOther => '其他';
|
||||
|
||||
@override
|
||||
String get feedbackContentLabel => '回饋內容';
|
||||
|
||||
@override
|
||||
String get feedbackContentHint => '請詳細描述您的問題或建議...';
|
||||
|
||||
@override
|
||||
String get feedbackImagesLabel => '添加截圖(最多3張)';
|
||||
|
||||
@override
|
||||
String get feedbackAnonymousLabel => '不上傳我的個人信息';
|
||||
|
||||
@override
|
||||
String get feedbackAnonymousHint => '勾選後將不採集您的用戶ID,僅採集設備信息用於問題排查';
|
||||
|
||||
@override
|
||||
String get feedbackSubmit => '提交回饋';
|
||||
|
||||
@override
|
||||
String get feedbackSubmitting => '提交中...';
|
||||
|
||||
@override
|
||||
String get feedbackSuccess => '感謝您的回饋,我們會盡快處理';
|
||||
|
||||
@override
|
||||
String get feedbackContentRequired => '請輸入回饋內容';
|
||||
|
||||
@override
|
||||
String get feedbackContentTooLong => '回饋內容不能超過500字';
|
||||
|
||||
@override
|
||||
String get feedbackTooManyImages => '最多只能上傳3張圖片';
|
||||
|
||||
@override
|
||||
String get feedbackImageTooLarge => '圖片大小不能超過5MB';
|
||||
}
|
||||
|
||||
@@ -487,5 +487,23 @@
|
||||
"settingsDoNotSellTitle": "个性化广告推荐",
|
||||
"settingsDoNotSellDescription": "关闭后,我们不会将您的个人信息用于广告推荐",
|
||||
"settingsDoNotSellEnabled": "已关闭",
|
||||
"settingsDoNotSellDisabled": "已开启"
|
||||
"settingsDoNotSellDisabled": "已开启",
|
||||
"settingsFeedbackTitle": "意见反馈",
|
||||
"feedbackTitle": "意见反馈",
|
||||
"feedbackTypeLabel": "反馈类型",
|
||||
"feedbackTypeBug": "问题反馈",
|
||||
"feedbackTypeSuggestion": "功能建议",
|
||||
"feedbackTypeOther": "其他",
|
||||
"feedbackContentLabel": "反馈内容",
|
||||
"feedbackContentHint": "请详细描述您的问题或建议...",
|
||||
"feedbackImagesLabel": "添加截图(最多3张)",
|
||||
"feedbackAnonymousLabel": "不上传我的个人信息",
|
||||
"feedbackAnonymousHint": "勾选后将不采集您的用户ID,仅采集设备信息用于问题排查",
|
||||
"feedbackSubmit": "提交反馈",
|
||||
"feedbackSubmitting": "提交中...",
|
||||
"feedbackSuccess": "感谢您的反馈,我们会尽快处理",
|
||||
"feedbackContentRequired": "请输入反馈内容",
|
||||
"feedbackContentTooLong": "反馈内容不能超过500字",
|
||||
"feedbackTooManyImages": "最多只能上传3张图片",
|
||||
"feedbackImageTooLarge": "图片大小不能超过5MB"
|
||||
}
|
||||
|
||||
@@ -389,5 +389,23 @@
|
||||
"settingsDoNotSellTitle": "個人化廣告推薦",
|
||||
"settingsDoNotSellDescription": "關閉後,我們不會將您的個人資訊用於廣告推薦",
|
||||
"settingsDoNotSellEnabled": "已關閉",
|
||||
"settingsDoNotSellDisabled": "已開啟"
|
||||
"settingsDoNotSellDisabled": "已開啟",
|
||||
"settingsFeedbackTitle": "意見回饋",
|
||||
"feedbackTitle": "意見回饋",
|
||||
"feedbackTypeLabel": "回饋類型",
|
||||
"feedbackTypeBug": "問題回饋",
|
||||
"feedbackTypeSuggestion": "功能建議",
|
||||
"feedbackTypeOther": "其他",
|
||||
"feedbackContentLabel": "回饋內容",
|
||||
"feedbackContentHint": "請詳細描述您的問題或建議...",
|
||||
"feedbackImagesLabel": "添加截圖(最多3張)",
|
||||
"feedbackAnonymousLabel": "不上傳我的個人信息",
|
||||
"feedbackAnonymousHint": "勾選後將不採集您的用戶ID,僅採集設備信息用於問題排查",
|
||||
"feedbackSubmit": "提交回饋",
|
||||
"feedbackSubmitting": "提交中...",
|
||||
"feedbackSuccess": "感謝您的回饋,我們會盡快處理",
|
||||
"feedbackContentRequired": "請輸入回饋內容",
|
||||
"feedbackContentTooLong": "回饋內容不能超過500字",
|
||||
"feedbackTooManyImages": "最多只能上傳3張圖片",
|
||||
"feedbackImageTooLarge": "圖片大小不能超過5MB"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user