Skip to content

Commit

Permalink
multi languages transcript are properly displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
josancamon19 committed Jun 12, 2024
1 parent bd8def2 commit 5583cfc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/AppWithWearable/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class _MyAppState extends State<MyApp> {
selectionColor: Colors.deepPurple,
)),
themeMode: ThemeMode.dark,
home: (SharedPreferencesUtil().onboardingCompleted && SharedPreferencesUtil().deviceId != '')
home: (!SharedPreferencesUtil().onboardingCompleted && SharedPreferencesUtil().deviceId != '')
? const HomePageWrapper()
: const WelcomePage(),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:flutter/material.dart';
Expand Down Expand Up @@ -271,6 +272,7 @@ class TranscriptWidgetState extends State<TranscriptWidget> {
}

_getDeepgramTranscriptUI() {
var needsUtf8 = SharedPreferencesUtil().recordingsLanguage != 'en';
return ListView.separated(
padding: EdgeInsets.zero,
shrinkWrap: true,
Expand Down Expand Up @@ -305,7 +307,7 @@ class TranscriptWidgetState extends State<TranscriptWidget> {
alignment: Alignment.centerLeft,
child: SelectionArea(
child: Text(
data.text,
needsUtf8 ? utf8.decode(data.text.toString().codeUnits) : data.text,
style: const TextStyle(letterSpacing: 0.0, color: Colors.grey),
textAlign: TextAlign.left,
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:friend_private/backend/mixpanel.dart';
import 'package:friend_private/backend/storage/memories.dart';
Expand Down Expand Up @@ -60,8 +62,8 @@ class _MemoryListItemState extends State<MemoryListItem> {
widget.memory.discarded
? Text(
widget.memory.transcript.length > 100
? '${widget.memory.transcript.substring(0, 100)}...'
: widget.memory.transcript,
? '${utf8.decode(widget.memory.transcript.substring(0, 100).toString().codeUnits)}...'
: utf8.decode(widget.memory.transcript.toString().codeUnits) ,
style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.grey.shade300, height: 1.3),
)
: const SizedBox(height: 8),
Expand Down
4 changes: 3 additions & 1 deletion apps/AppWithWearable/lib/pages/memory_detail/page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:friend_private/backend/mixpanel.dart';
Expand Down Expand Up @@ -269,7 +271,7 @@ class _MemoryDetailPageState extends State<MemoryDetailPage> {
),
const SizedBox(height: 16),
ExpandableTextWidget(
text: widget.memory.transcript,
text: utf8.decode(widget.memory.transcript.toString().codeUnits),
maxLines: 6,
linkColor: Colors.grey.shade300,
style: TextStyle(color: Colors.grey.shade300, fontSize: 15, height: 1.3),
Expand Down

0 comments on commit 5583cfc

Please sign in to comment.