Fixed _models_ and _screens_ folders structure

proper folders for models

unified _screen_ folder filenames
This commit is contained in:
Vadim 2022-12-18 12:03:41 +03:00
parent a7eba00894
commit 14bac950cf
46 changed files with 86 additions and 167 deletions

View file

@ -1,16 +1,16 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:lightmeter/data/ev_source/ev_source_type.dart';
import 'package:lightmeter/data/permissions_service.dart';
import 'package:lightmeter/screens/settings/settings_screen.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'data/models/ev_source_type.dart';
import 'data/permissions_service.dart';
import 'data/shared_prefs_service.dart';
import 'generated/l10n.dart';
import 'res/theme.dart';
import 'screens/metering/flow_metering.dart';
import 'screens/settings/screen_settings.dart';
import 'utils/stop_type_provider.dart';
final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();

View file

@ -1,5 +1,5 @@
import 'aperture_value.dart';
import 'shutter_speed_value.dart';
import 'photography_values/aperture_value.dart';
import 'photography_values/shutter_speed_value.dart';
class ExposurePair {
final ApertureValue aperture;

View file

@ -1,8 +1,8 @@
import 'package:lightmeter/data/models/nd_value.dart';
import 'package:lightmeter/data/models/theme_type.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'models/iso_value.dart';
import 'models/photography_values/iso_value.dart';
import 'models/photography_values/nd_value.dart';
import 'models/theme_type.dart';
class UserPreferencesService {
static const _isoKey = "ISO";

View file

@ -17,9 +17,6 @@
"showFractionalStops": "Show fractional stops",
"halfStops": "1/2",
"thirdStops": "1/3",
"caffeine": "Caffeine",
"keepsScreenOn": "Keeps screen on",
"haptics": "Haptics",
"theme": "Theme",
"chooseTheme": "Choose theme",
"themeLight": "Light",

View file

@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/data/ev_source/ev_source_type.dart';
import 'package:lightmeter/data/models/ev_source_type.dart';
import 'application.dart';

View file

@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/data/ev_source/ev_source_type.dart';
import 'package:lightmeter/data/models/ev_source_type.dart';
import 'application.dart';

View file

@ -2,10 +2,10 @@ import 'dart:async';
import 'dart:math';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/data/models/aperture_value.dart';
import 'package:lightmeter/data/models/photography_values/aperture_value.dart';
import 'package:lightmeter/data/models/exposure_pair.dart';
import 'package:lightmeter/data/models/photography_value.dart';
import 'package:lightmeter/data/models/shutter_speed_value.dart';
import 'package:lightmeter/data/models/photography_values/photography_value.dart';
import 'package:lightmeter/data/models/photography_values/shutter_speed_value.dart';
import 'package:lightmeter/data/shared_prefs_service.dart';
import 'package:lightmeter/screens/metering/communication/event_communication_metering.dart' as communication_events;
import 'package:lightmeter/screens/metering/communication/state_communication_metering.dart' as communication_states;

View file

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/metering/components/shared/filled_circle.dart';
import 'shared/widget_circle_filled.dart';
class MeteringMeasureButton extends StatefulWidget {
final double size;

View file

@ -1,11 +1,12 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/screens/metering/components/shared/filled_circle.dart';
class MeteringBottomControlsSideButton extends StatelessWidget {
import 'shared/widget_circle_filled.dart';
class MeteringSecondaryButton extends StatelessWidget {
final IconData icon;
final VoidCallback onPressed;
const MeteringBottomControlsSideButton({
const MeteringSecondaryButton({
required this.icon,
required this.onPressed,
super.key,

View file

@ -1,25 +0,0 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/res/dimens.dart';
class ZoomSlider extends StatelessWidget {
const ZoomSlider({super.key});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: Dimens.paddingL),
child: Row(
children: [
const Icon(Icons.zoom_out),
Expanded(
child: Slider(
value: 0,
onChanged: (value) {},
),
),
const Icon(Icons.zoom_in),
],
),
);
}
}

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/res/dimens.dart';
import 'components/measure_button.dart';
import 'components/side_buttons.dart';
import 'components/widget_button_measure.dart';
import 'components/widget_button_secondary.dart';
class MeteringBottomControls extends StatelessWidget {
final VoidCallback onSourceChanged;
@ -32,14 +32,14 @@ class MeteringBottomControls extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
MeteringBottomControlsSideButton(
MeteringSecondaryButton(
onPressed: onSourceChanged,
icon: Icons.flip_camera_android,
),
MeteringMeasureButton(
onTap: onMeasure,
),
MeteringBottomControlsSideButton(
MeteringSecondaryButton(
onPressed: onSettings,
icon: Icons.settings,
),

View file

@ -1,12 +1,12 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/photography_value.dart';
import 'package:lightmeter/data/models/photography_values/photography_value.dart';
import 'package:lightmeter/res/dimens.dart';
class ExposurePaitListItem<T extends PhotographyStopValue> extends StatelessWidget {
class ExposurePairsListItem<T extends PhotographyStopValue> extends StatelessWidget {
final T value;
final bool tickOnTheLeft;
const ExposurePaitListItem(this.value, {required this.tickOnTheLeft, super.key});
const ExposurePairsListItem(this.value, {required this.tickOnTheLeft, super.key});
@override
Widget build(BuildContext context) {

View file

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/exposure_pair.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/metering/components/exposure_pairs_list/components/exposure_pair_item.dart';
import 'package:lightmeter/screens/metering/components/exposure_pairs_list/components/widget_item_list_exposure_pairs.dart';
class ExposurePairsList extends StatelessWidget {
final List<ExposurePair> exposurePairs;
@ -27,7 +27,7 @@ class ExposurePairsList extends StatelessWidget {
Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: ExposurePaitListItem(
child: ExposurePairsListItem(
exposurePairs[index].aperture,
tickOnTheLeft: false,
),
@ -36,7 +36,7 @@ class ExposurePairsList extends StatelessWidget {
Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: ExposurePaitListItem(
child: ExposurePairsListItem(
exposurePairs[index].shutterSpeed,
tickOnTheLeft: true,
),

View file

@ -1,11 +1,20 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/metering/components/topbar/models/reading_value.dart';
class ReadingContainer extends StatelessWidget {
class ReadingValue {
final String label;
final String value;
const ReadingValue({
required this.label,
required this.value,
});
}
class ReadingValueContainer extends StatelessWidget {
late final List<Widget> _items;
ReadingContainer({
ReadingValueContainer({
required List<ReadingValue> values,
super.key,
}) {
@ -18,7 +27,7 @@ class ReadingContainer extends StatelessWidget {
}
}
ReadingContainer.singleValue({
ReadingValueContainer.singleValue({
required ReadingValue value,
super.key,
}) : _items = [_ReadingValueBuilder(value)];

View file

@ -2,8 +2,8 @@ import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/data/ev_source/camera/bloc_camera.dart';
import 'package:lightmeter/data/ev_source/camera/state_camera.dart';
import 'package:lightmeter/screens/metering/ev_source/camera/bloc_camera.dart';
import 'package:lightmeter/screens/metering/ev_source/camera/state_camera.dart';
class CameraView extends StatelessWidget {
const CameraView({Key? key}) : super(key: key);

View file

@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/data/models/photography_value.dart';
import 'package:lightmeter/data/models/photography_values/photography_value.dart';
import 'package:lightmeter/res/dimens.dart';
typedef DialogPickerItemBuilder<T extends PhotographyValue> = Widget Function(BuildContext, T);

View file

@ -1,9 +0,0 @@
class ReadingValue {
final String label;
final String value;
const ReadingValue({
required this.label,
required this.value,
});
}

View file

@ -1,18 +1,17 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/data/ev_source/camera/bloc_camera.dart';
import 'package:lightmeter/screens/metering/ev_source/camera/bloc_camera.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/data/models/exposure_pair.dart';
import 'package:lightmeter/data/models/iso_value.dart';
import 'package:lightmeter/data/models/nd_value.dart';
import 'package:lightmeter/data/models/photography_value.dart';
import 'package:lightmeter/data/models/photography_values/iso_value.dart';
import 'package:lightmeter/data/models/photography_values/nd_value.dart';
import 'package:lightmeter/data/models/photography_values/photography_value.dart';
import 'package:lightmeter/res/dimens.dart';
import 'components/camera_preview.dart';
import 'components/shared/animated_dialog.dart';
import 'components/dialog_picker.dart';
import 'components/reading_container.dart';
import 'models/reading_value.dart';
import 'components/widget_camera_preview.dart';
import 'components/shared/widget_dialog_animated.dart';
import 'components/widget_dialog_picker.dart';
import 'components/container_reading_value.dart';
class MeteringTopBar extends StatelessWidget {
final ExposurePair? fastest;
@ -57,7 +56,7 @@ class MeteringTopBar extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ReadingContainer(
ReadingValueContainer(
values: [
ReadingValue(
label: S.of(context).fastestExposurePair,
@ -75,7 +74,7 @@ class MeteringTopBar extends StatelessWidget {
),
/*
const _InnerPadding(),
ReadingContainer.singleValue(
ReadingValueContainer.singleValue(
value: ReadingValue(
label: 'EV',
value: ev.toStringAsFixed(1),
@ -168,7 +167,7 @@ class _AnimatedDialogPicker<T extends PhotographyValue> extends StatelessWidget
Widget build(BuildContext context) {
return AnimatedDialog(
key: _key,
closedChild: ReadingContainer.singleValue(
closedChild: ReadingValueContainer.singleValue(
value: ReadingValue(
label: title,
value: selectedValue.value.toString(),

View file

@ -6,7 +6,7 @@ import 'package:camera/camera.dart';
import 'package:exif/exif.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/data/ev_source/ev_source_bloc.dart';
import 'package:lightmeter/screens/metering/ev_source/ev_source_bloc.dart';
import 'package:lightmeter/screens/metering/communication/bloc_communication_metering.dart';
import 'package:lightmeter/screens/metering/communication/event_communication_metering.dart' as communication_event;
import 'package:lightmeter/screens/metering/communication/state_communication_metering.dart' as communication_states;

View file

@ -1,5 +1,5 @@
import 'dart:math';
import 'package:lightmeter/data/ev_source/ev_source_bloc.dart';
import 'package:lightmeter/screens/metering/ev_source/ev_source_bloc.dart';
import 'package:lightmeter/screens/metering/communication/bloc_communication_metering.dart';
import 'package:lightmeter/screens/metering/communication/event_communication_metering.dart' as communication_event;
import 'package:lightmeter/screens/metering/communication/state_communication_metering.dart' as communication_states;

View file

@ -1,6 +1,6 @@
import 'package:lightmeter/data/models/iso_value.dart';
import 'package:lightmeter/data/models/nd_value.dart';
import 'package:lightmeter/data/models/photography_value.dart';
import 'package:lightmeter/data/models/photography_values/iso_value.dart';
import 'package:lightmeter/data/models/photography_values/nd_value.dart';
import 'package:lightmeter/data/models/photography_values/photography_value.dart';
abstract class MeteringEvent {
const MeteringEvent();

View file

@ -1,12 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/data/ev_source/camera/bloc_camera.dart';
import 'package:lightmeter/data/ev_source/ev_source_type.dart';
import 'package:lightmeter/data/ev_source/random_ev/bloc_random_ev.dart';
import 'package:lightmeter/data/models/photography_value.dart';
import 'package:lightmeter/data/models/ev_source_type.dart';
import 'package:lightmeter/data/models/photography_values/photography_value.dart';
import 'package:lightmeter/data/shared_prefs_service.dart';
import 'package:lightmeter/screens/metering/bloc_metering.dart';
import 'package:lightmeter/screens/metering/communication/bloc_communication_metering.dart';
import 'ev_source/camera/bloc_camera.dart';
import 'ev_source/random_ev/bloc_random_ev.dart';
import 'bloc_metering.dart';
import 'communication/bloc_communication_metering.dart';
import 'screen_metering.dart';

View file

@ -1,12 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/data/models/photography_value.dart';
import 'package:lightmeter/data/models/photography_values/photography_value.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/settings/settings_screen.dart';
import 'package:lightmeter/screens/settings/screen_settings.dart';
import 'components/bottom_controls/bottom_controls.dart';
import 'components/exposure_pairs_list/exposure_pairs_list.dart';
import 'components/topbar/topbar.dart';
import 'components/bottom_controls/widget_bottom_controls.dart';
import 'components/exposure_pairs_list/widget_list_exposure_pairs.dart';
import 'components/topbar/widget_topbar.dart';
import 'bloc_metering.dart';
import 'event_metering.dart';
import 'state_metering.dart';

View file

@ -1,6 +1,6 @@
import 'package:lightmeter/data/models/exposure_pair.dart';
import 'package:lightmeter/data/models/iso_value.dart';
import 'package:lightmeter/data/models/nd_value.dart';
import 'package:lightmeter/data/models/photography_values/iso_value.dart';
import 'package:lightmeter/data/models/photography_values/nd_value.dart';
class MeteringState {
final double ev;

View file

@ -1,28 +0,0 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
class CaffeineListTile extends StatefulWidget {
const CaffeineListTile({super.key});
@override
State<CaffeineListTile> createState() => _CaffeineListTileState();
}
class _CaffeineListTileState extends State<CaffeineListTile> {
bool _isCaffeineOn = false;
@override
Widget build(BuildContext context) {
return SwitchListTile(
secondary: const Icon(Icons.coffee),
title: Text(S.of(context).caffeine),
subtitle: Text(S.of(context).keepsScreenOn),
value: _isCaffeineOn,
onChanged: (value) {
setState(() {
_isCaffeineOn = value;
});
},
);
}
}

View file

@ -1,27 +0,0 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
class HapticsListTile extends StatefulWidget {
const HapticsListTile({super.key});
@override
State<HapticsListTile> createState() => _HapticsListTileState();
}
class _HapticsListTileState extends State<HapticsListTile> {
bool _value = false;
@override
Widget build(BuildContext context) {
return SwitchListTile(
secondary: const Icon(Icons.vibration),
title: Text(S.of(context).haptics),
value: _value,
onChanged: (value) {
setState(() {
_value = value;
});
},
);
}
}

View file

@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/photography_value.dart';
import 'package:lightmeter/data/models/photography_values/photography_value.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/utils/stop_type_provider.dart';
import 'package:provider/provider.dart';
import 'shared/dialog_picker.dart';
import 'shared/widget_dialog_picker.dart';
class StopTypeListTile extends StatelessWidget {
const StopTypeListTile({super.key});

View file

@ -4,7 +4,7 @@ import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/res/theme.dart';
import 'package:provider/provider.dart';
import 'shared/dialog_picker.dart';
import 'shared/widget_dialog_picker.dart';
class ThemeTypeListTile extends StatelessWidget {
const ThemeTypeListTile({super.key});

View file

@ -2,9 +2,9 @@ import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/res/dimens.dart';
import 'components/fractional_stops_tile.dart';
import 'components/theme_type_tile.dart';
import 'components/version_label.dart';
import 'components/widget_list_tile_fractional_stops.dart';
import 'components/widget_list_tile_theme_type.dart';
import 'components/widget_label_version.dart';
class SettingsScreen extends StatelessWidget {
const SettingsScreen({super.key});

View file

@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/photography_value.dart';
import 'package:lightmeter/data/models/photography_values/photography_value.dart';
import 'package:provider/provider.dart';
class StopTypeProvider extends StatefulWidget {

View file

@ -1,7 +1,7 @@
import 'package:lightmeter/data/models/aperture_value.dart';
import 'package:lightmeter/data/models/iso_value.dart';
import 'package:lightmeter/data/models/photography_value.dart';
import 'package:lightmeter/data/models/shutter_speed_value.dart';
import 'package:lightmeter/data/models/photography_values/aperture_value.dart';
import 'package:lightmeter/data/models/photography_values/iso_value.dart';
import 'package:lightmeter/data/models/photography_values/photography_value.dart';
import 'package:lightmeter/data/models/photography_values/shutter_speed_value.dart';
import 'package:test/test.dart';
void main() {