Added camera and exposurepairs list placeholders

This commit is contained in:
Vadim 2023-02-05 16:56:04 +03:00
parent b8c6f51bd0
commit 9436a59094
8 changed files with 67 additions and 15 deletions

View file

@ -17,6 +17,7 @@
"filmSpeed": "Film speed", "filmSpeed": "Film speed",
"nd": "ND", "nd": "ND",
"ndFilterFactor": "Neutral density filter factor", "ndFilterFactor": "Neutral density filter factor",
"noExposurePairs": "There are no exposure pairs for the selected settings.",
"none": "None", "none": "None",
"cancel": "Cancel", "cancel": "Cancel",
"select": "Select", "select": "Select",

View file

@ -224,16 +224,18 @@ class _ThemeDataProvider extends StatelessWidget {
return ColorScheme( return ColorScheme(
brightness: brightness, brightness: brightness,
background: Color(scheme.background),
error: Color(scheme.error),
errorContainer: Color(scheme.errorContainer),
onBackground: Color(scheme.onBackground),
onError: Color(scheme.onError),
onErrorContainer: Color(scheme.onErrorContainer),
primary: Color(scheme.primary), primary: Color(scheme.primary),
onPrimary: Color(scheme.onPrimary), onPrimary: Color(scheme.onPrimary),
primaryContainer: Color(scheme.primaryContainer), primaryContainer: Color(scheme.primaryContainer),
onPrimaryContainer: Color(scheme.onPrimaryContainer), onPrimaryContainer: Color(scheme.onPrimaryContainer),
secondary: Color(scheme.secondary), secondary: Color(scheme.secondary),
onSecondary: Color(scheme.onSecondary), onSecondary: Color(scheme.onSecondary),
error: Color(scheme.error),
onError: Color(scheme.onError),
background: Color(scheme.background),
onBackground: Color(scheme.onBackground),
surface: Color.alphaBlend( surface: Color.alphaBlend(
Color(scheme.primary).withOpacity(0.05), Color(scheme.primary).withOpacity(0.05),
Color(scheme.background), Color(scheme.background),
@ -244,6 +246,8 @@ class _ThemeDataProvider extends StatelessWidget {
Color(scheme.background), Color(scheme.background),
), ),
onSurfaceVariant: Color(scheme.onSurfaceVariant), onSurfaceVariant: Color(scheme.onSurfaceVariant),
outline: Color(scheme.outline),
outlineVariant: Color(scheme.outlineVariant),
); );
} }
} }

View file

@ -46,9 +46,7 @@ class MeteringBottomControls extends StatelessWidget {
) )
else else
const Spacer(), const Spacer(),
MeteringMeasureButton( MeteringMeasureButton(onTap: onMeasure),
onTap: onMeasure,
),
Expanded( Expanded(
child: Center( child: Center(
child: IconButton( child: IconButton(

View file

@ -0,0 +1,14 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/res/dimens.dart';
class CameraViewPlaceholder extends StatelessWidget {
const CameraViewPlaceholder({super.key});
@override
Widget build(BuildContext context) {
return Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(Dimens.borderRadiusM)),
child: const Center(child: Icon(Icons.no_photography)),
);
}
}

View file

@ -12,6 +12,7 @@ import 'package:lightmeter/screens/metering/components/shared/readings_container
import 'bloc_container_camera.dart'; import 'bloc_container_camera.dart';
import 'components/camera_controls/widget_camera_controls.dart'; import 'components/camera_controls/widget_camera_controls.dart';
import 'components/camera_view_placeholder/widget_placeholder_camera_view.dart';
import 'event_container_camera.dart'; import 'event_container_camera.dart';
import 'state_container_camera.dart'; import 'state_container_camera.dart';
@ -76,13 +77,11 @@ class _CameraViewBuilder extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AspectRatio( return AspectRatio(
aspectRatio: PlatformConfig.cameraPreviewAspectRatio, aspectRatio: PlatformConfig.cameraPreviewAspectRatio,
child: Center( child: BlocBuilder<CameraContainerBloc, CameraContainerState>(
child: BlocBuilder<CameraContainerBloc, CameraContainerState>( buildWhen: (previous, current) => current is CameraInitializedState,
buildWhen: (previous, current) => current is CameraInitializedState, builder: (context, state) => state is CameraInitializedState
builder: (context, state) => state is CameraInitializedState ? Center(child: CameraView(controller: state.controller))
? CameraView(controller: state.controller) : const CameraViewPlaceholder(),
: const ColoredBox(color: Colors.black),
),
), ),
); );
} }

View file

@ -44,7 +44,7 @@ class LightSensorContainer extends StatelessWidget {
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM), padding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM),
child: ExposurePairsList(exposurePairs), child: Center(child: ExposurePairsList(exposurePairs)),
), ),
), ),
], ],

View file

@ -0,0 +1,32 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/res/dimens.dart';
class EmptyExposurePairsList extends StatelessWidget {
const EmptyExposurePairsList({super.key});
@override
Widget build(BuildContext context) {
return ConstrainedBox(
constraints: BoxConstraints(maxWidth: MediaQuery.of(context).size.width / 2),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.not_interested,
color: Theme.of(context).colorScheme.onBackground,
),
const SizedBox(height: Dimens.grid8),
Text(
S.of(context).noExposurePairs,
style: Theme.of(context)
.textTheme
.bodyMedium
?.copyWith(color: Theme.of(context).colorScheme.onBackground),
textAlign: TextAlign.center,
),
],
),
);
}
}

View file

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/exposure_pair.dart'; import 'package:lightmeter/data/models/exposure_pair.dart';
import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/res/dimens.dart';
import 'components/empty_exposure_pairs_list/widget_list_exposure_pairs_empty.dart';
import 'components/exposure_pairs_list_item/widget_item_list_exposure_pairs.dart'; import 'components/exposure_pairs_list_item/widget_item_list_exposure_pairs.dart';
class ExposurePairsList extends StatelessWidget { class ExposurePairsList extends StatelessWidget {
@ -11,6 +12,9 @@ class ExposurePairsList extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (exposurePairs.isEmpty) {
return const EmptyExposurePairsList();
}
return Stack( return Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [