@ -43,222 +43,236 @@ class WordZoomWidget extends StatelessWidget {
true & &
true & &
overlayController . hideWordCardContent ;
overlayController . hideWordCardContent ;
String get transformTargetId = > " newer-word-overlay- ${ token . text . uniqueKey } " ;
LayerLink get layerLink = >
MatrixState . pAnyState . layerLinkAndKey ( transformTargetId ) . link ;
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
final GlobalKey cardKey = MatrixState . pAnyState
/ / final GlobalKey cardKey = MatrixState . pAnyState
. layerLinkAndKey ( " word-zoom-card- ${ token . text . uniqueKey } " )
/ / . layerLinkAndKey ( " word-zoom-card- ${ token . text . uniqueKey } " )
. key ;
/ / . key ;
final overlayColor = Theme . of ( context ) . scaffoldBackgroundColor ;
final overlayColor = Theme . of ( context ) . scaffoldBackgroundColor ;
return Stack (
return Stack (
children: [
children: [
Container (
Container (
key: cardKey ,
padding: const EdgeInsets . all ( 12.0 ) ,
padding: const EdgeInsets . all ( 12.0 ) ,
constraints: const BoxConstraints (
constraints: const BoxConstraints (
minHeight: AppConfig . toolbarMinHeight - 8 ,
minHeight: AppConfig . toolbarMinHeight - 8 ,
maxHeight: AppConfig . toolbarMaxHeight - 8 ,
maxHeight: AppConfig . toolbarMaxHeight - 8 ,
maxWidth: AppConfig . toolbarMinWidth ,
maxWidth: AppConfig . toolbarMinWidth ,
) ,
) ,
child: SingleChildScrollView (
child: CompositedTransformTarget (
child: Column (
link: layerLink ,
spacing: 12.0 ,
child: SingleChildScrollView (
mainAxisSize: MainAxisSize . min ,
child: Column (
children: [
spacing: 12.0 ,
Row (
mainAxisSize: MainAxisSize . min ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
Row (
children: [
crossAxisAlignment: CrossAxisAlignment . start ,
SizedBox (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
width: 24.0 ,
children: [
height: 24.0 ,
SizedBox (
child: MouseRegion (
width: 24.0 ,
cursor: SystemMouseCursors . click ,
height: 24.0 ,
child: GestureDetector (
child: MouseRegion (
onTap: ( ) = >
cursor: SystemMouseCursors . click ,
overlayController . updateSelectedSpan ( null ) ,
child: GestureDetector (
child: const Icon (
onTap: ( ) = >
Icons . close ,
overlayController . updateSelectedSpan ( null ) ,
size: 16.0 ,
child: const Icon (
Icons . close ,
size: 16.0 ,
) ,
) ,
) ,
) ,
) ,
) ,
) ,
) ,
Flexible (
Flexible (
child: Text (
child: Text (
token . text . content ,
token . text . content ,
textAlign: TextAlign . center ,
textAlign: TextAlign . center ,
style: TextStyle (
style: TextStyle (
fontSize: 28.0 ,
fontSize: 28. 0,
fontWeight: FontWeight . w60 0,
fontWeight: FontWeight . w600 ,
height: 1.2 ,
height: 1.2 ,
color:
color:
Theme . of ( context ) . brightness = = Brightness . light
Theme . of ( context ) . brightness = = Brightness . light
? AppConfig . yellowDark
? AppConfig . yellowDark
: AppConfig . yellowLight ,
: AppConfig . yellowLight ,
) ,
) ,
) ,
) ,
) ,
) ,
ConstructXpWidget (
ConstructXpWidget (
id: token . vocabConstructID ,
id: token . vocabConstructID ,
onTap: ( ) = > context . go (
onTap: ( ) = > context . go (
" /rooms/analytics?mode=vocab " ,
" /rooms/analytics?mode=vocab " ,
extra: token . vocabConstructID ,
extra: token . vocabConstructID ,
) ,
) ,
) ,
) ,
] ,
] ,
) ,
) ,
LemmaMeaningBuilder (
LemmaMeaningBuilder (
langCode: messageEvent . messageDisplayLangCode ,
langCode: messageEvent . messageDisplayLangCode ,
constructId: token . vocabConstructID ,
constructId: token . vocabConstructID ,
builder: ( context , controller ) {
builder: ( context , controller ) {
if ( controller . editMode ) {
if ( controller . editMode ) {
return Column (
return Column (
mainAxisSize: MainAxisSize . min ,
mainAxisSize: MainAxisSize . min ,
children: [
children: [
Text (
Text (
" ${ L10n . of ( context ) . pangeaBotIsFallible } $ {L10n.of(context).whatIsMeaning(
" ${ L10n . of ( context ) . pangeaBotIsFallible } $ {L10n.of(context).whatIsMeaning(
token . vocabConstructID . lemma ,
token . vocabConstructID . lemma ,
token . vocabConstructID . category ,
token . vocabConstructID . category ,
) } " ,
) } " ,
textAlign: TextAlign . center ,
textAlign: TextAlign . center ,
style:
style: const TextStyle ( fontStyle: FontStyle . italic ) ,
const TextStyle ( fontStyle: FontStyle . italic ) ,
) ,
const SizedBox ( height: 10 ) ,
Padding (
padding:
const EdgeInsets . symmetric ( horizontal: 16.0 ) ,
child: TextField (
minLines: 1 ,
maxLines: 3 ,
controller: controller . controller ,
decoration: InputDecoration (
hintText: controller . lemmaInfo ? . meaning ,
) ,
) ,
) ,
) ,
const SizedBox ( height: 10 ) ,
const SizedBox ( height: 10 ) ,
Padding (
Row (
padding:
mainAxisAlignment: MainAxisAlignment . center ,
const EdgeInsets . symmetric ( horizontal: 16.0 ) ,
children: [
child: TextField (
ElevatedButton (
minLines: 1 ,
onPressed: ( ) = >
maxLines: 3 ,
controller . toggleEditMode ( false ) ,
controller: controller . controller ,
style: ElevatedButton . styleFrom (
decoration: InputDecoration (
shape: RoundedRectangleBorder (
hintText: controller . lemmaInfo ? . meaning ,
borderRadius: BorderRadius . circular ( 10.0 ) ,
) ,
padding: const EdgeInsets . symmetric (
horizontal: 10 ,
) ,
) ,
) ,
child: Text ( L10n . of ( context ) . cancel ) ,
) ,
) ,
const SizedBox ( width: 10 ) ,
) ,
ElevatedButton (
const SizedBox ( height: 10 ) ,
onPressed: ( ) = > controller . controller . text ! =
Row (
controller . lemmaInfo ? . meaning & &
mainAxisAlignment: MainAxisAlignment . center ,
controller . controller . text . isNotEmpty
children: [
? controller . editLemmaMeaning (
ElevatedButton (
controller . controller . text ,
onPressed: ( ) = >
)
controller . toggleEditMode ( false ) ,
: null ,
style: ElevatedButton . styleFrom (
style: ElevatedButton . styleFrom (
shape: RoundedRectangleBorder (
shape: RoundedRectangleBorder (
borderRadius: BorderRadius . circular ( 10.0 ) ,
borderRadius: BorderRadius . circular ( 10.0 ) ,
) ,
padding: const EdgeInsets . symmetric (
horizontal: 10 ,
) ,
) ,
) ,
padding: const EdgeInsets . symmetric (
child: Text ( L10n . of ( context ) . cancel ) ,
horizontal: 10 ,
) ,
const SizedBox ( width: 10 ) ,
ElevatedButton (
onPressed: ( ) = > controller . controller . text ! =
controller . lemmaInfo ? . meaning & &
controller . controller . text . isNotEmpty
? controller . editLemmaMeaning (
controller . controller . text ,
)
: null ,
style: ElevatedButton . styleFrom (
shape: RoundedRectangleBorder (
borderRadius: BorderRadius . circular ( 10.0 ) ,
) ,
padding: const EdgeInsets . symmetric (
horizontal: 10 ,
) ,
) ,
) ,
child: Text ( L10n . of ( context ) . saveChanges ) ,
) ,
) ,
child: Text ( L10n . of ( context ) . saveChanges ) ,
] ,
) ,
) ,
] ,
] ,
) ,
) ;
] ,
}
) ;
}
return Column (
return Column (
spacing: 12.0 ,
spacing: 12.0 ,
mainAxisSize: MainAxisSize . min ,
mainAxisSize: MainAxisSize . min ,
children: [
children: [
if ( MatrixState . pangeaController . languageController
if ( MatrixState . pangeaController . languageController
. showTrancription )
. showTrancription )
PhoneticTranscriptionWidget (
PhoneticTranscriptionWidget (
text: token . text . content ,
text: token . text . content ,
textLanguage: PLanguageStore . byLangCode (
textLanguage: PLanguageStore . byLangCode (
messageEvent . messageDisplayLangCode ,
messageEvent . messageDisplayLangCode ,
) ? ?
) ? ?
LanguageModel . unknown ,
LanguageModel . unknown ,
style: const TextStyle ( fontSize: 14.0 ) ,
style: const TextStyle ( fontSize: 14.0 ) ,
iconSize: 24.0 ,
iconSize: 24.0 ,
)
)
else
else
WordAudioButton (
WordAudioButton (
text: token . text . content ,
text: token . text . content ,
uniqueID: " lemma-content- ${ token . text . content } " ,
uniqueID: " lemma-content- ${ token . text . content } " ,
langCode: messageEvent . messageDisplayLangCode ,
langCode: messageEvent . messageDisplayLangCode ,
iconSize: 24.0 ,
iconSize: 24.0 ,
) ,
LemmaReactionPicker (
cId: _selectedToken . vocabConstructID ,
event: messageEvent . event ,
controller: overlayController . widget . chatController ,
) ,
) ,
LemmaReactionPicker (
if ( controller . error ! = null )
cId: _selectedToken . vocabConstructID ,
ErrorIndicator (
event: messageEvent . event ,
message: L10n . of ( context ) . errorFetchingDefinition ,
controller: overlayController . widget . chatController ,
style: const TextStyle ( fontSize: 14.0 ) ,
) ,
)
if ( controller . error ! = null )
else if ( controller . isLoading | |
ErrorIndicator (
controller . lemmaInfo = = null )
message: L10n . of ( context ) . errorFetchingDefinition ,
const CircularProgressIndicator . adaptive ( )
style: const TextStyle ( fontSize: 14.0 ) ,
else
)
GestureDetector (
else if ( controller . isLoading | |
onLongPress: ( ) = >
controller . lemmaInfo = = null )
controller . toggleEditMode ( true ) ,
const CircularProgressIndicator . adaptive ( )
onDoubleTap: ( ) = >
else
controller . toggleEditMode ( true ) ,
GestureDetector (
child: token . lemma . text . toLowerCase ( ) = =
onLongPress: ( ) = > controller . toggleEditMode ( true ) ,
token . text . content . toLowerCase ( )
onDoubleTap: ( ) = > controller . toggleEditMode ( true ) ,
? Text (
child: token . lemma . text . toLowerCase ( ) = =
controller . lemmaInfo ! . meaning ,
token . text . content . toLowerCase ( )
style: const TextStyle ( fontSize: 14.0 ) ,
? Text (
textAlign: TextAlign . center ,
controller . lemmaInfo ! . meaning ,
)
style: const TextStyle ( fontSize: 14.0 ) ,
: RichText (
textAlign: TextAlign . center ,
text: TextSpan (
)
style: DefaultTextStyle . of ( context )
: RichText (
. style
text: TextSpan (
. copyWith (
style: DefaultTextStyle . of ( context )
fontSize: 14.0 ,
. style
) ,
. copyWith (
children: [
fontSize: 14.0 ,
TextSpan ( text: token . lemma . text ) ,
const WidgetSpan (
child: SizedBox ( width: 8.0 ) ,
) ,
const TextSpan ( text: " : " ) ,
const WidgetSpan (
child: SizedBox ( width: 8.0 ) ,
) ,
) ,
children: [
TextSpan (
TextSpan ( text: token . lemma . text ) ,
text: controller . lemmaInfo ! . meaning ,
const WidgetSpan (
) ,
child: SizedBox ( width: 8.0 ) ,
] ,
) ,
) ,
const TextSpan ( text: " : " ) ,
const WidgetSpan (
child: SizedBox ( width: 8.0 ) ,
) ,
TextSpan (
text: controller . lemmaInfo ! . meaning ,
) ,
] ,
) ,
) ,
) ,
) ,
) ,
] ,
],
) ;
);
} ,
} ,
) ,
) ,
] ,
] ,
) ,
) ,
) ,
) ,
) ,
) ,
) ,
wordIsNew
wordIsNew
? NewWordOverlay (
? NewWordOverlay (
key: ValueKey ( transformTargetId ) ,
token: token ,
overlayColor: overlayColor ,
overlayColor: overlayColor ,
cardKey: cardKey ,
overlayController: overlayController ,
transformTargetId: transformTargetId ,
/ / cardKey: cardKey ,
)
)
: const SizedBox . shrink ( ) ,
: const SizedBox . shrink ( ) ,
] ,
] ,