Skip to content

Commit 32ce841

Browse files
committed
format
1 parent efc86aa commit 32ce841

File tree

8 files changed

+75
-79
lines changed

8 files changed

+75
-79
lines changed

example/lib/pages/demos/popup_menu_demo_page.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,8 @@ class _PopupMenuDemoPageState extends State<PopupMenuDemoPage> {
332332
setState(() {
333333
if (item.value == 'toggle_mode') {
334334
_editMode = !_editMode;
335-
_selectedAction = 'Switched to ${_editMode ? "Edit" : "View"} mode';
335+
_selectedAction =
336+
'Switched to ${_editMode ? "Edit" : "View"} mode';
336337
} else {
337338
_selectedAction = item.label;
338339
}
@@ -343,7 +344,10 @@ class _PopupMenuDemoPageState extends State<PopupMenuDemoPage> {
343344
),
344345
const SizedBox(width: 16),
345346
Container(
346-
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
347+
padding: const EdgeInsets.symmetric(
348+
horizontal: 12,
349+
vertical: 6,
350+
),
347351
decoration: BoxDecoration(
348352
color: _editMode
349353
? CupertinoColors.systemYellow.withOpacity(0.2)

example/lib/test_tab_colors.dart

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,13 @@ class _TestTabColorsState extends State<TestTabColors> {
3030
@override
3131
Widget build(BuildContext context) {
3232
return AdaptiveScaffold(
33-
appBar: AdaptiveAppBar(
34-
title: 'Tab Bar Color Test',
35-
),
33+
appBar: AdaptiveAppBar(title: 'Tab Bar Color Test'),
3634
body: Center(
3735
child: Column(
3836
mainAxisAlignment: MainAxisAlignment.center,
3937
children: [
40-
Text('Selected Tab: $_selectedIndex',
38+
Text(
39+
'Selected Tab: $_selectedIndex',
4140
style: const TextStyle(fontSize: 24),
4241
),
4342
const SizedBox(height: 20),
@@ -48,23 +47,14 @@ class _TestTabColorsState extends State<TestTabColors> {
4847
),
4948
bottomNavigationBar: AdaptiveBottomNavigationBar(
5049
items: [
51-
AdaptiveNavigationDestination(
52-
icon: 'house',
53-
label: 'Home',
54-
),
50+
AdaptiveNavigationDestination(icon: 'house', label: 'Home'),
5551
AdaptiveNavigationDestination(
5652
icon: 'magnifyingglass',
5753
label: 'Search',
5854
isSearch: true,
5955
),
60-
AdaptiveNavigationDestination(
61-
icon: 'person',
62-
label: 'Profile',
63-
),
64-
AdaptiveNavigationDestination(
65-
icon: 'gearshape',
66-
label: 'Settings',
67-
),
56+
AdaptiveNavigationDestination(icon: 'person', label: 'Profile'),
57+
AdaptiveNavigationDestination(icon: 'gearshape', label: 'Settings'),
6858
],
6959
selectedIndex: _selectedIndex,
7060
onTap: (index) {
@@ -78,4 +68,4 @@ class _TestTabColorsState extends State<TestTabColors> {
7868
),
7969
);
8070
}
81-
}
71+
}

lib/src/widgets/adaptive_blur_view.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,7 @@ class AdaptiveBlurView extends StatelessWidget {
7474
child: Container(
7575
decoration: BoxDecoration(
7676
borderRadius: borderRadius,
77-
border: Border.all(
78-
color: _getBorderColor(context),
79-
width: 0.5,
80-
),
77+
border: Border.all(color: _getBorderColor(context), width: 0.5),
8178
),
8279
),
8380
),

lib/src/widgets/adaptive_popup_menu_button.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,12 @@ class _MaterialPopupMenuButton<T> extends StatefulWidget {
243243
bool get isCustomWidget => child != null;
244244

245245
@override
246-
State<_MaterialPopupMenuButton<T>> createState() => _MaterialPopupMenuButtonState<T>();
246+
State<_MaterialPopupMenuButton<T>> createState() =>
247+
_MaterialPopupMenuButtonState<T>();
247248
}
248249

249-
class _MaterialPopupMenuButtonState<T> extends State<_MaterialPopupMenuButton<T>> {
250+
class _MaterialPopupMenuButtonState<T>
251+
extends State<_MaterialPopupMenuButton<T>> {
250252
@override
251253
Widget build(BuildContext context) {
252254
final menuItems = <PopupMenuEntry<int>>[];

lib/src/widgets/adaptive_scaffold.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ class _AdaptiveScaffoldState extends State<AdaptiveScaffold> {
261261
minimizeBehavior: widget.minimizeBehavior,
262262
enableBlur: widget.enableBlur,
263263
selectedItemColor: widget.bottomNavigationBar!.selectedItemColor,
264-
unselectedItemColor: widget.bottomNavigationBar!.unselectedItemColor,
264+
unselectedItemColor:
265+
widget.bottomNavigationBar!.unselectedItemColor,
265266
);
266267
}
267268
// iOS 26+ with useNativeBottomBar=false OR iOS <26
@@ -276,7 +277,8 @@ class _AdaptiveScaffoldState extends State<AdaptiveScaffold> {
276277
currentIndex: widget.bottomNavigationBar!.selectedIndex!,
277278
onTap: widget.bottomNavigationBar!.onTap!,
278279
activeColor: widget.bottomNavigationBar!.selectedItemColor,
279-
inactiveColor: widget.bottomNavigationBar!.unselectedItemColor ??
280+
inactiveColor:
281+
widget.bottomNavigationBar!.unselectedItemColor ??
280282
CupertinoColors.inactiveGray,
281283
items: widget.bottomNavigationBar!.items!.map((dest) {
282284
// Convert icon to IconData if it's a String (SF Symbol)
@@ -757,7 +759,8 @@ class _MinimizableTabBarState extends State<_MinimizableTabBar>
757759
destinations: widget.destinations,
758760
selectedIndex: widget.selectedIndex,
759761
onTap: widget.onTap,
760-
tint: widget.selectedItemColor ?? CupertinoTheme.of(context).primaryColor,
762+
tint:
763+
widget.selectedItemColor ?? CupertinoTheme.of(context).primaryColor,
761764
unselectedItemTint: widget.unselectedItemColor,
762765
minimizeBehavior: widget.minimizeBehavior,
763766
),

lib/src/widgets/ios26/ios26_native_tab_bar.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ class _IOS26NativeTabBarState extends State<IOS26NativeTabBar> {
7878
if (color is CupertinoDynamicColor) {
7979
// Resolve based on current brightness
8080
final brightness = MediaQuery.platformBrightnessOf(context);
81-
resolvedColor = brightness == Brightness.dark ? color.darkColor : color.color;
81+
resolvedColor = brightness == Brightness.dark
82+
? color.darkColor
83+
: color.color;
8284
}
8385

8486
return ((resolvedColor.a * 255.0).round() & 0xff) << 24 |
@@ -119,7 +121,6 @@ class _IOS26NativeTabBarState extends State<IOS26NativeTabBar> {
119121
'backgroundColor': _colorToARGB(widget.backgroundColor!),
120122
};
121123

122-
123124
final platformView = UiKitView(
124125
viewType: 'adaptive_platform_ui/ios26_tab_bar',
125126
creationParams: creationParams,

lib/src/widgets/ios26/ios26_popup_menu_button.dart

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ class _IOS26PopupMenuButtonState<T> extends State<IOS26PopupMenuButton<T>> {
199199

200200
if (oldItem.runtimeType != newItem.runtimeType) return true;
201201

202-
if (oldItem is AdaptivePopupMenuItem<T> && newItem is AdaptivePopupMenuItem<T>) {
202+
if (oldItem is AdaptivePopupMenuItem<T> &&
203+
newItem is AdaptivePopupMenuItem<T>) {
203204
if (oldItem.label != newItem.label ||
204205
oldItem.icon != newItem.icon ||
205206
oldItem.enabled != newItem.enabled ||
@@ -299,12 +300,14 @@ class _IOS26PopupMenuButtonState<T> extends State<IOS26PopupMenuButton<T>> {
299300
};
300301

301302
// Create a unique key based on button label/icon and items to force recreation on change
302-
final itemsKey = widget.items.map((item) {
303-
if (item is AdaptivePopupMenuItem<T>) {
304-
return '${item.label}_${item.icon}_${item.enabled}_${item.value}';
305-
}
306-
return 'divider';
307-
}).join('_');
303+
final itemsKey = widget.items
304+
.map((item) {
305+
if (item is AdaptivePopupMenuItem<T>) {
306+
return '${item.label}_${item.icon}_${item.enabled}_${item.value}';
307+
}
308+
return 'divider';
309+
})
310+
.join('_');
308311

309312
final viewKey = ValueKey(
310313
'${widget.buttonLabel}_${widget.buttonIcon}_${widget.child?.runtimeType}_$itemsKey',

test/adaptive_blur_view_test.dart

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,16 @@ void main() {
77
testWidgets('creates blur view with child', (WidgetTester tester) async {
88
await tester.pumpWidget(
99
const MaterialApp(
10-
home: Scaffold(
11-
body: AdaptiveBlurView(
12-
child: Text('Test Child'),
13-
),
14-
),
10+
home: Scaffold(body: AdaptiveBlurView(child: Text('Test Child'))),
1511
),
1612
);
1713

1814
expect(find.text('Test Child'), findsOneWidget);
1915
});
2016

21-
testWidgets('creates blur view with custom blur style',
22-
(WidgetTester tester) async {
17+
testWidgets('creates blur view with custom blur style', (
18+
WidgetTester tester,
19+
) async {
2320
await tester.pumpWidget(
2421
const MaterialApp(
2522
home: Scaffold(
@@ -35,8 +32,9 @@ void main() {
3532
expect(find.byType(AdaptiveBlurView), findsOneWidget);
3633
});
3734

38-
testWidgets('creates blur view with border radius',
39-
(WidgetTester tester) async {
35+
testWidgets('creates blur view with border radius', (
36+
WidgetTester tester,
37+
) async {
4038
await tester.pumpWidget(
4139
MaterialApp(
4240
home: Scaffold(
@@ -52,8 +50,9 @@ void main() {
5250
expect(find.byType(ClipRRect), findsWidgets);
5351
});
5452

55-
testWidgets('applies BackdropFilter on non-iOS 26 platforms',
56-
(WidgetTester tester) async {
53+
testWidgets('applies BackdropFilter on non-iOS 26 platforms', (
54+
WidgetTester tester,
55+
) async {
5756
await tester.pumpWidget(
5857
const MaterialApp(
5958
home: Scaffold(
@@ -80,16 +79,23 @@ void main() {
8079
});
8180

8281
test('BlurStyle converts to UIBlurEffect style string correctly', () {
83-
expect(BlurStyle.systemUltraThinMaterial.toUIBlurEffectStyle(),
84-
'systemUltraThinMaterial');
85-
expect(BlurStyle.systemThinMaterial.toUIBlurEffectStyle(),
86-
'systemThinMaterial');
8782
expect(
88-
BlurStyle.systemMaterial.toUIBlurEffectStyle(), 'systemMaterial');
89-
expect(BlurStyle.systemThickMaterial.toUIBlurEffectStyle(),
90-
'systemThickMaterial');
91-
expect(BlurStyle.systemChromeMaterial.toUIBlurEffectStyle(),
92-
'systemChromeMaterial');
83+
BlurStyle.systemUltraThinMaterial.toUIBlurEffectStyle(),
84+
'systemUltraThinMaterial',
85+
);
86+
expect(
87+
BlurStyle.systemThinMaterial.toUIBlurEffectStyle(),
88+
'systemThinMaterial',
89+
);
90+
expect(BlurStyle.systemMaterial.toUIBlurEffectStyle(), 'systemMaterial');
91+
expect(
92+
BlurStyle.systemThickMaterial.toUIBlurEffectStyle(),
93+
'systemThickMaterial',
94+
);
95+
expect(
96+
BlurStyle.systemChromeMaterial.toUIBlurEffectStyle(),
97+
'systemChromeMaterial',
98+
);
9399
});
94100

95101
test('BlurStyle converts to ImageFilter correctly', () {
@@ -99,16 +105,13 @@ void main() {
99105
expect(filter.runtimeType.toString(), contains('ImageFilter'));
100106
});
101107

102-
testWidgets('blur view works with different children widgets',
103-
(WidgetTester tester) async {
108+
testWidgets('blur view works with different children widgets', (
109+
WidgetTester tester,
110+
) async {
104111
// Test with Icon
105112
await tester.pumpWidget(
106113
const MaterialApp(
107-
home: Scaffold(
108-
body: AdaptiveBlurView(
109-
child: Icon(Icons.home),
110-
),
111-
),
114+
home: Scaffold(body: AdaptiveBlurView(child: Icon(Icons.home))),
112115
),
113116
);
114117
expect(find.byIcon(Icons.home), findsOneWidget);
@@ -118,11 +121,7 @@ void main() {
118121
MaterialApp(
119122
home: Scaffold(
120123
body: AdaptiveBlurView(
121-
child: Container(
122-
width: 100,
123-
height: 100,
124-
color: Colors.red,
125-
),
124+
child: Container(width: 100, height: 100, color: Colors.red),
126125
),
127126
),
128127
),
@@ -134,12 +133,7 @@ void main() {
134133
const MaterialApp(
135134
home: Scaffold(
136135
body: AdaptiveBlurView(
137-
child: Column(
138-
children: [
139-
Text('Line 1'),
140-
Text('Line 2'),
141-
],
142-
),
136+
child: Column(children: [Text('Line 1'), Text('Line 2')]),
143137
),
144138
),
145139
),
@@ -148,8 +142,9 @@ void main() {
148142
expect(find.text('Line 2'), findsOneWidget);
149143
});
150144

151-
testWidgets('blur view applies correct background color in light mode',
152-
(WidgetTester tester) async {
145+
testWidgets('blur view applies correct background color in light mode', (
146+
WidgetTester tester,
147+
) async {
153148
await tester.pumpWidget(
154149
MaterialApp(
155150
theme: ThemeData(brightness: Brightness.light),
@@ -167,8 +162,9 @@ void main() {
167162
expect(find.byType(BackdropFilter), findsOneWidget);
168163
});
169164

170-
testWidgets('blur view applies correct background color in dark mode',
171-
(WidgetTester tester) async {
165+
testWidgets('blur view applies correct background color in dark mode', (
166+
WidgetTester tester,
167+
) async {
172168
await tester.pumpWidget(
173169
MaterialApp(
174170
theme: ThemeData(brightness: Brightness.dark),

0 commit comments

Comments
 (0)