diff --git a/lib/screens/metering/components/topbar/topbar.dart b/lib/screens/metering/components/topbar/topbar.dart index 9bc50ec..1f97610 100644 --- a/lib/screens/metering/components/topbar/topbar.dart +++ b/lib/screens/metering/components/topbar/topbar.dart @@ -7,13 +7,11 @@ import 'package:lightmeter/utils/text_line_height.dart'; class MeteringTopBar extends StatelessWidget { static const _columnsCount = 3; - final double lux; final double ev; final int iso; final double nd; const MeteringTopBar({ - required this.lux, required this.ev, required this.iso, required this.nd, @@ -22,31 +20,23 @@ class MeteringTopBar extends StatelessWidget { @override Widget build(BuildContext context) { - final columnWidth = (MediaQuery.of(context).size.width - Dimens.paddingM * (_columnsCount + 1)) / 3; - return CustomPaint( - painter: TopBarShape( - color: Theme.of(context).colorScheme.surface, - appendixSize: Size( - (MediaQuery.of(context).size.width - Dimens.paddingM * 4) / 3 + Dimens.paddingM * 2, - Dimens.paddingM + - Theme.of(context).textTheme.labelMedium!.lineHeight + - Dimens.grid4 + - Theme.of(context).textTheme.titleLarge!.lineHeight + - Dimens.paddingM * 2, - ), - ), + final columnWidth = + (MediaQuery.of(context).size.width - Dimens.paddingM * 2 - Dimens.grid16 * (_columnsCount - 1)) / 3; + return ColoredBox( + color: Theme.of(context).colorScheme.surface, child: Padding( padding: const EdgeInsets.all(Dimens.paddingM), child: SafeArea( bottom: false, - child: Column( + child: Row( mainAxisSize: MainAxisSize.min, children: [ - IntrinsicHeight( - child: Row( + Expanded( + child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Expanded( + SizedBox( + height: columnWidth / 3 * 4, child: ReadingContainer( values: const [ ReadingValue( @@ -61,70 +51,54 @@ class MeteringTopBar extends StatelessWidget { ), ), const _InnerPadding(), - SizedBox( - width: columnWidth, - child: ClipRRect( - borderRadius: BorderRadius.circular(Dimens.borderRadiusM), - child: const AspectRatio( - aspectRatio: 3 / 4, - child: ColoredBox(color: Colors.black), + Row( + children: [ + SizedBox( + width: columnWidth, + child: ReadingContainer.singleValue( + value: ReadingValue( + label: 'EV', + value: ev.toString(), + ), + ), ), - ), + const _InnerPadding(), + SizedBox( + width: columnWidth, + child: ReadingContainer.singleValue( + value: ReadingValue( + label: 'ISO', + value: iso.toString(), + ), + ), + ), + ], ) ], ), ), const _InnerPadding(), - Row( - children: [ - SizedBox( - width: columnWidth, - child: ReadingContainer.singleValue( - value: ReadingValue( - label: 'LUX', - value: lux.toString(), + SizedBox( + width: columnWidth, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(Dimens.borderRadiusM), + child: const AspectRatio( + aspectRatio: 3 / 4, + child: ColoredBox(color: Colors.black), ), ), - ), - const _InnerPadding(), - SizedBox( - width: columnWidth, - child: ReadingContainer.singleValue( - value: ReadingValue( - label: 'EV', - value: ev.toString(), - ), - ), - ), - const _InnerPadding(), - SizedBox( - width: columnWidth, - child: ReadingContainer.singleValue( - value: ReadingValue( - label: 'ISO', - value: iso.toString(), - ), - ), - ), - ], - ), - const _InnerPadding(), - Row( - children: [ - const Spacer(), - const _InnerPadding(), - const Spacer(), - const _InnerPadding(), - SizedBox( - width: columnWidth, - child: ReadingContainer.singleValue( + const _InnerPadding(), + ReadingContainer.singleValue( value: ReadingValue( label: 'ND', value: nd.toString(), ), ), - ), - ], + ], + ), ), ], ), @@ -135,5 +109,5 @@ class MeteringTopBar extends StatelessWidget { } class _InnerPadding extends SizedBox { - const _InnerPadding() : super(height: Dimens.paddingM, width: Dimens.borderRadiusM); + const _InnerPadding() : super(height: Dimens.grid16, width: Dimens.grid16); }