Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add upgrade alert on login and ticket page #400

Merged
merged 3 commits into from
Mar 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions lib/core/widgets/upgrade_alert.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:upgrader/upgrader.dart' as upgrade;

class UpgradeAlert extends StatelessWidget {
final Widget child;
const UpgradeAlert({required this.child});

@override
Widget build(BuildContext context) {
return upgrade.UpgradeAlert(
upgrader: upgrade.Upgrader(
showReleaseNotes: false,
dialogStyle: Platform.isIOS
? upgrade.UpgradeDialogStyle.cupertino
: upgrade.UpgradeDialogStyle.material,
),
child: child,
);
}
}
59 changes: 31 additions & 28 deletions lib/widgets/pages/login/login_page_base.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:coffeecard/base/style/text_styles.dart';
import 'package:coffeecard/core/widgets/upgrade_alert.dart';
import 'package:coffeecard/utils/responsive.dart';
import 'package:coffeecard/widgets/components/images/analog_logo.dart';
import 'package:coffeecard/widgets/components/login/login_input_hint.dart';
Expand Down Expand Up @@ -27,35 +28,37 @@ class LoginPageBase extends StatelessWidget {

@override
Widget build(BuildContext context) {
return AppScaffold.withoutTitle(
resizeToAvoidBottomInset: resizeToAvoidBottomInset,
body: Column(
children: [
Expanded(
child: Column(
children: [
Gap(deviceIsSmall(context) ? 12 : 64),
const AnalogLogo(),
const Gap(16),
Text(
title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: AppTextStyle.pageTitle,
),
const Gap(16),
inputWidget,
const Gap(16),
LoginInputHint(defaultHint: defaultHint, error: error),
const Gap(12),
...ctaChildren,
const Gap(12),
],
return UpgradeAlert(
child: AppScaffold.withoutTitle(
resizeToAvoidBottomInset: resizeToAvoidBottomInset,
body: Column(
children: [
Expanded(
child: Column(
children: [
Gap(deviceIsSmall(context) ? 12 : 64),
const AnalogLogo(),
const Gap(16),
Text(
title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: AppTextStyle.pageTitle,
),
const Gap(16),
inputWidget,
const Gap(16),
LoginInputHint(defaultHint: defaultHint, error: error),
const Gap(12),
...ctaChildren,
const Gap(12),
],
),
),
),
if (bottomWidget != null) bottomWidget!,
],
if (bottomWidget != null) bottomWidget!,
],
),
),
);
}
Expand Down
55 changes: 29 additions & 26 deletions lib/widgets/pages/tickets/tickets_page.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:coffeecard/base/strings.dart';
import 'package:coffeecard/core/widgets/upgrade_alert.dart';
import 'package:coffeecard/features/opening_hours/opening_hours.dart';
import 'package:coffeecard/widgets/components/scaffold.dart';
import 'package:coffeecard/widgets/components/section_title.dart';
Expand All @@ -20,33 +21,35 @@ class TicketsPage extends StatelessWidget {

@override
Widget build(BuildContext context) {
return AppScaffold.withTitle(
title: Strings.ticketsPageTitle,
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: ListView(
controller: scrollController,
shrinkWrap: true,
padding: const EdgeInsets.all(16.0),
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
SectionTitle(Strings.ticketsMyTickets),
OpeningHoursIndicator(),
],
),
const TicketSection(),
const Gap(24),
const SectionTitle(Strings.shopText),
const ShopSection(),
],
return UpgradeAlert(
child: AppScaffold.withTitle(
title: Strings.ticketsPageTitle,
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: ListView(
controller: scrollController,
shrinkWrap: true,
padding: const EdgeInsets.all(16.0),
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
SectionTitle(Strings.ticketsMyTickets),
OpeningHoursIndicator(),
],
),
const TicketSection(),
const Gap(24),
const SectionTitle(Strings.shopText),
const ShopSection(),
],
),
),
),
],
],
),
),
);
}
Expand Down
168 changes: 168 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.2"
dart_style:
dependency: transitive
description:
Expand All @@ -239,6 +246,48 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.1"
device_info_plus:
dependency: transitive
description:
name: device_info_plus
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.0"
device_info_plus_linux:
dependency: transitive
description:
name: device_info_plus_linux
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0"
device_info_plus_macos:
dependency: transitive
description:
name: device_info_plus_macos
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0"
device_info_plus_platform_interface:
dependency: transitive
description:
name: device_info_plus_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0"
device_info_plus_web:
dependency: transitive
description:
name: device_info_plus_web
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0"
device_info_plus_windows:
dependency: transitive
description:
name: device_info_plus_windows
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.0"
diff_match_patch:
dependency: transitive
description:
Expand Down Expand Up @@ -506,6 +555,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
html:
dependency: transitive
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.1"
http:
dependency: "direct main"
description:
Expand Down Expand Up @@ -660,13 +716,62 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
os_detect:
dependency: transitive
description:
name: os_detect
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
package_info_plus:
dependency: transitive
description:
name: package_info_plus
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
package_info_plus_linux:
dependency: transitive
description:
name: package_info_plus_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
package_info_plus_macos:
dependency: transitive
description:
name: package_info_plus_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
package_info_plus_web:
dependency: transitive
description:
name: package_info_plus_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
package_info_plus_windows:
dependency: transitive
description:
name: package_info_plus_windows
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
path:
dependency: transitive
description:
Expand Down Expand Up @@ -856,6 +961,55 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
shared_preferences:
dependency: transitive
description:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.17"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.15"
shared_preferences_foundation:
dependency: transitive
description:
name: shared_preferences_foundation
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
shelf:
dependency: transitive
description:
Expand Down Expand Up @@ -1036,6 +1190,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
upgrader:
dependency: "direct main"
description:
name: upgrader
url: "https://pub.dartlang.org"
source: hosted
version: "4.11.1"
url_launcher:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1106,6 +1267,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
version:
dependency: transitive
description:
name: version
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
vm_service:
dependency: transitive
description:
Expand Down
3 changes: 3 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ dependencies:
# functional programming thingies
dartz: 0.10.1

# Upgrade notifier
upgrader: ^4.11.1
fremartini marked this conversation as resolved.
Show resolved Hide resolved

dev_dependencies:
flutter_test:
sdk: flutter
Expand Down