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'; import 'package:tuple/tuple.dart';
class Constants { 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 // 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 // so we give it a `strutStyle` with a slightly larger height
static const overflowStrutStyle = StrutStyle(height: 1.3); static const overflowStrutStyle = StrutStyle(height: 1.3);
@ -26,6 +29,18 @@ class Constants {
static const int infoGroupMaxValueLength = 140; static const int infoGroupMaxValueLength = 140;
static const List<Dependency> androidDependencies = [ 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( Dependency(
name: 'Android-TiffBitmapFactory', name: 'Android-TiffBitmapFactory',
license: 'MIT', license: 'MIT',
@ -96,7 +111,7 @@ class Constants {
sourceUrl: 'https://github.com/Skylled/expansion_tile_card', sourceUrl: 'https://github.com/Skylled/expansion_tile_card',
), ),
Dependency( Dependency(
name: 'FlutterFire', name: 'FlutterFire (Core, Analytics, Crashlytics)',
license: 'BSD 3-Clause', license: 'BSD 3-Clause',
licenseUrl: 'https://github.com/FirebaseExtended/flutterfire/blob/master/LICENSE', licenseUrl: 'https://github.com/FirebaseExtended/flutterfire/blob/master/LICENSE',
sourceUrl: 'https://github.com/FirebaseExtended/flutterfire', sourceUrl: 'https://github.com/FirebaseExtended/flutterfire',
@ -186,7 +201,7 @@ class Constants {
sourceUrl: 'https://github.com/boyan01/overlay_support', sourceUrl: 'https://github.com/boyan01/overlay_support',
), ),
Dependency( Dependency(
name: 'Package info', name: 'Package Info',
license: 'BSD 3-Clause', license: 'BSD 3-Clause',
licenseUrl: 'https://github.com/flutter/plugins/blob/master/packages/package_info/LICENSE', licenseUrl: 'https://github.com/flutter/plugins/blob/master/packages/package_info/LICENSE',
sourceUrl: 'https://github.com/flutter/plugins/tree/master/packages/package_info', 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', 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', 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/aves_logo.dart';
import 'package:aves/widgets/common/link_chip.dart'; import 'package:aves/widgets/common/link_chip.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:package_info/package_info.dart'; import 'package:package_info/package_info.dart';
class AboutPage extends StatelessWidget { class AboutPage extends StatelessWidget {
@ -16,7 +15,6 @@ class AboutPage extends StatelessWidget {
title: Text('About'), title: Text('About'),
), ),
body: SafeArea( body: SafeArea(
child: AnimationLimiter(
child: CustomScrollView( child: CustomScrollView(
slivers: [ slivers: [
SliverPadding( SliverPadding(
@ -27,6 +25,42 @@ class AboutPage extends StatelessWidget {
AppReference(), AppReference(),
SizedBox(height: 16), SizedBox(height: 16),
Divider(), 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/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/icons.dart';
import 'package:aves/widgets/common/link_chip.dart'; import 'package:aves/widgets/common/link_chip.dart';
import 'package:aves/widgets/common/menu_row.dart'; import 'package:aves/widgets/common/menu_row.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
class Licenses extends StatefulWidget { class Licenses extends StatefulWidget {
@override @override
@ -13,18 +12,20 @@ class Licenses extends StatefulWidget {
} }
class _LicensesState extends State<Licenses> { class _LicensesState extends State<Licenses> {
final ValueNotifier<String> _expandedNotifier = ValueNotifier(null);
LicenseSort _sort = LicenseSort.name; LicenseSort _sort = LicenseSort.name;
List<Dependency> _packages; List<Dependency> _platform, _flutter;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_packages = [...Constants.androidDependencies, ...Constants.flutterPackages]; _platform = List.from(Constants.androidDependencies);
_flutter = List.from(Constants.flutterPackages);
_sortPackages(); _sortPackages();
} }
void _sortPackages() { void _sortPackages() {
_packages.sort((a, b) { int compare(Dependency a, Dependency b) {
switch (_sort) { switch (_sort) {
case LicenseSort.license: case LicenseSort.license:
final c = compareAsciiUpperCase(a.license, b.license); final c = compareAsciiUpperCase(a.license, b.license);
@ -33,7 +34,10 @@ class _LicensesState extends State<Licenses> {
default: default:
return compareAsciiUpperCase(a.name, b.name); return compareAsciiUpperCase(a.name, b.name);
} }
}); }
_platform.sort(compare);
_flutter.sort(compare);
} }
@override @override
@ -41,25 +45,29 @@ class _LicensesState extends State<Licenses> {
return SliverPadding( return SliverPadding(
padding: EdgeInsets.symmetric(horizontal: 8), padding: EdgeInsets.symmetric(horizontal: 8),
sliver: SliverList( sliver: SliverList(
delegate: SliverChildBuilderDelegate( delegate: SliverChildListDelegate(
(context, index) { [
if (index-- == 0) { _buildHeader(),
return _buildHeader(); SizedBox(height: 16),
} AvesExpansionTile(
final child = LicenseRow(_packages[index]); title: 'Android Libraries',
return AnimationConfiguration.staggeredList( color: Constants.androidGreen,
position: index, expandedNotifier: _expandedNotifier,
duration: Durations.staggeredAnimation, children: _platform.map((package) => LicenseRow(package)).toList(),
delay: Durations.staggeredAnimationDelay, ),
child: SlideAnimation( AvesExpansionTile(
verticalOffset: 50.0, title: 'Flutter Packages',
child: FadeInAnimation( color: Constants.flutterBlue,
child: child, 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); final subColor = bodyTextStyle.color.withOpacity(.6);
return Padding( return Padding(
padding: EdgeInsets.only(top: 16), padding: EdgeInsets.symmetric(vertical: 8),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [

View file

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

View file

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

View file

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

View file

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

View file

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