mirror of
https://github.com/canonical/ubuntu-desktop-provision.git
synced 2025-08-01 07:39:27 +00:00
feat: use OptionButton
on StoragePage
(#1112)
 UDENG-6921
This commit is contained in:
@ -5,8 +5,8 @@ import 'package:ubuntu_bootstrap/l10n.dart';
|
||||
import 'package:ubuntu_bootstrap/pages/storage/storage_model.dart';
|
||||
import 'package:ubuntu_bootstrap/widgets.dart';
|
||||
import 'package:ubuntu_provision/ubuntu_provision.dart';
|
||||
import 'package:ubuntu_utils/ubuntu_utils.dart';
|
||||
import 'package:ubuntu_wizard/ubuntu_wizard.dart';
|
||||
import 'package:yaru/yaru.dart';
|
||||
|
||||
export 'storage_model.dart'
|
||||
show
|
||||
@ -121,7 +121,7 @@ class StoragePage extends ConsumerWidget with ProvisioningPage {
|
||||
),
|
||||
subtitle: Text(
|
||||
lang.installationTypeAlongsideInfo(flavor.displayName),
|
||||
style: theme.textTheme.bodySmall!.copyWith(
|
||||
style: theme.textTheme.bodyMedium!.copyWith(
|
||||
color: canInstallAlongside ? null : theme.disabledColor,
|
||||
),
|
||||
),
|
||||
@ -166,10 +166,9 @@ class StoragePage extends ConsumerWidget with ProvisioningPage {
|
||||
title: Text(lang.installationTypeManual),
|
||||
subtitle: Text(
|
||||
lang.installationTypeManualInfo(flavor.displayName),
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
],
|
||||
].withSpacing(kWizardSpacing / 2),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -202,11 +201,9 @@ class _InstallationTypeTile extends ConsumerWidget {
|
||||
return Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: Material(
|
||||
child: YaruRadioListTile(
|
||||
child: OptionButton<StorageType?>(
|
||||
title: title,
|
||||
subtitle: subtitle,
|
||||
contentPadding: kWizardTilePadding,
|
||||
isThreeLine: true,
|
||||
value: storageType,
|
||||
groupValue: model.type,
|
||||
onChanged: enabled ? onChanged : null,
|
||||
@ -228,12 +225,13 @@ class _WarningSubtitle extends ConsumerWidget {
|
||||
return RichText(
|
||||
text: TextSpan(
|
||||
text: UbuntuLocalizations.of(context).warningLabel,
|
||||
style: theme.textTheme.bodySmall!.copyWith(
|
||||
style: theme.textTheme.bodyMedium!.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: theme.colorScheme.error,
|
||||
),
|
||||
children: <TextSpan>[
|
||||
TextSpan(text: ': ', style: theme.textTheme.bodySmall),
|
||||
TextSpan(text: text, style: theme.textTheme.bodySmall),
|
||||
TextSpan(text: ': ', style: theme.textTheme.bodyMedium),
|
||||
TextSpan(text: text, style: theme.textTheme.bodyMedium),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
@ -13,7 +13,7 @@ import 'package:ubuntu_bootstrap/widgets/bitlocker_warning.dart';
|
||||
import 'package:ubuntu_provision/providers.dart';
|
||||
import 'package:ubuntu_provision/services.dart';
|
||||
import 'package:ubuntu_test/ubuntu_test.dart';
|
||||
import 'package:yaru/yaru.dart';
|
||||
import 'package:ubuntu_utils/ubuntu_utils.dart';
|
||||
import 'package:yaru_test/yaru_test.dart';
|
||||
|
||||
import 'test_storage.dart';
|
||||
@ -80,7 +80,7 @@ void main() {
|
||||
final l10n = UbuntuBootstrapLocalizations.of(context);
|
||||
|
||||
expect(
|
||||
find.radioListTile(
|
||||
find.optionButton(
|
||||
l10n.installationTypeAlongside(productInfo.name, osProber.long),
|
||||
),
|
||||
findsOneWidget,
|
||||
@ -103,7 +103,7 @@ void main() {
|
||||
final l10n = UbuntuBootstrapLocalizations.of(context);
|
||||
|
||||
expect(
|
||||
find.radioListTile(
|
||||
find.optionButton(
|
||||
l10n.installationTypeAlongsideDual(
|
||||
productInfo.name,
|
||||
osProbers[0].long,
|
||||
@ -130,7 +130,7 @@ void main() {
|
||||
final l10n = UbuntuBootstrapLocalizations.of(context);
|
||||
|
||||
expect(
|
||||
find.radioListTile(l10n.installationTypeAlongsideMulti(productInfo.name)),
|
||||
find.optionButton(l10n.installationTypeAlongsideMulti(productInfo.name)),
|
||||
findsOneWidget,
|
||||
);
|
||||
});
|
||||
@ -150,7 +150,7 @@ void main() {
|
||||
final l10n = UbuntuBootstrapLocalizations.of(context);
|
||||
|
||||
expect(
|
||||
find.radioListTile(l10n.installationTypeAlongsideMulti(productInfo.name)),
|
||||
find.optionButton(l10n.installationTypeAlongsideMulti(productInfo.name)),
|
||||
findsOneWidget,
|
||||
);
|
||||
});
|
||||
@ -171,7 +171,7 @@ void main() {
|
||||
final context = tester.element(find.byType(StoragePage));
|
||||
final l10n = UbuntuBootstrapLocalizations.of(context);
|
||||
|
||||
final radio = find.radioListTile(
|
||||
final radio = find.optionButton(
|
||||
l10n.installationTypeAlongside('Ubuntu', osProber.long),
|
||||
);
|
||||
expect(radio, findsOneWidget);
|
||||
@ -196,7 +196,7 @@ void main() {
|
||||
final context = tester.element(find.byType(StoragePage));
|
||||
final l10n = UbuntuBootstrapLocalizations.of(context);
|
||||
|
||||
final radio = find.radioListTile(
|
||||
final radio = find.optionButton(
|
||||
l10n.installationTypeAlongside('Ubuntu', osProber.long),
|
||||
);
|
||||
expect(radio, findsOneWidget);
|
||||
@ -221,7 +221,7 @@ void main() {
|
||||
final context = tester.element(find.byType(StoragePage));
|
||||
final l10n = UbuntuBootstrapLocalizations.of(context);
|
||||
|
||||
final radio = find.radioListTile(
|
||||
final radio = find.optionButton(
|
||||
l10n.installationTypeAlongside('Ubuntu', osProber.long),
|
||||
);
|
||||
expect(radio, findsOneWidget);
|
||||
@ -245,7 +245,7 @@ void main() {
|
||||
final context = tester.element(find.byType(StoragePage));
|
||||
final l10n = UbuntuBootstrapLocalizations.of(context);
|
||||
|
||||
final radio = find.radioListTile(
|
||||
final radio = find.optionButton(
|
||||
l10n.installationTypeAlongside('Ubuntu', 'Ubuntu 18.04 LTS'),
|
||||
);
|
||||
expect(radio, findsOneWidget);
|
||||
@ -262,7 +262,7 @@ void main() {
|
||||
final context = tester.element(find.byType(StoragePage));
|
||||
final l10n = UbuntuBootstrapLocalizations.of(context);
|
||||
|
||||
final radio = find.radioListTile(
|
||||
final radio = find.optionButton(
|
||||
l10n.installationTypeAlongsideUnknown('Ubuntu'),
|
||||
);
|
||||
expect(radio, findsOneWidget);
|
||||
@ -293,7 +293,7 @@ void main() {
|
||||
final context = tester.element(find.byType(StoragePage));
|
||||
final l10n = UbuntuBootstrapLocalizations.of(context);
|
||||
|
||||
final radio = find.radioListTile(
|
||||
final radio = find.optionButton(
|
||||
l10n.installationTypeAlongsideDual(
|
||||
'Ubuntu',
|
||||
'Windows 10',
|
||||
@ -328,7 +328,7 @@ void main() {
|
||||
final context = tester.element(find.byType(StoragePage));
|
||||
final l10n = UbuntuBootstrapLocalizations.of(context);
|
||||
|
||||
final radio = find.radioListTile(
|
||||
final radio = find.optionButton(
|
||||
l10n.installationTypeAlongsideMulti('Ubuntu'),
|
||||
);
|
||||
expect(radio, findsOneWidget);
|
||||
@ -365,7 +365,7 @@ void main() {
|
||||
final context = tester.element(find.byType(StoragePage));
|
||||
final l10n = UbuntuBootstrapLocalizations.of(context);
|
||||
|
||||
final radio = find.radioListTile(
|
||||
final radio = find.optionButton(
|
||||
l10n.installationTypeAlongsideMulti('Ubuntu'),
|
||||
);
|
||||
expect(radio, findsOneWidget);
|
||||
@ -380,7 +380,7 @@ void main() {
|
||||
final context = tester.element(find.byType(StoragePage));
|
||||
final l10n = UbuntuBootstrapLocalizations.of(context);
|
||||
|
||||
final radio = find.radioListTile(l10n.installationTypeErase('Ubuntu'));
|
||||
final radio = find.optionButton(l10n.installationTypeErase('Ubuntu'));
|
||||
expect(radio, findsOneWidget);
|
||||
await tester.tap(radio);
|
||||
verify(model.type = argThat(isA<StorageTypeErase>())).called(1);
|
||||
@ -393,7 +393,7 @@ void main() {
|
||||
final context = tester.element(find.byType(StoragePage));
|
||||
final l10n = UbuntuBootstrapLocalizations.of(context);
|
||||
|
||||
final radio = find.radioListTile(l10n.installationTypeErase('Ubuntu'));
|
||||
final radio = find.optionButton(l10n.installationTypeErase('Ubuntu'));
|
||||
expect(radio, findsNothing);
|
||||
});
|
||||
|
||||
@ -404,7 +404,7 @@ void main() {
|
||||
final context = tester.element(find.byType(StoragePage));
|
||||
final l10n = UbuntuBootstrapLocalizations.of(context);
|
||||
|
||||
final radio = find.radioListTile(l10n.installationTypeManual);
|
||||
final radio = find.optionButton(l10n.installationTypeManual);
|
||||
await tester.ensureVisible(radio);
|
||||
expect(radio, findsOneWidget);
|
||||
await tester.tap(radio);
|
||||
@ -418,7 +418,7 @@ void main() {
|
||||
final context = tester.element(find.byType(StoragePage));
|
||||
final l10n = UbuntuBootstrapLocalizations.of(context);
|
||||
|
||||
final radio = find.radioListTile(l10n.installationTypeManual);
|
||||
final radio = find.optionButton(l10n.installationTypeManual);
|
||||
expect(radio, findsNothing);
|
||||
});
|
||||
|
||||
@ -596,9 +596,9 @@ void main() {
|
||||
}
|
||||
|
||||
extension on CommonFinders {
|
||||
Finder radioListTile(String text) {
|
||||
Finder optionButton(String text) {
|
||||
return widgetWithText(
|
||||
YaruRadioListTile<StorageType>,
|
||||
OptionButton<StorageType?>,
|
||||
text,
|
||||
);
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ extension UbuntuBootstrapPageTester on WidgetTester {
|
||||
);
|
||||
|
||||
if (type != null) {
|
||||
await tapRadio<StorageType>(type);
|
||||
await tapRadio<StorageType?>(type);
|
||||
await pump();
|
||||
}
|
||||
await pumpAndSettle();
|
||||
|
Reference in New Issue
Block a user