Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppLinks セクションを追加 #213

Merged
merged 10 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/app_links/app_store.png
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memo-badge
↓でダウンロードしたものを Figma に配置して Google Play と同じ画像形式で扱えるように png としてダウンロードしてアプリで使いやすいようにしています。
https://developer.apple.com/jp/app-store/marketing/guidelines/

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/app_links/google_play.png
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memo-badge
↓でダウンロードしたものを Figma に配置して、上下のパディングを削除してアプリで使いやすいようにしています。
https://play.google.com/intl/en_us/badges/?hl=ja

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions lib/app/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:confwebsite2023/core/components/responsive_widget.dart';
import 'package:confwebsite2023/core/theme.dart';
import 'package:confwebsite2023/features/access/ui/access_widget.dart';
import 'package:confwebsite2023/features/announcement/ui/announcement_section.dart';
import 'package:confwebsite2023/features/app_links/ui/app_links_section.dart';
import 'package:confwebsite2023/features/count_down/model/count_down_timer.dart';
import 'package:confwebsite2023/features/count_down/ui/count_down_section.dart';
import 'package:confwebsite2023/features/event/hands-on/ui/hands_on_event.dart';
Expand Down Expand Up @@ -184,6 +185,13 @@ class _MainPageBody extends StatelessWidget {
const SliverToBoxAdapter(
child: Spaces.vertical_80,
),
_Sliver(
padding: padding,
child: const AppLinksSection(),
),
const SliverToBoxAdapter(
child: Spaces.vertical_80,
),
_Sliver(
padding: padding,
child: const NewsSection(),
Expand Down
16 changes: 16 additions & 0 deletions lib/core/gen/assets.gen.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/core/theme/app_text_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AppTextStyle {
);

static final _shadowHeading2 = Shadow(
color: GradientConstant.accent.secoundary.colors.last.withOpacity(0.25),
color: GradientConstant.accent.secondary.colors.last.withOpacity(0.25),
blurRadius: 10,
offset: const Offset(0, 2),
);
Expand Down
2 changes: 2 additions & 0 deletions lib/core/theme/dimension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ class Spaces {
static const SizedBox vertical_16 = SizedBox(height: 16);
static const SizedBox vertical_20 = SizedBox(height: 20);
static const SizedBox vertical_24 = SizedBox(height: 24);
static const SizedBox vertical_28 = SizedBox(height: 28);
static const SizedBox vertical_30 = SizedBox(height: 30);
static const SizedBox vertical_36 = SizedBox(height: 36);
static const SizedBox vertical_40 = SizedBox(height: 40);
static const SizedBox vertical_80 = SizedBox(height: 80);
static const SizedBox vertical_82 = SizedBox(height: 82);
Expand Down
10 changes: 1 addition & 9 deletions lib/core/theme/gradient.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class _Accent {
],
);

Gradient get secoundary => const LinearGradient(
Gradient get secondary => const LinearGradient(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memo-badge
Typo があったため、ついでに修正しました。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typoの修正いただきありがとうございます!!
全然気づけていませんでした🙇‍♀️

colors: [
Color.fromARGB(255, 243, 239, 147),
Color.fromARGB(255, 241, 122, 55),
Expand All @@ -30,14 +30,6 @@ class _Accent {
class _Sponsor {
const _Sponsor();

Gradient get diamond => const LinearGradient(
colors: [
Color.fromARGB(255, 155, 202, 240),
Color.fromARGB(255, 225, 253, 255),
Color.fromARGB(255, 155, 202, 240),
],
);

Comment on lines -33 to -40
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memo-badge
未使用で今後も使用する予定がないため、ついでに削除しました。

Gradient get platinum => const LinearGradient(
colors: [
Color.fromARGB(255, 225, 236, 255),
Expand Down
95 changes: 95 additions & 0 deletions lib/features/app_links/ui/app_links.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import 'dart:async';

import 'package:confwebsite2023/core/components/responsive_widget.dart';
import 'package:confwebsite2023/core/gen/assets.gen.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

final class AppLinks extends StatelessWidget {
const AppLinks({super.key});

@override
Widget build(BuildContext context) {
final screenSizeType = ResponsiveWidget.getScreenSizeType(context);
final spacing = switch (screenSizeType) {
ScreenSizeType.large || ScreenSizeType.medium => 40.0,
ScreenSizeType.small => 24.0,
};
return Wrap(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memo-badge
より小さい端末では、自動的にリンクを縦に並べられるように Wrap を使用しました。

alignment: WrapAlignment.center,
spacing: spacing,
runSpacing: spacing,
children: const [
_AppLink.appStore(),
_AppLink.googlePlay(),
],
);
}
}

final class _AppLink extends StatelessWidget {
const _AppLink.appStore() : _type = _AppLinkType.appStore;

const _AppLink.googlePlay() : _type = _AppLinkType.googlePlay;

final _AppLinkType _type;

@override
Widget build(BuildContext context) {
final onTap = switch (_type) {
_AppLinkType.appStore => () {
final uri = Uri.parse(
'https://apps.apple.com/app/id6469518498',
);
unawaited(launchUrl(uri));
},
_AppLinkType.googlePlay => () {
final uri = Uri.parse(
'https://play.google.com/store/apps/details?id=jp.flutterkaigi.conf2023',
);
unawaited(launchUrl(uri));
},
};

final assetName = switch (_type) {
_AppLinkType.appStore => Assets.appLinks.appStore.keyName,
_AppLinkType.googlePlay => Assets.appLinks.googlePlay.keyName,
};

final imageButton = Material(
color: Colors.transparent,
child: Ink.image(
image: AssetImage(assetName),
fit: BoxFit.fitHeight,
child: InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(8),
),
),
);
Comment on lines +59 to +69
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memo-badge
公式ドキュメントに記載されている通り、画像にエフェクトを被せられるようにこのようにしています。
ただし、角丸がいい感じに自動的につけることができなかったため、違和感なさそうな固定値を設定しています。

FYI:


final screenSizeType = ResponsiveWidget.getScreenSizeType(context);
final height = switch (screenSizeType) {
ScreenSizeType.large || ScreenSizeType.medium => 54.0,
ScreenSizeType.small => 42.0,
};

final aspectRatio = switch (_type) {
_AppLinkType.appStore => 148 / 54,
_AppLinkType.googlePlay => 182 / 54,
};
Comment on lines +77 to +80
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memo-badge
Figma から落としてきた画像のサイズで縦横比を計算しています。


return SizedBox(
height: height,
child: AspectRatio(
aspectRatio: aspectRatio,
child: imageButton,
),
);
}
}

enum _AppLinkType {
appStore,
googlePlay,
}
27 changes: 27 additions & 0 deletions lib/features/app_links/ui/app_links_header.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'package:confwebsite2023/core/components/responsive_widget.dart';
import 'package:confwebsite2023/core/components/section_header.dart';
import 'package:confwebsite2023/core/theme/app_text_style.dart';
import 'package:confwebsite2023/core/theme/gradient.dart';
import 'package:flutter/material.dart';

final class AppLinksHeader extends StatelessWidget {
const AppLinksHeader({super.key});

@override
Widget build(BuildContext context) {
const text = 'Application';
final gradient = GradientConstant.accent.secondary;
return ResponsiveWidget(
largeWidget: SectionHeader.centerAlignment(
text: text,
style: AppTextStyle.pcHeading2,
gradient: gradient,
),
smallWidget: SectionHeader.centerAlignment(
text: text,
style: AppTextStyle.spHeading2,
gradient: gradient,
),
);
}
}
22 changes: 22 additions & 0 deletions lib/features/app_links/ui/app_links_section.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'package:confwebsite2023/core/theme.dart';
import 'package:confwebsite2023/features/app_links/ui/app_links.dart';
import 'package:confwebsite2023/features/app_links/ui/app_links_header.dart';
import 'package:confwebsite2023/features/app_links/ui/app_links_summary.dart';
import 'package:flutter/material.dart';

final class AppLinksSection extends StatelessWidget {
const AppLinksSection({super.key});

@override
Widget build(BuildContext context) {
return const Column(
children: [
AppLinksHeader(),
Spaces.vertical_28,
AppLinksSummary(),
Spaces.vertical_36,
AppLinks(),
],
);
}
}
27 changes: 27 additions & 0 deletions lib/features/app_links/ui/app_links_summary.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'package:confwebsite2023/core/components/responsive_widget.dart';
import 'package:flutter/material.dart';

final class AppLinksSummary extends StatelessWidget {
const AppLinksSummary({super.key});

@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final textColor = theme.colorScheme.onPrimaryContainer;
final textStyle = theme.textTheme.bodyLarge?.copyWith(
color: textColor,
);
final screenType = ResponsiveWidget.getScreenSizeType(context);
final text = switch (screenType) {
ScreenSizeType.large ||
ScreenSizeType.medium =>
'FlutterKaigi 2023 のカンファレンスアプリをダウンロード',
ScreenSizeType.small => 'FlutterKaigi 2023 の\nカンファレンスアプリをダウンロード',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memo-badge
小さい端末では意図的に「FlutterKaigi 2023 の」の後に改行を入れて、ヘッダーやボタンのサイズ感に合わせるようにしています。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

とてもいい感じに実装されていますね!ありがとうございます!!!

};
return Text(
text,
textAlign: TextAlign.center,
style: textStyle,
);
}
}
4 changes: 2 additions & 2 deletions lib/features/sponsor/data/sponsor_data_source.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/features/sponsor/ui/detail/sponsor_session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ final class _SponsorSessionHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
const title = 'Sponsor Session';
final gradient = GradientConstant.accent.secoundary;
final gradient = GradientConstant.accent.secondary;
return ResponsiveWidget(
largeWidget: SectionHeader.centerAlignment(
text: title,
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ flutter:
generate: true
assets:
- .env
- assets/app_links/
- assets/icons/
- assets/sponsors/
- assets/
Expand Down