Merge branch 'version_info' into 'master'
fix merge issues See merge request lukas/notes!2
This commit is contained in:
commit
c996d7fc7d
2
.gitignore
vendored
2
.gitignore
vendored
@ -42,3 +42,5 @@ app.*.map.json
|
|||||||
/android/app/debug
|
/android/app/debug
|
||||||
/android/app/profile
|
/android/app/profile
|
||||||
/android/app/release
|
/android/app/release
|
||||||
|
|
||||||
|
lib/gen/meta.dart
|
||||||
|
@ -9,6 +9,8 @@ flutter_build_android:
|
|||||||
- flutter packages get
|
- flutter packages get
|
||||||
- flutter clean
|
- flutter clean
|
||||||
script:
|
script:
|
||||||
|
- cd gen && flutter pub get
|
||||||
|
- dart run metagen.dart && cd ..
|
||||||
- flutter build apk --target-platform android-arm64
|
- flutter build apk --target-platform android-arm64
|
||||||
- mv build/app/outputs/apk/release/app-release.apk ./notes.apk
|
- mv build/app/outputs/apk/release/app-release.apk ./notes.apk
|
||||||
artifacts:
|
artifacts:
|
||||||
@ -22,6 +24,8 @@ linux_build:
|
|||||||
- apt-get install -y --no-install-recommends cmake ninja-build clang build-essential pkg-config libgtk-3-dev liblzma-dev lcov libvlc-dev vlc libsecret-1-dev libjsoncpp-dev
|
- apt-get install -y --no-install-recommends cmake ninja-build clang build-essential pkg-config libgtk-3-dev liblzma-dev lcov libvlc-dev vlc libsecret-1-dev libjsoncpp-dev
|
||||||
- flutter config --enable-linux-desktop
|
- flutter config --enable-linux-desktop
|
||||||
- flutter packages get
|
- flutter packages get
|
||||||
|
- cd gen && flutter pub get
|
||||||
|
- dart run metagen.dart && cd ..
|
||||||
- flutter build linux
|
- flutter build linux
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
|
45
gen/metagen.dart
Normal file
45
gen/metagen.dart
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
import 'package:yaml/yaml.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
print('generating version file');
|
||||||
|
MetaUpdate('../pubspec.yaml').writeMetaDartFile('../lib/gen/meta.dart');
|
||||||
|
}
|
||||||
|
|
||||||
|
class MetaUpdate {
|
||||||
|
String pathToYaml = '';
|
||||||
|
String metaDartFileContents = '';
|
||||||
|
MetaUpdate(this.pathToYaml);
|
||||||
|
|
||||||
|
void writeMetaDartFile(String metaDartFilePath) {
|
||||||
|
File metaDartFile = File(metaDartFilePath);
|
||||||
|
|
||||||
|
final version = getPubSpec('version');
|
||||||
|
final time = DateTime.now().millisecondsSinceEpoch;
|
||||||
|
print('Version: $version');
|
||||||
|
print('BuildTime: $time');
|
||||||
|
|
||||||
|
String metaDartFileContents = """
|
||||||
|
/// DO NOT EDIT THIS FILE EXCEPT TO ENTER INITIAL VERSION AND OTHER META INFO
|
||||||
|
/// THIS FILE IS AUTOMATICALLY OVERWRITTEN
|
||||||
|
|
||||||
|
class Meta {
|
||||||
|
static const String version = '$version';
|
||||||
|
static const int buildTime = $time;
|
||||||
|
static const bool devBuild = false;
|
||||||
|
}
|
||||||
|
""";
|
||||||
|
|
||||||
|
metaDartFile.writeAsStringSync(metaDartFileContents);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getPubSpec(String pubSpecParam) {
|
||||||
|
File f = File(pathToYaml);
|
||||||
|
|
||||||
|
String yamlText = f.readAsStringSync();
|
||||||
|
// ignore: always_specify_types
|
||||||
|
Map yaml = loadYaml(yamlText);
|
||||||
|
|
||||||
|
return yaml[pubSpecParam];
|
||||||
|
}
|
||||||
|
}
|
47
gen/pubspec.lock
Normal file
47
gen/pubspec.lock
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# Generated by pub
|
||||||
|
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||||
|
packages:
|
||||||
|
collection:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: collection
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.17.0"
|
||||||
|
path:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: path
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.8.2"
|
||||||
|
source_span:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: source_span
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.9.1"
|
||||||
|
string_scanner:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: string_scanner
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.2.0"
|
||||||
|
term_glyph:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: term_glyph
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.2.1"
|
||||||
|
yaml:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: yaml
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.1.1"
|
||||||
|
sdks:
|
||||||
|
dart: ">=2.18.2 <3.0.0"
|
8
gen/pubspec.yaml
Normal file
8
gen/pubspec.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
name: gen
|
||||||
|
version: 1.0.0+1
|
||||||
|
|
||||||
|
environment:
|
||||||
|
sdk: '>=2.18.2 <3.0.0'
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
yaml:
|
8
lib/gen/meta.dart
Normal file
8
lib/gen/meta.dart
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/// DO NOT EDIT THIS FILE EXCEPT TO ENTER INITIAL VERSION AND OTHER META INFO
|
||||||
|
/// THIS FILE IS AUTOMATICALLY OVERWRITTEN
|
||||||
|
|
||||||
|
class Meta {
|
||||||
|
static const String version = '0.0.0+0-dev';
|
||||||
|
static const int buildTime = 71727248562000;
|
||||||
|
static const bool devBuild = true;
|
||||||
|
}
|
26
lib/pages/settings_page.dart
Normal file
26
lib/pages/settings_page.dart
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../gen/meta.dart';
|
||||||
|
|
||||||
|
class SettingsPage extends StatelessWidget {
|
||||||
|
const SettingsPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final buildTimeString =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(Meta.buildTime).toIso8601String();
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(),
|
||||||
|
body: Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Text('Notes'),
|
||||||
|
const Text('Version: ${Meta.version}'),
|
||||||
|
Text('Build Time: $buildTimeString'),
|
||||||
|
if (Meta.devBuild) const Text('Attention, this is a dev build!')
|
||||||
|
],
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '../context/file_change_notifier.dart';
|
import '../context/file_change_notifier.dart';
|
||||||
|
import '../pages/settings_page.dart';
|
||||||
import 'drawer_item.dart';
|
import 'drawer_item.dart';
|
||||||
|
|
||||||
enum View { all, shared, recycle, folders }
|
enum View { all, shared, recycle, folders }
|
||||||
@ -86,7 +87,13 @@ class _CollapseDrawerState extends State<CollapseDrawer>
|
|||||||
icon: const Icon(Icons.settings_outlined),
|
icon: const Icon(Icons.settings_outlined),
|
||||||
iconSize: 26,
|
iconSize: 26,
|
||||||
color: const Color(0xffa8a8a8),
|
color: const Color(0xffa8a8a8),
|
||||||
onPressed: () {},
|
onPressed: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const SettingsPage(),
|
||||||
|
));
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
Loading…
Reference in New Issue
Block a user