Prettified ExposurePairsList ruler

This commit is contained in:
Vadim 2022-12-17 00:25:08 +03:00
parent ca8c1f8e4d
commit fb0923903a
2 changed files with 42 additions and 24 deletions

View file

@ -23,6 +23,7 @@ class ExposurePaitListItem<T extends PhotographyStopValue> extends StatelessWidg
width: tickLength(), width: tickLength(),
), ),
), ),
if (value.stopType != StopType.full) const SizedBox(width: Dimens.grid8),
]; ];
return Row( return Row(
mainAxisAlignment: tickOnTheLeft ? MainAxisAlignment.start : MainAxisAlignment.end, mainAxisAlignment: tickOnTheLeft ? MainAxisAlignment.start : MainAxisAlignment.end,

View file

@ -16,26 +16,51 @@ class ExposurePairsList extends StatelessWidget {
Positioned.fill( Positioned.fill(
child: ListView.builder( child: ListView.builder(
key: ValueKey(exposurePairs.hashCode), key: ValueKey(exposurePairs.hashCode),
padding: const EdgeInsets.all(Dimens.paddingL),
itemCount: exposurePairs.length, itemCount: exposurePairs.length,
itemBuilder: (_, index) => Row( itemBuilder: (_, index) => Stack(
mainAxisAlignment: MainAxisAlignment.center, alignment: Alignment.center,
children: [ children: [
Expanded( Row(
child: Align( mainAxisAlignment: MainAxisAlignment.center,
alignment: Alignment.centerLeft, children: [
child: ExposurePaitListItem( Expanded(
exposurePairs[index].aperture, child: Align(
tickOnTheLeft: false, alignment: Alignment.centerLeft,
child: ExposurePaitListItem(
exposurePairs[index].aperture,
tickOnTheLeft: false,
),
),
), ),
), Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: ExposurePaitListItem(
exposurePairs[index].shutterSpeed,
tickOnTheLeft: true,
),
),
),
],
), ),
const SizedBox(width: Dimens.grid16), Positioned(
Expanded( top: 0,
child: Align( bottom: 0,
alignment: Alignment.centerLeft, child: LayoutBuilder(
child: ExposurePaitListItem( builder: (context, constraints) => Align(
exposurePairs[index].shutterSpeed, alignment: index == 0
tickOnTheLeft: true, ? Alignment.bottomCenter
: (index == exposurePairs.length - 1 ? Alignment.topCenter : Alignment.center),
child: SizedBox(
height: index == 0 || index == exposurePairs.length - 1
? constraints.maxHeight / 2
: constraints.maxHeight,
child: ColoredBox(
color: Theme.of(context).colorScheme.onBackground,
child: const SizedBox(width: 1),
),
),
), ),
), ),
), ),
@ -43,14 +68,6 @@ class ExposurePairsList extends StatelessWidget {
), ),
), ),
), ),
Positioned(
top: 0,
bottom: 0,
child: ColoredBox(
color: Theme.of(context).colorScheme.onBackground,
child: const SizedBox(width: 1),
),
),
], ],
); );
} }