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",
|
"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",
|
||||||
|
|
|
@ -44,15 +44,28 @@ class ThemeProvider extends StatefulWidget {
|
||||||
State<ThemeProvider> createState() => ThemeProviderState();
|
State<ThemeProvider> createState() => ThemeProviderState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ThemeProviderState extends State<ThemeProvider> {
|
class ThemeProviderState extends State<ThemeProvider> with WidgetsBindingObserver {
|
||||||
UserPreferencesService get _prefs => context.read<UserPreferencesService>();
|
UserPreferencesService get _prefs => context.read<UserPreferencesService>();
|
||||||
|
|
||||||
late final _themeTypeNotifier = ValueNotifier<ThemeType>(_prefs.themeType);
|
late final _themeTypeNotifier = ValueNotifier<ThemeType>(_prefs.themeType);
|
||||||
late final _dynamicColorNotifier = ValueNotifier<bool>(_prefs.dynamicColor);
|
late final _dynamicColorNotifier = ValueNotifier<bool>(_prefs.dynamicColor);
|
||||||
late final _primaryColorNotifier = ValueNotifier<Color>(_prefs.primaryColor);
|
late final _primaryColorNotifier = ValueNotifier<Color>(_prefs.primaryColor);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
WidgetsBinding.instance.addObserver(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangePlatformBrightness() {
|
||||||
|
super.didChangePlatformBrightness();
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
WidgetsBinding.instance.removeObserver(this);
|
||||||
_themeTypeNotifier.dispose();
|
_themeTypeNotifier.dispose();
|
||||||
_dynamicColorNotifier.dispose();
|
_dynamicColorNotifier.dispose();
|
||||||
_primaryColorNotifier.dispose();
|
_primaryColorNotifier.dispose();
|
||||||
|
@ -216,16 +229,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),
|
||||||
|
@ -236,6 +251,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),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(
|
||||||
|
|
|
@ -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 '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
|
||||||
? CameraView(controller: state.controller)
|
? Center(child: CameraView(controller: state.controller))
|
||||||
: const ColoredBox(color: Colors.black),
|
: const CameraViewPlaceholder(),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -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/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: [
|
||||||
|
|
Loading…
Reference in a new issue