Skip to content

Commit

Permalink
Slight refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ivirtex committed Oct 18, 2023
1 parent 0b0e457 commit 5aee039
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
11 changes: 4 additions & 7 deletions lib/explore/widgets/next_launch_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ class NextLaunchCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
final doesExist = launch != null;
final launchDate = launch?.net;
final timeLeft = launch?.net?.difference(DateTime.now());
final launchName = launch?.name;
final launchStatus = launch?.status;
final description = createShortDescription(launch?.mission?.description);

return Column(
Expand All @@ -39,7 +36,7 @@ class NextLaunchCard extends StatelessWidget {
),
ExploreCard(
title: const Text('Status'),
trailing: LaunchStatus(launchStatus),
trailing: LaunchStatus(launch?.status),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(kBorderRadius),
),
Expand All @@ -51,9 +48,9 @@ class NextLaunchCard extends StatelessWidget {
),
const Spacer(),
CountdownTimer(
launchDate: launchDate,
launchDate: launch?.net,
// TODO(ivirtex): use netPrecision instead
mode: launchStatus?.abbrev == StatusAbbrev.go &&
mode: launch?.status?.abbrev == StatusAbbrev.go &&
timeLeft! < 24.hours
? CountdownTimerMode.hoursMinutesSeconds
: CountdownTimerMode.daysHoursMinutes,
Expand All @@ -64,7 +61,7 @@ class NextLaunchCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
launchName ?? 'Unknown',
launch?.name ?? 'Unknown',
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: kListSpacing),
Expand Down
3 changes: 1 addition & 2 deletions lib/settings/view/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,9 @@ class _SettingsViewState extends State<SettingsView> {
),
SwitchListTile(
secondary: const Icon(Icons.star_rounded),
title: const Text('Notices and closures at Starbase'),
title: const Text('Notices and closures at Starbase (Beta)'),
value: _areStarbaseNotificationsEnabled,
onChanged: (isEnabled) {
// TODO(ivirtex): set up with Adapty
setState(() {
_areStarbaseNotificationsEnabled = isEnabled;

Expand Down

0 comments on commit 5aee039

Please sign in to comment.