about: changed layout, added credits, added generated license list

This commit is contained in:
Thibault Deckers 2020-11-19 15:37:52 +09:00
parent ced2861860
commit 258d06198d
8 changed files with 108 additions and 54 deletions

View file

@ -3,6 +3,9 @@ import 'package:flutter/painting.dart';
import 'package:tuple/tuple.dart';
class Constants {
static const Color androidGreen = Color(0xFF3DDC84);
static const Color flutterBlue = Color(0xFF47D1FD);
// as of Flutter v1.22.3, overflowing `Text` miscalculates height and some text (e.g. 'Å') is clipped
// so we give it a `strutStyle` with a slightly larger height
static const overflowStrutStyle = StrutStyle(height: 1.3);
@ -26,6 +29,18 @@ class Constants {
static const int infoGroupMaxValueLength = 140;
static const List<Dependency> androidDependencies = [
Dependency(
name: 'AndroidX Core-KTX',
license: 'Apache 2.0',
licenseUrl: 'https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/LICENSE.txt',
sourceUrl: 'https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/core/core-ktx',
),
Dependency(
name: 'AndroidX Exifinterface',
license: 'Apache 2.0',
licenseUrl: 'https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/LICENSE.txt',
sourceUrl: 'https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/exifinterface/exifinterface',
),
Dependency(
name: 'Android-TiffBitmapFactory',
license: 'MIT',
@ -96,7 +111,7 @@ class Constants {
sourceUrl: 'https://github.com/Skylled/expansion_tile_card',
),
Dependency(
name: 'FlutterFire',
name: 'FlutterFire (Core, Analytics, Crashlytics)',
license: 'BSD 3-Clause',
licenseUrl: 'https://github.com/FirebaseExtended/flutterfire/blob/master/LICENSE',
sourceUrl: 'https://github.com/FirebaseExtended/flutterfire',
@ -186,7 +201,7 @@ class Constants {
sourceUrl: 'https://github.com/boyan01/overlay_support',
),
Dependency(
name: 'Package info',
name: 'Package Info',
license: 'BSD 3-Clause',
licenseUrl: 'https://github.com/flutter/plugins/blob/master/packages/package_info/LICENSE',
sourceUrl: 'https://github.com/flutter/plugins/tree/master/packages/package_info',
@ -275,12 +290,6 @@ class Constants {
licenseUrl: 'https://github.com/flutter/plugins/blob/master/packages/url_launcher/url_launcher/LICENSE',
sourceUrl: 'https://github.com/flutter/plugins/blob/master/packages/url_launcher/url_launcher',
),
Dependency(
name: 'UUID',
license: 'MIT',
licenseUrl: 'https://github.com/Daegalus/dart-uuid/blob/master/LICENSE',
sourceUrl: 'https://github.com/Daegalus/dart-uuid',
),
];
}

View file

@ -3,7 +3,6 @@ import 'package:aves/widgets/about/licenses.dart';
import 'package:aves/widgets/common/aves_logo.dart';
import 'package:aves/widgets/common/link_chip.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:package_info/package_info.dart';
class AboutPage extends StatelessWidget {
@ -16,7 +15,6 @@ class AboutPage extends StatelessWidget {
title: Text('About'),
),
body: SafeArea(
child: AnimationLimiter(
child: CustomScrollView(
slivers: [
SliverPadding(
@ -27,6 +25,42 @@ class AboutPage extends StatelessWidget {
AppReference(),
SizedBox(height: 16),
Divider(),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ConstrainedBox(
constraints: BoxConstraints(minHeight: 48),
child: Align(
alignment: AlignmentDirectional.centerStart,
child: Text(
'Credits',
style: Theme.of(context).textTheme.headline6.copyWith(fontFamily: 'Concourse Caps'),
),
),
),
RichText(
text: TextSpan(
children: [
TextSpan(text: 'This app uses the font '),
WidgetSpan(
child: LinkChip(
text: 'Concourse',
url: 'https://mbtype.com/fonts/concourse/',
textStyle: TextStyle(fontWeight: FontWeight.bold),
),
alignment: PlaceholderAlignment.middle,
),
TextSpan(text: ' for titles and the media information page.'),
],
),
),
SizedBox(height: 16),
],
),
),
Divider(),
],
),
),
@ -35,7 +69,6 @@ class AboutPage extends StatelessWidget {
],
),
),
),
);
}
}

View file

@ -1,11 +1,10 @@
import 'package:aves/utils/constants.dart';
import 'package:aves/utils/durations.dart';
import 'package:aves/widgets/common/aves_expansion_tile.dart';
import 'package:aves/widgets/common/icons.dart';
import 'package:aves/widgets/common/link_chip.dart';
import 'package:aves/widgets/common/menu_row.dart';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
class Licenses extends StatefulWidget {
@override
@ -13,18 +12,20 @@ class Licenses extends StatefulWidget {
}
class _LicensesState extends State<Licenses> {
final ValueNotifier<String> _expandedNotifier = ValueNotifier(null);
LicenseSort _sort = LicenseSort.name;
List<Dependency> _packages;
List<Dependency> _platform, _flutter;
@override
void initState() {
super.initState();
_packages = [...Constants.androidDependencies, ...Constants.flutterPackages];
_platform = List.from(Constants.androidDependencies);
_flutter = List.from(Constants.flutterPackages);
_sortPackages();
}
void _sortPackages() {
_packages.sort((a, b) {
int compare(Dependency a, Dependency b) {
switch (_sort) {
case LicenseSort.license:
final c = compareAsciiUpperCase(a.license, b.license);
@ -33,7 +34,10 @@ class _LicensesState extends State<Licenses> {
default:
return compareAsciiUpperCase(a.name, b.name);
}
});
}
_platform.sort(compare);
_flutter.sort(compare);
}
@override
@ -41,25 +45,29 @@ class _LicensesState extends State<Licenses> {
return SliverPadding(
padding: EdgeInsets.symmetric(horizontal: 8),
sliver: SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
if (index-- == 0) {
return _buildHeader();
}
final child = LicenseRow(_packages[index]);
return AnimationConfiguration.staggeredList(
position: index,
duration: Durations.staggeredAnimation,
delay: Durations.staggeredAnimationDelay,
child: SlideAnimation(
verticalOffset: 50.0,
child: FadeInAnimation(
child: child,
delegate: SliverChildListDelegate(
[
_buildHeader(),
SizedBox(height: 16),
AvesExpansionTile(
title: 'Android Libraries',
color: Constants.androidGreen,
expandedNotifier: _expandedNotifier,
children: _platform.map((package) => LicenseRow(package)).toList(),
),
AvesExpansionTile(
title: 'Flutter Packages',
color: Constants.flutterBlue,
expandedNotifier: _expandedNotifier,
children: _flutter.map((package) => LicenseRow(package)).toList(),
),
Center(
child: TextButton(
onPressed: () => showLicensePage(context: context),
child: Text('All Licenses'.toUpperCase()),
),
),
);
},
childCount: _packages.length + 1,
],
),
),
);
@ -122,7 +130,7 @@ class LicenseRow extends StatelessWidget {
final subColor = bodyTextStyle.color.withOpacity(.6);
return Padding(
padding: EdgeInsets.only(top: 16),
padding: EdgeInsets.symmetric(vertical: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [

View file

@ -4,11 +4,13 @@ import 'package:flutter/material.dart';
class AvesExpansionTile extends StatelessWidget {
final String title;
final Color color;
final List<Widget> children;
final ValueNotifier<String> expandedNotifier;
const AvesExpansionTile({
@required this.title,
this.color,
this.expandedNotifier,
@required this.children,
});
@ -27,6 +29,7 @@ class AvesExpansionTile extends StatelessWidget {
expandedNotifier: expandedNotifier,
title: HighlightTitle(
title,
color: color,
fontSize: 18,
enabled: enabled,
),

View file

@ -4,11 +4,13 @@ import 'package:flutter/material.dart';
class HighlightTitle extends StatelessWidget {
final String name;
final Color color;
final double fontSize;
final bool enabled;
const HighlightTitle(
this.name, {
this.color,
this.fontSize = 20,
this.enabled = true,
}) : assert(name != null);
@ -21,7 +23,7 @@ class HighlightTitle extends StatelessWidget {
alignment: AlignmentDirectional.centerStart,
child: Container(
decoration: HighlightDecoration(
color: enabled ? stringToColor(name) : disabledColor,
color: enabled ? color ?? stringToColor(name) : disabledColor,
),
margin: EdgeInsets.symmetric(vertical: 4.0),
child: Text(

View file

@ -173,7 +173,7 @@ extension ExtraEntryMapStyle on EntryMapStyle {
case EntryMapStyle.googleTerrain:
return 'Google Maps (Terrain)';
case EntryMapStyle.osmHot:
return 'Humanitarian OpenStreetMap';
return 'Humanitarian OSM';
case EntryMapStyle.stamenToner:
return 'Stamen Toner';
case EntryMapStyle.stamenWatercolor:

View file

@ -1048,7 +1048,7 @@ packages:
source: hosted
version: "0.9.0+5"
uuid:
dependency: "direct main"
dependency: transitive
description:
name: uuid
url: "https://pub.dartlang.org"

View file

@ -93,7 +93,6 @@ dependencies:
streams_channel:
tuple:
url_launcher:
uuid:
dev_dependencies:
flutter_test: