mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 23:10:40 +00:00
Merge remote-tracking branch 'origin' into bug/ML-20
This commit is contained in:
commit
dce4e08dd1
8 changed files with 81 additions and 16 deletions
|
@ -17,6 +17,7 @@
|
|||
"filmSpeed": "Film speed",
|
||||
"nd": "ND",
|
||||
"ndFilterFactor": "Neutral density filter factor",
|
||||
"noExposurePairs": "There are no exposure pairs for the selected settings.",
|
||||
"none": "None",
|
||||
"cancel": "Cancel",
|
||||
"select": "Select",
|
||||
|
|
|
@ -44,15 +44,28 @@ class ThemeProvider extends StatefulWidget {
|
|||
State<ThemeProvider> createState() => ThemeProviderState();
|
||||
}
|
||||
|
||||
class ThemeProviderState extends State<ThemeProvider> {
|
||||
class ThemeProviderState extends State<ThemeProvider> with WidgetsBindingObserver {
|
||||
UserPreferencesService get _prefs => context.read<UserPreferencesService>();
|
||||
|
||||
late final _themeTypeNotifier = ValueNotifier<ThemeType>(_prefs.themeType);
|
||||
late final _dynamicColorNotifier = ValueNotifier<bool>(_prefs.dynamicColor);
|
||||
late final _primaryColorNotifier = ValueNotifier<Color>(_prefs.primaryColor);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangePlatformBrightness() {
|
||||
super.didChangePlatformBrightness();
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
_themeTypeNotifier.dispose();
|
||||
_dynamicColorNotifier.dispose();
|
||||
_primaryColorNotifier.dispose();
|
||||
|
@ -216,16 +229,18 @@ class _ThemeDataProvider extends StatelessWidget {
|
|||
|
||||
return ColorScheme(
|
||||
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),
|
||||
onPrimary: Color(scheme.onPrimary),
|
||||
primaryContainer: Color(scheme.primaryContainer),
|
||||
onPrimaryContainer: Color(scheme.onPrimaryContainer),
|
||||
secondary: Color(scheme.secondary),
|
||||
onSecondary: Color(scheme.onSecondary),
|
||||
error: Color(scheme.error),
|
||||
onError: Color(scheme.onError),
|
||||
background: Color(scheme.background),
|
||||
onBackground: Color(scheme.onBackground),
|
||||
surface: Color.alphaBlend(
|
||||
Color(scheme.primary).withOpacity(0.05),
|
||||
Color(scheme.background),
|
||||
|
@ -236,6 +251,8 @@ class _ThemeDataProvider extends StatelessWidget {
|
|||
Color(scheme.background),
|
||||
),
|
||||
onSurfaceVariant: Color(scheme.onSurfaceVariant),
|
||||
outline: Color(scheme.outline),
|
||||
outlineVariant: Color(scheme.outlineVariant),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,9 +46,7 @@ class MeteringBottomControls extends StatelessWidget {
|
|||
)
|
||||
else
|
||||
const Spacer(),
|
||||
MeteringMeasureButton(
|
||||
onTap: onMeasure,
|
||||
),
|
||||
MeteringMeasureButton(onTap: onMeasure),
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: IconButton(
|
||||
|
|
|
@ -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)),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ import 'package:lightmeter/screens/metering/components/shared/readings_container
|
|||
|
||||
import 'bloc_container_camera.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 'state_container_camera.dart';
|
||||
|
||||
|
@ -76,13 +77,11 @@ class _CameraViewBuilder extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return AspectRatio(
|
||||
aspectRatio: PlatformConfig.cameraPreviewAspectRatio,
|
||||
child: Center(
|
||||
child: BlocBuilder<CameraContainerBloc, CameraContainerState>(
|
||||
buildWhen: (previous, current) => current is CameraInitializedState,
|
||||
builder: (context, state) => state is CameraInitializedState
|
||||
? CameraView(controller: state.controller)
|
||||
: const ColoredBox(color: Colors.black),
|
||||
),
|
||||
child: BlocBuilder<CameraContainerBloc, CameraContainerState>(
|
||||
buildWhen: (previous, current) => current is CameraInitializedState,
|
||||
builder: (context, state) => state is CameraInitializedState
|
||||
? Center(child: CameraView(controller: state.controller))
|
||||
: const CameraViewPlaceholder(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class LightSensorContainer extends StatelessWidget {
|
|||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM),
|
||||
child: ExposurePairsList(exposurePairs),
|
||||
child: Center(child: ExposurePairsList(exposurePairs)),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:lightmeter/data/models/exposure_pair.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';
|
||||
|
||||
class ExposurePairsList extends StatelessWidget {
|
||||
|
@ -11,6 +12,9 @@ class ExposurePairsList extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (exposurePairs.isEmpty) {
|
||||
return const EmptyExposurePairsList();
|
||||
}
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
|
|
Loading…
Reference in a new issue