Skip to content

Commit 67b1183

Browse files
authored
fix: switch vocab / grammar buttons to use icon and text (#1888)
1 parent ea2896c commit 67b1183

File tree

2 files changed

+39
-29
lines changed

2 files changed

+39
-29
lines changed

lib/pangea/analytics_details_popup/analytics_details_popup.dart

+31-28
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import 'package:flutter/material.dart';
22

3-
import 'package:fluffychat/config/app_config.dart';
3+
import 'package:flutter_gen/gen_l10n/l10n.dart';
4+
import 'package:material_symbols_icons/symbols.dart';
5+
46
import 'package:fluffychat/pangea/analytics_details_popup/morph_analytics_view.dart';
57
import 'package:fluffychat/pangea/analytics_details_popup/morph_details_view.dart';
68
import 'package:fluffychat/pangea/analytics_details_popup/vocab_analytics_view.dart';
79
import 'package:fluffychat/pangea/analytics_details_popup/vocab_details_view.dart';
8-
import 'package:fluffychat/pangea/analytics_misc/analytics_constants.dart';
910
import 'package:fluffychat/pangea/analytics_misc/construct_identifier.dart';
1011
import 'package:fluffychat/pangea/analytics_misc/construct_type_enum.dart';
1112
import 'package:fluffychat/pangea/analytics_summary/progress_indicators_enum.dart';
@@ -63,38 +64,40 @@ class AnalyticsPopupWrapperState extends State<AnalyticsPopupWrapper> {
6364
: () => setConstructZoom(null),
6465
),
6566
actions: [
66-
Padding(
67-
padding: const EdgeInsets.all(8.0),
68-
child: SizedBox(
69-
height: 30.0,
70-
width: 30.0,
71-
child: InkWell(
72-
child: Image.network(
73-
'${AppConfig.assetsBaseURL}/${AnalyticsConstants.vocabIconFileName}',
74-
),
75-
onTap: () => setState(() {
76-
localView = ConstructTypeEnum.vocab;
77-
localConstructZoom = null;
78-
}),
67+
TextButton.icon(
68+
style: TextButton.styleFrom(
69+
shape: RoundedRectangleBorder(
70+
borderRadius: BorderRadius.circular(10.0),
7971
),
72+
backgroundColor: localView == ConstructTypeEnum.vocab
73+
? Theme.of(context).colorScheme.primary.withAlpha(50)
74+
: Theme.of(context).colorScheme.surface,
8075
),
76+
label: Text(L10n.of(context).vocab),
77+
icon: const Icon(Symbols.dictionary),
78+
onPressed: () => setState(() {
79+
localView = ConstructTypeEnum.vocab;
80+
localConstructZoom = null;
81+
}),
8182
),
82-
Padding(
83-
padding: const EdgeInsets.all(8.0),
84-
child: SizedBox(
85-
height: 30.0,
86-
width: 30.0,
87-
child: InkWell(
88-
child: Image.network(
89-
'${AppConfig.assetsBaseURL}/${AnalyticsConstants.morphIconFileName}',
90-
),
91-
onTap: () => setState(() {
92-
localView = ConstructTypeEnum.morph;
93-
localConstructZoom = null;
94-
}),
83+
const SizedBox(width: 4.0),
84+
TextButton.icon(
85+
style: TextButton.styleFrom(
86+
shape: RoundedRectangleBorder(
87+
borderRadius: BorderRadius.circular(10.0),
9588
),
89+
backgroundColor: localView == ConstructTypeEnum.morph
90+
? Theme.of(context).colorScheme.primary.withAlpha(50)
91+
: Theme.of(context).colorScheme.surface,
9692
),
93+
label: Text(L10n.of(context).grammar),
94+
icon: const Icon(Symbols.toys_and_games),
95+
onPressed: () => setState(() {
96+
localView = ConstructTypeEnum.morph;
97+
localConstructZoom = null;
98+
}),
9799
),
100+
const SizedBox(width: 4.0),
98101
],
99102
),
100103
body: localView == ConstructTypeEnum.morph

lib/pangea/analytics_summary/progress_indicator.dart

+8-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ class ProgressIndicatorBadge extends StatelessWidget {
3838
child: Row(
3939
mainAxisSize: MainAxisSize.min,
4040
children: [
41+
Icon(
42+
size: 14,
43+
indicator.icon,
44+
color: indicator.color(context),
45+
weight: 1000,
46+
),
47+
const SizedBox(width: 4.0),
4148
Text(
4249
indicator.tooltip(context),
4350
style: TextStyle(
@@ -46,7 +53,7 @@ class ProgressIndicatorBadge extends StatelessWidget {
4653
color: indicator.color(context),
4754
),
4855
),
49-
const SizedBox(width: 5),
56+
const SizedBox(width: 4.0),
5057
!loading
5158
? Text(
5259
points.toString(),

0 commit comments

Comments
 (0)