Skip to content

Commit 6f62683

Browse files
committed
feat: Add iOS Swift Package Manager support, update plugin initialization, and enhance example usage
1 parent 250a1a8 commit 6f62683

15 files changed

Lines changed: 199 additions & 96 deletions

File tree

.github/workflows/publish_to_pub.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,32 @@ name: Publish to Pub.dev
33
on:
44
push:
55
branches: [beta, main]
6+
workflow_dispatch:
67
workflow_call:
78
secrets:
89
CREDENTIAL_JSON:
9-
required: true
10+
required: false
11+
OAUTH_ACCESS_TOKEN:
12+
required: false
13+
OAUTH_REFRESH_TOKEN:
14+
required: false
15+
16+
concurrency:
17+
group: pub-publish
18+
cancel-in-progress: false
1019

1120
jobs:
1221
publishing:
1322
runs-on: ubuntu-latest
1423
steps:
1524
- name: "Checkout"
16-
uses: actions/checkout@v2 # required!
25+
uses: actions/checkout@v4
1726

1827
- name: ">> Flutter package <<"
19-
uses: k-paxian/dart-package-publisher@master
28+
uses: k-paxian/dart-package-publisher@v.1.6.2
2029
with:
30+
accessToken: ${{ secrets.OAUTH_ACCESS_TOKEN }}
31+
refreshToken: ${{ secrets.OAUTH_REFRESH_TOKEN }}
2132
credentialJson: ${{ secrets.CREDENTIAL_JSON }}
2233
flutter: true
2334
skipTests: true

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.0.8 - 2026-05-23
2+
3+
- feat: Add iOS Swift Package Manager support alongside CocoaPods
4+
15
## 0.0.7 - 2026-05-19
26

37
Device dataset Updated

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ dependencies:
1717
corner_radius_plugin: any
1818
```
1919
20+
### iOS package managers
21+
22+
The iOS implementation now supports both CocoaPods and Swift Package Manager.
23+
24+
- **CocoaPods** continues to work for existing Flutter iOS projects.
25+
- **Swift Package Manager** works with Flutter's SwiftPM integration on supported Flutter/Xcode versions; no extra plugin-side setup is required beyond enabling SwiftPM for the host app.
26+
2027
## Usage
2128
2229
Initialize during app startup, e.g. in `main()` or `initState()`.

example/README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ Demonstrates how to use the corner_radius_plugin plugin.
44

55
## Getting Started
66

7-
This project is a starting point for a Flutter application.
7+
This example initializes the plugin once at startup and then reads the value
8+
from `CornerRadiusPlugin.screenRadius`.
89

9-
A few resources to get you started if this is your first Flutter project:
10+
Key points:
1011

11-
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
12-
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
12+
- Call `await CornerRadiusPlugin.init(defaultRadius: 12)` once (for example in
13+
`initState`).
14+
- Use `CornerRadiusPlugin.screenRadius` for the current corner values.
15+
- Provide a non-zero `defaultRadius` as a fallback for unsupported platforms or
16+
unknown devices.
1317

14-
For help getting started with Flutter development, view the
15-
[online documentation](https://docs.flutter.dev/), which offers tutorials,
16-
samples, guidance on mobile development, and a full API reference.
18+
Run the example from the package root with Flutter as usual.

example/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,5 @@
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
23-
<key>MinimumOSVersion</key>
24-
<string>13.0</string>
2523
</dict>
2624
</plist>

example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- corner_radius_plugin (0.0.1):
2+
- corner_radius_plugin (0.0.8):
33
- Flutter
44
- Flutter (1.0.0)
55
- integration_test (0.0.1):
@@ -19,7 +19,7 @@ EXTERNAL SOURCES:
1919
:path: ".symlinks/plugins/integration_test/ios"
2020

2121
SPEC CHECKSUMS:
22-
corner_radius_plugin: ff13d7cf5bf4a014c88393c0d304b9dd1f45b85c
22+
corner_radius_plugin: 81c1da586a9b45e894ca04f4226574e73121eb9a
2323
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
2424
integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586e
2525

example/ios/Runner/AppDelegate.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ import Flutter
22
import UIKit
33

44
@main
5-
@objc class AppDelegate: FlutterAppDelegate {
5+
@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate {
66
override func application(
77
_ application: UIApplication,
88
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
99
) -> Bool {
10-
GeneratedPluginRegistrant.register(with: self)
1110
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
1211
}
12+
13+
func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
14+
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
15+
}
1316
}

example/ios/Runner/Info.plist

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5+
<key>CADisableMinimumFrameDurationOnPhone</key>
6+
<true/>
57
<key>CFBundleDevelopmentRegion</key>
68
<string>$(DEVELOPMENT_LANGUAGE)</string>
79
<key>CFBundleDisplayName</key>
@@ -24,6 +26,29 @@
2426
<string>$(FLUTTER_BUILD_NUMBER)</string>
2527
<key>LSRequiresIPhoneOS</key>
2628
<true/>
29+
<key>UIApplicationSceneManifest</key>
30+
<dict>
31+
<key>UIApplicationSupportsMultipleScenes</key>
32+
<false/>
33+
<key>UISceneConfigurations</key>
34+
<dict>
35+
<key>UIWindowSceneSessionRoleApplication</key>
36+
<array>
37+
<dict>
38+
<key>UISceneClassName</key>
39+
<string>UIWindowScene</string>
40+
<key>UISceneConfigurationName</key>
41+
<string>flutter</string>
42+
<key>UISceneDelegateClassName</key>
43+
<string>FlutterSceneDelegate</string>
44+
<key>UISceneStoryboardFile</key>
45+
<string>Main</string>
46+
</dict>
47+
</array>
48+
</dict>
49+
</dict>
50+
<key>UIApplicationSupportsIndirectInputEvents</key>
51+
<true/>
2752
<key>UILaunchStoryboardName</key>
2853
<string>LaunchScreen</string>
2954
<key>UIMainStoryboardFile</key>
@@ -41,9 +66,5 @@
4166
<string>UIInterfaceOrientationLandscapeLeft</string>
4267
<string>UIInterfaceOrientationLandscapeRight</string>
4368
</array>
44-
<key>CADisableMinimumFrameDurationOnPhone</key>
45-
<true/>
46-
<key>UIApplicationSupportsIndirectInputEvents</key>
47-
<true/>
4869
</dict>
4970
</plist>

example/lib/main.dart

Lines changed: 81 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,24 @@ class MyApp extends StatefulWidget {
1414
}
1515

1616
class _MyAppState extends State<MyApp> {
17+
late final Future<CornerRadius> _radiusFuture;
18+
1719
@override
1820
void initState() {
1921
super.initState();
22+
// Initialize once with a non-zero fallback radius for unsupported devices.
23+
_radiusFuture = CornerRadiusPlugin.init(defaultRadius: 12);
2024
}
2125

2226
@override
2327
Widget build(BuildContext context) {
2428
return MaterialApp(
29+
debugShowCheckedModeBanner: false,
2530
home: Scaffold(
31+
appBar: AppBar(title: const Text('Corner Radius Plugin Example')),
2632
body: SafeArea(
2733
child: FutureBuilder(
28-
future: CornerRadiusPlugin.init(),
34+
future: _radiusFuture,
2935
builder: (context, snapshot) {
3036
if (!snapshot.hasData) {
3137
return const Center(child: CircularProgressIndicator());
@@ -36,57 +42,69 @@ class _MyAppState extends State<MyApp> {
3642
return const Center(child: Text('No data'));
3743
}
3844

45+
// Demonstrate the static getter after init.
46+
final screenRadius = CornerRadiusPlugin.screenRadius;
47+
3948
return Padding(
4049
padding: const EdgeInsets.all(16),
41-
child: DecoratedBox(
42-
decoration: BoxDecoration(
43-
color: Colors.blue,
44-
borderRadius: BorderRadius.only(
45-
topLeft: Radius.circular(data.topLeft),
46-
topRight: Radius.circular(data.topRight),
47-
bottomLeft: Radius.circular(data.bottomLeft),
48-
bottomRight: Radius.circular(data.bottomRight),
49-
),
50-
),
51-
child: Padding(
52-
padding: const EdgeInsets.all(32),
53-
child: Stack(
54-
children: [
55-
Align(
56-
alignment: Alignment.topLeft,
57-
child: Text(
58-
data.topLeft.toStringAsFixed(2).toString(),
59-
textAlign: TextAlign.center,
60-
style: TextStyle(color: Colors.white, fontSize: 32),
61-
),
62-
),
63-
Align(
64-
alignment: Alignment.topRight,
65-
child: Text(
66-
data.topRight.toStringAsFixed(2).toString(),
67-
textAlign: TextAlign.center,
68-
style: TextStyle(color: Colors.white, fontSize: 32),
50+
child: Column(
51+
crossAxisAlignment: CrossAxisAlignment.stretch,
52+
children: [
53+
Expanded(
54+
child: DecoratedBox(
55+
decoration: BoxDecoration(
56+
color: Colors.blue,
57+
borderRadius: BorderRadius.only(
58+
topLeft: Radius.circular(screenRadius.topLeft),
59+
topRight: Radius.circular(screenRadius.topRight),
60+
bottomLeft: Radius.circular(
61+
screenRadius.bottomLeft,
62+
),
63+
bottomRight: Radius.circular(
64+
screenRadius.bottomRight,
65+
),
6966
),
7067
),
71-
Align(
72-
alignment: Alignment.bottomLeft,
73-
child: Text(
74-
data.bottomLeft.toStringAsFixed(2).toString(),
75-
textAlign: TextAlign.center,
76-
style: TextStyle(color: Colors.white, fontSize: 32),
68+
child: Padding(
69+
padding: const EdgeInsets.all(24),
70+
child: Stack(
71+
children: [
72+
_CornerValue(
73+
alignment: Alignment.topLeft,
74+
value: screenRadius.topLeft,
75+
),
76+
_CornerValue(
77+
alignment: Alignment.topRight,
78+
value: screenRadius.topRight,
79+
),
80+
_CornerValue(
81+
alignment: Alignment.bottomLeft,
82+
value: screenRadius.bottomLeft,
83+
),
84+
_CornerValue(
85+
alignment: Alignment.bottomRight,
86+
value: screenRadius.bottomRight,
87+
),
88+
],
7789
),
7890
),
79-
Align(
80-
alignment: Alignment.bottomRight,
81-
child: Text(
82-
data.bottomRight.toStringAsFixed(2).toString(),
83-
textAlign: TextAlign.center,
84-
style: TextStyle(color: Colors.white, fontSize: 32),
85-
),
91+
),
92+
),
93+
const SizedBox(height: 16),
94+
Card(
95+
child: Padding(
96+
padding: const EdgeInsets.all(12),
97+
child: Text(
98+
'Initialized with defaultRadius: 12\n'
99+
'Current values (TL, TR, BL, BR): '
100+
'${screenRadius.topLeft.toStringAsFixed(2)}, '
101+
'${screenRadius.topRight.toStringAsFixed(2)}, '
102+
'${screenRadius.bottomLeft.toStringAsFixed(2)}, '
103+
'${screenRadius.bottomRight.toStringAsFixed(2)}',
86104
),
87-
],
105+
),
88106
),
89-
),
107+
],
90108
),
91109
);
92110
},
@@ -96,3 +114,22 @@ class _MyAppState extends State<MyApp> {
96114
);
97115
}
98116
}
117+
118+
class _CornerValue extends StatelessWidget {
119+
const _CornerValue({required this.alignment, required this.value});
120+
121+
final Alignment alignment;
122+
final double value;
123+
124+
@override
125+
Widget build(BuildContext context) {
126+
return Align(
127+
alignment: alignment,
128+
child: Text(
129+
value.toStringAsFixed(2),
130+
textAlign: TextAlign.center,
131+
style: const TextStyle(color: Colors.white, fontSize: 28),
132+
),
133+
);
134+
}
135+
}

ios/Classes/UIDevice+ModelIdentifier.swift

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)