1563-grammar-icon-in-light-mode (#1565)

* fix(morph_svgs): fixing light/dark mode coloring

* dart formatting

---------

Co-authored-by: ggurdin <46800240+ggurdin@users.noreply.github.com>
pull/1593/head
wcjord 10 months ago committed by GitHub
parent c4b35f67c7
commit 387a7aa51a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -211,17 +211,10 @@ class VocabAnalyticsPopupState extends State<VocabAnalyticsPopup> {
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircleAvatar(
backgroundColor:
Theme.of(context).brightness == Brightness.light
? Colors.white
: Colors.black,
radius: 16,
child: CustomizedSvg(
svgUrl: type.svgURL,
colorReplacements: const {},
errorIcon: Text(type.emoji),
),
CustomizedSvg(
svgUrl: type.svgURL,
colorReplacements: const {},
errorIcon: Text(type.emoji),
),
Text(
" ${type.xpString} XP",

@ -5,8 +5,13 @@ import 'package:get_storage/get_storage.dart';
import 'package:http/http.dart' as http;
class CustomizedSvg extends StatelessWidget {
/// URL of the SVG file
final String svgUrl;
/// Map of color replacements
final Map<String, String> colorReplacements;
/// Icon to show in case of error
final Widget errorIcon;
const CustomizedSvg({
@ -38,6 +43,8 @@ class CustomizedSvg extends StatelessWidget {
Future<String> _getModifiedSvg() async {
final svgContent = await _fetchSvg();
String modifiedSvg = svgContent;
// find the white and replace with black
// or find black and replace with white
modifiedSvg = modifiedSvg.replaceAll("fill=\"none\"", '');
for (final entry in colorReplacements.entries) {
modifiedSvg = modifiedSvg.replaceAll(entry.key, entry.value);

@ -33,6 +33,6 @@ class EmojiPracticeButton extends StatelessWidget {
isSelected: isSelected,
onPressed: onPressed,
)
: const SizedBox(width: 40);
: const SizedBox(width: 60);
}
}

@ -23,6 +23,7 @@ class WordZoomActivityButton extends StatelessWidget {
Widget buttonContent = IconButton(
onPressed: onPressed,
icon: icon,
iconSize: 24,
color: isSelected ? Theme.of(context).colorScheme.primary : null,
style: IconButton.styleFrom(
backgroundColor: isSelected

@ -36,12 +36,14 @@ class MorphologicalListItem extends StatelessWidget {
icon: svgLink != null
? CustomizedSvg(
svgUrl: svgLink!,
colorReplacements: {
"white": Theme.of(context).cardColor.hexValue.toString(),
"black": Theme.of(context).brightness == Brightness.dark
? "white"
: "black",
},
colorReplacements:
Theme.of(context).brightness == Brightness.dark
? {
"white":
Theme.of(context).cardColor.hexValue.toString(),
"black": "white",
}
: {},
errorIcon: Icon(icon),
)
: Icon(icon),

Loading…
Cancel
Save