m3_lightmeter/lib/screens/metering/components/shared/exposure_pairs_list/widget_list_exposure_pairs.dart
Vadim 4bb080a144
Implemented IAP & Equipment profiles (#89)
* added equipment profiles to layout config

* calculate layout height based on `MeteringScreenLayoutFeature`

* Update cd_dev.yml

* Fixed equipment profile tile padding

* import

* `webfactory/ssh-agent`

* Update pubspec.yaml

* fixed `MeteringScreenLayoutConfigJson` tests

* fixed `UserPreferencesService` tests

* reset selected equipment profile when layout feature is disabled

* `IAPProductType.equipment` -> `IAPProductType.paidFeatures`

* updated packages versions

* Update shared_prefs_service.dart

* Fixed & tested exposure pairs list builder

* typo

* typo

* added iap repo stub

* Renamed `EquipmentProfileData` ->`EquipmentProfile`

* Moved `EquipmentProfileProvider` to iap repo

* Update README.md

* Fixed `EquipmentProfileListener`

* Improved `EquipmentProfilesListTile` statuses visualization

* Update README.md

* Update ci.yml

* Post-merge fixes

* typo

* Added workflow checks

* more sophisticated iap icons

* Include IAP by default

* added loader for `IAPProductStatus.pending`

* typo

* Added equipment profiles list placeholder

* typo

* separated `IconPlaceholder`

* improved `buildExposureValues` testing

* cleanup
2023-09-02 10:32:08 +02:00

87 lines
3.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/exposure_pair.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/metering/components/shared/exposure_pairs_list/components/exposure_pairs_list_item/widget_item_list_exposure_pairs.dart';
import 'package:lightmeter/screens/shared/icon_placeholder/widget_icon_placeholder.dart';
class ExposurePairsList extends StatelessWidget {
final List<ExposurePair> exposurePairs;
const ExposurePairsList(this.exposurePairs, {super.key});
@override
Widget build(BuildContext context) {
return AnimatedSwitcher(
duration: Dimens.switchDuration,
child: exposurePairs.isEmpty
? IconPlaceholder(
icon: Icons.not_interested,
text: S.of(context).noExposurePairs,
)
: Stack(
alignment: Alignment.center,
children: [
Positioned.fill(
child: ListView.builder(
key: ValueKey(exposurePairs.hashCode),
padding: const EdgeInsets.symmetric(vertical: Dimens.paddingL),
itemCount: exposurePairs.length,
itemBuilder: (_, index) => Stack(
alignment: Alignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: ExposurePairsListItem(
exposurePairs[index].aperture,
tickOnTheLeft: false,
),
),
),
Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: ExposurePairsListItem(
exposurePairs[index].shutterSpeed,
tickOnTheLeft: true,
),
),
),
],
),
Positioned(
top: 0,
bottom: 0,
child: LayoutBuilder(
builder: (context, constraints) => Align(
alignment: index == 0
? 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),
),
),
),
),
),
],
),
),
),
],
),
);
}
}