-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is quite a large commit since there are a lot of moving pieces. The existing Landscape page needs its skip functionality removed, the skip page uses an updated version of copy, the skip page uses an entirely new layout, etc. I plan on expanding the use of reusable navigation and other layout widgets since the new designs will be much more consistent across pages.
- Loading branch information
Showing
10 changed files
with
243 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
gui/packages/ubuntupro/lib/pages/landscape_skip/landscape_skip_page.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
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.dart'; | ||
import 'package:wizard_router/wizard_router.dart'; | ||
|
||
import '../../routes.dart'; | ||
import '../landscape/landscape_model.dart'; | ||
import '../widgets/navigation_row.dart'; | ||
import '../widgets/page_widgets.dart'; | ||
import '../widgets/radio_tile.dart'; | ||
|
||
enum _SkipEnum { | ||
skip, | ||
register, | ||
} | ||
|
||
class LandscapeSkipPage extends StatefulWidget { | ||
const LandscapeSkipPage({super.key}); | ||
|
||
@override | ||
State<LandscapeSkipPage> createState() => _LandscapeSkipPageState(); | ||
} | ||
|
||
class _LandscapeSkipPageState extends State<LandscapeSkipPage> { | ||
_SkipEnum groupValue = _SkipEnum.skip; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final lang = AppLocalizations.of(context); | ||
final wizard = Wizard.of(context); | ||
|
||
return ColumnPage( | ||
svgAsset: 'assets/Landscape-tag.svg', | ||
title: lang.landscapeTitle, | ||
left: [ | ||
MarkdownBody( | ||
data: lang.landscapeHeading( | ||
'[${lang.learnMore}](${LandscapeModel.landscapeURI})', | ||
), | ||
onTapLink: (_, href, __) => launchUrl(LandscapeModel.landscapeURI), | ||
), | ||
], | ||
right: [ | ||
RadioTile( | ||
value: _SkipEnum.skip, | ||
title: lang.landscapeSkip, | ||
subtitle: lang.landscapeSkipDescription, | ||
groupValue: groupValue, | ||
onChanged: (v) => setState(() { | ||
groupValue = v!; | ||
}), | ||
), | ||
RadioTile( | ||
value: _SkipEnum.register, | ||
title: lang.landscapeSkipRegister, | ||
groupValue: groupValue, | ||
onChanged: (v) => setState(() { | ||
groupValue = v!; | ||
}), | ||
), | ||
], | ||
navigationRow: NavigationRow( | ||
onBack: wizard.back, | ||
onNext: () { | ||
switch (groupValue) { | ||
case _SkipEnum.skip: | ||
wizard.jump(Routes.subscriptionStatus); | ||
case _SkipEnum.register: | ||
wizard.next(); | ||
} | ||
}, | ||
), | ||
); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
gui/packages/ubuntupro/lib/pages/widgets/navigation_row.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class NavigationRow extends StatelessWidget { | ||
const NavigationRow({ | ||
required this.onBack, | ||
required this.onNext, | ||
this.backText, | ||
this.nextText, | ||
super.key, | ||
}); | ||
|
||
final void Function()? onBack; | ||
final String? backText; | ||
final void Function()? onNext; | ||
final String? nextText; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
OutlinedButton(onPressed: onBack, child: Text(backText ?? 'Back')), | ||
FilledButton(onPressed: onNext, child: Text(nextText ?? 'Next')), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:yaru/yaru.dart'; | ||
|
||
class RadioTile<T> extends StatelessWidget { | ||
const RadioTile({ | ||
required this.value, | ||
required this.title, | ||
required this.groupValue, | ||
required this.onChanged, | ||
this.subtitle, | ||
super.key, | ||
}); | ||
|
||
final String title; | ||
final String? subtitle; | ||
final T value, groupValue; | ||
final Function(T?)? onChanged; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
// Adds a nice visual clue that the tile is selected. | ||
return YaruSelectableContainer( | ||
selected: groupValue == value, | ||
selectionColor: Theme.of(context).colorScheme.tertiaryContainer, | ||
child: YaruRadioListTile( | ||
contentPadding: EdgeInsets.zero, | ||
visualDensity: VisualDensity.comfortable, | ||
dense: true, | ||
title: Text(title), | ||
subtitle: subtitle != null ? Text(subtitle!) : null, | ||
value: value, | ||
groupValue: groupValue, | ||
onChanged: onChanged, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters