Merge pull request #64 from krawieck/about-page

This commit is contained in:
Filip Krawczyk 2020-10-02 21:14:27 +02:00 committed by GitHub
commit 7285e27346
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 83 additions and 13 deletions

View File

@ -186,7 +186,9 @@ class AddAccountPage extends HookWidget {
onPressed: usernameController.text.isEmpty ||
passwordController.text.isEmpty
? null
: loading.pending ? () {} : handleOnAdd,
: loading.pending
? () {}
: handleOnAdd,
),
FlatButton(
shape: RoundedRectangleBorder(

View File

@ -7,6 +7,7 @@ import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import '../hooks/stores.dart';
import '../util/goto.dart';
import '../widgets/about_tile.dart';
import 'add_account.dart';
import 'add_instance.dart';
@ -41,7 +42,8 @@ class SettingsPage extends StatelessWidget {
onTap: () {
goTo(context, (_) => AppearanceConfigPage());
},
)
),
AboutTile()
],
),
),

View File

@ -0,0 +1,55 @@
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:package_info/package_info.dart';
import '../hooks/memo_future.dart';
import '../url_launcher.dart';
import 'bottom_modal.dart';
/// Title that opens a dialog with information about Lemmur.
/// Licenses, changelog, version etc.
class AboutTile extends HookWidget {
@override
Widget build(BuildContext context) {
final packageInfoSnap = useMemoFuture(PackageInfo.fromPlatform);
final assetBundle = DefaultAssetBundle.of(context);
final changelogSnap =
useMemoFuture(() => assetBundle.loadString('CHANGELOG.md'));
if (!packageInfoSnap.hasData || !changelogSnap.hasData) {
return const SizedBox.shrink();
}
final packageInfo = packageInfoSnap.data;
final changelog = changelogSnap.data;
// TODO: add app icon
return AboutListTile(
icon: Icon(Icons.info),
aboutBoxChildren: [
FlatButton.icon(
icon: Icon(Icons.subject),
label: Text('changelog'),
onPressed: () => showModalBottomSheet(
context: context,
builder: (_) => BottomModal(
child: MarkdownBody(data: changelog),
),
),
),
FlatButton.icon(
icon: Icon(Icons.code),
label: Text('source code'),
onPressed: () => openInBrowser('https://github.com/krawieck/lemmur'),
),
FlatButton.icon(
icon: Icon(Icons.monetization_on),
label: Text('support development'),
onPressed: () {}, // TODO: link to some donation site
),
],
applicationVersion: packageInfo.version,
);
}
}

View File

@ -464,6 +464,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"
path:
dependency: transitive
description:

View File

@ -15,31 +15,36 @@ 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: 1.0.0+1
version: 0.1.0
environment:
sdk: '>=2.7.0 <3.0.0'
dependencies:
# widgets
flutter_speed_dial: ^1.2.5
flutter_slidable: ^0.5.7
photo_view: ^0.10.2
url_launcher: ^5.5.1
markdown: ^2.1.8
flutter_markdown: ^0.4.3
esys_flutter_share: ^1.0.2
flutter_hooks: ^0.13.2
cached_network_image: ^2.2.0+1
timeago: ^2.0.27
fuzzy: <1.0.0
lemmy_api_client: ^0.6.0
# native
esys_flutter_share: ^1.0.2
url_launcher: ^5.5.1
shared_preferences: '>=0.5.0 <2.0.0'
package_info: ^0.4.3
# state management
flutter_hooks: ^0.13.2
mobx: ^1.2.1
flutter_mobx: ^1.1.0
provider: ^4.3.1
shared_preferences: '>=0.5.0 <2.0.0'
# utils
timeago: ^2.0.27
fuzzy: <1.0.0
lemmy_api_client: ^0.6.0
flutter:
sdk: flutter
@ -63,9 +68,8 @@ flutter:
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
assets:
- CHANGELOG.md
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see