If clicking level bar does nothing, make it act unselectable (#3520)

* If clicking level bar does nothing, make it act unselectable

* Allow selection for vocab/grammar pages
This commit is contained in:
Kelrap 2025-07-22 12:32:20 -04:00 committed by GitHub
parent a474110984
commit 28095ca963
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 5 deletions

View file

@ -46,6 +46,8 @@ class AnalyticsPageView extends StatelessWidget {
children: [
LearningProgressIndicators(
selected: controller.selectedIndicator,
canSelect: controller.selectedIndicator !=
ProgressIndicatorEnum.level,
),
Expanded(
child: Builder(

View file

@ -21,9 +21,12 @@ import 'package:fluffychat/widgets/matrix.dart';
/// be clicked to access more fine-grained analytics data.
class LearningProgressIndicators extends StatefulWidget {
final ProgressIndicatorEnum? selected;
final bool canSelect;
const LearningProgressIndicators({
super.key,
this.selected,
this.canSelect = true,
});
@override
@ -171,7 +174,7 @@ class LearningProgressIndicatorsState
builder: (context, hovered) {
return Container(
decoration: BoxDecoration(
color: hovered
color: hovered && widget.canSelect
? Theme.of(context)
.colorScheme
.primary
@ -184,11 +187,15 @@ class LearningProgressIndicatorsState
horizontal: 4.0,
),
child: MouseRegion(
cursor: SystemMouseCursors.click,
cursor: widget.canSelect
? SystemMouseCursors.click
: MouseCursor.defer,
child: GestureDetector(
onTap: () {
context.go("/rooms/analytics?mode=level");
},
onTap: widget.canSelect
? () {
context.go("/rooms/analytics?mode=level");
}
: null,
child: Row(
spacing: 8.0,
children: [