diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 1bfe8ed..c990e62 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -54,6 +54,7 @@ "isoValuesFilterDescription": "Select the ISO values to display. These may be your most commonly used values or those supported by your camera.", "equipmentProfile": "Equipment profile", "equipmentProfiles": "Equipment profiles", + "tapToAdd": "Tap to add", "general": "General", "keepScreenOn": "Keep screen on", "haptics": "Haptics", diff --git a/lib/l10n/intl_fr.arb b/lib/l10n/intl_fr.arb index f75d76b..b091277 100644 --- a/lib/l10n/intl_fr.arb +++ b/lib/l10n/intl_fr.arb @@ -42,6 +42,7 @@ "film": "Pellicule", "equipment": "Équipement", "equipmentProfileName": "Nom du profil de l'équipement", + "tapToAdd": "Appuie pour ajouter", "equipmentProfileNameHint": "Praktica MTL5B", "equipmentProfileAllValues": "Tout", "apertureValues": "Valeurs Aperture", diff --git a/lib/l10n/intl_ru.arb b/lib/l10n/intl_ru.arb index 3a67fc2..6f76223 100644 --- a/lib/l10n/intl_ru.arb +++ b/lib/l10n/intl_ru.arb @@ -54,6 +54,7 @@ "isoValuesFilterDescription": "Выберите значения ISO для отображения. Это может быть наиболее часто используемые значения или значения, поддерживаемые вашей камерой.", "equipmentProfile": "Оборудование", "equipmentProfiles": "Профили оборудования", + "tapToAdd": "Нажмите, чтобы добавить", "general": "Общие", "keepScreenOn": "Запрет блокировки", "haptics": "Вибрация", diff --git a/lib/l10n/intl_zh.arb b/lib/l10n/intl_zh.arb index 5d020cf..02bdf6c 100644 --- a/lib/l10n/intl_zh.arb +++ b/lib/l10n/intl_zh.arb @@ -54,6 +54,7 @@ "isoValuesFilterDescription": "选择要显示的 ISO。这些值可能是您最常用的值,也可能是相机支持的值。", "equipmentProfile": "设备配置", "equipmentProfiles": "设备配置", + "tapToAdd": "點擊添加", "general": "通用", "keepScreenOn": "保持屏幕常亮", "haptics": "震动", diff --git a/lib/res/dimens.dart b/lib/res/dimens.dart index a1bb780..e3eed95 100644 --- a/lib/res/dimens.dart +++ b/lib/res/dimens.dart @@ -14,7 +14,6 @@ class Dimens { static const double grid48 = 48; static const double grid56 = 56; static const double grid72 = 72; - static const double grid168 = 168; static const double paddingS = 8; static const double paddingM = 16; @@ -30,6 +29,8 @@ class Dimens { static const double enabledOpacity = 1.0; static const double disabledOpacity = 0.38; + static const double sliverAppBarExpandedHeight = 168; + // TopBar static const double readingContainerDoubleValueHeight = 128; static const double readingContainerSingleValueHeight = 76; diff --git a/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart b/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart index 1819e7f..6faf82d 100644 --- a/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart +++ b/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart @@ -44,30 +44,38 @@ class _EquipmentProfilesScreenState extends State { icon: const Icon(Icons.close), ), ], - slivers: [ - SliverList( - delegate: SliverChildBuilderDelegate( - (context, index) => index > 0 - ? Padding( - padding: EdgeInsets.fromLTRB( - Dimens.paddingM, - index == 0 ? Dimens.paddingM : 0, - Dimens.paddingM, - Dimens.paddingM, - ), - child: EquipmentProfileContainer( - key: profileContainersKeys[index], - data: EquipmentProfiles.of(context)[index], - onExpand: () => _keepExpandedAt(index), - onUpdate: (profileData) => _updateProfileAt(profileData, index), - onDelete: () => _removeProfileAt(index), - ), - ) - : const SizedBox.shrink(), - childCount: profilesCount, - ), - ), - ], + slivers: profilesCount == 1 + ? [ + SliverFillRemaining( + hasScrollBody: false, + child: _EquipmentProfilesListPlaceholder(onTap: _addProfile), + ) + ] + : [ + SliverList( + delegate: SliverChildBuilderDelegate( + (context, index) => index > 0 // skip default + ? Padding( + padding: EdgeInsets.fromLTRB( + Dimens.paddingM, + index == 0 ? Dimens.paddingM : 0, + Dimens.paddingM, + Dimens.paddingM, + ), + child: EquipmentProfileContainer( + key: profileContainersKeys[index], + data: EquipmentProfiles.of(context)[index], + onExpand: () => _keepExpandedAt(index), + onUpdate: (profileData) => _updateProfileAt(profileData, index), + onDelete: () => _removeProfileAt(index), + ), + ) + : const SizedBox.shrink(), + childCount: profilesCount, + ), + ), + SliverToBoxAdapter(child: SizedBox(height: MediaQuery.paddingOf(context).bottom)), + ], ); } @@ -99,3 +107,44 @@ class _EquipmentProfilesScreenState extends State { }); } } + +class _EquipmentProfilesListPlaceholder extends StatelessWidget { + final VoidCallback onTap; + + const _EquipmentProfilesListPlaceholder({required this.onTap}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.only( + bottom: Dimens.sliverAppBarExpandedHeight, + ), + child: FractionallySizedBox( + widthFactor: 1 / 1.618, + child: Center( + child: GestureDetector( + onTap: onTap, + child: Opacity( + opacity: Dimens.disabledOpacity, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.add, + size: MediaQuery.sizeOf(context).width / (1.618 * 1.618), + ), + const SizedBox(height: Dimens.grid4), + Text( + 'Tap to add', + style: Theme.of(context).textTheme.headlineSmall, + textAlign: TextAlign.center, + ) + ], + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/settings/screen_settings.dart b/lib/screens/settings/screen_settings.dart index 9332d3f..38256e8 100644 --- a/lib/screens/settings/screen_settings.dart +++ b/lib/screens/settings/screen_settings.dart @@ -50,6 +50,7 @@ class _SettingsScreenState extends State { ], ), ), + SliverToBoxAdapter(child: SizedBox(height: MediaQuery.paddingOf(context).bottom)), ], ), ); diff --git a/lib/screens/shared/sliver_screen/screen_sliver.dart b/lib/screens/shared/sliver_screen/screen_sliver.dart index d4542b1..20d2e66 100644 --- a/lib/screens/shared/sliver_screen/screen_sliver.dart +++ b/lib/screens/shared/sliver_screen/screen_sliver.dart @@ -24,7 +24,7 @@ class SliverScreen extends StatelessWidget { SliverAppBar( pinned: true, automaticallyImplyLeading: false, - expandedHeight: Dimens.grid168, + expandedHeight: Dimens.sliverAppBarExpandedHeight, flexibleSpace: FlexibleSpaceBar( centerTitle: false, titlePadding: const EdgeInsets.all(Dimens.paddingM), @@ -39,7 +39,6 @@ class SliverScreen extends StatelessWidget { actions: appBarActions, ), ...slivers, - SliverToBoxAdapter(child: SizedBox(height: MediaQuery.of(context).padding.bottom)), ], ), ),