fixed feature checkbox width calculation

This commit is contained in:
Vadim 2024-07-23 15:37:19 +02:00
parent 0b06d9b8c7
commit 719e50ed52
2 changed files with 6 additions and 16 deletions

View file

@ -1,6 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/providers/films_provider.dart';
enum AppFeature { enum AppFeature {
reflectedLightMetering, reflectedLightMetering,

View file

@ -168,9 +168,6 @@ class _FeatureItem extends StatelessWidget {
} }
class _FeatureHighlight extends StatelessWidget { class _FeatureHighlight extends StatelessWidget {
static double? _freeWidth;
static double? _proWidth;
final bool highlight; final bool highlight;
final bool roundedTop; final bool roundedTop;
final bool roundedBottom; final bool roundedBottom;
@ -185,20 +182,14 @@ class _FeatureHighlight extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
_FeatureHighlight._freeWidth ??= textSize(
S.of(context).featuresFree,
Theme.of(context).textTheme.bodyMedium,
MediaQuery.sizeOf(context).width,
).width;
_FeatureHighlight._proWidth ??= textSize(
S.of(context).featuresPro,
Theme.of(context).textTheme.bodyMedium,
MediaQuery.sizeOf(context).width,
).width;
return Container( return Container(
constraints: BoxConstraints( constraints: BoxConstraints(
minWidth: minWidth: textSize(
((highlight ? _FeatureHighlight._proWidth : _FeatureHighlight._freeWidth) ?? 0.0) + Dimens.paddingM * 2, highlight ? S.of(context).featuresPro : S.of(context).featuresFree,
Theme.of(context).textTheme.bodyMedium,
MediaQuery.sizeOf(context).width,
).width +
Dimens.paddingM * 2,
), ),
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: Dimens.paddingM, horizontal: Dimens.paddingM,