diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index f0c73c9..f9d8167 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -22,7 +22,11 @@ class MessageLookup extends MessageLookupByLibrary { final messages = _notInlinedMessages(_notInlinedMessages); static Map _notInlinedMessages(_) => { + "caffeine": MessageLookupByLibrary.simpleMessage("Caffeine"), "fastestExposurePair": MessageLookupByLibrary.simpleMessage("Fastest"), + "haptics": MessageLookupByLibrary.simpleMessage("Haptics"), + "keepsScreenOn": + MessageLookupByLibrary.simpleMessage("Keeps screen on"), "settings": MessageLookupByLibrary.simpleMessage("Settings"), "slowestExposurePair": MessageLookupByLibrary.simpleMessage("Slowest") }; diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 176e88c..4fa1b88 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -79,6 +79,36 @@ class S { args: [], ); } + + /// `Caffeine` + String get caffeine { + return Intl.message( + 'Caffeine', + name: 'caffeine', + desc: '', + args: [], + ); + } + + /// `Keeps screen on` + String get keepsScreenOn { + return Intl.message( + 'Keeps screen on', + name: 'keepsScreenOn', + desc: '', + args: [], + ); + } + + /// `Haptics` + String get haptics { + return Intl.message( + 'Haptics', + name: 'haptics', + desc: '', + args: [], + ); + } } class AppLocalizationDelegate extends LocalizationsDelegate { diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index d5a2e40..8c8f9e9 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -2,5 +2,8 @@ "@@locale": "en", "fastestExposurePair": "Fastest", "slowestExposurePair": "Slowest", - "settings": "Settings" + "settings": "Settings", + "caffeine": "Caffeine", + "keepsScreenOn": "Keeps screen on", + "haptics": "Haptics" } \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index ff0f870..218c8d4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -7,6 +7,7 @@ import 'models/photography_value.dart'; import 'res/theme.dart'; import 'screens/metering/metering_bloc.dart'; import 'screens/metering/metering_screen.dart'; +import 'screens/settings/settings_screen.dart'; import 'utils/stop_type_provider.dart'; void main() { @@ -34,7 +35,7 @@ class MyApp extends StatelessWidget { GlobalCupertinoLocalizations.delegate, ], supportedLocales: S.delegate.supportedLocales, - home: const MeteringScreen(), + home: const SettingsScreen(), ), ), ); diff --git a/lib/screens/settings/components/caffeine_tile.dart b/lib/screens/settings/components/caffeine_tile.dart new file mode 100644 index 0000000..201d192 --- /dev/null +++ b/lib/screens/settings/components/caffeine_tile.dart @@ -0,0 +1,28 @@ +import 'package:flutter/material.dart'; +import 'package:lightmeter/generated/l10n.dart'; + +class CaffeineListTile extends StatefulWidget { + const CaffeineListTile({super.key}); + + @override + State createState() => _CaffeineListTileState(); +} + +class _CaffeineListTileState extends State { + 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; + }); + }, + ); + } +} diff --git a/lib/screens/settings/components/haptics_tile.dart b/lib/screens/settings/components/haptics_tile.dart new file mode 100644 index 0000000..88ec1d0 --- /dev/null +++ b/lib/screens/settings/components/haptics_tile.dart @@ -0,0 +1,27 @@ +import 'package:flutter/material.dart'; +import 'package:lightmeter/generated/l10n.dart'; + +class HapticsListTile extends StatefulWidget { + const HapticsListTile({super.key}); + + @override + State createState() => _HapticsListTileState(); +} + +class _HapticsListTileState extends State { + 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; + }); + }, + ); + } +} diff --git a/lib/screens/settings/components/stop_type_tile.dart b/lib/screens/settings/components/stop_type_tile.dart new file mode 100644 index 0000000..939af93 --- /dev/null +++ b/lib/screens/settings/components/stop_type_tile.dart @@ -0,0 +1,12 @@ +import 'package:flutter/material.dart'; + +class StopTypeTile extends StatelessWidget { + const StopTypeTile({super.key}); + + @override + Widget build(BuildContext context) { + return ListTile( + leading: const Icon(Icons.rule), + ); + } +} diff --git a/lib/screens/settings/settings_screen.dart b/lib/screens/settings/settings_screen.dart index 7f736cc..09b7ba8 100644 --- a/lib/screens/settings/settings_screen.dart +++ b/lib/screens/settings/settings_screen.dart @@ -1,4 +1,9 @@ import 'package:flutter/material.dart'; +import 'package:lightmeter/generated/l10n.dart'; +import 'package:lightmeter/res/dimens.dart'; + +import 'components/caffeine_tile.dart'; +import 'components/haptics_tile.dart'; class SettingsScreen extends StatelessWidget { const SettingsScreen({super.key}); @@ -11,7 +16,16 @@ class SettingsScreen extends StatelessWidget { slivers: [ SliverAppBar( pinned: true, + leading: null, expandedHeight: 160.0, + flexibleSpace: FlexibleSpaceBar( + centerTitle: false, + titlePadding: const EdgeInsets.all(Dimens.paddingM), + title: Text( + S.of(context).settings, + style: TextStyle(color: Theme.of(context).colorScheme.onSurface, fontSize: 24), + ), + ), actions: [ IconButton( onPressed: () {}, @@ -19,11 +33,7 @@ class SettingsScreen extends StatelessWidget { ), ], ), - SliverList( - delegate: SliverChildListDelegate( - [], - ), - ), + SliverList(delegate: SliverChildListDelegate([CaffeineListTile(), HapticsListTile()])), ], ), );