use new buttons
Some checks failed
Flutter analyze & test / flutter_analyze_and_test (push) Has been cancelled

This commit is contained in:
otsmr 2026-07-30 11:59:13 +02:00
parent 753500ebfa
commit 60c553e53c
8 changed files with 119 additions and 69 deletions

View file

@ -3434,6 +3434,12 @@ abstract class AppLocalizations {
/// **'Zero ads. Total privacy.'** /// **'Zero ads. Total privacy.'**
String get subscriptionPledgeSubtitle; String get subscriptionPledgeSubtitle;
/// No description provided for @subscriptionManage.
///
/// In en, this message translates to:
/// **'Manage subscription'**
String get subscriptionManage;
/// No description provided for @dragToZoom. /// No description provided for @dragToZoom.
/// ///
/// In en, this message translates to: /// In en, this message translates to:

View file

@ -1980,6 +1980,9 @@ class AppLocalizationsDe extends AppLocalizations {
@override @override
String get subscriptionPledgeSubtitle => 'Keine Werbung. Volle Privatsphäre.'; String get subscriptionPledgeSubtitle => 'Keine Werbung. Volle Privatsphäre.';
@override
String get subscriptionManage => 'Abonnement verwalten';
@override @override
String get dragToZoom => 'Zum Zoomen ziehen'; String get dragToZoom => 'Zum Zoomen ziehen';

View file

@ -1965,6 +1965,9 @@ class AppLocalizationsEn extends AppLocalizations {
@override @override
String get subscriptionPledgeSubtitle => 'Zero ads. Total privacy.'; String get subscriptionPledgeSubtitle => 'Zero ads. Total privacy.';
@override
String get subscriptionManage => 'Manage subscription';
@override @override
String get dragToZoom => 'Drag to Zoom'; String get dragToZoom => 'Drag to Zoom';

@ -1 +1 @@
Subproject commit 659bfb084ea26d5471dea6c6d8e1c950c95ecea2 Subproject commit 2f37f6cd8ebd07dbc113bab0d5816bd37fb4fca6

View file

@ -13,6 +13,7 @@ import 'package:twonly/src/services/subscription.service.dart';
import 'package:twonly/src/utils/misc.dart'; import 'package:twonly/src/utils/misc.dart';
import 'package:twonly/src/visual/components/alert.dialog.dart'; import 'package:twonly/src/visual/components/alert.dialog.dart';
import 'package:twonly/src/visual/components/snackbar.dart'; import 'package:twonly/src/visual/components/snackbar.dart';
import 'package:twonly/src/visual/elements/my_button.element.dart';
import 'package:twonly/src/visual/views/settings/subscription/select_additional_users.view.dart'; import 'package:twonly/src/visual/views/settings/subscription/select_additional_users.view.dart';
class AdditionalUsersView extends StatefulWidget { class AdditionalUsersView extends StatefulWidget {
@ -57,16 +58,18 @@ class _AdditionalUsersViewState extends State<AdditionalUsersView> {
} }
Future<void> addAdditionalUser() async { Future<void> addAdditionalUser() async {
final selectedUserIds = await context.navPush( final selectedUserIds =
SelectAdditionalUsers( await context.navPush(
limit: _planLimit, SelectAdditionalUsers(
alreadySelected: limit: _planLimit,
ballance?.additionalAccounts alreadySelected:
.map((e) => e.userId.toInt()) ballance?.additionalAccounts
.toList() ?? .map((e) => e.userId.toInt())
[], .toList() ??
), [],
) as List<int>?; ),
)
as List<int>?;
if (selectedUserIds == null) return; if (selectedUserIds == null) return;
for (final selectedUserId in selectedUserIds) { for (final selectedUserId in selectedUserIds) {
final res = await apiService.addAdditionalUser(Int64(selectedUserId)); final res = await apiService.addAdditionalUser(Int64(selectedUserId));
@ -110,7 +113,8 @@ class _AdditionalUsersViewState extends State<AdditionalUsersView> {
Center( Center(
child: Padding( child: Padding(
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
child: FilledButton( child: MyButton(
variant: MyButtonVariant.primaryMiddle,
onPressed: addAdditionalUser, onPressed: addAdditionalUser,
child: Text( child: Text(
context.lang.additionalUserAddButton( context.lang.additionalUserAddButton(

View file

@ -14,6 +14,7 @@ import 'package:twonly/src/visual/components/flame_counter.comp.dart';
import 'package:twonly/src/visual/context_menu/user.context_menu.dart'; import 'package:twonly/src/visual/context_menu/user.context_menu.dart';
import 'package:twonly/src/visual/decorations/input_text.decoration.dart'; import 'package:twonly/src/visual/decorations/input_text.decoration.dart';
import 'package:twonly/src/visual/elements/contact_chip.element.dart'; import 'package:twonly/src/visual/elements/contact_chip.element.dart';
import 'package:twonly/src/visual/elements/my_button.element.dart';
class SelectAdditionalUsers extends StatefulWidget { class SelectAdditionalUsers extends StatefulWidget {
const SelectAdditionalUsers({ const SelectAdditionalUsers({
@ -101,17 +102,24 @@ class _SelectAdditionalUsers extends State<SelectAdditionalUsers> {
title: Text(context.lang.additionalUserSelectTitle), title: Text(context.lang.additionalUserSelectTitle),
), ),
floatingActionButtonAnimator: FloatingActionButtonAnimator.noAnimation, floatingActionButtonAnimator: FloatingActionButtonAnimator.noAnimation,
floatingActionButton: FilledButton.icon( floatingActionButton: MyButton(
variant: MyButtonVariant.primaryMiddle,
onPressed: selectedUsers.isEmpty onPressed: selectedUsers.isEmpty
? null ? null
: () => Navigator.pop(context, selectedUsers.toList()), : () => Navigator.pop(context, selectedUsers.toList()),
label: Text( child: Row(
context.lang.additionalUserSelectButton( mainAxisSize: MainAxisSize.min,
widget.limit, children: [
selectedUsers.length + widget.alreadySelected.length, const FaIcon(FontAwesomeIcons.userPlus, size: 16),
), const SizedBox(width: 8),
Text(
context.lang.additionalUserSelectButton(
widget.limit,
selectedUsers.length + widget.alreadySelected.length,
),
),
],
), ),
icon: const FaIcon(FontAwesomeIcons.userPlus),
), ),
body: SafeArea( body: SafeArea(
child: Padding( child: Padding(

View file

@ -11,6 +11,7 @@ import 'package:twonly/src/providers/purchases.provider.dart';
import 'package:twonly/src/services/subscription.service.dart'; import 'package:twonly/src/services/subscription.service.dart';
import 'package:twonly/src/utils/misc.dart'; import 'package:twonly/src/utils/misc.dart';
import 'package:twonly/src/visual/elements/better_list_title.element.dart'; import 'package:twonly/src/visual/elements/better_list_title.element.dart';
import 'package:twonly/src/visual/elements/my_button.element.dart';
import 'package:twonly/src/visual/views/settings/subscription/additional_users.view.dart'; import 'package:twonly/src/visual/views/settings/subscription/additional_users.view.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@ -141,6 +142,23 @@ class _SubscriptionViewState extends State<SubscriptionView> {
), ),
], ],
const SizedBox(height: 30), const SizedBox(height: 30),
if (isPayingUser(currentPlan) ||
currentPlan == SubscriptionPlan.Tester) ...[
BetterListTile(
icon: FontAwesomeIcons.userPlus,
text: context.lang.manageAdditionalUsers,
subtitle: loaded ? Text('${context.lang.open}: 3') : null,
onTap: () async {
await context.navPush(
AdditionalUsersView(
ballance: ballance,
),
);
await initAsync();
},
),
const Divider(),
],
BetterListTile( BetterListTile(
icon: FontAwesomeIcons.fileContract, icon: FontAwesomeIcons.fileContract,
text: context.lang.termsOfService, text: context.lang.termsOfService,
@ -172,24 +190,6 @@ class _SubscriptionViewState extends State<SubscriptionView> {
); );
}, },
), ),
if (isPayingUser(currentPlan) ||
currentPlan == SubscriptionPlan.Tester)
const Divider(),
if (isPayingUser(currentPlan) ||
currentPlan == SubscriptionPlan.Tester)
BetterListTile(
icon: FontAwesomeIcons.userPlus,
text: context.lang.manageAdditionalUsers,
subtitle: loaded ? Text('${context.lang.open}: 3') : null,
onTap: () async {
await context.navPush(
AdditionalUsersView(
ballance: ballance,
),
);
await initAsync();
},
),
], ],
), ),
); );
@ -310,8 +310,10 @@ class _PlanCardState extends State<PlanCard> {
), ),
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
if (currentPlan == widget.plan) if (currentPlan == widget.plan &&
FilledButton.icon( widget.plan != SubscriptionPlan.Tester)
MyButton(
variant: MyButtonVariant.primaryMiddle,
onPressed: () async { onPressed: () async {
var url = 'https://apps.apple.com/account/subscriptions'; var url = 'https://apps.apple.com/account/subscriptions';
if (Platform.isAndroid) { if (Platform.isAndroid) {
@ -323,53 +325,77 @@ class _PlanCardState extends State<PlanCard> {
mode: LaunchMode.externalApplication, mode: LaunchMode.externalApplication,
); );
}, },
label: const Text('Manage subscription'), child: Text(context.lang.subscriptionManage),
), ),
if (widget.onPurchase != null && if (widget.onPurchase != null &&
monthlyProduct != null && monthlyProduct != null &&
!isPayingUser(currentPlan)) !isPayingUser(currentPlan)) ...[
OutlinedButton.icon( const SizedBox(height: 8),
MyButton(
variant: MyButtonVariant.primaryMiddle,
onPressed: _isLoading != null onPressed: _isLoading != null
? null ? null
: () => onButtonPressed(monthlyProduct), : () => onButtonPressed(monthlyProduct),
icon: _isLoading == monthlyProduct child: Row(
? const SizedBox( mainAxisSize: MainAxisSize.min,
width: 10, children: [
height: 10, if (_isLoading == monthlyProduct) ...[
const SizedBox(
width: 14,
height: 14,
child: CircularProgressIndicator.adaptive( child: CircularProgressIndicator.adaptive(
strokeWidth: 1, strokeWidth: 2,
), ),
) ),
: null, const SizedBox(width: 8),
label: Text( ],
context.lang.upgradeToPaidPlanButton( Flexible(
widget.plan.name, child: Text(
' (${getFormattedPrice(monthlyProduct)}/${context.lang.month})', context.lang.upgradeToPaidPlanButton(
), widget.plan.name,
' (${getFormattedPrice(monthlyProduct)}/${context.lang.month})',
),
textAlign: TextAlign.center,
),
),
],
), ),
), ),
],
if (widget.onPurchase != null && if (widget.onPurchase != null &&
(yearlyProduct != null && !isPayingUser(currentPlan))) (yearlyProduct != null && !isPayingUser(currentPlan))) ...[
FilledButton.icon( const SizedBox(height: 8),
MyButton(
variant: MyButtonVariant.primaryMiddle,
onPressed: _isLoading != null onPressed: _isLoading != null
? null ? null
: () => onButtonPressed(yearlyProduct), : () => onButtonPressed(yearlyProduct),
icon: _isLoading == yearlyProduct child: Row(
? const SizedBox( mainAxisSize: MainAxisSize.min,
width: 10, children: [
height: 10, if (_isLoading == yearlyProduct) ...[
const SizedBox(
width: 14,
height: 14,
child: CircularProgressIndicator.adaptive( child: CircularProgressIndicator.adaptive(
strokeWidth: 1, strokeWidth: 2,
), ),
) ),
: null, const SizedBox(width: 8),
label: Text( ],
context.lang.upgradeToPaidPlanButton( Flexible(
widget.plan.name, child: Text(
' (${getFormattedPrice(yearlyProduct)}/${context.lang.year})', context.lang.upgradeToPaidPlanButton(
), widget.plan.name,
' (${getFormattedPrice(yearlyProduct)}/${context.lang.year})',
),
textAlign: TextAlign.center,
),
),
],
), ),
), ),
],
], ],
), ),
), ),

View file

@ -3,7 +3,7 @@ description: "twonly, a privacy-friendly way to connect with friends through sec
publish_to: 'none' publish_to: 'none'
version: 0.4.3+163 version: 0.4.3+164
environment: environment:
sdk: ^3.11.0 sdk: ^3.11.0