fix merge issues

This commit is contained in:
Lukas Heiligenbrunner 2022-11-02 23:31:44 +00:00
parent ac1f388dd8
commit 5202732964
8 changed files with 148 additions and 1 deletions

2
.gitignore vendored
View File

@ -42,3 +42,5 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
lib/gen/meta.dart

View File

@ -9,6 +9,8 @@ flutter_build_android:
- flutter packages get
- flutter clean
script:
- cd gen && flutter pub get
- dart run metagen.dart && cd ..
- flutter build apk --target-platform android-arm64
- mv build/app/outputs/apk/release/app-release.apk ./notes.apk
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
- flutter config --enable-linux-desktop
- flutter packages get
- cd gen && flutter pub get
- dart run metagen.dart && cd ..
- flutter build linux
artifacts:
paths:

45
gen/metagen.dart Normal file
View 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
View 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
View 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
View 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;
}

View 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!')
],
)));
}
}

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../context/file_change_notifier.dart';
import '../pages/settings_page.dart';
import 'drawer_item.dart';
enum View { all, shared, recycle, folders }
@ -86,7 +87,13 @@ class _CollapseDrawerState extends State<CollapseDrawer>
icon: const Icon(Icons.settings_outlined),
iconSize: 26,
color: const Color(0xffa8a8a8),
onPressed: () {},
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SettingsPage(),
));
},
),
),
const SizedBox(