-
Notifications
You must be signed in to change notification settings - Fork 12
/
author_info_widget.dart
111 lines (107 loc) · 4.77 KB
/
author_info_widget.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:notredame/features/ets/events/author/author_info_skeleton.dart';
import 'package:notredame/features/ets/events/social/models/social_link.dart';
import 'package:notredame/features/ets/events/social/social_links_card.dart';
import 'package:notredame/features/ets/events/author/author_viewmodel.dart';
import 'package:notredame/utils/utils.dart';
import 'package:notredame/utils/app_theme.dart';
import 'package:stacked/stacked.dart';
class AuthorInfoWidget extends ViewModelWidget<AuthorViewModel> {
const AuthorInfoWidget({super.key});
@override
Widget build(BuildContext context, AuthorViewModel model) {
final author = model.author;
List<SocialLink> socialLinks = [];
if (author != null) {
socialLinks = [
if (author.email != null)
SocialLink(id: 0, name: 'Email', link: author.email!),
if (author.facebookLink != null)
SocialLink(id: 1, name: 'Facebook', link: author.facebookLink!),
if (author.instagramLink != null)
SocialLink(id: 2, name: 'Instagram', link: author.instagramLink!),
if (author.tikTokLink != null)
SocialLink(id: 3, name: 'TikTok', link: author.tikTokLink!),
if (author.xLink != null)
SocialLink(id: 4, name: 'X', link: author.xLink!),
if (author.redditLink != null)
SocialLink(id: 5, name: 'Reddit', link: author.redditLink!),
if (author.discordLink != null)
SocialLink(id: 6, name: 'Discord', link: author.discordLink!),
if (author.linkedInLink != null)
SocialLink(id: 7, name: 'LinkedIn', link: author.linkedInLink!),
];
}
return Padding(
padding: const EdgeInsets.only(top: 76),
child: model.isBusy
? AuthorInfoSkeleton()
: SizedBox(
width: double.infinity,
child: Card(
color: Utils.getColorByBrightnessNullable(
context, AppTheme.newsSecondaryColor, null),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16)),
child: Container(
padding: const EdgeInsets.fromLTRB(32, 64, 32, 16),
child: Column(
children: [
if (author?.organization != null ||
author?.organization != "")
Text(
author?.organization ?? "",
style: const TextStyle(fontSize: 26),
),
if (author?.organization != null &&
author?.organization != "")
const SizedBox(height: 8),
if (author?.profileDescription != null &&
author?.profileDescription != "")
Text(
author?.profileDescription ?? "",
style: TextStyle(
color: Utils.getColorByBrightness(
context,
AppTheme.etsDarkGrey,
AppTheme.newsSecondaryColor),
fontSize: 16,
),
textAlign: TextAlign.center,
),
if (author?.profileDescription != null &&
author?.profileDescription != "")
const SizedBox(height: 8),
IconButton(
onPressed: () async {
await showModalBottomSheet(
isDismissible: true,
enableDrag: true,
isScrollControlled: true,
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(10)),
),
builder: (context) =>
SocialLinks(socialLinks: socialLinks),
);
},
icon: FaIcon(
FontAwesomeIcons.link,
color: Utils.getColorByBrightness(
context,
AppTheme.newsAccentColorLight,
AppTheme.newsAccentColorDark),
),
),
],
),
),
),
),
);
}
}