mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20:39 +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",
|
"chooseTheme": "Choose theme",
|
||||||
"themeLight": "Light",
|
"themeLight": "Light",
|
||||||
"themeDark": "Dark",
|
"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';
|
import 'application.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
runApp(const Application(EvSourceType.camera));
|
runApp(const Application(EvSourceType.camera));
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,5 +4,6 @@ import 'package:lightmeter/data/ev_source/ev_source_type.dart';
|
||||||
import 'application.dart';
|
import 'application.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
runApp(const Application(EvSourceType.mock));
|
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/fractional_stops_tile.dart';
|
||||||
import 'components/theme_type_tile.dart';
|
import 'components/theme_type_tile.dart';
|
||||||
|
import 'components/version_label.dart';
|
||||||
|
|
||||||
class SettingsScreen extends StatelessWidget {
|
class SettingsScreen extends StatelessWidget {
|
||||||
const SettingsScreen({super.key});
|
const SettingsScreen({super.key});
|
||||||
|
@ -12,38 +13,48 @@ class SettingsScreen extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
body: CustomScrollView(
|
body: SafeArea(
|
||||||
slivers: <Widget>[
|
top: false,
|
||||||
SliverAppBar(
|
child: CustomScrollView(
|
||||||
pinned: true,
|
slivers: <Widget>[
|
||||||
automaticallyImplyLeading: false,
|
SliverAppBar(
|
||||||
expandedHeight: Dimens.grid168,
|
pinned: true,
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
automaticallyImplyLeading: false,
|
||||||
centerTitle: false,
|
expandedHeight: Dimens.grid168,
|
||||||
titlePadding: const EdgeInsets.all(Dimens.paddingM),
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
title: Text(
|
centerTitle: false,
|
||||||
S.of(context).settings,
|
titlePadding: const EdgeInsets.all(Dimens.paddingM),
|
||||||
style: TextStyle(color: Theme.of(context).colorScheme.onSurface, fontSize: 24),
|
title: Text(
|
||||||
|
S.of(context).settings,
|
||||||
|
style: TextStyle(color: Theme.of(context).colorScheme.onSurface, fontSize: 24),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
actions: [
|
||||||
actions: [
|
IconButton(
|
||||||
IconButton(
|
onPressed: Navigator.of(context).pop,
|
||||||
onPressed: Navigator.of(context).pop,
|
icon: const Icon(Icons.close),
|
||||||
icon: const Icon(Icons.close),
|
),
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SliverList(
|
|
||||||
delegate: SliverChildListDelegate(
|
|
||||||
[
|
|
||||||
const StopTypeListTile(),
|
|
||||||
// const CaffeineListTile(),
|
|
||||||
// const HapticsListTile(),
|
|
||||||
const ThemeTypeListTile(),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
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
|
name: lightmeter
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
publish_to: "none"
|
publish_to: "none"
|
||||||
version: 1.0.0+1
|
version: 0.1.0+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.18.0 <3.0.0"
|
sdk: ">=2.18.0 <3.0.0"
|
||||||
|
@ -17,6 +17,7 @@ dependencies:
|
||||||
intl: 0.17.0
|
intl: 0.17.0
|
||||||
intl_utils: 2.8.1
|
intl_utils: 2.8.1
|
||||||
material_color_utilities: ^0.2.0
|
material_color_utilities: ^0.2.0
|
||||||
|
package_info_plus: 3.0.2
|
||||||
permission_handler: 10.2.0
|
permission_handler: 10.2.0
|
||||||
provider: ^6.0.4
|
provider: ^6.0.4
|
||||||
shared_preferences: 2.0.15
|
shared_preferences: 2.0.15
|
||||||
|
|
Loading…
Reference in a new issue