about: added source link

This commit is contained in:
Thibault Deckers 2020-06-12 19:09:19 +09:00
parent fb4455399f
commit 043fe51379
3 changed files with 83 additions and 54 deletions

View file

@ -1,4 +1,5 @@
import 'package:aves/widgets/about/licenses.dart';
import 'package:aves/widgets/common/link_chip.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
@ -19,17 +20,27 @@ class AboutPage extends StatelessWidget {
delegate: SliverChildListDelegate(
[
Center(
child: Text.rich(
TextSpan(
children: [
const TextSpan(text: 'Made with ❤️ and '),
WidgetSpan(
child: FlutterLogo(
size: Theme.of(context).textTheme.bodyText2.fontSize * 1.25,
),
child: Column(
children: [
Text.rich(
TextSpan(
children: [
const TextSpan(text: 'Made with ❤️ and '),
WidgetSpan(
child: FlutterLogo(
size: Theme.of(context).textTheme.bodyText2.fontSize * 1.25,
),
),
],
),
],
),
),
const SizedBox(height: 8),
const LinkChip(
text: 'Sources',
url: 'https://github.com/deckerst/aves',
textStyle: TextStyle(fontWeight: FontWeight.bold),
),
],
),
),
const SizedBox(height: 8),

View file

@ -1,11 +1,11 @@
import 'package:aves/utils/constants.dart';
import 'package:aves/utils/durations.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';
import 'package:url_launcher/url_launcher.dart';
class Licenses extends StatefulWidget {
@override
@ -115,8 +115,6 @@ class LicenseRow extends StatelessWidget {
const LicenseRow(this.package);
static const borderRadius = BorderRadius.all(Radius.circular(8));
@override
Widget build(BuildContext context) {
final textTheme = Theme.of(context).textTheme;
@ -128,50 +126,17 @@ class LicenseRow extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
InkWell(
borderRadius: borderRadius,
onTap: () => launch(package.sourceUrl),
child: Padding(
padding: const EdgeInsets.all(8),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
package.name,
style: const TextStyle(fontWeight: FontWeight.bold),
),
const SizedBox(width: 8),
Icon(
AIcons.openInNew,
size: bodyTextStyle.fontSize,
)
],
),
),
LinkChip(
text: package.name,
url: package.sourceUrl,
textStyle: const TextStyle(fontWeight: FontWeight.bold),
),
Padding(
padding: const EdgeInsetsDirectional.only(start: 16),
child: InkWell(
borderRadius: borderRadius,
onTap: () => launch(package.licenseUrl),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
package.license,
style: TextStyle(color: subColor),
),
const SizedBox(width: 8),
Icon(
AIcons.openInNew,
size: bodyTextStyle.fontSize,
color: subColor,
)
],
),
),
child: LinkChip(
text: package.license,
url: package.licenseUrl,
color: subColor,
),
),
],

View file

@ -0,0 +1,53 @@
import 'package:aves/widgets/common/icons.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class LinkChip extends StatelessWidget {
final String text;
final String url;
final Color color;
final TextStyle textStyle;
static const borderRadius = BorderRadius.all(Radius.circular(8));
const LinkChip({
Key key,
@required this.text,
@required this.url,
this.color,
this.textStyle,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final effectiveTextStyle = (textStyle ?? DefaultTextStyle.of(context).style).copyWith(
color: color,
);
return InkWell(
borderRadius: borderRadius,
onTap: () async {
if (await canLaunch(url)) {
await launch(url);
}
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
text,
style: effectiveTextStyle,
),
const SizedBox(width: 8),
Icon(
AIcons.openInNew,
size: Theme.of(context).textTheme.bodyText2.fontSize,
color: color,
)
],
),
),
);
}
}