Jaime Blasco

fix: analyzer warnings

  1 +include: package:lints/recommended.yaml
1 import 'package:flutter/cupertino.dart'; 1 import 'package:flutter/cupertino.dart';
2 import 'package:flutter/foundation.dart'; 2 import 'package:flutter/foundation.dart';
3 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
4 -import 'package:url_launcher/url_launcher.dart'; 4 +import 'package:url_launcher/url_launcher_string.dart';
5 5
6 class WebFrame extends StatelessWidget { 6 class WebFrame extends StatelessWidget {
7 final Widget child; 7 final Widget child;
@@ -133,14 +133,14 @@ class WebFrame extends StatelessWidget { @@ -133,14 +133,14 @@ class WebFrame extends StatelessWidget {
133 Row( 133 Row(
134 children: <Widget>[ 134 children: <Widget>[
135 InkWell( 135 InkWell(
136 - onTap: () => launch( 136 + onTap: () => launchUrlString(
137 'https://pub.dev/packages/modal_bottom_sheet'), 137 'https://pub.dev/packages/modal_bottom_sheet'),
138 child: Image.asset('assets/flutter.png', 138 child: Image.asset('assets/flutter.png',
139 height: 60), 139 height: 60),
140 ), 140 ),
141 Spacer(), 141 Spacer(),
142 InkWell( 142 InkWell(
143 - onTap: () => launch( 143 + onTap: () => launchUrlString(
144 'https://github.com/jamesblasco/modal_bottom_sheet'), 144 'https://github.com/jamesblasco/modal_bottom_sheet'),
145 child: Image.asset('assets/github.png', 145 child: Image.asset('assets/github.png',
146 height: 60), 146 height: 60),
@@ -49,7 +49,7 @@ packages: @@ -49,7 +49,7 @@ packages:
49 name: cupertino_icons 49 name: cupertino_icons
50 url: "https://pub.dartlang.org" 50 url: "https://pub.dartlang.org"
51 source: hosted 51 source: hosted
52 - version: "0.1.3" 52 + version: "1.0.5"
53 fake_async: 53 fake_async:
54 dependency: transitive 54 dependency: transitive
55 description: 55 description:
@@ -174,56 +174,56 @@ packages: @@ -174,56 +174,56 @@ packages:
174 name: url_launcher 174 name: url_launcher
175 url: "https://pub.dartlang.org" 175 url: "https://pub.dartlang.org"
176 source: hosted 176 source: hosted
177 - version: "6.0.20" 177 + version: "6.1.5"
178 url_launcher_android: 178 url_launcher_android:
179 dependency: transitive 179 dependency: transitive
180 description: 180 description:
181 name: url_launcher_android 181 name: url_launcher_android
182 url: "https://pub.dartlang.org" 182 url: "https://pub.dartlang.org"
183 source: hosted 183 source: hosted
184 - version: "6.0.15" 184 + version: "6.0.17"
185 url_launcher_ios: 185 url_launcher_ios:
186 dependency: transitive 186 dependency: transitive
187 description: 187 description:
188 name: url_launcher_ios 188 name: url_launcher_ios
189 url: "https://pub.dartlang.org" 189 url: "https://pub.dartlang.org"
190 source: hosted 190 source: hosted
191 - version: "6.0.15" 191 + version: "6.0.17"
192 url_launcher_linux: 192 url_launcher_linux:
193 dependency: transitive 193 dependency: transitive
194 description: 194 description:
195 name: url_launcher_linux 195 name: url_launcher_linux
196 url: "https://pub.dartlang.org" 196 url: "https://pub.dartlang.org"
197 source: hosted 197 source: hosted
198 - version: "3.0.0" 198 + version: "3.0.1"
199 url_launcher_macos: 199 url_launcher_macos:
200 dependency: transitive 200 dependency: transitive
201 description: 201 description:
202 name: url_launcher_macos 202 name: url_launcher_macos
203 url: "https://pub.dartlang.org" 203 url: "https://pub.dartlang.org"
204 source: hosted 204 source: hosted
205 - version: "3.0.0" 205 + version: "3.0.1"
206 url_launcher_platform_interface: 206 url_launcher_platform_interface:
207 dependency: transitive 207 dependency: transitive
208 description: 208 description:
209 name: url_launcher_platform_interface 209 name: url_launcher_platform_interface
210 url: "https://pub.dartlang.org" 210 url: "https://pub.dartlang.org"
211 source: hosted 211 source: hosted
212 - version: "2.0.5" 212 + version: "2.1.0"
213 url_launcher_web: 213 url_launcher_web:
214 dependency: transitive 214 dependency: transitive
215 description: 215 description:
216 name: url_launcher_web 216 name: url_launcher_web
217 url: "https://pub.dartlang.org" 217 url: "https://pub.dartlang.org"
218 source: hosted 218 source: hosted
219 - version: "2.0.9" 219 + version: "2.0.13"
220 url_launcher_windows: 220 url_launcher_windows:
221 dependency: transitive 221 dependency: transitive
222 description: 222 description:
223 name: url_launcher_windows 223 name: url_launcher_windows
224 url: "https://pub.dartlang.org" 224 url: "https://pub.dartlang.org"
225 source: hosted 225 source: hosted
226 - version: "3.0.0" 226 + version: "3.0.1"
227 vector_math: 227 vector_math:
228 dependency: transitive 228 dependency: transitive
229 description: 229 description:
@@ -14,19 +14,17 @@ publish_to: none @@ -14,19 +14,17 @@ publish_to: none
14 version: 1.0.0+1 14 version: 1.0.0+1
15 15
16 environment: 16 environment:
17 - sdk: ">=2.12.0-29.10.beta <3.0.0" 17 + flutter: ">=3.0.0"
  18 + sdk: '>=2.17.0 <3.0.0'
  19 +
18 20
19 dependencies: 21 dependencies:
  22 + cupertino_icons: ^1.0.5
20 flutter: 23 flutter:
21 sdk: flutter 24 sdk: flutter
22 - url_launcher: ^6.0.20  
23 modal_bottom_sheet: 25 modal_bottom_sheet:
24 path: '../' 26 path: '../'
25 -  
26 -  
27 - # The following adds the Cupertino Icons font to your application.  
28 - # Use with the CupertinoIcons class for iOS style icons.  
29 - cupertino_icons: ^0.1.3 27 + url_launcher: ^6.1.5
30 28
31 dev_dependencies: 29 dev_dependencies:
32 flutter_test: 30 flutter_test:
@@ -101,7 +101,7 @@ class ModalBottomSheet extends StatefulWidget { @@ -101,7 +101,7 @@ class ModalBottomSheet extends StatefulWidget {
101 final ScrollController scrollController; 101 final ScrollController scrollController;
102 102
103 @override 103 @override
104 - _ModalBottomSheetState createState() => _ModalBottomSheetState(); 104 + ModalBottomSheetState createState() => ModalBottomSheetState();
105 105
106 /// Creates an [AnimationController] suitable for a 106 /// Creates an [AnimationController] suitable for a
107 /// [ModalBottomSheet.animationController]. 107 /// [ModalBottomSheet.animationController].
@@ -121,7 +121,7 @@ class ModalBottomSheet extends StatefulWidget { @@ -121,7 +121,7 @@ class ModalBottomSheet extends StatefulWidget {
121 } 121 }
122 } 122 }
123 123
124 -class _ModalBottomSheetState extends State<ModalBottomSheet> 124 +class ModalBottomSheetState extends State<ModalBottomSheet>
125 with TickerProviderStateMixin { 125 with TickerProviderStateMixin {
126 final GlobalKey _childKey = GlobalKey(debugLabel: 'BottomSheet child'); 126 final GlobalKey _childKey = GlobalKey(debugLabel: 'BottomSheet child');
127 127
@@ -6,7 +6,7 @@ import 'package:flutter/services.dart'; @@ -6,7 +6,7 @@ import 'package:flutter/services.dart';
6 import '../../modal_bottom_sheet.dart'; 6 import '../../modal_bottom_sheet.dart';
7 import '../bottom_sheet_route.dart'; 7 import '../bottom_sheet_route.dart';
8 8
9 -const Radius _default_bar_top_radius = Radius.circular(15); 9 +const Radius kDefaultBarTopRadius = Radius.circular(15);
10 10
11 class BarBottomSheet extends StatelessWidget { 11 class BarBottomSheet extends StatelessWidget {
12 final Widget child; 12 final Widget child;
@@ -57,8 +57,8 @@ class BarBottomSheet extends StatelessWidget { @@ -57,8 +57,8 @@ class BarBottomSheet extends StatelessWidget {
57 RoundedRectangleBorder( 57 RoundedRectangleBorder(
58 side: BorderSide(), 58 side: BorderSide(),
59 borderRadius: BorderRadius.only( 59 borderRadius: BorderRadius.only(
60 - topLeft: _default_bar_top_radius,  
61 - topRight: _default_bar_top_radius), 60 + topLeft: kDefaultBarTopRadius,
  61 + topRight: kDefaultBarTopRadius),
62 ), 62 ),
63 clipBehavior: clipBehavior ?? Clip.hardEdge, 63 clipBehavior: clipBehavior ?? Clip.hardEdge,
64 color: backgroundColor ?? Colors.white, 64 color: backgroundColor ?? Colors.white,
@@ -46,17 +46,17 @@ class _CupertinoBottomSheetContainer extends StatelessWidget { @@ -46,17 +46,17 @@ class _CupertinoBottomSheetContainer extends StatelessWidget {
46 final topSafeAreaPadding = MediaQuery.of(context).padding.top; 46 final topSafeAreaPadding = MediaQuery.of(context).padding.top;
47 final topPadding = _kPreviousPageVisibleOffset + topSafeAreaPadding; 47 final topPadding = _kPreviousPageVisibleOffset + topSafeAreaPadding;
48 48
49 - final _shadow = shadow ?? _kDefaultBoxShadow; 49 + final shadow = this.shadow ?? _kDefaultBoxShadow;
50 BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5); 50 BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5);
51 - final _backgroundColor =  
52 - backgroundColor ?? CupertinoTheme.of(context).scaffoldBackgroundColor; 51 + final backgroundColor = this.backgroundColor ??
  52 + CupertinoTheme.of(context).scaffoldBackgroundColor;
53 return Padding( 53 return Padding(
54 padding: EdgeInsets.only(top: topPadding), 54 padding: EdgeInsets.only(top: topPadding),
55 child: ClipRRect( 55 child: ClipRRect(
56 borderRadius: BorderRadius.vertical(top: topRadius), 56 borderRadius: BorderRadius.vertical(top: topRadius),
57 child: Container( 57 child: Container(
58 decoration: 58 decoration:
59 - BoxDecoration(color: _backgroundColor, boxShadow: [_shadow]), 59 + BoxDecoration(color: backgroundColor, boxShadow: [shadow]),
60 width: double.infinity, 60 width: double.infinity,
61 child: MediaQuery.removePadding( 61 child: MediaQuery.removePadding(
62 context: context, 62 context: context,
@@ -211,10 +211,10 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { @@ -211,10 +211,10 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
211 } 211 }
212 212
213 @override 213 @override
214 - Widget getPreviousRouteTransition(BuildContext context,  
215 - Animation<double> secondaryAnimation, Widget child) { 214 + Widget getPreviousRouteTransition(
  215 + BuildContext context, Animation<double> secondAnimation, Widget child) {
216 return _CupertinoModalTransition( 216 return _CupertinoModalTransition(
217 - secondaryAnimation: secondaryAnimation, 217 + secondaryAnimation: secondAnimation,
218 body: child, 218 body: child,
219 animationCurve: previousRouteAnimationCurve, 219 animationCurve: previousRouteAnimationCurve,
220 topRadius: topRadius, 220 topRadius: topRadius,
@@ -290,20 +290,16 @@ class _CupertinoModalTransition extends StatelessWidget { @@ -290,20 +290,16 @@ class _CupertinoModalTransition extends StatelessWidget {
290 } 290 }
291 } 291 }
292 292
293 -class _CupertinoScaffold extends InheritedWidget { 293 +class CupertinoScaffoldInheirted extends InheritedWidget {
294 final AnimationController? animation; 294 final AnimationController? animation;
295 295
296 final Radius? topRadius; 296 final Radius? topRadius;
297 297
298 - @override  
299 - final Widget child;  
300 -  
301 - const _CupertinoScaffold({  
302 - Key? key, 298 + const CupertinoScaffoldInheirted({
303 this.animation, 299 this.animation,
304 - required this.child, 300 + required super.child,
305 this.topRadius, 301 this.topRadius,
306 - }) : super(key: key, child: child); 302 + }) : super();
307 303
308 @override 304 @override
309 bool updateShouldNotify(InheritedWidget oldWidget) { 305 bool updateShouldNotify(InheritedWidget oldWidget) {
@@ -313,8 +309,8 @@ class _CupertinoScaffold extends InheritedWidget { @@ -313,8 +309,8 @@ class _CupertinoScaffold extends InheritedWidget {
313 309
314 // Support 310 // Support
315 class CupertinoScaffold extends StatefulWidget { 311 class CupertinoScaffold extends StatefulWidget {
316 - static _CupertinoScaffold? of(BuildContext context) =>  
317 - context.dependOnInheritedWidgetOfExactType<_CupertinoScaffold>(); 312 + static CupertinoScaffoldInheirted? of(BuildContext context) =>
  313 + context.dependOnInheritedWidgetOfExactType<CupertinoScaffoldInheirted>();
318 314
319 final Widget body; 315 final Widget body;
320 final Radius topRadius; 316 final Radius topRadius;
@@ -405,7 +401,7 @@ class _CupertinoScaffoldState extends State<CupertinoScaffold> @@ -405,7 +401,7 @@ class _CupertinoScaffoldState extends State<CupertinoScaffold>
405 401
406 @override 402 @override
407 Widget build(BuildContext context) { 403 Widget build(BuildContext context) {
408 - return _CupertinoScaffold( 404 + return CupertinoScaffoldInheirted(
409 animation: animationController, 405 animation: animationController,
410 topRadius: widget.topRadius, 406 topRadius: widget.topRadius,
411 child: _CupertinoModalTransition( 407 child: _CupertinoModalTransition(
@@ -61,17 +61,18 @@ WidgetWithChildBuilder _materialContainerBuilder(BuildContext context, @@ -61,17 +61,18 @@ WidgetWithChildBuilder _materialContainerBuilder(BuildContext context,
61 final color = backgroundColor ?? 61 final color = backgroundColor ??
62 bottomSheetTheme.modalBackgroundColor ?? 62 bottomSheetTheme.modalBackgroundColor ??
63 bottomSheetTheme.backgroundColor; 63 bottomSheetTheme.backgroundColor;
64 - final _elevation = elevation ?? bottomSheetTheme.elevation ?? 0.0;  
65 - final _shape = shape ?? bottomSheetTheme.shape;  
66 - final _clipBehavior = 64 + final effectiveElevation = elevation ?? bottomSheetTheme.elevation ?? 0.0;
  65 + final effectiveShape = shape ?? bottomSheetTheme.shape;
  66 + final effectiveClipBehavior =
67 clipBehavior ?? bottomSheetTheme.clipBehavior ?? Clip.none; 67 clipBehavior ?? bottomSheetTheme.clipBehavior ?? Clip.none;
68 68
69 - final result = (context, animation, child) => Material(  
70 - color: color,  
71 - elevation: _elevation,  
72 - shape: _shape,  
73 - clipBehavior: _clipBehavior,  
74 - child: child); 69 + Widget result(context, animation, child) => Material(
  70 + color: color,
  71 + elevation: effectiveElevation,
  72 + shape: effectiveShape,
  73 + clipBehavior: effectiveClipBehavior,
  74 + child: child,
  75 + );
75 if (theme != null) { 76 if (theme != null) {
76 return (context, animation, child) => 77 return (context, animation, child) =>
77 Theme(data: theme, child: result(context, animation, child)); 78 Theme(data: theme, child: result(context, animation, child));
@@ -15,10 +15,10 @@ class ScrollToTopStatusBarHandler extends StatefulWidget { @@ -15,10 +15,10 @@ class ScrollToTopStatusBarHandler extends StatefulWidget {
15 }) : super(key: key); 15 }) : super(key: key);
16 16
17 @override 17 @override
18 - _ScrollToTopStatusBarState createState() => _ScrollToTopStatusBarState(); 18 + ScrollToTopStatusBarState createState() => ScrollToTopStatusBarState();
19 } 19 }
20 20
21 -class _ScrollToTopStatusBarState extends State<ScrollToTopStatusBarHandler> { 21 +class ScrollToTopStatusBarState extends State<ScrollToTopStatusBarHandler> {
22 @override 22 @override
23 void initState() { 23 void initState() {
24 super.initState(); 24 super.initState();
@@ -60,6 +60,13 @@ packages: @@ -60,6 +60,13 @@ packages:
60 description: flutter 60 description: flutter
61 source: sdk 61 source: sdk
62 version: "0.0.0" 62 version: "0.0.0"
  63 + lints:
  64 + dependency: "direct dev"
  65 + description:
  66 + name: lints
  67 + url: "https://pub.dartlang.org"
  68 + source: hosted
  69 + version: "2.0.0"
63 matcher: 70 matcher:
64 dependency: transitive 71 dependency: transitive
65 description: 72 description:
@@ -13,4 +13,5 @@ dependencies: @@ -13,4 +13,5 @@ dependencies:
13 13
14 dev_dependencies: 14 dev_dependencies:
15 flutter_test: 15 flutter_test:
16 - sdk: flutter  
  16 + sdk: flutter
  17 + lints: ^2.0.0
@@ -12,34 +12,34 @@ void main() { @@ -12,34 +12,34 @@ void main() {
12 Future<void> Function(BuildContext context, WidgetBuilder builder) 12 Future<void> Function(BuildContext context, WidgetBuilder builder)
13 onPressed, 13 onPressed,
14 ) async { 14 ) async {
15 - int _initState = 0, _dispose = 0; 15 + int initState = 0, dispose = 0;
16 await _pumpWidget( 16 await _pumpWidget(
17 tester: tester, 17 tester: tester,
18 onPressed: (context) => onPressed( 18 onPressed: (context) => onPressed(
19 context, 19 context,
20 (_) => _TestWidget( 20 (_) => _TestWidget(
21 - onInitState: () => _initState++,  
22 - onDispose: () => _dispose++, 21 + onInitState: () => initState++,
  22 + onDispose: () => dispose++,
23 ), 23 ),
24 ), 24 ),
25 ); 25 );
26 - expect(_initState, 0); 26 + expect(initState, 0);
27 await tester.tap(_textButtonWithText('Press me')); 27 await tester.tap(_textButtonWithText('Press me'));
28 await tester.pumpAndSettle(); 28 await tester.pumpAndSettle();
29 - expect(_initState, 1);  
30 - expect(_dispose, 0); 29 + expect(initState, 1);
  30 + expect(dispose, 0);
31 await tester.tap(_textButtonWithText('TestWidget push')); 31 await tester.tap(_textButtonWithText('TestWidget push'));
32 await tester.pumpAndSettle(); 32 await tester.pumpAndSettle();
33 - expect(_initState, 1);  
34 - expect(_dispose, 0); 33 + expect(initState, 1);
  34 + expect(dispose, 0);
35 await tester.tap(_textButtonWithText('TestWidget pushed pop')); 35 await tester.tap(_textButtonWithText('TestWidget pushed pop'));
36 await tester.pumpAndSettle(); 36 await tester.pumpAndSettle();
37 - expect(_initState, 1);  
38 - expect(_dispose, 0); 37 + expect(initState, 1);
  38 + expect(dispose, 0);
39 await tester.tap(_textButtonWithText('TestWidget pop')); 39 await tester.tap(_textButtonWithText('TestWidget pop'));
40 await tester.pumpAndSettle(); 40 await tester.pumpAndSettle();
41 - expect(_initState, 1);  
42 - expect(_dispose, 1); 41 + expect(initState, 1);
  42 + expect(dispose, 1);
43 } 43 }
44 44
45 testWidgets('with showCupertinoModalBottomSheet', (tester) { 45 testWidgets('with showCupertinoModalBottomSheet', (tester) {