feat(flutter): 增加关键操作震动反馈
This commit is contained in:
1 parent
e609e3ad8d
commit
8a481d5c62
20 files changed
+308
-72
No files matched your search
@@ -11,6 +11,7 @@ import '../../../core/data/repositories/comment_repository.dart';
|
||||
import '../../../core/data/repositories/interaction_repository.dart';
|
||||
import '../../../core/data/services/comment_controller.dart';
|
||||
import '../../../core/formatting/error_text.dart';
|
||||
import '../../../core/platform/haptics.dart';
|
||||
import '../../../core/theme/app_colors.dart';
|
||||
import '../../../core/widgets/auth_gate.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
@@ -60,6 +61,7 @@ class _DramaCommentsSheetState extends State<DramaCommentsSheet> {
|
||||
if (_controller.submitting) return;
|
||||
if (_input.text.trim().isEmpty) return;
|
||||
if (!await ensureSignedIn(context) || !mounted) return;
|
||||
unawaited(context.read<Haptics>().lightImpact());
|
||||
final result = await _controller.publish(_input.text, replyTo: _replyTo);
|
||||
if (!mounted) return;
|
||||
if (result.isSuccess) {
|
||||
@@ -84,6 +86,7 @@ class _DramaCommentsSheetState extends State<DramaCommentsSheet> {
|
||||
|
||||
Future<void> _like(DramaComment comment) async {
|
||||
if (!await ensureSignedIn(context) || !mounted) return;
|
||||
unawaited(context.read<Haptics>().lightImpact());
|
||||
final result = await _controller.toggleLike(comment);
|
||||
if (!result.isSuccess && mounted) {
|
||||
_showMessage(
|
||||
@@ -116,7 +119,8 @@ class _DramaCommentsSheetState extends State<DramaCommentsSheet> {
|
||||
final result = await _controller.delete(comment);
|
||||
if (!result.isSuccess && mounted) {
|
||||
_showMessage(
|
||||
result.errorMessage ?? AppLocalizations.of(context)!.commentDeleteFailed,
|
||||
result.errorMessage ??
|
||||
AppLocalizations.of(context)!.commentDeleteFailed,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -126,6 +130,7 @@ class _DramaCommentsSheetState extends State<DramaCommentsSheet> {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final draft = await showReportDialog(context, title: l10n.reportComment);
|
||||
if (draft == null || !mounted) return;
|
||||
unawaited(context.read<Haptics>().lightImpact());
|
||||
final result = await _controller.report(
|
||||
comment,
|
||||
reason: draft.reason,
|
||||
|
||||
Reference in new issue
Block a user