Skip to content

Commit

Permalink
Merge pull request #125 from kosukesaigusa/108_replace_link_widget_in…
Browse files Browse the repository at this point in the history
…_job_detail

#108 仕事詳細画面のリンクをWebLinkウィジェットに置き換え
  • Loading branch information
RikitoNoto committed Aug 7, 2023
2 parents d26d8b1 + 96e2732 commit e39ee1a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
5 changes: 5 additions & 0 deletions packages/dart_flutter_common/lib/src/widgets/web_link.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class WebLink extends StatelessWidget {
this.textStyle,
this.linkStyle,
this.onFailLaunch,
this.maxLines,
super.key,
});

Expand All @@ -34,6 +35,9 @@ class WebLink extends StatelessWidget {
/// [urlText]のurl部分のスタイル
final TextStyle? linkStyle;

/// urlの表示最大行数
final int? maxLines;

/// リンク遷移が失敗した場合のコールバック
final void Function(String url)? onFailLaunch;

Expand All @@ -48,6 +52,7 @@ class WebLink extends StatelessWidget {
onFailLaunch?.call(link.url);
}
},
maxLines: maxLines,
text: urlText,
style: textStyle,
linkStyle: linkStyle,
Expand Down
18 changes: 14 additions & 4 deletions packages/mottai_flutter_app/lib/job/ui/job_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,22 @@ class _JobDetail extends ConsumerWidget {
titleStyle: Theme.of(context).textTheme.headlineMedium,
sectionPadding: const EdgeInsets.only(bottom: 32),
content: Column(
//TODO: リンクウィジェットにする。
crossAxisAlignment: CrossAxisAlignment.start,
children: readHost.urls
.map(
(url) => Text(
url,
style: Theme.of(context).textTheme.bodyLarge,
(url) => WebLink(
urlText: url,
mode: LaunchMode.externalApplication,
linkStyle: Theme.of(context)
.textTheme
.bodyLarge
?.copyWith(
color: Colors.blue,
decoration: TextDecoration.underline,
decorationColor: Colors.blue,
),
textStyle: Theme.of(context).textTheme.bodyLarge,
maxLines: 1,
),
)
.toList(),
Expand Down
2 changes: 1 addition & 1 deletion packages/mottai_flutter_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ environment:
dependencies:
auto_route: ^7.7.0
cached_network_image: ^3.2.3
cloud_functions: ^4.3.4
# TODO: mottai_flutter_app で geoflutterfire_plus の DocumentSnapshot 型を使用する
# 必要がなくなるようにリファクタする or geoflutterfire_plus 自体を改善する。
cloud_firestore: ^4.8.4
cloud_functions: ^4.3.4
crypto: ^3.0.3
dart_flutter_common:
path: ../dart_flutter_common
Expand Down

0 comments on commit e39ee1a

Please sign in to comment.