mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-10-19 14:50:40 +00:00
9ffb5112c1
* 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
59 lines
1.7 KiB
Dart
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;
|
|
}
|
|
}
|
|
}
|