Compare commits

..

4 Commits

Author SHA1 Message Date
13ea182707 💄 Localized about page 2025-07-02 22:59:28 +08:00
14183a7316 💄 Colorful name for subscribed users 2025-07-02 22:24:56 +08:00
9fc9b87608 💄 Optimized leveling page 2025-07-02 22:17:25 +08:00
53c2445ba9 🐛 Remove extra items inside settings 2025-07-02 21:47:26 +08:00
9 changed files with 667 additions and 671 deletions

View File

@ -46,7 +46,7 @@
"delete": "Delete",
"deletePublisher": "Delete Publisher",
"deletePublisherHint": "Are you sure to delete this publisher? This will also deleted all the post and collections under this publisher.",
"somethingWentWrong": "Something went wrong...",
"somethingWentWrong": "Something went wrong",
"deletePost": "Delete Post",
"safetyReport": "Report",
"safetyReportTitle": "Safety Report",
@ -538,29 +538,19 @@
"paymentError": "Payment failed: {error}",
"usePinInstead": "Use PIN Code",
"levelProgress": "Level Progress",
"unlockedFeatures": "Unlocked Features",
"unlockedFeaturesDescription": "Features unlocked at your current level will be displayed here.",
"stellarMembership": "Stellar Membership",
"upgradeYourPlan": "Upgrade Your Plan",
"chooseYourPlan": "Choose Your Plan",
"currentMembership": "Current: {}",
"currentMembershipMember": "A member of Stellar Program · {}",
"membershipExpires": "Expires: {}",
"membershipTierStellar": "Stellar",
"membershipTierNova": "Nova",
"membershipTierSupernova": "Supernova",
"membershipTierUnknown": "Unknown",
"membershipPriceStellar": "10 NS$ per month",
"membershipPriceNova": "20 NS$ per month",
"membershipPriceSupernova": "30 NS$ per month",
"membershipFeatureBasic": "Basic features",
"membershipFeaturePrioritySupport": "Priority support",
"membershipFeatureAdFree": "Ad-free experience",
"membershipFeatureAllPrimary": "All Primary features",
"membershipFeatureAdvancedCustomization": "Advanced customization",
"membershipFeatureEarlyAccess": "Early access",
"membershipFeatureAllNova": "All Nova features",
"membershipFeatureExclusiveContent": "Exclusive content",
"membershipFeatureVipSupport": "VIP support",
"membershipPriceStellar": "1200 NSP per month, level 3+ required",
"membershipPriceNova": "2400 NSP per month, level 6+ required",
"membershipPriceSupernova": "3600 NSP per month, level 9+ required",
"membershipCurrentBadge": "CURRENT",
"restorePurchase": "Restore Purchase",
"restorePurchaseDescription": "Enter your payment provider and order ID to restore your purchase.",
@ -597,7 +587,7 @@
"no": "No",
"yes": "Yes",
"navigateToChat": "Navigate to Chat",
"wouldYouLikeToNavigateToChat": "Would you like to navigate to the chat?",
"wouldYouLikeToNavigateToChat": "Would You like to navigate to the chat?",
"abuseReport": "Report",
"abuseReportTitle": "Report Content",
"abuseReportDescription": "Help us keep the community safe by reporting inappropriate content or behavior.",
@ -678,5 +668,27 @@
"learnMore": "Learn More",
"discoverWebArticles": "Articles from external sites",
"webArticlesStand": "Article Stand",
"about": "About"
"about": "About",
"membershipCancel": "Cancel Membership",
"membershipCancelConfirm": "Are you sure to cancel your membership?",
"membershipCancelHint": "Are you sure to cancel your membership? You will not be charged again. Your membership will remain active until the end of the current billing period. And you will not able to resubscribe until the end of the current subscription ends.",
"membershipCancelSuccess": "Your membership has been successfully canceled.",
"aboutScreenTitle": "About",
"aboutScreenVersionInfo": "Version {} ({})",
"aboutScreenAppInfoSectionTitle": "App Information",
"aboutScreenPackageNameLabel": "Package Name",
"aboutScreenVersionLabel": "Version",
"aboutScreenBuildNumberLabel": "Build Number",
"aboutScreenLinksSectionTitle": "Links",
"aboutScreenPrivacyPolicyTitle": "Privacy Policy",
"aboutScreenTermsOfServiceTitle": "Terms of Service",
"aboutScreenOpenSourceLicensesTitle": "Open Source Licenses",
"aboutScreenDeveloperSectionTitle": "Developer",
"aboutScreenContactUsTitle": "Contact Us",
"aboutScreenLicenseTitle": "License",
"aboutScreenLicenseContent": "All copyright reserved © {} Solsynth\nOpen-sourced under license GNU AGPL v3.0",
"aboutScreenCopyright": "© {} {}. All rights reserved.",
"aboutScreenFailedToLoadPackageInfo": "Failed to load package info: {error}",
"copiedToClipboard": "Copied to clipboard",
"copyToClipboardTooltip": "Copy to clipboard"
}

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:styled_widget/styled_widget.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:easy_localization/easy_localization.dart';
class AboutScreen extends StatefulWidget {
const AboutScreen({super.key});
@ -12,8 +14,8 @@ class AboutScreen extends StatefulWidget {
class _AboutScreenState extends State<AboutScreen> {
PackageInfo _packageInfo = PackageInfo(
appName: 'Island',
packageName: 'com.example.island',
appName: 'Solian',
packageName: 'dev.solsynth.solian',
version: '1.0.0',
buildNumber: '1',
);
@ -38,7 +40,9 @@ class _AboutScreenState extends State<AboutScreen> {
} catch (e) {
if (mounted) {
setState(() {
_errorMessage = 'Failed to load package info: $e';
_errorMessage = 'aboutScreenFailedToLoadPackageInfo'.tr(
args: [e.toString()],
);
_isLoading = false;
});
}
@ -57,7 +61,7 @@ class _AboutScreenState extends State<AboutScreen> {
final theme = Theme.of(context);
return Scaffold(
appBar: AppBar(title: const Text('About'), elevation: 0),
appBar: AppBar(title: Text('about'.tr()), elevation: 0),
body:
_isLoading
? const Center(child: CircularProgressIndicator())
@ -88,7 +92,9 @@ class _AboutScreenState extends State<AboutScreen> {
),
),
Text(
'Version ${_packageInfo.version} (${_packageInfo.buildNumber})',
'aboutScreenVersionInfo'.tr(
args: [_packageInfo.version, _packageInfo.buildNumber],
),
style: theme.textTheme.bodyMedium?.copyWith(
color: theme.textTheme.bodySmall?.color,
),
@ -98,24 +104,24 @@ class _AboutScreenState extends State<AboutScreen> {
// App Info Card
_buildSection(
context,
title: 'App Information',
title: 'aboutScreenAppInfoSectionTitle'.tr(),
children: [
_buildInfoItem(
context,
icon: Icons.info_outline,
label: 'Package Name',
label: 'aboutScreenPackageNameLabel'.tr(),
value: _packageInfo.packageName,
),
_buildInfoItem(
context,
icon: Icons.update,
label: 'Version',
label: 'aboutScreenVersionLabel'.tr(),
value: _packageInfo.version,
),
_buildInfoItem(
context,
icon: Icons.build,
label: 'Build Number',
label: 'aboutScreenBuildNumberLabel'.tr(),
value: _packageInfo.buildNumber,
),
],
@ -126,12 +132,12 @@ class _AboutScreenState extends State<AboutScreen> {
// Links Card
_buildSection(
context,
title: 'Links',
title: 'aboutScreenLinksSectionTitle'.tr(),
children: [
_buildListTile(
context,
icon: Icons.privacy_tip_outlined,
title: 'Privacy Policy',
title: 'aboutScreenPrivacyPolicyTitle'.tr(),
onTap:
() => _launchURL(
'https://solsynth.dev/terms/privacy-policy',
@ -140,16 +146,16 @@ class _AboutScreenState extends State<AboutScreen> {
_buildListTile(
context,
icon: Icons.description_outlined,
title: 'Terms of Service',
title: 'aboutScreenTermsOfServiceTitle'.tr(),
onTap:
() => _launchURL(
'https://example.com/terms/basic-law',
'https://solsynth.dev/terms/basic-law',
),
),
_buildListTile(
context,
icon: Icons.code,
title: 'Open Source Licenses',
title: 'aboutScreenOpenSourceLicensesTitle'.tr(),
onTap: () {
showLicensePage(
context: context,
@ -167,21 +173,22 @@ class _AboutScreenState extends State<AboutScreen> {
// Developer Info
_buildSection(
context,
title: 'Developer',
title: 'aboutScreenDeveloperSectionTitle'.tr(),
children: [
_buildListTile(
context,
icon: Icons.email_outlined,
title: 'Contact Us',
title: 'aboutScreenContactUsTitle'.tr(),
subtitle: 'lily@solsynth.dev',
onTap: () => _launchURL('mailto:lily@solsynth.dev'),
),
_buildListTile(
context,
icon: Icons.copyright,
title: 'License',
subtitle:
'Copyright reserved © ${DateTime.now().year} Solsynth\nGNU Affero General Public License v3.0',
title: 'aboutScreenLicenseTitle'.tr(),
subtitle: 'aboutScreenLicenseContent'.tr(
args: [DateTime.now().year.toString()],
),
onTap:
() => _launchURL(
'https://github.com/Solsynth/Solian/blob/v3/LICENSE.txt',
@ -196,7 +203,9 @@ class _AboutScreenState extends State<AboutScreen> {
Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
'© ${DateTime.now().year} ${_packageInfo.appName}. All rights reserved.',
'aboutScreenCopyright'.tr(
args: [DateTime.now().year.toString(), "Solsynth"],
),
style: theme.textTheme.bodySmall,
textAlign: TextAlign.center,
),
@ -264,12 +273,12 @@ class _AboutScreenState extends State<AboutScreen> {
onPressed: () {
Clipboard.setData(ClipboardData(text: value));
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Copied to clipboard')),
SnackBar(content: Text('copiedToClipboard'.tr())),
);
},
padding: EdgeInsets.zero,
constraints: const BoxConstraints(),
tooltip: 'Copy to clipboard',
tooltip: 'copyToClipboardTooltip'.tr(),
),
],
),
@ -283,13 +292,18 @@ class _AboutScreenState extends State<AboutScreen> {
String? subtitle,
required VoidCallback onTap,
}) {
final multipleLines = subtitle?.contains('\n') ?? false;
return Column(
children: [
ListTile(
leading: Icon(icon),
leading: Icon(icon).padding(top: multipleLines ? 8 : 0),
title: Text(title),
subtitle: subtitle != null ? Text(subtitle) : null,
trailing: const Icon(Icons.chevron_right),
isThreeLine: multipleLines,
trailing: const Icon(
Icons.chevron_right,
).padding(top: multipleLines ? 8 : 0),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
onTap: onTap,
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
minLeadingWidth: 24,

View File

@ -1,4 +1,7 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:google_fonts/google_fonts.dart';
@ -14,7 +17,9 @@ import 'package:island/widgets/alert.dart';
import 'package:island/widgets/app_scaffold.dart';
import 'package:island/widgets/payment/payment_overlay.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:material_symbols_icons/symbols.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:styled_widget/styled_widget.dart';
part 'leveling.g.dart';
@ -84,35 +89,6 @@ class LevelingScreen extends HookConsumerWidget {
// Membership section
_buildMembershipSection(context, ref, stellarSubscription),
const Gap(16),
// Unlocked features section
Container(
width: double.infinity,
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(12),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'unlockedFeatures'.tr(),
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
const Gap(8),
Text(
'unlockedFeaturesDescription'.tr(),
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
],
),
),
],
),
),
@ -292,6 +268,31 @@ class LevelingScreen extends HookConsumerWidget {
) {
final isActive = membership?.isActive ?? false;
Future<void> membershipCancel() async {
if (!isActive || membership == null) return;
final confirm = await showConfirmAlert(
'membershipCancelHint'.tr(),
'membershipCancelConfirm'.tr(),
);
if (!confirm || !context.mounted) return;
try {
showLoadingModal(context);
final client = ref.watch(apiClientProvider);
await client.post('/subscriptions/${membership.identifier}/cancel');
ref.invalidate(accountStellarSubscriptionProvider);
ref.read(userInfoProvider.notifier).fetchUser();
if (context.mounted) {
hideLoadingModal(context);
showSnackBar('membershipCancelSuccess'.tr());
}
} catch (err) {
if (context.mounted) hideLoadingModal(context);
showErrorAlert(err);
}
}
return Container(
width: double.infinity,
padding: const EdgeInsets.all(16),
@ -307,7 +308,7 @@ class LevelingScreen extends HookConsumerWidget {
borderRadius: BorderRadius.circular(12),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
children: [
@ -327,27 +328,42 @@ class LevelingScreen extends HookConsumerWidget {
if (isActive) ...[
_buildCurrentMembershipCard(context, membership!),
const Gap(16),
const Gap(12),
FilledButton.icon(
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all(
Theme.of(context).colorScheme.error,
),
foregroundColor: WidgetStateProperty.all(
Theme.of(context).colorScheme.onError,
),
),
onPressed: membershipCancel,
icon: const Icon(Symbols.cancel),
label: Text('membershipCancel'.tr()),
),
],
Text(
isActive ? 'upgradeYourPlan'.tr() : 'chooseYourPlan'.tr(),
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
),
const Gap(12),
_buildMembershipTiers(context, ref, membership),
const Gap(12),
if (!isActive) ...[
Text(
'chooseYourPlan'.tr(),
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
),
const Gap(12),
_buildMembershipTiers(context, ref, membership),
],
// Restore Purchase Button
OutlinedButton.icon(
onPressed: () => _showRestorePurchaseSheet(context, ref),
icon: const Icon(Icons.restore),
label: Text('restorePurchase'.tr()),
style: OutlinedButton.styleFrom(
minimumSize: const Size(double.infinity, 48),
),
),
// As you know Apple platform need IAP
if (kIsWeb || !(Platform.isIOS || Platform.isMacOS))
OutlinedButton.icon(
onPressed: () => _showRestorePurchaseSheet(context, ref),
icon: const Icon(Icons.restore),
label: Text('restorePurchase'.tr()),
style: OutlinedButton.styleFrom(
minimumSize: const Size(double.infinity, 48),
),
).padding(top: 12),
],
),
);
@ -410,33 +426,18 @@ class LevelingScreen extends HookConsumerWidget {
'id': 'solian.stellar.primary',
'name': 'membershipTierStellar'.tr(),
'price': 'membershipPriceStellar'.tr(),
'features': [
'membershipFeatureBasic'.tr(),
'membershipFeaturePrioritySupport'.tr(),
'membershipFeatureAdFree'.tr(),
],
'color': Colors.blue,
},
{
'id': 'solian.stellar.nova',
'name': 'membershipTierNova'.tr(),
'price': 'membershipPriceNova'.tr(),
'features': [
'membershipFeatureAllPrimary'.tr(),
'membershipFeatureAdvancedCustomization'.tr(),
'membershipFeatureEarlyAccess'.tr(),
],
'color': Colors.purple,
'color': Colors.indigo,
},
{
'id': 'solian.stellar.supernova',
'name': 'membershipTierSupernova'.tr(),
'price': 'membershipPriceSupernova'.tr(),
'features': [
'membershipFeatureAllNova'.tr(),
'membershipFeatureExclusiveContent'.tr(),
'membershipFeatureVipSupport'.tr(),
],
'color': Colors.orange,
},
];

View File

@ -9,7 +9,6 @@ import 'package:island/widgets/app_scaffold.dart';
import 'package:island/widgets/post/post_item.dart';
import 'package:island/widgets/post/post_quick_reply.dart';
import 'package:island/widgets/post/post_replies.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:styled_widget/styled_widget.dart';

View File

@ -341,26 +341,6 @@ class SettingsScreen extends HookConsumerWidget {
];
final behaviorSettings = [
ListTile(
minLeadingWidth: 48,
title: Text('creatorHub').tr(),
contentPadding: const EdgeInsets.only(left: 24, right: 17),
leading: const Icon(Symbols.rocket_launch),
trailing: const Icon(Symbols.chevron_right),
onTap: () => context.push('/creators'),
),
// Developer Hub
ListTile(
minLeadingWidth: 48,
title: Text('developerHub').tr(),
contentPadding: const EdgeInsets.only(left: 24, right: 17),
leading: const Icon(Symbols.hub),
trailing: const Icon(Symbols.chevron_right),
onTap: () => context.push('/developers'),
),
// Auto translate settings
ListTile(
minLeadingWidth: 48,
title: Text('settingsAutoTranslate').tr(),

View File

@ -21,11 +21,23 @@ class AccountName extends StatelessWidget {
@override
Widget build(BuildContext context) {
var nameStyle = (style ?? TextStyle());
if (account.profile.stellarMembership != null) {
nameStyle = nameStyle.copyWith(
color: (switch (account.profile.stellarMembership!.identifier) {
'solian.stellar.primary' => Colors.blueAccent,
'solian.stellar.nova' => Colors.indigoAccent,
'solian.stellar.supernova' => Colors.amberAccent,
_ => null,
}),
);
}
return Row(
mainAxisSize: MainAxisSize.min,
spacing: 4,
children: [
Flexible(child: Text(account.nick, style: style)),
Flexible(child: Text(account.nick, style: nameStyle)),
if (account.profile.stellarMembership != null)
StellarMembershipMark(membership: account.profile.stellarMembership!),
if (account.profile.verification != null)
@ -87,36 +99,23 @@ class StellarMembershipMark extends StatelessWidget {
Color _getMembershipTierColor(String identifier) {
switch (identifier) {
case 'solian.stellar.primary':
return Colors.amber;
case 'solian.stellar.nova':
return Colors.blue;
case 'solian.stellar.nova':
return Colors.indigo;
case 'solian.stellar.supernova':
return Colors.purple;
return Colors.amber;
default:
return Colors.grey;
}
}
IconData _getMembershipTierIcon(String identifier) {
switch (identifier) {
case 'solian.stellar.primary':
return Symbols.star;
case 'solian.stellar.nova':
return Symbols.auto_awesome;
case 'solian.stellar.supernova':
return Symbols.diamond;
default:
return Symbols.workspace_premium;
}
}
@override
Widget build(BuildContext context) {
if (!membership.isActive) return const SizedBox.shrink();
final tierName = _getMembershipTierName(membership.identifier);
final tierColor = _getMembershipTierColor(membership.identifier);
final tierIcon = _getMembershipTierIcon(membership.identifier);
final tierIcon = Symbols.award_star;
return Tooltip(
richMessage: TextSpan(
@ -124,7 +123,7 @@ class StellarMembershipMark extends StatelessWidget {
children: [
TextSpan(text: '\n'),
TextSpan(
text: 'currentMembership'.tr(args: [tierName]),
text: 'currentMembershipMember'.tr(args: [tierName]),
style: TextStyle(fontWeight: FontWeight.normal),
),
],

View File

@ -244,7 +244,7 @@ class CloudFileZoomIn extends HookConsumerWidget {
);
}
String _formatFileSize(int bytes) {
String formatFileSize(int bytes) {
if (bytes <= 0) return '0 B';
if (bytes < 1024) return '$bytes B';
if (bytes < 1024 * 1024) return '${(bytes / 1024).toStringAsFixed(2)} KB';
@ -274,7 +274,7 @@ class CloudFileZoomIn extends HookConsumerWidget {
buildInfoRow(
Icons.storage,
'Size',
_formatFileSize(item.size),
formatFileSize(item.size),
),
const Divider(height: 1),
buildInfoRow(

View File

@ -286,7 +286,7 @@ class _PaymentContentState extends ConsumerState<_PaymentContent> {
}
String _formatCurrency(int amount, String currency) {
final value = amount / 100.0;
final value = amount;
return '${value.toStringAsFixed(2)} $currency';
}