fix: prevent word card overflow in vocab details (#5049)
This commit is contained in:
parent
306b830035
commit
288e11ffe5
2 changed files with 76 additions and 87 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue