fix: prevent word card overflow in vocab details (#5049)

This commit is contained in:
ggurdin 2026-01-05 12:21:33 -05:00 committed by GitHub
parent 306b830035
commit 288e11ffe5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 76 additions and 87 deletions

View file

@ -90,38 +90,33 @@ class VocabDetailsView extends StatelessWidget {
child: Column(
spacing: 16.0,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
WordZoomWidget(
token: tokenText,
WordZoomWidget(
token: tokenText,
langCode:
MatrixState.pangeaController.userController.userL2Code!,
construct: constructId,
onClose: Navigator.of(context).pop,
onFlagTokenInfo:
(LemmaInfoResponse lemmaInfo, String phonetics) {
final requestData = TokenInfoFeedbackRequestData(
userId: Matrix.of(context).client.userID!,
detectedLanguage:
MatrixState.pangeaController.userController.userL2Code!,
tokens: [token],
selectedToken: 0,
wordCardL1:
MatrixState.pangeaController.userController.userL1Code!,
lemmaInfo: lemmaInfo,
phonetics: phonetics,
);
TokenFeedbackUtil.showTokenFeedbackDialog(
context,
requestData: requestData,
langCode:
MatrixState.pangeaController.userController.userL2Code!,
construct: constructId,
onClose: Navigator.of(context).pop,
onFlagTokenInfo:
(LemmaInfoResponse lemmaInfo, String phonetics) {
final requestData = TokenInfoFeedbackRequestData(
userId: Matrix.of(context).client.userID!,
detectedLanguage: MatrixState
.pangeaController.userController.userL2Code!,
tokens: [token],
selectedToken: 0,
wordCardL1: MatrixState
.pangeaController.userController.userL1Code!,
lemmaInfo: lemmaInfo,
phonetics: phonetics,
);
TokenFeedbackUtil.showTokenFeedbackDialog(
context,
requestData: requestData,
langCode: MatrixState
.pangeaController.userController.userL2Code!,
);
},
),
],
);
},
),
if (construct != null)
Column(

View file

@ -71,66 +71,60 @@ class WordZoomWidget extends StatelessWidget {
child: Column(
spacing: 12.0,
children: [
LayoutBuilder(
builder: (context, constraints) {
return SizedBox(
height: 40.0,
width: constraints.maxWidth - 24.0,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
onClose != null
? IconButton(
color:
Theme.of(context).iconTheme.color,
icon: const Icon(Icons.close),
onPressed: onClose,
)
: const SizedBox(
width: 40.0,
height: 40.0,
),
Flexible(
child: Container(
constraints: const BoxConstraints(
minHeight: 40.0,
),
alignment: Alignment.center,
child: Text(
token.content,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 28.0,
fontWeight: FontWeight.w600,
height: 1.2,
color: Theme.of(context).brightness ==
Brightness.light
? AppConfig.yellowDark
: AppConfig.yellowLight,
overflow: TextOverflow.ellipsis,
),
),
SizedBox(
height: 40.0,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
onClose != null
? IconButton(
color: Theme.of(context).iconTheme.color,
icon: const Icon(Icons.close),
onPressed: onClose,
)
: const SizedBox(
width: 40.0,
height: 40.0,
),
Flexible(
child: Container(
constraints: const BoxConstraints(
minHeight: 40.0,
),
alignment: Alignment.center,
child: Text(
token.content,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 28.0,
fontWeight: FontWeight.w600,
height: 1.2,
color: Theme.of(context).brightness ==
Brightness.light
? AppConfig.yellowDark
: AppConfig.yellowLight,
overflow: TextOverflow.ellipsis,
),
),
onFlagTokenInfo != null
? TokenFeedbackButton(
textLanguage: PLanguageStore.byLangCode(
langCode,
) ??
LanguageModel.unknown,
constructId: construct,
text: token.content,
onFlagTokenInfo: onFlagTokenInfo!,
messageInfo: event?.content ?? {},
)
: const SizedBox(
width: 40.0,
height: 40.0,
),
],
),
),
);
},
onFlagTokenInfo != null
? TokenFeedbackButton(
textLanguage: PLanguageStore.byLangCode(
langCode,
) ??
LanguageModel.unknown,
constructId: construct,
text: token.content,
onFlagTokenInfo: onFlagTokenInfo!,
messageInfo: event?.content ?? {},
)
: const SizedBox(
width: 40.0,
height: 40.0,
),
],
),
),
Expanded(
child: Column(