mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20:39 +00:00
added some mock tiles to settings
This commit is contained in:
parent
6b3be40254
commit
6dd0a9b192
8 changed files with 122 additions and 7 deletions
|
@ -22,7 +22,11 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||||
|
|
||||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||||
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
|
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
|
||||||
|
"caffeine": MessageLookupByLibrary.simpleMessage("Caffeine"),
|
||||||
"fastestExposurePair": MessageLookupByLibrary.simpleMessage("Fastest"),
|
"fastestExposurePair": MessageLookupByLibrary.simpleMessage("Fastest"),
|
||||||
|
"haptics": MessageLookupByLibrary.simpleMessage("Haptics"),
|
||||||
|
"keepsScreenOn":
|
||||||
|
MessageLookupByLibrary.simpleMessage("Keeps screen on"),
|
||||||
"settings": MessageLookupByLibrary.simpleMessage("Settings"),
|
"settings": MessageLookupByLibrary.simpleMessage("Settings"),
|
||||||
"slowestExposurePair": MessageLookupByLibrary.simpleMessage("Slowest")
|
"slowestExposurePair": MessageLookupByLibrary.simpleMessage("Slowest")
|
||||||
};
|
};
|
||||||
|
|
|
@ -79,6 +79,36 @@ class S {
|
||||||
args: [],
|
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<S> {
|
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
|
||||||
|
|
|
@ -2,5 +2,8 @@
|
||||||
"@@locale": "en",
|
"@@locale": "en",
|
||||||
"fastestExposurePair": "Fastest",
|
"fastestExposurePair": "Fastest",
|
||||||
"slowestExposurePair": "Slowest",
|
"slowestExposurePair": "Slowest",
|
||||||
"settings": "Settings"
|
"settings": "Settings",
|
||||||
|
"caffeine": "Caffeine",
|
||||||
|
"keepsScreenOn": "Keeps screen on",
|
||||||
|
"haptics": "Haptics"
|
||||||
}
|
}
|
|
@ -7,6 +7,7 @@ import 'models/photography_value.dart';
|
||||||
import 'res/theme.dart';
|
import 'res/theme.dart';
|
||||||
import 'screens/metering/metering_bloc.dart';
|
import 'screens/metering/metering_bloc.dart';
|
||||||
import 'screens/metering/metering_screen.dart';
|
import 'screens/metering/metering_screen.dart';
|
||||||
|
import 'screens/settings/settings_screen.dart';
|
||||||
import 'utils/stop_type_provider.dart';
|
import 'utils/stop_type_provider.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
@ -34,7 +35,7 @@ class MyApp extends StatelessWidget {
|
||||||
GlobalCupertinoLocalizations.delegate,
|
GlobalCupertinoLocalizations.delegate,
|
||||||
],
|
],
|
||||||
supportedLocales: S.delegate.supportedLocales,
|
supportedLocales: S.delegate.supportedLocales,
|
||||||
home: const MeteringScreen(),
|
home: const SettingsScreen(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
28
lib/screens/settings/components/caffeine_tile.dart
Normal file
28
lib/screens/settings/components/caffeine_tile.dart
Normal file
|
@ -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<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;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
27
lib/screens/settings/components/haptics_tile.dart
Normal file
27
lib/screens/settings/components/haptics_tile.dart
Normal file
|
@ -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<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;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
12
lib/screens/settings/components/stop_type_tile.dart
Normal file
12
lib/screens/settings/components/stop_type_tile.dart
Normal file
|
@ -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),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,9 @@
|
||||||
import 'package:flutter/material.dart';
|
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 {
|
class SettingsScreen extends StatelessWidget {
|
||||||
const SettingsScreen({super.key});
|
const SettingsScreen({super.key});
|
||||||
|
@ -11,7 +16,16 @@ class SettingsScreen extends StatelessWidget {
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
SliverAppBar(
|
SliverAppBar(
|
||||||
pinned: true,
|
pinned: true,
|
||||||
|
leading: null,
|
||||||
expandedHeight: 160.0,
|
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: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
|
@ -19,11 +33,7 @@ class SettingsScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SliverList(
|
SliverList(delegate: SliverChildListDelegate([CaffeineListTile(), HapticsListTile()])),
|
||||||
delegate: SliverChildListDelegate(
|
|
||||||
[],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue