💄 Optimized featured post
This commit is contained in:
@@ -219,20 +219,20 @@ class AccountName extends StatelessWidget {
|
||||
if (account.automatedId != null)
|
||||
hideOverlay
|
||||
? Icon(
|
||||
Symbols.smart_toy,
|
||||
size: 16,
|
||||
color: nameStyle.color,
|
||||
fill: 1,
|
||||
)
|
||||
: Tooltip(
|
||||
message: 'accountAutomated'.tr(),
|
||||
child: Icon(
|
||||
Symbols.smart_toy,
|
||||
size: 16,
|
||||
color: nameStyle.color,
|
||||
fill: 1,
|
||||
)
|
||||
: Tooltip(
|
||||
message: 'accountAutomated'.tr(),
|
||||
child: Icon(
|
||||
Symbols.smart_toy,
|
||||
size: 16,
|
||||
color: nameStyle.color,
|
||||
fill: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -275,20 +275,20 @@ class AccountName extends StatelessWidget {
|
||||
if (account.automatedId != null)
|
||||
hideOverlay
|
||||
? Icon(
|
||||
Symbols.smart_toy,
|
||||
size: 16,
|
||||
color: nameStyle.color,
|
||||
fill: 1,
|
||||
)
|
||||
: Tooltip(
|
||||
message: 'accountAutomated'.tr(),
|
||||
child: Icon(
|
||||
Symbols.smart_toy,
|
||||
size: 16,
|
||||
color: nameStyle.color,
|
||||
fill: 1,
|
||||
)
|
||||
: Tooltip(
|
||||
message: 'accountAutomated'.tr(),
|
||||
child: Icon(
|
||||
Symbols.smart_toy,
|
||||
size: 16,
|
||||
color: nameStyle.color,
|
||||
fill: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -310,29 +310,28 @@ class VerificationMark extends StatelessWidget {
|
||||
? kVerificationMarkIcons[mark.type]
|
||||
: Symbols.verified,
|
||||
size: 16,
|
||||
color:
|
||||
(kVerificationMarkColors.length > mark.type && mark.type >= 0)
|
||||
? kVerificationMarkColors[mark.type]
|
||||
: Colors.blue,
|
||||
color: (kVerificationMarkColors.length > mark.type && mark.type >= 0)
|
||||
? kVerificationMarkColors[mark.type]
|
||||
: Colors.blue,
|
||||
fill: 1,
|
||||
);
|
||||
|
||||
return hideOverlay
|
||||
? icon
|
||||
: Tooltip(
|
||||
richMessage: TextSpan(
|
||||
text: mark.title ?? 'No title',
|
||||
children: [
|
||||
TextSpan(text: '\n'),
|
||||
TextSpan(
|
||||
text: mark.description ?? 'descriptionNone'.tr(),
|
||||
style: TextStyle(fontWeight: FontWeight.normal),
|
||||
),
|
||||
],
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
child: icon,
|
||||
);
|
||||
richMessage: TextSpan(
|
||||
text: mark.title ?? 'No title',
|
||||
children: [
|
||||
TextSpan(text: '\n'),
|
||||
TextSpan(
|
||||
text: mark.description ?? 'descriptionNone'.tr(),
|
||||
style: TextStyle(fontWeight: FontWeight.normal),
|
||||
),
|
||||
],
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
child: icon,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,19 +383,19 @@ class StellarMembershipMark extends StatelessWidget {
|
||||
return hideOverlay
|
||||
? icon
|
||||
: Tooltip(
|
||||
richMessage: TextSpan(
|
||||
text: 'stellarMembership'.tr(),
|
||||
children: [
|
||||
TextSpan(text: '\n'),
|
||||
TextSpan(
|
||||
text: 'currentMembershipMember'.tr(args: [tierName]),
|
||||
style: TextStyle(fontWeight: FontWeight.normal),
|
||||
),
|
||||
],
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
child: icon,
|
||||
);
|
||||
richMessage: TextSpan(
|
||||
text: 'stellarMembership'.tr(),
|
||||
children: [
|
||||
TextSpan(text: '\n'),
|
||||
TextSpan(
|
||||
text: 'currentMembershipMember'.tr(args: [tierName]),
|
||||
style: TextStyle(fontWeight: FontWeight.normal),
|
||||
),
|
||||
],
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
child: icon,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,10 +413,9 @@ class VerificationStatusCard extends StatelessWidget {
|
||||
? kVerificationMarkIcons[mark.type]
|
||||
: Symbols.verified,
|
||||
size: 32,
|
||||
color:
|
||||
(kVerificationMarkColors.length > mark.type && mark.type >= 0)
|
||||
? kVerificationMarkColors[mark.type]
|
||||
: Colors.blue,
|
||||
color: (kVerificationMarkColors.length > mark.type && mark.type >= 0)
|
||||
? kVerificationMarkColors[mark.type]
|
||||
: Colors.blue,
|
||||
fill: 1,
|
||||
).alignment(Alignment.centerLeft),
|
||||
const Gap(8),
|
||||
|
||||
@@ -21,7 +21,8 @@ Future<List<SnPost>> featuredPosts(Ref ref) async {
|
||||
}
|
||||
|
||||
class PostFeaturedList extends HookConsumerWidget {
|
||||
const PostFeaturedList({super.key});
|
||||
final bool collapsable;
|
||||
const PostFeaturedList({super.key, this.collapsable = true});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@@ -86,6 +87,7 @@ class PostFeaturedList extends HookConsumerWidget {
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
margin: EdgeInsets.zero,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 48,
|
||||
@@ -121,36 +123,37 @@ class PostFeaturedList extends HookConsumerWidget {
|
||||
},
|
||||
icon: const Icon(Symbols.arrow_right),
|
||||
),
|
||||
IconButton(
|
||||
padding: EdgeInsets.zero,
|
||||
visualDensity: VisualDensity.compact,
|
||||
constraints: const BoxConstraints(),
|
||||
onPressed: () {
|
||||
isCollapsed.value = !isCollapsed.value;
|
||||
talker.info(
|
||||
'Manual toggle. isCollapsed set to ${isCollapsed.value}',
|
||||
);
|
||||
if (isCollapsed.value &&
|
||||
featuredPostsAsync.hasValue &&
|
||||
featuredPostsAsync.value!.isNotEmpty) {
|
||||
prefs.setString(
|
||||
kFeaturedPostsCollapsedId,
|
||||
featuredPostsAsync.value!.first.id,
|
||||
);
|
||||
if (collapsable)
|
||||
IconButton(
|
||||
padding: EdgeInsets.zero,
|
||||
visualDensity: VisualDensity.compact,
|
||||
constraints: const BoxConstraints(),
|
||||
onPressed: () {
|
||||
isCollapsed.value = !isCollapsed.value;
|
||||
talker.info(
|
||||
'Stored collapsed ID: ${featuredPostsAsync.value!.first.id}',
|
||||
'Manual toggle. isCollapsed set to ${isCollapsed.value}',
|
||||
);
|
||||
} else {
|
||||
prefs.remove(kFeaturedPostsCollapsedId);
|
||||
talker.info('Removed stored collapsed ID.');
|
||||
}
|
||||
},
|
||||
icon: Icon(
|
||||
isCollapsed.value
|
||||
? Symbols.expand_more
|
||||
: Symbols.expand_less,
|
||||
if (isCollapsed.value &&
|
||||
featuredPostsAsync.hasValue &&
|
||||
featuredPostsAsync.value!.isNotEmpty) {
|
||||
prefs.setString(
|
||||
kFeaturedPostsCollapsedId,
|
||||
featuredPostsAsync.value!.first.id,
|
||||
);
|
||||
talker.info(
|
||||
'Stored collapsed ID: ${featuredPostsAsync.value!.first.id}',
|
||||
);
|
||||
} else {
|
||||
prefs.remove(kFeaturedPostsCollapsedId);
|
||||
talker.info('Removed stored collapsed ID.');
|
||||
}
|
||||
},
|
||||
icon: Icon(
|
||||
isCollapsed.value
|
||||
? Symbols.expand_more
|
||||
: Symbols.expand_less,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
).padding(horizontal: 16, vertical: 8),
|
||||
),
|
||||
@@ -158,14 +161,14 @@ class PostFeaturedList extends HookConsumerWidget {
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
child: Visibility(
|
||||
visible: !isCollapsed.value,
|
||||
visible: collapsable ? !isCollapsed.value : true,
|
||||
child: featuredPostsAsync.when(
|
||||
loading:
|
||||
() => const Center(child: CircularProgressIndicator()),
|
||||
loading: () =>
|
||||
const Center(child: CircularProgressIndicator()),
|
||||
error: (error, stack) => Center(child: Text('Error: $error')),
|
||||
data: (posts) {
|
||||
return SizedBox(
|
||||
height: 320,
|
||||
height: 344,
|
||||
child: PageView.builder(
|
||||
controller: pageViewController,
|
||||
scrollDirection: Axis.horizontal,
|
||||
|
||||
Reference in New Issue
Block a user