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 Enhanced Navigation Methods to WoltModalSheet #188

Merged
merged 10 commits into from
May 3, 2024
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
298 changes: 197 additions & 101 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion coffee_maker/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
1 change: 1 addition & 0 deletions coffee_maker/devtools_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extensions:
1 change: 1 addition & 0 deletions coffee_maker/ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions coffee_maker/ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
44 changes: 44 additions & 0 deletions coffee_maker/ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ class _LargeScreenCoffeeOrderListHeader extends StatelessWidget {
),
child: Text(
'${_coffeeMakerStep.stepName} ($_count)',
style: Theme.of(context).textTheme.titleMedium!,
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(color: Colors.black),
textAlign: TextAlign.center,
),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import 'package:coffee_maker/home/online/view_model/store_online_view_model.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:wolt_modal_sheet/wolt_modal_sheet.dart';

class AddWaterDescriptionModalPage {
AddWaterDescriptionModalPage._();

static WoltModalSheetPage build({
required VoidCallback onCancelPressed,
required VoidCallback onNextPage,
required VoidCallback onClosed,
}) {
static WoltModalSheetPage build(String coffeeOrderId) {
return WoltModalSheetPage(
heroImage: const Image(
image: AssetImage('lib/assets/images/add_water_description.png'),
Expand All @@ -19,24 +17,35 @@ class AddWaterDescriptionModalPage {
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
child: Column(
children: [
WoltElevatedButton(
onPressed: onCancelPressed,
theme: WoltElevatedButtonTheme.secondary,
child: const Text('Cancel order'),
),
Builder(builder: (context) {
final model = context.read<StoreOnlineViewModel>();

return WoltElevatedButton(
onPressed: () {
model.onCoffeeOrderStatusChange(coffeeOrderId);
Navigator.pop(context);
},
theme: WoltElevatedButtonTheme.secondary,
child: const Text('Cancel order'),
);
}),
const SizedBox(height: 8),
WoltElevatedButton(
onPressed: onNextPage,
child: const Text('Continue to temperature'),
),
Builder(builder: (context) {
return WoltElevatedButton(
onPressed: WoltModalSheet.of(context).showNext,
child: const Text('Continue to temperature'),
);
}),
],
),
),
pageTitle: const ModalSheetTitle(
'Adding water for coffee',
textAlign: TextAlign.center,
),
trailingNavBarWidget: WoltModalSheetCloseButton(onClosed: onClosed),
trailingNavBarWidget: Builder(builder: (context) {
return WoltModalSheetCloseButton(onClosed: Navigator.of(context).pop);
}),
child: const Padding(
padding: EdgeInsets.only(bottom: (2 * WoltElevatedButton.height) + 8),
child: Padding(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import 'package:coffee_maker/entities/coffee_maker_step.dart';
import 'package:coffee_maker/home/online/modal_pages/add_water/widgets/water_quantity_temperature_input.dart';
import 'package:coffee_maker/home/online/modal_pages/add_water/widgets/water_source_list.dart';
import 'package:coffee_maker/home/online/view_model/store_online_view_model.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:wolt_modal_sheet/wolt_modal_sheet.dart';

class WaterSettingsModalPage {
WaterSettingsModalPage._();

static WoltModalSheetPage build({
required VoidCallback onBackButtonPressed,
required VoidCallback onClosed,
required VoidCallback onWaterAdded,
}) {
static WoltModalSheetPage build(String coffeeOrderId) {
final buttonEnabledListener = ValueNotifier(false);
const pageTitle = 'Water settings';

Expand All @@ -21,18 +20,24 @@ class WaterSettingsModalPage {
builder: (_, isEnabled, __) {
return Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
child: WoltElevatedButton(
onPressed: onWaterAdded,
enabled: isEnabled,
child: const Text('Finish adding water'),
),
child: Builder(builder: (context) {
final model = context.read<StoreOnlineViewModel>();
return WoltElevatedButton(
onPressed: () {
model.onCoffeeOrderStatusChange(
coffeeOrderId, CoffeeMakerStep.ready);
Navigator.pop(context);
},
enabled: isEnabled,
child: const Text('Finish adding water'),
);
}),
);
},
),
pageTitle: const ModalSheetTitle(pageTitle),
trailingNavBarWidget: WoltModalSheetCloseButton(onClosed: onClosed),
leadingNavBarWidget:
WoltModalSheetBackButton(onBackPressed: onBackButtonPressed),
trailingNavBarWidget: const WoltModalSheetCloseButton(),
leadingNavBarWidget: const WoltModalSheetBackButton(),
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 16, 16, 120),
child: Column(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,40 +1,47 @@
import 'package:coffee_maker/entities/coffee_maker_step.dart';
import 'package:coffee_maker/home/online/view_model/store_online_view_model.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:wolt_modal_sheet/wolt_modal_sheet.dart';

class GrindOrRejectModalPage {
GrindOrRejectModalPage._();

static WoltModalSheetPage build({
required String coffeeOrderId,
required VoidCallback onRejectPressed,
required VoidCallback onStartGrinding,
required VoidCallback onClosed,
}) {
static WoltModalSheetPage build({required String coffeeOrderId}) {
return WoltModalSheetPage(
stickyActionBar: Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
child: Column(
children: [
WoltElevatedButton(
onPressed: onRejectPressed,
theme: WoltElevatedButtonTheme.secondary,
colorName: WoltColorName.red,
child: const Text('Reject order'),
),
Builder(builder: (context) {
return WoltElevatedButton(
onPressed: WoltModalSheet.of(context).showNext,
theme: WoltElevatedButtonTheme.secondary,
colorName: WoltColorName.red,
child: const Text('Reject order'),
);
}),
const SizedBox(height: 8),
WoltElevatedButton(
onPressed: onStartGrinding,
child: const Text('Start grinding'),
),
Builder(builder: (context) {
final model = context.read<StoreOnlineViewModel>();
return WoltElevatedButton(
onPressed: () {
model.onCoffeeOrderStatusChange(
coffeeOrderId, CoffeeMakerStep.addWater);
Navigator.pop(context);
},
child: const Text('Start grinding'),
);
}),
],
),
),
pageTitle: ModalSheetTitle(
'Are you ready to prepare order $coffeeOrderId?',
textAlign: TextAlign.center,
),
trailingNavBarWidget: WoltModalSheetCloseButton(onClosed: onClosed),
trailingNavBarWidget: const WoltModalSheetCloseButton(),
child: const Padding(
padding: EdgeInsets.only(bottom: (2 * WoltElevatedButton.height) + 48),
child: Padding(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import 'package:coffee_maker/home/online/modal_pages/grind/reject_order_reason.dart';
import 'package:coffee_maker/home/online/view_model/store_online_view_model.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:wolt_modal_sheet/wolt_modal_sheet.dart';

class RejectOrderModalPage {
RejectOrderModalPage._();

static WoltModalSheetPage build({
required VoidCallback onCoffeeOrderRejected,
required VoidCallback onBackButtonPressed,
required VoidCallback onClosed,
}) {
static WoltModalSheetPage build({required String coffeeOrderId}) {
final buttonEnabledListener = ValueNotifier(false);

return WoltModalSheetPage(
Expand All @@ -19,20 +17,25 @@ class RejectOrderModalPage {
builder: (_, isEnabled, __) {
return Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
child: WoltElevatedButton(
onPressed: onCoffeeOrderRejected,
theme: WoltElevatedButtonTheme.secondary,
colorName: WoltColorName.red,
enabled: isEnabled,
child: const Text('Reject'),
),
child: Builder(builder: (context) {
final model = context.read<StoreOnlineViewModel>();
return WoltElevatedButton(
onPressed: () {
model.onCoffeeOrderStatusChange(coffeeOrderId);
Navigator.pop(context);
},
theme: WoltElevatedButtonTheme.secondary,
colorName: WoltColorName.red,
enabled: isEnabled,
child: const Text('Reject'),
);
}),
);
},
),
pageTitle: const ModalSheetTitle('Reject order'),
trailingNavBarWidget: WoltModalSheetCloseButton(onClosed: onClosed),
leadingNavBarWidget:
WoltModalSheetBackButton(onBackPressed: onBackButtonPressed),
trailingNavBarWidget: const WoltModalSheetCloseButton(),
leadingNavBarWidget: const WoltModalSheetBackButton(),
child: Padding(
padding: const EdgeInsets.only(bottom: 120),
child: Padding(
Expand Down
Loading
Loading