Skip to content

Commit 1ce4eb9

Browse files
committed
Perbaikan clipper untuk bottom navigation bar
1 parent e4b9321 commit 1ce4eb9

File tree

3 files changed

+78
-73
lines changed

3 files changed

+78
-73
lines changed

ios/Runner.xcodeproj/project.pbxproj

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@
99
/* Begin PBXBuildFile section */
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1111
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
12-
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
13-
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1412
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
15-
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
16-
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1713
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
1814
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
1915
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
@@ -26,8 +22,6 @@
2622
dstPath = "";
2723
dstSubfolderSpec = 10;
2824
files = (
29-
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
30-
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
3125
);
3226
name = "Embed Frameworks";
3327
runOnlyForDeploymentPostprocessing = 0;
@@ -38,13 +32,11 @@
3832
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
3933
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
4034
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
41-
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
4235
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
4336
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
4437
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
4538
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
4639
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
47-
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
4840
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
4941
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
5042
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@@ -57,8 +49,6 @@
5749
isa = PBXFrameworksBuildPhase;
5850
buildActionMask = 2147483647;
5951
files = (
60-
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
61-
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
6252
);
6353
runOnlyForDeploymentPostprocessing = 0;
6454
};
@@ -68,9 +58,7 @@
6858
9740EEB11CF90186004384FC /* Flutter */ = {
6959
isa = PBXGroup;
7060
children = (
71-
3B80C3931E831B6300D905FE /* App.framework */,
7261
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
73-
9740EEBA1CF902C7004384FC /* Flutter.framework */,
7462
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7563
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
7664
9740EEB31CF90195004384FC /* Generated.xcconfig */,
@@ -201,7 +189,7 @@
201189
);
202190
runOnlyForDeploymentPostprocessing = 0;
203191
shellPath = /bin/sh;
204-
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
192+
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
205193
};
206194
9740EEB61CF901F6004384FC /* Run Script */ = {
207195
isa = PBXShellScriptBuildPhase;

lib/clipper/wavy_bottom_navigation_bar_clipper.dart

Lines changed: 65 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,97 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter_screenutil/flutter_screenutil.dart';
23

34
class WavyBottomNavigationBarClipper extends CustomClipper<Path> {
5+
46
@override
57
Path getClip(Size size) {
68
Path path = Path();
9+
path.lineTo(0, 0);
10+
11+
var zeroControlPoint = Offset(((size.width / 10) - 30.w) / 2, 0);
12+
var zeroEndPoint = Offset((size.width / 10) - 30.w, 35.w);
13+
path.quadraticBezierTo(
14+
zeroControlPoint.dx,
15+
zeroControlPoint.dy,
16+
zeroEndPoint.dx,
17+
zeroEndPoint.dy,
18+
);
719

8-
path.lineTo(0, 2);
9-
path.lineTo(10, 3);
10-
path.lineTo(15, 5);
11-
path.lineTo(20, 10);
12-
var firstControlPoint = Offset((size.width / 3.6) - 40, 60);
13-
var firstEndPoint = Offset(size.width / 3.6, 10);
20+
path.lineTo(size.width / 10 - 30.w, 35.w);
21+
var firstControlPoint = Offset((size.width / 10) + 75.w, 160.w);
22+
var firstEndPoint = Offset((size.width / 10) + 150.w + 20.w, 35.w);
1423
path.quadraticBezierTo(
1524
firstControlPoint.dx,
1625
firstControlPoint.dy,
1726
firstEndPoint.dx,
1827
firstEndPoint.dy,
1928
);
20-
path.lineTo(size.width / 3.6, 10);
29+
path.lineTo((size.width / 10) + 150.w + 20.w, 35.w);
2130

22-
var dxSecondEndPoint = size.width / 3;
23-
var secondControlPoint = Offset(dxSecondEndPoint + 5, -10);
24-
var secondEndPoint = Offset(dxSecondEndPoint + 25, 10);
31+
double widthMiddleEndPoint = size.width / 2;
32+
double temp1 = (size.width / 10) + 150.w + 20.w;
33+
double temp2 = widthMiddleEndPoint - 75.w - 20.w;
34+
double dxFirstMiddleControlPoint = temp1 + ((temp2 - temp1).abs() / 2);
35+
var firstMiddleControlPoint = Offset(dxFirstMiddleControlPoint, -20.w);
36+
var firstMiddleEndPoint = Offset(temp2, 35.w);
2537
path.quadraticBezierTo(
26-
secondControlPoint.dx,
27-
secondControlPoint.dy,
28-
secondEndPoint.dx,
29-
secondEndPoint.dy,
38+
firstMiddleControlPoint.dx,
39+
firstMiddleControlPoint.dy,
40+
firstMiddleEndPoint.dx,
41+
firstMiddleEndPoint.dy,
3042
);
31-
path.lineTo(dxSecondEndPoint + 25, 10);
43+
path.lineTo(dxFirstMiddleControlPoint, 0);
3244

33-
var dxThirdEndPoint = size.width - (size.width / 2.5);
34-
var thirdControlPoint = Offset(dxThirdEndPoint - 36, 60);
35-
var thirdEndPoint = Offset((size.width / 3) * 2 - 25, 10);
45+
path.lineTo(widthMiddleEndPoint - 75.w - 20.w, 35.w);
46+
var middleControlPoint = Offset(widthMiddleEndPoint, 160.w);
47+
var middleEndPoint = Offset(widthMiddleEndPoint + 75.w + 20.w, 35.w);
3648
path.quadraticBezierTo(
37-
thirdControlPoint.dx,
38-
thirdControlPoint.dy,
39-
thirdEndPoint.dx,
40-
thirdEndPoint.dy,
49+
middleControlPoint.dx,
50+
middleControlPoint.dy,
51+
middleEndPoint.dx,
52+
middleEndPoint.dy,
4153
);
54+
path.lineTo(widthMiddleEndPoint + 75.w + 20.w, 35.w);
4255

43-
var dxFourthEndPoint = (size.width / 3) * 2;
44-
var fourthControlPoint = Offset(dxFourthEndPoint + 5, -10);
45-
var fourthEndPoint = Offset(dxFourthEndPoint + 25, 10);
56+
double widthLastEndPoint = size.width - ((size.width / 10) + 150.w + 20.w);
57+
double widthLastEndPoint2 = size.width - ((size.width / 10) - 30.w);
58+
double temp3 = widthMiddleEndPoint + 75.w + 20.w;
59+
double temp4 = widthLastEndPoint;
60+
double dxLastMiddleControlPoint = temp3 + ((temp4 - temp3).abs() / 2);
61+
var lastMiddleControlPoint = Offset(dxLastMiddleControlPoint, -20.w);
62+
var lastMiddleEndPoint = Offset(temp4, 35.w);
4663
path.quadraticBezierTo(
47-
fourthControlPoint.dx,
48-
fourthControlPoint.dy,
49-
fourthEndPoint.dx,
50-
fourthEndPoint.dy,
64+
lastMiddleControlPoint.dx,
65+
lastMiddleControlPoint.dy,
66+
lastMiddleEndPoint.dx,
67+
lastMiddleEndPoint.dy,
5168
);
69+
path.lineTo(widthLastEndPoint, 35.w);
5270

53-
var dxFifthEndPoint = size.width - ((size.width / 3.6) - 40);
54-
var fifthControlPoint = Offset(dxFifthEndPoint, 60);
55-
var fifthEndPoint = Offset(dxFifthEndPoint + 40, 10);
71+
var lastControlPoint = Offset(size.width - ((size.width / 10) + 75.w), 160.w);
72+
var lastEndPoint = Offset(widthLastEndPoint2, 35.w);
5673
path.quadraticBezierTo(
57-
fifthControlPoint.dx,
58-
fifthControlPoint.dy,
59-
fifthEndPoint.dx,
60-
fifthEndPoint.dy,
74+
lastControlPoint.dx,
75+
lastControlPoint.dy,
76+
lastEndPoint.dx,
77+
lastEndPoint.dy,
6178
);
79+
path.lineTo(widthLastEndPoint2, 35.w);
6280

63-
path.lineTo(size.width - 20, 10);
64-
path.lineTo(size.width - 15, 5);
65-
path.lineTo(size.width - 10, 3);
66-
path.lineTo(size.width, 2);
81+
double widthLastEndPoint3 = size.width - (((size.width / 10) - 30.w) / 2);
82+
var lastControlPoint2 = Offset(widthLastEndPoint3, 0);
83+
var lastEndPoint2 = Offset(size.width, 0.w);
84+
path.quadraticBezierTo(
85+
lastControlPoint2.dx,
86+
lastControlPoint2.dy,
87+
lastEndPoint2.dx,
88+
lastEndPoint2.dy,
89+
);
90+
91+
path.lineTo(size.width, 0);
6792
path.lineTo(size.width, size.height);
6893
path.lineTo(0, size.height);
6994
path.close();
70-
7195
return path;
7296
}
7397

pubspec.lock

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,42 @@ packages:
77
name: archive
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.0.11"
10+
version: "2.0.13"
1111
args:
1212
dependency: transitive
1313
description:
1414
name: args
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "1.5.2"
17+
version: "1.6.0"
1818
async:
1919
dependency: transitive
2020
description:
2121
name: async
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "2.4.0"
24+
version: "2.4.1"
2525
boolean_selector:
2626
dependency: transitive
2727
description:
2828
name: boolean_selector
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "1.0.5"
31+
version: "2.0.0"
3232
charcode:
3333
dependency: transitive
3434
description:
3535
name: charcode
3636
url: "https://pub.dartlang.org"
3737
source: hosted
38-
version: "1.1.2"
38+
version: "1.1.3"
3939
collection:
4040
dependency: transitive
4141
description:
4242
name: collection
4343
url: "https://pub.dartlang.org"
4444
source: hosted
45-
version: "1.14.11"
45+
version: "1.14.12"
4646
convert:
4747
dependency: transitive
4848
description:
@@ -56,7 +56,7 @@ packages:
5656
name: crypto
5757
url: "https://pub.dartlang.org"
5858
source: hosted
59-
version: "2.1.3"
59+
version: "2.1.4"
6060
cupertino_icons:
6161
dependency: "direct main"
6262
description:
@@ -87,7 +87,7 @@ packages:
8787
name: image
8888
url: "https://pub.dartlang.org"
8989
source: hosted
90-
version: "2.1.4"
90+
version: "2.1.12"
9191
matcher:
9292
dependency: transitive
9393
description:
@@ -109,13 +109,6 @@ packages:
109109
url: "https://pub.dartlang.org"
110110
source: hosted
111111
version: "1.6.4"
112-
pedantic:
113-
dependency: transitive
114-
description:
115-
name: pedantic
116-
url: "https://pub.dartlang.org"
117-
source: hosted
118-
version: "1.8.0+1"
119112
petitparser:
120113
dependency: transitive
121114
description:
@@ -129,7 +122,7 @@ packages:
129122
name: quiver
130123
url: "https://pub.dartlang.org"
131124
source: hosted
132-
version: "2.0.5"
125+
version: "2.1.3"
133126
sky_engine:
134127
dependency: transitive
135128
description: flutter
@@ -141,7 +134,7 @@ packages:
141134
name: source_span
142135
url: "https://pub.dartlang.org"
143136
source: hosted
144-
version: "1.5.5"
137+
version: "1.7.0"
145138
stack_trace:
146139
dependency: transitive
147140
description:
@@ -176,7 +169,7 @@ packages:
176169
name: test_api
177170
url: "https://pub.dartlang.org"
178171
source: hosted
179-
version: "0.2.11"
172+
version: "0.2.15"
180173
typed_data:
181174
dependency: transitive
182175
description:
@@ -197,6 +190,6 @@ packages:
197190
name: xml
198191
url: "https://pub.dartlang.org"
199192
source: hosted
200-
version: "3.5.0"
193+
version: "3.6.1"
201194
sdks:
202195
dart: ">=2.6.0 <3.0.0"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy