Skip to content
This repository has been archived by the owner on Jul 20, 2021. It is now read-only.

Commit

Permalink
show app version in settings tab
Browse files Browse the repository at this point in the history
  • Loading branch information
IceArrow256 committed Feb 17, 2021
1 parent 65b5373 commit ce7a042
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ app.*.symbols

# Obfuscation related
app.*.map.json

# Keys
keys/keystore.jks
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
## [0.12.0] - 2020-02-17
### Added
- Refactor game edit page.
- Refactor game view page.
- Refactor game in list edit page.
- Refactor game in list view page.
- Refactor game view page.
- Show app version in settings tab.

## [0.11.0] - 2020-02-16
### Added
Expand Down
22 changes: 19 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {

compileSdkVersion 29

sourceSets {
Expand All @@ -45,11 +52,20 @@ android {
versionName flutterVersionName
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {

release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
}
}
}
Expand All @@ -60,4 +76,4 @@ flutter {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
}
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@
android:name="flutterEmbedding"
android:value="2" />
</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
43 changes: 37 additions & 6 deletions lib/pages/tabs/settings_tab.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
import 'package:flutter/material.dart';
import 'package:package_info/package_info.dart';

class SettingsTab extends StatelessWidget {
class SettingsTab extends StatefulWidget {
final bool isDarkTheme;
final ValueChanged<bool> updateIsDarkTheme;

const SettingsTab(
{Key key, @required this.isDarkTheme, @required this.updateIsDarkTheme})
: super(key: key);

@override
_SettingsTabState createState() => _SettingsTabState();
}

class _SettingsTabState extends State<SettingsTab> {
String _appName;
String _version;

@override
Widget build(BuildContext context) {
return ListView(
Expand All @@ -21,18 +30,40 @@ class SettingsTab extends StatelessWidget {
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text('Appearance'),
Text(
'Appearance',
style: TextStyle(fontSize: 16),
),
SwitchListTile(
title: Text('Dark Theme'),
value: isDarkTheme,
value: widget.isDarkTheme,
onChanged: (value) {
updateIsDarkTheme(value);
})
widget.updateIsDarkTheme(value);
}),
],
),
),
)
),
Center(
child: Text('$_appName $_version'),
),
],
);
}

_getVersion() async {
var packageInfo = await PackageInfo.fromPlatform();
setState(() {
_appName = packageInfo.appName;
_version = packageInfo.version;
});
}

@override
void initState() {
_appName = '';
_version = '';
_getVersion();
super.initState();
}
}
21 changes: 21 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_automation:
dependency: "direct main"
description:
name: flutter_automation
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
flutter_test:
dependency: "direct dev"
description: flutter
Expand All @@ -254,6 +261,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.2"
http_multi_server:
dependency: transitive
description:
Expand Down Expand Up @@ -345,6 +359,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
package_info:
dependency: "direct main"
description:
name: package_info
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.3+4"
path:
dependency: transitive
description:
Expand Down
4 changes: 3 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.11.0
version: 0.12.0

environment:
sdk: ">=2.7.0 <3.0.0"
Expand All @@ -25,6 +25,8 @@ dependencies:
sdk: flutter
shared_preferences: ^0.5.12+4
floor: ^0.18.0
flutter_automation: ^1.4.0
package_info: ^0.4.3+4


# The following adds the Cupertino Icons font to your application.
Expand Down

0 comments on commit ce7a042

Please sign in to comment.