Created
June 4, 2024 14:35
-
-
Save alpbak/95cdc5c1ceb0565258ff769c4c350ed5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
moveTextForward() { | |
if (mounted) { | |
textAnimationController.forward(from: 0).whenComplete(() { | |
textScaleAnimationController.forward(from: 0).whenComplete(() { | |
textScaleAnimationController.reverse().whenComplete(() { | |
Future.delayed(const Duration(milliseconds: 2000), () { | |
if (!isProcessingText) { | |
originalStr = MDLanguage().w('please wait'); | |
} else { | |
originalStr = MDLanguage().w('processing'); | |
} | |
isProcessingText = !isProcessingText; | |
if (!widget.isLoading) { | |
return; | |
} | |
moveTextForward(); | |
}); | |
}); | |
}); | |
}); | |
} | |
} | |
Widget textFirstWidget() { | |
String part1 = originalStr.substring(0, currentCharacter); | |
String part2 = originalStr.substring(currentCharacter, maxCharacter + 1); | |
String part11 = | |
originalStr.substring(0, min(currentCharacter + 2, maxCharacter)); | |
String part22 = originalStr.substring( | |
min(currentCharacter + 2, maxCharacter), maxCharacter + 1); | |
String part111 = | |
originalStr.substring(0, min(currentCharacter + 4, maxCharacter)); | |
String part222 = originalStr.substring( | |
min(currentCharacter + 4, maxCharacter), maxCharacter + 1); | |
return Stack( | |
children: [ | |
RichText( | |
maxLines: 10, | |
textAlign: TextAlign.center, | |
overflow: TextOverflow.ellipsis, | |
text: TextSpan( | |
text: part111, | |
children: <TextSpan>[ | |
TextSpan(text: part222, style: testWhiteTextStyle()), | |
], | |
style: testRedTextStyle(), | |
), | |
), | |
RichText( | |
maxLines: 10, | |
textAlign: TextAlign.center, | |
overflow: TextOverflow.ellipsis, | |
text: TextSpan( | |
text: part11, | |
children: <TextSpan>[ | |
TextSpan(text: part22, style: testWhiteTextStyle()), | |
], | |
style: testgreyTextStyle(), | |
), | |
), | |
RichText( | |
maxLines: 10, | |
textAlign: TextAlign.center, | |
overflow: TextOverflow.ellipsis, | |
text: TextSpan( | |
text: part1, | |
children: <TextSpan>[ | |
TextSpan(text: part2, style: testWhiteTextStyle()), | |
], | |
style: testBlackTextStyle(), | |
), | |
), | |
], | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment