Skip to content

Commit

Permalink
work on long press on save button for addprogresscard
Browse files Browse the repository at this point in the history
  • Loading branch information
NeXTormer committed Jun 12, 2023
1 parent ecca9bb commit 6b1cca2
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 38 deletions.
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.8.21'
repositories {
google()
jcenter()
Expand Down Expand Up @@ -28,7 +28,7 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}

Expand Down
Empty file modified decrypt.sh
100644 → 100755
Empty file.
19 changes: 1 addition & 18 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
876F9496663AF784ACD46FBB /* [CP] Embed Pods Frameworks */,
F12FD65526FC60AD009A720C /* Crashlytics */,
335344252F5AF12CED64EB8A /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -213,30 +212,14 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
335344252F5AF12CED64EB8A /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/add_progress_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ class _AddProgressScreenState extends State<AddProgressScreen> {
child: AddProgressCard(
controller: controller,
activity: widget.activity,
onSave: () {
onSave: (bool longPress) {
saveData();
Navigator.of(context).pop();
if (!longPress) Navigator.of(context).pop();
},
onUseSmartSuggestions: () {
lastUsedRepsWeight = false;
Expand Down
26 changes: 18 additions & 8 deletions lib/widgets/add_progress_screen/add_progress_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AddProgressCard extends StatelessWidget {
final AddProgressController controller;
final FredericActivity activity;
final List<RepsWeightSuggestion>? suggestions;
final void Function() onSave;
final void Function(bool longpress) onSave;
final void Function()? onUseSmartSuggestions;
final void Function()? onUseRepsWeight;

Expand Down Expand Up @@ -85,13 +85,23 @@ class AddProgressCard extends StatelessWidget {
Padding(
padding: const EdgeInsets.only(
left: 0, right: 0, top: 16),
child: FredericButton(tr('save'), onPressed: () {
if (FredericBackend.instance.canUseApp) {
onSave();
} else {
FeatureNotPurchasedDialog.show(context);
}
}),
child: FredericButton(
tr('save'),
onPressed: () {
if (FredericBackend.instance.canUseApp) {
onSave(false);
} else {
FeatureNotPurchasedDialog.show(context);
}
},
onLongPress: () {
if (FredericBackend.instance.canUseApp) {
onSave(true);
} else {
FeatureNotPurchasedDialog.show(context);
}
},
),
)
],
),
Expand Down
12 changes: 12 additions & 0 deletions lib/widgets/standard_elements/frederic_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:frederic/main.dart';
class FredericButton extends StatelessWidget {
FredericButton(this.text,
{required this.onPressed,
this.onLongPress,
Color? mainColor,
Color? textColor,
this.inverted = false,
Expand All @@ -30,6 +31,7 @@ class FredericButton extends StatelessWidget {
final FontWeight fontWeight;

final void Function() onPressed;
final void Function()? onLongPress;

@override
Widget build(BuildContext context) {
Expand All @@ -42,6 +44,16 @@ class FredericButton extends StatelessWidget {
onPressed.call();
}
},
onLongPress: onLongPress == null
? null
: () {
if (haptics) {
HapticFeedback.selectionClick();
}
if (!loading) {
onLongPress?.call();
}
},
child: Container(
width: double.infinity,
height: height,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class _ActivityPlayerViewState extends State<ActivityPlayerView> {
return AddProgressCard(
controller: addProgressController,
activity: widget.activity.activity,
onSave: () => saveProgress(playerState),
onSave: (_) => saveProgress(playerState),
suggestions: widget.showSmartSuggestions
? setListData[widget.activity.activity.id]
.getSuggestions(
Expand Down
4 changes: 2 additions & 2 deletions macos/Flutter/ephemeral/Flutter-Generated.xcconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/home/felix/Dev/SDKs/flutter
FLUTTER_APPLICATION_PATH=/home/felix/Dev/Projects/frederic
FLUTTER_ROOT=/Users/felix/Developer/SDKs/flutter
FLUTTER_APPLICATION_PATH=/Users/felix/Developer/Projects/NeverSkip
COCOAPODS_PARALLEL_CODE_SIGN=true
FLUTTER_BUILD_DIR=build
FLUTTER_BUILD_NAME=1.0.1
Expand Down
4 changes: 2 additions & 2 deletions macos/Flutter/ephemeral/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/home/felix/Dev/SDKs/flutter"
export "FLUTTER_APPLICATION_PATH=/home/felix/Dev/Projects/frederic"
export "FLUTTER_ROOT=/Users/felix/Developer/SDKs/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/felix/Developer/Projects/NeverSkip"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=1.0.1"
Expand Down
8 changes: 5 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:

firebase_core: ^2.3.0
firebase_auth: ^4.1.5
cloud_firestore: ^4.1.0
cloud_firestore: ^4.8.0
firebase_storage: ^11.0.6
firebase_analytics: ^10.0.6
firebase_messaging: ^14.1.3
Expand Down Expand Up @@ -55,7 +55,7 @@ dependencies:
shimmer: ^2.0.0
fl_chart: ^0.55.2
confetti: ^0.7.0
screenshot: ^1.2.3
screenshot: ^2.1.0
animations: ^2.0.1
fluttertoast: ^8.0.6
image_picker: ^0.8.3+2
Expand All @@ -67,10 +67,12 @@ dependencies:
infinite_listview: ^1.1.0
introduction_screen: ^3.0.0
cached_network_image: ^3.0.0
# modal_bottom_sheet: ^2.1.2


modal_bottom_sheet:
git:
url: git@github.com:jamesblasco/modal_bottom_sheet.git
url: https://github.com/jamesblasco/modal_bottom_sheet.git
path: modal_bottom_sheet

easy_localization: ^3.0.0
Expand Down

0 comments on commit 6b1cca2

Please sign in to comment.