chore: fix app freezing in release mode (#2067)
This commit is contained in:
parent
8abf036381
commit
50af914f86
2 changed files with 67 additions and 65 deletions
|
|
@ -77,57 +77,54 @@ class WordEmojiChoiceState extends State<WordEmojiChoice> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
FutureBuilder(
|
||||
future: widget.token.getEmojiChoices(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasError) {
|
||||
return Text(L10n.of(context).oopsSomethingWentWrong);
|
||||
}
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
FutureBuilder(
|
||||
future: widget.token.getEmojiChoices(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasError) {
|
||||
return Text(L10n.of(context).oopsSomethingWentWrong);
|
||||
}
|
||||
|
||||
if (snapshot.connectionState == ConnectionState.waiting ||
|
||||
snapshot.data == null) {
|
||||
return const ItShimmer(originalSpan: "😀", fontSize: 26);
|
||||
}
|
||||
if (snapshot.connectionState == ConnectionState.waiting ||
|
||||
snapshot.data == null) {
|
||||
return const ItShimmer(originalSpan: "😀", fontSize: 26);
|
||||
}
|
||||
|
||||
return ChoicesArray(
|
||||
isLoading:
|
||||
snapshot.connectionState == ConnectionState.waiting,
|
||||
choices: snapshot.data!
|
||||
.map(
|
||||
(emoji) => Choice(
|
||||
color: localSelected == emoji
|
||||
? AppConfig.primaryColor
|
||||
: Colors.transparent,
|
||||
text: emoji,
|
||||
isGold: localSelected == emoji,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onPressed: (emoji, index) => onChoice(context, emoji),
|
||||
originalSpan: "😀",
|
||||
uniqueKeyForLayerLink: (int index) => "emojiChoice$index",
|
||||
selectedChoiceIndex: snapshot.data!.indexWhere(
|
||||
(element) => element == widget.token.getEmoji(),
|
||||
),
|
||||
tts: null,
|
||||
fontSize: 26,
|
||||
enableMultiSelect: true,
|
||||
isActive: true,
|
||||
overflowMode: OverflowMode.horizontalScroll,
|
||||
);
|
||||
},
|
||||
),
|
||||
const InstructionsInlineTooltip(
|
||||
instructionsEnum: InstructionsEnum.chooseEmoji,
|
||||
),
|
||||
],
|
||||
),
|
||||
return ChoicesArray(
|
||||
isLoading: snapshot.connectionState == ConnectionState.waiting,
|
||||
choices: snapshot.data!
|
||||
.map(
|
||||
(emoji) => Choice(
|
||||
color: localSelected == emoji
|
||||
? AppConfig.primaryColor
|
||||
: Colors.transparent,
|
||||
text: emoji,
|
||||
isGold: localSelected == emoji,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onPressed: (emoji, index) => onChoice(context, emoji),
|
||||
originalSpan: "😀",
|
||||
uniqueKeyForLayerLink: (int index) => "emojiChoice$index",
|
||||
selectedChoiceIndex: snapshot.data!.indexWhere(
|
||||
(element) => element == widget.token.getEmoji(),
|
||||
),
|
||||
tts: null,
|
||||
fontSize: 26,
|
||||
enableMultiSelect: true,
|
||||
isActive: true,
|
||||
overflowMode: OverflowMode.horizontalScroll,
|
||||
);
|
||||
},
|
||||
),
|
||||
const InstructionsInlineTooltip(
|
||||
instructionsEnum: InstructionsEnum.chooseEmoji,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,25 +181,30 @@ class LemmaMeaningWidgetState extends State<LemmaMeaningWidget> {
|
|||
);
|
||||
}
|
||||
|
||||
return Flexible(
|
||||
child: Tooltip(
|
||||
triggerMode: TooltipTriggerMode.tap,
|
||||
message: L10n.of(context).doubleClickToEdit,
|
||||
child: GestureDetector(
|
||||
onLongPress: () => _toggleEditMode(true),
|
||||
onDoubleTap: () => _toggleEditMode(true),
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
style: widget.style,
|
||||
children: [
|
||||
if (widget.leading != null) widget.leading!,
|
||||
if (widget.leading != null) const TextSpan(text: ' '),
|
||||
TextSpan(text: snapshot.data!.meaning),
|
||||
],
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Tooltip(
|
||||
triggerMode: TooltipTriggerMode.tap,
|
||||
message: L10n.of(context).doubleClickToEdit,
|
||||
child: GestureDetector(
|
||||
onLongPress: () => _toggleEditMode(true),
|
||||
onDoubleTap: () => _toggleEditMode(true),
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
style: widget.style,
|
||||
children: [
|
||||
if (widget.leading != null) widget.leading!,
|
||||
if (widget.leading != null) const TextSpan(text: ' '),
|
||||
TextSpan(text: snapshot.data!.meaning),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue