fix: switch vocab / grammar buttons to use icon and text (#1888)

This commit is contained in:
ggurdin 2025-02-21 14:48:54 -05:00 committed by GitHub
parent ea2896c3dc
commit 67b118387c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 39 additions and 29 deletions

View file

@ -1,11 +1,12 @@
import 'package:flutter/material.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:material_symbols_icons/symbols.dart';
import 'package:fluffychat/pangea/analytics_details_popup/morph_analytics_view.dart';
import 'package:fluffychat/pangea/analytics_details_popup/morph_details_view.dart';
import 'package:fluffychat/pangea/analytics_details_popup/vocab_analytics_view.dart';
import 'package:fluffychat/pangea/analytics_details_popup/vocab_details_view.dart';
import 'package:fluffychat/pangea/analytics_misc/analytics_constants.dart';
import 'package:fluffychat/pangea/analytics_misc/construct_identifier.dart';
import 'package:fluffychat/pangea/analytics_misc/construct_type_enum.dart';
import 'package:fluffychat/pangea/analytics_summary/progress_indicators_enum.dart';
@ -63,38 +64,40 @@ class AnalyticsPopupWrapperState extends State<AnalyticsPopupWrapper> {
: () => setConstructZoom(null),
),
actions: [
Padding(
padding: const EdgeInsets.all(8.0),
child: SizedBox(
height: 30.0,
width: 30.0,
child: InkWell(
child: Image.network(
'${AppConfig.assetsBaseURL}/${AnalyticsConstants.vocabIconFileName}',
),
onTap: () => setState(() {
localView = ConstructTypeEnum.vocab;
localConstructZoom = null;
}),
TextButton.icon(
style: TextButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
backgroundColor: localView == ConstructTypeEnum.vocab
? Theme.of(context).colorScheme.primary.withAlpha(50)
: Theme.of(context).colorScheme.surface,
),
label: Text(L10n.of(context).vocab),
icon: const Icon(Symbols.dictionary),
onPressed: () => setState(() {
localView = ConstructTypeEnum.vocab;
localConstructZoom = null;
}),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: SizedBox(
height: 30.0,
width: 30.0,
child: InkWell(
child: Image.network(
'${AppConfig.assetsBaseURL}/${AnalyticsConstants.morphIconFileName}',
),
onTap: () => setState(() {
localView = ConstructTypeEnum.morph;
localConstructZoom = null;
}),
const SizedBox(width: 4.0),
TextButton.icon(
style: TextButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
backgroundColor: localView == ConstructTypeEnum.morph
? Theme.of(context).colorScheme.primary.withAlpha(50)
: Theme.of(context).colorScheme.surface,
),
label: Text(L10n.of(context).grammar),
icon: const Icon(Symbols.toys_and_games),
onPressed: () => setState(() {
localView = ConstructTypeEnum.morph;
localConstructZoom = null;
}),
),
const SizedBox(width: 4.0),
],
),
body: localView == ConstructTypeEnum.morph

View file

@ -38,6 +38,13 @@ class ProgressIndicatorBadge extends StatelessWidget {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
size: 14,
indicator.icon,
color: indicator.color(context),
weight: 1000,
),
const SizedBox(width: 4.0),
Text(
indicator.tooltip(context),
style: TextStyle(
@ -46,7 +53,7 @@ class ProgressIndicatorBadge extends StatelessWidget {
color: indicator.color(context),
),
),
const SizedBox(width: 5),
const SizedBox(width: 4.0),
!loading
? Text(
points.toString(),