mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 15:00:40 +00:00
Added version label
This commit is contained in:
parent
fb0923903a
commit
e7a8d0e1d5
6 changed files with 83 additions and 31 deletions
|
@ -24,5 +24,16 @@
|
|||
"chooseTheme": "Choose theme",
|
||||
"themeLight": "Light",
|
||||
"themeDark": "Dark",
|
||||
"themeSystemDefault": "System default"
|
||||
"themeSystemDefault": "System default",
|
||||
"version": "Version: {version} ({buildNumber})",
|
||||
"@version": {
|
||||
"placeholders": {
|
||||
"version": {
|
||||
"type": "String"
|
||||
},
|
||||
"buildNumber": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,5 +4,6 @@ import 'package:lightmeter/data/ev_source/ev_source_type.dart';
|
|||
import 'application.dart';
|
||||
|
||||
void main() {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
runApp(const Application(EvSourceType.camera));
|
||||
}
|
||||
|
|
|
@ -4,5 +4,6 @@ import 'package:lightmeter/data/ev_source/ev_source_type.dart';
|
|||
import 'application.dart';
|
||||
|
||||
void main() {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
runApp(const Application(EvSourceType.mock));
|
||||
}
|
27
lib/screens/settings/components/version_label.dart
Normal file
27
lib/screens/settings/components/version_label.dart
Normal file
|
@ -0,0 +1,27 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
class VersionLabel extends StatelessWidget {
|
||||
const VersionLabel({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FutureBuilder<PackageInfo>(
|
||||
future: PackageInfo.fromPlatform(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.data != null) {
|
||||
final version = snapshot.data!.version;
|
||||
final buildNumber = snapshot.data!.buildNumber;
|
||||
return Center(
|
||||
child: Text(
|
||||
S.of(context).version(version, buildNumber),
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ import 'package:lightmeter/res/dimens.dart';
|
|||
|
||||
import 'components/fractional_stops_tile.dart';
|
||||
import 'components/theme_type_tile.dart';
|
||||
import 'components/version_label.dart';
|
||||
|
||||
class SettingsScreen extends StatelessWidget {
|
||||
const SettingsScreen({super.key});
|
||||
|
@ -12,38 +13,48 @@ class SettingsScreen extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
body: CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
SliverAppBar(
|
||||
pinned: true,
|
||||
automaticallyImplyLeading: false,
|
||||
expandedHeight: Dimens.grid168,
|
||||
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),
|
||||
body: SafeArea(
|
||||
top: false,
|
||||
child: CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
SliverAppBar(
|
||||
pinned: true,
|
||||
automaticallyImplyLeading: false,
|
||||
expandedHeight: Dimens.grid168,
|
||||
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: Navigator.of(context).pop,
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
],
|
||||
),
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
const StopTypeListTile(),
|
||||
// const CaffeineListTile(),
|
||||
// const HapticsListTile(),
|
||||
const ThemeTypeListTile(),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: Navigator.of(context).pop,
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
const StopTypeListTile(),
|
||||
// const CaffeineListTile(),
|
||||
// const HapticsListTile(),
|
||||
const ThemeTypeListTile(),
|
||||
],
|
||||
),
|
||||
),
|
||||
SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: const [VersionLabel()],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
name: lightmeter
|
||||
description: A new Flutter project.
|
||||
publish_to: "none"
|
||||
version: 1.0.0+1
|
||||
version: 0.1.0+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.18.0 <3.0.0"
|
||||
|
@ -17,6 +17,7 @@ dependencies:
|
|||
intl: 0.17.0
|
||||
intl_utils: 2.8.1
|
||||
material_color_utilities: ^0.2.0
|
||||
package_info_plus: 3.0.2
|
||||
permission_handler: 10.2.0
|
||||
provider: ^6.0.4
|
||||
shared_preferences: 2.0.15
|
||||
|
|
Loading…
Reference in a new issue