From 4a7a3e4f4d652577f0abaaa51385d8d29b52310c Mon Sep 17 00:00:00 2001 From: ashuntu Date: Tue, 17 Dec 2024 15:21:23 -0600 Subject: [PATCH 1/6] Reorganize subscription status page Adjusts copy, adds text links to the bottom of the page, and aligns the design across all types of subscription management --- gui/packages/ubuntupro/lib/l10n/app_en.arb | 15 +--- .../subscription_status_page.dart | 22 +++--- .../subscription_status_widgets.dart | 44 ++++-------- .../lib/pages/widgets/page_widgets.dart | 70 +++++++++++++++++++ 4 files changed, 100 insertions(+), 51 deletions(-) diff --git a/gui/packages/ubuntupro/lib/l10n/app_en.arb b/gui/packages/ubuntupro/lib/l10n/app_en.arb index 2487aad19..8dac44247 100644 --- a/gui/packages/ubuntupro/lib/l10n/app_en.arb +++ b/gui/packages/ubuntupro/lib/l10n/app_en.arb @@ -43,18 +43,9 @@ "getUbuntuPro": "Get Ubuntu Pro", "learnMore": "Learn more", - "subscriptionIsActive": "Your subscription is active!", - "storeManaged": "This subscription is managed through Microsoft Store.", - "manageSubscription": "Manage your subscription", - "orgManaged": "This subscription is owned and managed by your organization.", - "manuallyManaged": "Visit {proDashboardLink} to manage your subscription.", - "@manuallyManaged": { - "placeholders": { - "proDashboardLink": { - "type": "String" - } - } - }, + "ubuntuProEnabled": "Ubuntu Pro is enabled on this machine.", + "ubuntuProEnabledInfo": "All Ubuntu WSL instances have access to Ubuntu Pro security features.", + "ubuntuProManage": "Manage Ubuntu Pro subscription", "detachPro": "Detach Ubuntu Pro", "updatingSubscriptionInfo": "Updating the subscription information.", diff --git a/gui/packages/ubuntupro/lib/pages/subscription_status/subscription_status_page.dart b/gui/packages/ubuntupro/lib/pages/subscription_status/subscription_status_page.dart index f017bb136..c52cca076 100644 --- a/gui/packages/ubuntupro/lib/pages/subscription_status/subscription_status_page.dart +++ b/gui/packages/ubuntupro/lib/pages/subscription_status/subscription_status_page.dart @@ -1,8 +1,10 @@ import 'package:agentapi/agentapi.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:provider/provider.dart'; import 'package:ubuntu_service/ubuntu_service.dart'; +import 'package:url_launcher/url_launcher_string.dart'; import 'package:wizard_router/wizard_router.dart'; import 'package:yaru/yaru.dart'; @@ -24,19 +26,17 @@ class SubscriptionStatusPage extends StatelessWidget { duration: const Duration(milliseconds: 700), child: switch (model) { StoreSubscriptionStatusModel() => SubscriptionStatus( - caption: lang.storeManaged, actionButtons: [ if (model.canConfigureLandscape) _landscapeButton(context), - OutlinedButton( - onPressed: model.launchManagementWebPage, - child: Text(lang.manageSubscription), + ], + footerLinks: [ + MarkdownBody( + data: '[${lang.ubuntuProManage}]()', + onTapLink: (_, href, __) => model.launchManagementWebPage(), ), ], ), UserSubscriptionStatusModel() => SubscriptionStatus( - caption: lang.manuallyManaged( - '[ubuntu.com/pro/dashboard](https://ubuntu.com/pro/dashboard)', - ), actionButtons: [ if (model.canConfigureLandscape) _landscapeButton(context), ElevatedButton( @@ -59,9 +59,15 @@ class SubscriptionStatusPage extends StatelessWidget { child: Text(lang.detachPro), ), ], + footerLinks: [ + MarkdownBody( + data: '[${lang.ubuntuProManage}]()', + onTapLink: (_, href, __) => + launchUrlString('https://ubuntu.com/pro/dashboard'), + ), + ], ), OrgSubscriptionStatusModel() => SubscriptionStatus( - caption: lang.orgManaged, actionButtons: model.canConfigureLandscape ? [_landscapeButton(context)] : null, diff --git a/gui/packages/ubuntupro/lib/pages/subscription_status/subscription_status_widgets.dart b/gui/packages/ubuntupro/lib/pages/subscription_status/subscription_status_widgets.dart index 90024acf0..ba7ca553e 100644 --- a/gui/packages/ubuntupro/lib/pages/subscription_status/subscription_status_widgets.dart +++ b/gui/packages/ubuntupro/lib/pages/subscription_status/subscription_status_widgets.dart @@ -1,56 +1,38 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import 'package:flutter_markdown/flutter_markdown.dart'; -import 'package:url_launcher/url_launcher_string.dart'; import 'package:yaru/yaru.dart'; -import '../widgets/page_widgets.dart'; +import '/pages/widgets/page_widgets.dart'; /// A page content widget built on top of the Dark styled landing page showing the current user active subscription /// feedback and an optional action button in a column layout. class SubscriptionStatus extends StatelessWidget { const SubscriptionStatus({ super.key, - required this.caption, this.actionButtons, + this.footerLinks, }); - /// The caption to render below the active subscription subtitle. - final String caption; - /// The optional action button matching the capabilities of the current subscription type. final List? actionButtons; + final List? footerLinks; + @override Widget build(BuildContext context) { final lang = AppLocalizations.of(context); - final theme = Theme.of(context); - final linkStyle = MarkdownStyleSheet.fromTheme( - theme.copyWith( - textTheme: theme.textTheme.copyWith( - bodyMedium: theme.textTheme.bodyMedium?.copyWith( - fontWeight: FontWeight.w100, - ), - ), - ), - ).copyWith( - a: TextStyle( - decoration: TextDecoration.underline, - color: theme.colorScheme.onSurface, - ), - ); - - return LandingPage( - centered: true, + return CenteredPage( + footer: footerLinks != null + ? Row( + mainAxisAlignment: MainAxisAlignment.center, + children: footerLinks!, + ) + : null, children: [ const SizedBox(height: 16.0), YaruInfoBox( - title: Text(lang.subscriptionIsActive), - subtitle: MarkdownBody( - data: caption, - onTapLink: (_, href, __) => launchUrlString(href!), - styleSheet: linkStyle, - ), + title: Text(lang.ubuntuProEnabled), + subtitle: Text(lang.ubuntuProEnabledInfo), yaruInfoType: YaruInfoType.success, ), if (actionButtons != null) diff --git a/gui/packages/ubuntupro/lib/pages/widgets/page_widgets.dart b/gui/packages/ubuntupro/lib/pages/widgets/page_widgets.dart index 9d917b6b6..1d3241c70 100644 --- a/gui/packages/ubuntupro/lib/pages/widgets/page_widgets.dart +++ b/gui/packages/ubuntupro/lib/pages/widgets/page_widgets.dart @@ -170,6 +170,76 @@ class _PageContent extends StatelessWidget { } } +class CenteredPage extends StatelessWidget { + const CenteredPage({ + super.key, + required this.children, + this.svgAsset = 'assets/Ubuntu-tag.svg', + this.title = 'Ubuntu Pro', + this.footer, + }); + + final List children; + final Widget? footer; + final String svgAsset; + final String title; + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Pro4WSLPage( + body: Padding( + padding: const EdgeInsets.fromLTRB(32.0, 24.0, 32.0, 32.0), + child: Column( + children: [ + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 540.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + RichText( + text: TextSpan( + children: [ + WidgetSpan( + child: SvgPicture.asset( + svgAsset, + height: 70, + ), + ), + const WidgetSpan( + child: SizedBox( + width: 8, + ), + ), + TextSpan( + text: title, + style: theme.textTheme.displaySmall + ?.copyWith(fontWeight: FontWeight.w100), + ), + ], + ), + ), + const SizedBox(height: 16), + ...children, + ], + ), + ), + ], + ), + ), + if (footer != null) footer!, + ], + ), + ), + ); + } +} + /// Two-column, vertically centered page. The left column always contains the /// svg image and title, with the left children below it. Both columns are equal /// in width. Optionally, a [NavigationRow] may be provided that will span the From 2b19560bd97b5a1d648a261c7c16bf7d348cfea0 Mon Sep 17 00:00:00 2001 From: ashuntu Date: Tue, 17 Dec 2024 16:12:46 -0600 Subject: [PATCH 2/6] Fix end to end and unit tests --- .../ubuntupro/end_to_end/end_to_end_test.dart | 4 +-- .../subscription_status_page_test.dart | 13 +++++---- .../susbcription_status_widgets_test.dart | 28 ++++++++++++++----- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/gui/packages/ubuntupro/end_to_end/end_to_end_test.dart b/gui/packages/ubuntupro/end_to_end/end_to_end_test.dart index 100c01d13..b61468486 100644 --- a/gui/packages/ubuntupro/end_to_end/end_to_end_test.dart +++ b/gui/packages/ubuntupro/end_to_end/end_to_end_test.dart @@ -52,7 +52,7 @@ Future testOrganizationProvidedToken(WidgetTester tester) async { // asserts that we transitioned to the organization-managed status page. final l10n = tester.l10n(); - expect(find.text(l10n.orgManaged), findsOneWidget); + expect(find.text(l10n.ubuntuProManage), findsNothing); } Future testManualTokenInput(WidgetTester tester) async { @@ -99,5 +99,5 @@ Future testPurchase(WidgetTester tester) async { // asserts that we transitioned to the store-managed status page. l10n = tester.l10n(); - expect(find.text(l10n.storeManaged), findsOneWidget); + expect(find.text(l10n.ubuntuProManage), findsOneWidget); } diff --git a/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_page_test.dart b/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_page_test.dart index e2dacc7e6..00317dec7 100644 --- a/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_page_test.dart +++ b/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_page_test.dart @@ -40,7 +40,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); - expect(find.text(lang.manageSubscription), findsOneWidget); + expect(find.text(lang.ubuntuProManage), findsOneWidget); expect(find.text(lang.landscapeConfigureButton), findsNothing); }); @@ -53,10 +53,11 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); - expect(find.text(lang.orgManaged), findsOneWidget); + expect(find.text(lang.ubuntuProManage), findsNothing); expect(find.text(lang.landscapeConfigureButton), findsNothing); }); }); + group('landscape:', () { testWidgets('user', (tester) async { final landscape = LandscapeSource()..ensureNone(); @@ -82,7 +83,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); - expect(find.text(lang.manageSubscription), findsOneWidget); + expect(find.text(lang.ubuntuProManage), findsOneWidget); expect(find.text(lang.landscapeConfigureButton), findsOneWidget); }); @@ -96,7 +97,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); - expect(find.text(lang.orgManaged), findsOneWidget); + expect(find.text(lang.ubuntuProManage), findsNothing); expect(find.text(lang.landscapeConfigureButton), findsOneWidget); }); }); @@ -136,7 +137,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); - expect(find.text(lang.manageSubscription), findsOneWidget); + expect(find.text(lang.ubuntuProManage), findsOneWidget); expect(find.text(lang.landscapeConfigureButton), findsNothing); }); @@ -155,7 +156,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); - expect(find.text(lang.orgManaged), findsOneWidget); + expect(find.text(lang.ubuntuProManage), findsNothing); expect(find.text(lang.landscapeConfigureButton), findsNothing); }); }); diff --git a/gui/packages/ubuntupro/test/pages/subscription_status/susbcription_status_widgets_test.dart b/gui/packages/ubuntupro/test/pages/subscription_status/susbcription_status_widgets_test.dart index 2813f4ecc..613697120 100644 --- a/gui/packages/ubuntupro/test/pages/subscription_status/susbcription_status_widgets_test.dart +++ b/gui/packages/ubuntupro/test/pages/subscription_status/susbcription_status_widgets_test.dart @@ -1,22 +1,37 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:ubuntupro/pages/subscription_status/subscription_status_widgets.dart'; +import 'package:yaru_test/yaru_test.dart'; import '../../utils/build_multiprovider_app.dart'; void main() { group('subscription status', () { - const caption = 'my caption'; - const buttonName = 'my button'; + const footerText = 'my footer'; + const buttonText = 'my button'; - testWidgets('caption', (tester) async { + testWidgets('footer', (tester) async { + var clicked = false; await tester.pumpWidget( buildSingleRouteMultiProviderApp( - child: const SubscriptionStatus(caption: caption), + child: SubscriptionStatus( + footerLinks: [ + TextButton( + onPressed: () => clicked = true, + child: const Text(footerText), + ), + ], + ), ), ); - expect(find.text(caption), findsOneWidget); + final button = find.button(footerText); + expect(button, findsOneWidget); + + expect(clicked, isFalse); + await tester.tap(button); + await tester.pumpAndSettle(); + expect(clicked, isTrue); }); testWidgets('action button', (tester) async { @@ -24,11 +39,10 @@ void main() { await tester.pumpWidget( buildSingleRouteMultiProviderApp( child: SubscriptionStatus( - caption: caption, actionButtons: [ TextButton( onPressed: () => clicked = true, - child: const Text(buttonName), + child: const Text(buttonText), ), ], ), From e3e60845c025640c72c61f5e0fc372444c883db4 Mon Sep 17 00:00:00 2001 From: ashuntu Date: Tue, 17 Dec 2024 16:56:01 -0600 Subject: [PATCH 3/6] Add test coverage for footer links --- .../subscription_status_page_test.dart | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_page_test.dart b/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_page_test.dart index 00317dec7..393e5b121 100644 --- a/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_page_test.dart +++ b/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_page_test.dart @@ -7,15 +7,59 @@ import 'package:ubuntu_service/ubuntu_service.dart'; import 'package:ubuntupro/core/agent_api_client.dart'; import 'package:ubuntupro/pages/subscription_status/subscription_status_model.dart'; import 'package:ubuntupro/pages/subscription_status/subscription_status_page.dart'; +import 'package:url_launcher_platform_interface/url_launcher_platform_interface.dart'; import 'package:wizard_router/wizard_router.dart'; import '../../utils/build_multiprovider_app.dart'; +import '../../utils/url_launcher_mock.dart'; void main() { group('subscription info:', () { final client = FakeAgentApiClient(); registerServiceInstance(client); final info = SubscriptionInfo(); + + group('footer links:', () { + final landscape = LandscapeSource()..ensureOrganization(); + testWidgets('user', (tester) async { + final launcher = FakeUrlLauncher(); + UrlLauncherPlatform.instance = launcher; + + info.ensureUser(); + final app = buildApp(info, landscape, client); + + await tester.pumpWidget(app); + + final context = tester.element(find.byType(SubscriptionStatusPage)); + final lang = AppLocalizations.of(context); + + expect(launcher.launched, isFalse); + await tester + .tapOnText(find.textRange.ofSubstring(lang.ubuntuProManage)); + await tester.pump(); + expect(launcher.launched, isTrue); + }); + + testWidgets('store', (tester) async { + final launcher = FakeUrlLauncher(); + UrlLauncherPlatform.instance = launcher; + + info.ensureMicrosoftStore(); + final app = buildApp(info, landscape, client); + + await tester.pumpWidget(app); + + final context = tester.element(find.byType(SubscriptionStatusPage)); + final lang = AppLocalizations.of(context); + + expect(launcher.launched, isFalse); + await tester + .tapOnText(find.textRange.ofSubstring(lang.ubuntuProManage)); + await tester.pump(); + expect(launcher.launched, isTrue); + }); + }); + group('org landscape:', () { final landscape = LandscapeSource()..ensureOrganization(); testWidgets('user', (tester) async { @@ -27,6 +71,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); + expect(find.text(lang.ubuntuProManage), findsOneWidget); expect(find.text(lang.detachPro), findsOneWidget); expect(find.text(lang.landscapeConfigureButton), findsNothing); }); @@ -69,6 +114,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); + expect(find.text(lang.ubuntuProManage), findsOneWidget); expect(find.text(lang.detachPro), findsOneWidget); expect(find.text(lang.landscapeConfigureButton), findsOneWidget); }); @@ -118,6 +164,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); + expect(find.text(lang.ubuntuProManage), findsOneWidget); expect(find.text(lang.detachPro), findsOneWidget); expect(find.text(lang.landscapeConfigureButton), findsNothing); }); From d392058a3ecb748d64625a48f324ea50e8be9459 Mon Sep 17 00:00:00 2001 From: ashuntu Date: Wed, 18 Dec 2024 09:08:05 -0600 Subject: [PATCH 4/6] Replaced centered row with Centered --- .../lib/pages/widgets/page_widgets.dart | 61 +++++++++---------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/gui/packages/ubuntupro/lib/pages/widgets/page_widgets.dart b/gui/packages/ubuntupro/lib/pages/widgets/page_widgets.dart index 1d3241c70..7f9f75837 100644 --- a/gui/packages/ubuntupro/lib/pages/widgets/page_widgets.dart +++ b/gui/packages/ubuntupro/lib/pages/widgets/page_widgets.dart @@ -194,42 +194,39 @@ class CenteredPage extends StatelessWidget { child: Column( children: [ Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 540.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - RichText( - text: TextSpan( - children: [ - WidgetSpan( - child: SvgPicture.asset( - svgAsset, - height: 70, - ), - ), - const WidgetSpan( - child: SizedBox( - width: 8, - ), + child: Center( + child: ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 540.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + RichText( + text: TextSpan( + children: [ + WidgetSpan( + child: SvgPicture.asset( + svgAsset, + height: 70, ), - TextSpan( - text: title, - style: theme.textTheme.displaySmall - ?.copyWith(fontWeight: FontWeight.w100), + ), + const WidgetSpan( + child: SizedBox( + width: 8, ), - ], - ), + ), + TextSpan( + text: title, + style: theme.textTheme.displaySmall + ?.copyWith(fontWeight: FontWeight.w100), + ), + ], ), - const SizedBox(height: 16), - ...children, - ], - ), + ), + const SizedBox(height: 16), + ...children, + ], ), - ], + ), ), ), if (footer != null) footer!, From 63fbed2fa48996d77c6d6b282cf705bf308d1f97 Mon Sep 17 00:00:00 2001 From: ashuntu Date: Wed, 18 Dec 2024 09:10:55 -0600 Subject: [PATCH 5/6] Rename manage ubuntu pro translation string --- .../ubuntupro/end_to_end/end_to_end_test.dart | 4 ++-- gui/packages/ubuntupro/lib/l10n/app_en.arb | 2 +- .../subscription_status_page.dart | 4 ++-- .../subscription_status_page_test.dart | 22 +++++++++---------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/gui/packages/ubuntupro/end_to_end/end_to_end_test.dart b/gui/packages/ubuntupro/end_to_end/end_to_end_test.dart index b61468486..96c8933b1 100644 --- a/gui/packages/ubuntupro/end_to_end/end_to_end_test.dart +++ b/gui/packages/ubuntupro/end_to_end/end_to_end_test.dart @@ -52,7 +52,7 @@ Future testOrganizationProvidedToken(WidgetTester tester) async { // asserts that we transitioned to the organization-managed status page. final l10n = tester.l10n(); - expect(find.text(l10n.ubuntuProManage), findsNothing); + expect(find.text(l10n.manageUbuntuPro), findsNothing); } Future testManualTokenInput(WidgetTester tester) async { @@ -99,5 +99,5 @@ Future testPurchase(WidgetTester tester) async { // asserts that we transitioned to the store-managed status page. l10n = tester.l10n(); - expect(find.text(l10n.ubuntuProManage), findsOneWidget); + expect(find.text(l10n.manageUbuntuPro), findsOneWidget); } diff --git a/gui/packages/ubuntupro/lib/l10n/app_en.arb b/gui/packages/ubuntupro/lib/l10n/app_en.arb index 8dac44247..d5ca62339 100644 --- a/gui/packages/ubuntupro/lib/l10n/app_en.arb +++ b/gui/packages/ubuntupro/lib/l10n/app_en.arb @@ -45,7 +45,7 @@ "ubuntuProEnabled": "Ubuntu Pro is enabled on this machine.", "ubuntuProEnabledInfo": "All Ubuntu WSL instances have access to Ubuntu Pro security features.", - "ubuntuProManage": "Manage Ubuntu Pro subscription", + "manageUbuntuPro": "Manage Ubuntu Pro subscription", "detachPro": "Detach Ubuntu Pro", "updatingSubscriptionInfo": "Updating the subscription information.", diff --git a/gui/packages/ubuntupro/lib/pages/subscription_status/subscription_status_page.dart b/gui/packages/ubuntupro/lib/pages/subscription_status/subscription_status_page.dart index c52cca076..e53c87201 100644 --- a/gui/packages/ubuntupro/lib/pages/subscription_status/subscription_status_page.dart +++ b/gui/packages/ubuntupro/lib/pages/subscription_status/subscription_status_page.dart @@ -31,7 +31,7 @@ class SubscriptionStatusPage extends StatelessWidget { ], footerLinks: [ MarkdownBody( - data: '[${lang.ubuntuProManage}]()', + data: '[${lang.manageUbuntuPro}]()', onTapLink: (_, href, __) => model.launchManagementWebPage(), ), ], @@ -61,7 +61,7 @@ class SubscriptionStatusPage extends StatelessWidget { ], footerLinks: [ MarkdownBody( - data: '[${lang.ubuntuProManage}]()', + data: '[${lang.manageUbuntuPro}]()', onTapLink: (_, href, __) => launchUrlString('https://ubuntu.com/pro/dashboard'), ), diff --git a/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_page_test.dart b/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_page_test.dart index 393e5b121..1548143bf 100644 --- a/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_page_test.dart +++ b/gui/packages/ubuntupro/test/pages/subscription_status/subscription_status_page_test.dart @@ -35,7 +35,7 @@ void main() { expect(launcher.launched, isFalse); await tester - .tapOnText(find.textRange.ofSubstring(lang.ubuntuProManage)); + .tapOnText(find.textRange.ofSubstring(lang.manageUbuntuPro)); await tester.pump(); expect(launcher.launched, isTrue); }); @@ -54,7 +54,7 @@ void main() { expect(launcher.launched, isFalse); await tester - .tapOnText(find.textRange.ofSubstring(lang.ubuntuProManage)); + .tapOnText(find.textRange.ofSubstring(lang.manageUbuntuPro)); await tester.pump(); expect(launcher.launched, isTrue); }); @@ -71,7 +71,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); - expect(find.text(lang.ubuntuProManage), findsOneWidget); + expect(find.text(lang.manageUbuntuPro), findsOneWidget); expect(find.text(lang.detachPro), findsOneWidget); expect(find.text(lang.landscapeConfigureButton), findsNothing); }); @@ -85,7 +85,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); - expect(find.text(lang.ubuntuProManage), findsOneWidget); + expect(find.text(lang.manageUbuntuPro), findsOneWidget); expect(find.text(lang.landscapeConfigureButton), findsNothing); }); @@ -98,7 +98,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); - expect(find.text(lang.ubuntuProManage), findsNothing); + expect(find.text(lang.manageUbuntuPro), findsNothing); expect(find.text(lang.landscapeConfigureButton), findsNothing); }); }); @@ -114,7 +114,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); - expect(find.text(lang.ubuntuProManage), findsOneWidget); + expect(find.text(lang.manageUbuntuPro), findsOneWidget); expect(find.text(lang.detachPro), findsOneWidget); expect(find.text(lang.landscapeConfigureButton), findsOneWidget); }); @@ -129,7 +129,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); - expect(find.text(lang.ubuntuProManage), findsOneWidget); + expect(find.text(lang.manageUbuntuPro), findsOneWidget); expect(find.text(lang.landscapeConfigureButton), findsOneWidget); }); @@ -143,7 +143,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); - expect(find.text(lang.ubuntuProManage), findsNothing); + expect(find.text(lang.manageUbuntuPro), findsNothing); expect(find.text(lang.landscapeConfigureButton), findsOneWidget); }); }); @@ -164,7 +164,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); - expect(find.text(lang.ubuntuProManage), findsOneWidget); + expect(find.text(lang.manageUbuntuPro), findsOneWidget); expect(find.text(lang.detachPro), findsOneWidget); expect(find.text(lang.landscapeConfigureButton), findsNothing); }); @@ -184,7 +184,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); - expect(find.text(lang.ubuntuProManage), findsOneWidget); + expect(find.text(lang.manageUbuntuPro), findsOneWidget); expect(find.text(lang.landscapeConfigureButton), findsNothing); }); @@ -203,7 +203,7 @@ void main() { final context = tester.element(find.byType(SubscriptionStatusPage)); final lang = AppLocalizations.of(context); - expect(find.text(lang.ubuntuProManage), findsNothing); + expect(find.text(lang.manageUbuntuPro), findsNothing); expect(find.text(lang.landscapeConfigureButton), findsNothing); }); }); From 2af76cbba673cdbb7719c00290981a1b7501bdfd Mon Sep 17 00:00:00 2001 From: ashuntu Date: Wed, 18 Dec 2024 10:55:41 -0600 Subject: [PATCH 6/6] Remove LandingPage since it is not used anymore --- .../lib/pages/widgets/page_widgets.dart | 101 ------------------ 1 file changed, 101 deletions(-) diff --git a/gui/packages/ubuntupro/lib/pages/widgets/page_widgets.dart b/gui/packages/ubuntupro/lib/pages/widgets/page_widgets.dart index 7f9f75837..698b98045 100644 --- a/gui/packages/ubuntupro/lib/pages/widgets/page_widgets.dart +++ b/gui/packages/ubuntupro/lib/pages/widgets/page_widgets.dart @@ -69,107 +69,6 @@ class Pro4WSLPage extends StatelessWidget { } } -// A more stylized page that mimics the design of the https://ubuntu.com/pro -// landing page, with a dark background and an [svgAsset] logo followed by -// a title with some opacity, rendering the [children] in a column layout. -class LandingPage extends StatelessWidget { - const LandingPage({ - super.key, - required this.children, - this.svgAsset = 'assets/Ubuntu-tag.svg', - this.title = 'Ubuntu Pro', - this.centered = false, - }); - final List children; - final String svgAsset; - final String title; - final bool centered; - - @override - Widget build(BuildContext context) { - final theme = Theme.of(context); - - return Pro4WSLPage( - body: Padding( - padding: const EdgeInsets.fromLTRB(32.0, 32.0, 32.0, 8.0), - child: centered - ? Center( - child: ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 480.0), - child: _PageContent( - svgAsset: svgAsset, - title: title, - data: theme, - centered: true, - children: children, - ), - ), - ) - : _PageContent( - svgAsset: svgAsset, - title: title, - data: theme, - children: children, - ), - ), - ); - } -} - -class _PageContent extends StatelessWidget { - const _PageContent({ - required this.svgAsset, - required this.title, - required ThemeData data, - required this.children, - this.centered = false, - }) : _data = data; - - final String svgAsset; - final String title; - final ThemeData _data; - final List children; - final bool centered; - - @override - Widget build(BuildContext context) { - return Column( - crossAxisAlignment: - centered ? CrossAxisAlignment.center : CrossAxisAlignment.start, - mainAxisAlignment: - centered ? MainAxisAlignment.center : MainAxisAlignment.start, - children: [ - RichText( - text: TextSpan( - children: [ - WidgetSpan( - child: SvgPicture.asset( - svgAsset, - height: 70, - ), - ), - const WidgetSpan( - child: SizedBox( - width: 8, - ), - ), - TextSpan( - text: title, - style: _data.textTheme.displaySmall - ?.copyWith(fontWeight: FontWeight.w100), - ), - ], - ), - ), - const SizedBox( - height: 12, - ), - ...children, - ], - ); - } -} - class CenteredPage extends StatelessWidget { const CenteredPage({ super.key,