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,7 +13,9 @@ 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(
|
||||||
|
top: false,
|
||||||
|
child: CustomScrollView(
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
SliverAppBar(
|
SliverAppBar(
|
||||||
pinned: true,
|
pinned: true,
|
||||||
|
@ -43,8 +46,16 @@ class SettingsScreen extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
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