mirror of
https://github.com/lichess-org/mobile.git
synced 2026-05-26 13:50:52 +00:00
Add an info icon to the disabled rating filter button title
This commit is contained in:
@@ -152,7 +152,26 @@ class CreateGameWidget extends ConsumerWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(context.l10n.ratingFilter, style: labelStyle),
|
||||
GestureDetector(
|
||||
onTap: canUseRatingRange
|
||||
? null
|
||||
: () => _showDisabledRatingRangeExplanation(context),
|
||||
child: Row(
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Text(context.l10n.ratingFilter, style: labelStyle),
|
||||
if (!canUseRatingRange)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 4.0),
|
||||
child: Icon(
|
||||
Icons.info_outline,
|
||||
size: 16.0,
|
||||
color: Theme.of(context).disabledColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
side: BorderSide(color: Theme.of(context).dividerColor),
|
||||
@@ -183,24 +202,7 @@ class CreateGameWidget extends ConsumerWidget {
|
||||
},
|
||||
);
|
||||
}
|
||||
: () {
|
||||
showAdaptiveDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog.adaptive(
|
||||
content: Text(
|
||||
context
|
||||
.l10n
|
||||
.ratingRangeIsDisabledBecauseYourRatingIsProvisional,
|
||||
),
|
||||
actions: [
|
||||
PlatformDialogAction(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text(context.l10n.mobileOkButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
: () => _showDisabledRatingRangeExplanation(context),
|
||||
child: canUseRatingRange
|
||||
? Text(
|
||||
'${playPrefs.customRatingDelta.$1 == 0 ? '-' : ''}${playPrefs.customRatingDelta.$1} / +${playPrefs.customRatingDelta.$2}',
|
||||
@@ -239,4 +241,19 @@ class CreateGameWidget extends ConsumerWidget {
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void _showDisabledRatingRangeExplanation(BuildContext context) {
|
||||
showAdaptiveDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog.adaptive(
|
||||
content: Text(context.l10n.ratingRangeIsDisabledBecauseYourRatingIsProvisional),
|
||||
actions: [
|
||||
PlatformDialogAction(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text(context.l10n.mobileOkButton),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user