m3_lightmeter/lib/screens/metering/components/shared/exposure_pairs_list/components/exposure_pairs_list_item/widget_item_list_exposure_pairs.dart
Vadim 9ffb5112c1
ML-16 [Android] Implement incident light metering (#17)
* wip

* rename

* wip

* rename

* fixed camera screen layout

* omit camera measure on startup

* added calibration for light sensor

* save evsource

* Update widget_button_measure.dart

* fixed iOS init

* hide light sensor calibration on ios

* cleanup
2023-01-29 19:57:47 +03:00

59 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/photography_values/photography_value.dart';
import 'package:lightmeter/res/dimens.dart';
class ExposurePairsListItem<T extends PhotographyStopValue> extends StatelessWidget {
final T value;
final bool tickOnTheLeft;
const ExposurePairsListItem(
this.value, {
required this.tickOnTheLeft,
super.key,
});
@override
Widget build(BuildContext context) {
final List<Widget> rowChildren = [
Text(
value.toString(),
style: labelTextStyle(context).copyWith(color: Theme.of(context).colorScheme.onBackground),
),
const SizedBox(width: Dimens.grid8),
ColoredBox(
color: Theme.of(context).colorScheme.onBackground,
child: SizedBox(
height: 1,
width: tickLength(),
),
),
if (value.stopType != StopType.full) const SizedBox(width: Dimens.grid4),
];
return Row(
mainAxisAlignment: tickOnTheLeft ? MainAxisAlignment.start : MainAxisAlignment.end,
children: tickOnTheLeft ? rowChildren.reversed.toList() : rowChildren,
);
}
TextStyle labelTextStyle(BuildContext context) {
switch (value.stopType) {
case StopType.full:
return Theme.of(context).textTheme.bodyLarge!;
case StopType.half:
return Theme.of(context).textTheme.bodyMedium!;
case StopType.third:
return Theme.of(context).textTheme.bodySmall!;
}
}
double tickLength() {
switch (value.stopType) {
case StopType.full:
return Dimens.grid16;
case StopType.half:
return Dimens.grid8;
case StopType.third:
return Dimens.grid8;
}
}
}