Jaime Blasco

fix: analyzer warnings

include: package:lints/recommended.yaml
\ No newline at end of file
... ...
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher_string.dart';
class WebFrame extends StatelessWidget {
final Widget child;
... ... @@ -133,14 +133,14 @@ class WebFrame extends StatelessWidget {
Row(
children: <Widget>[
InkWell(
onTap: () => launch(
onTap: () => launchUrlString(
'https://pub.dev/packages/modal_bottom_sheet'),
child: Image.asset('assets/flutter.png',
height: 60),
),
Spacer(),
InkWell(
onTap: () => launch(
onTap: () => launchUrlString(
'https://github.com/jamesblasco/modal_bottom_sheet'),
child: Image.asset('assets/github.png',
height: 60),
... ...
... ... @@ -49,7 +49,7 @@ packages:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
version: "1.0.5"
fake_async:
dependency: transitive
description:
... ... @@ -174,56 +174,56 @@ packages:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.20"
version: "6.1.5"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.15"
version: "6.0.17"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.15"
version: "6.0.17"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.0.1"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.0.1"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
version: "2.1.0"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.9"
version: "2.0.13"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.0.1"
vector_math:
dependency: transitive
description:
... ...
... ... @@ -14,19 +14,17 @@ publish_to: none
version: 1.0.0+1
environment:
sdk: ">=2.12.0-29.10.beta <3.0.0"
flutter: ">=3.0.0"
sdk: '>=2.17.0 <3.0.0'
dependencies:
cupertino_icons: ^1.0.5
flutter:
sdk: flutter
url_launcher: ^6.0.20
modal_bottom_sheet:
path: '../'
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
url_launcher: ^6.1.5
dev_dependencies:
flutter_test:
... ...
... ... @@ -101,7 +101,7 @@ class ModalBottomSheet extends StatefulWidget {
final ScrollController scrollController;
@override
_ModalBottomSheetState createState() => _ModalBottomSheetState();
ModalBottomSheetState createState() => ModalBottomSheetState();
/// Creates an [AnimationController] suitable for a
/// [ModalBottomSheet.animationController].
... ... @@ -121,7 +121,7 @@ class ModalBottomSheet extends StatefulWidget {
}
}
class _ModalBottomSheetState extends State<ModalBottomSheet>
class ModalBottomSheetState extends State<ModalBottomSheet>
with TickerProviderStateMixin {
final GlobalKey _childKey = GlobalKey(debugLabel: 'BottomSheet child');
... ...
... ... @@ -6,7 +6,7 @@ import 'package:flutter/services.dart';
import '../../modal_bottom_sheet.dart';
import '../bottom_sheet_route.dart';
const Radius _default_bar_top_radius = Radius.circular(15);
const Radius kDefaultBarTopRadius = Radius.circular(15);
class BarBottomSheet extends StatelessWidget {
final Widget child;
... ... @@ -57,8 +57,8 @@ class BarBottomSheet extends StatelessWidget {
RoundedRectangleBorder(
side: BorderSide(),
borderRadius: BorderRadius.only(
topLeft: _default_bar_top_radius,
topRight: _default_bar_top_radius),
topLeft: kDefaultBarTopRadius,
topRight: kDefaultBarTopRadius),
),
clipBehavior: clipBehavior ?? Clip.hardEdge,
color: backgroundColor ?? Colors.white,
... ...
... ... @@ -46,17 +46,17 @@ class _CupertinoBottomSheetContainer extends StatelessWidget {
final topSafeAreaPadding = MediaQuery.of(context).padding.top;
final topPadding = _kPreviousPageVisibleOffset + topSafeAreaPadding;
final _shadow = shadow ?? _kDefaultBoxShadow;
final shadow = this.shadow ?? _kDefaultBoxShadow;
BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5);
final _backgroundColor =
backgroundColor ?? CupertinoTheme.of(context).scaffoldBackgroundColor;
final backgroundColor = this.backgroundColor ??
CupertinoTheme.of(context).scaffoldBackgroundColor;
return Padding(
padding: EdgeInsets.only(top: topPadding),
child: ClipRRect(
borderRadius: BorderRadius.vertical(top: topRadius),
child: Container(
decoration:
BoxDecoration(color: _backgroundColor, boxShadow: [_shadow]),
BoxDecoration(color: backgroundColor, boxShadow: [shadow]),
width: double.infinity,
child: MediaQuery.removePadding(
context: context,
... ... @@ -211,10 +211,10 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
}
@override
Widget getPreviousRouteTransition(BuildContext context,
Animation<double> secondaryAnimation, Widget child) {
Widget getPreviousRouteTransition(
BuildContext context, Animation<double> secondAnimation, Widget child) {
return _CupertinoModalTransition(
secondaryAnimation: secondaryAnimation,
secondaryAnimation: secondAnimation,
body: child,
animationCurve: previousRouteAnimationCurve,
topRadius: topRadius,
... ... @@ -290,20 +290,16 @@ class _CupertinoModalTransition extends StatelessWidget {
}
}
class _CupertinoScaffold extends InheritedWidget {
class CupertinoScaffoldInheirted extends InheritedWidget {
final AnimationController? animation;
final Radius? topRadius;
@override
final Widget child;
const _CupertinoScaffold({
Key? key,
const CupertinoScaffoldInheirted({
this.animation,
required this.child,
required super.child,
this.topRadius,
}) : super(key: key, child: child);
}) : super();
@override
bool updateShouldNotify(InheritedWidget oldWidget) {
... ... @@ -313,8 +309,8 @@ class _CupertinoScaffold extends InheritedWidget {
// Support
class CupertinoScaffold extends StatefulWidget {
static _CupertinoScaffold? of(BuildContext context) =>
context.dependOnInheritedWidgetOfExactType<_CupertinoScaffold>();
static CupertinoScaffoldInheirted? of(BuildContext context) =>
context.dependOnInheritedWidgetOfExactType<CupertinoScaffoldInheirted>();
final Widget body;
final Radius topRadius;
... ... @@ -405,7 +401,7 @@ class _CupertinoScaffoldState extends State<CupertinoScaffold>
@override
Widget build(BuildContext context) {
return _CupertinoScaffold(
return CupertinoScaffoldInheirted(
animation: animationController,
topRadius: widget.topRadius,
child: _CupertinoModalTransition(
... ...
... ... @@ -61,17 +61,18 @@ WidgetWithChildBuilder _materialContainerBuilder(BuildContext context,
final color = backgroundColor ??
bottomSheetTheme.modalBackgroundColor ??
bottomSheetTheme.backgroundColor;
final _elevation = elevation ?? bottomSheetTheme.elevation ?? 0.0;
final _shape = shape ?? bottomSheetTheme.shape;
final _clipBehavior =
final effectiveElevation = elevation ?? bottomSheetTheme.elevation ?? 0.0;
final effectiveShape = shape ?? bottomSheetTheme.shape;
final effectiveClipBehavior =
clipBehavior ?? bottomSheetTheme.clipBehavior ?? Clip.none;
final result = (context, animation, child) => Material(
color: color,
elevation: _elevation,
shape: _shape,
clipBehavior: _clipBehavior,
child: child);
Widget result(context, animation, child) => Material(
color: color,
elevation: effectiveElevation,
shape: effectiveShape,
clipBehavior: effectiveClipBehavior,
child: child,
);
if (theme != null) {
return (context, animation, child) =>
Theme(data: theme, child: result(context, animation, child));
... ...
... ... @@ -15,10 +15,10 @@ class ScrollToTopStatusBarHandler extends StatefulWidget {
}) : super(key: key);
@override
_ScrollToTopStatusBarState createState() => _ScrollToTopStatusBarState();
ScrollToTopStatusBarState createState() => ScrollToTopStatusBarState();
}
class _ScrollToTopStatusBarState extends State<ScrollToTopStatusBarHandler> {
class ScrollToTopStatusBarState extends State<ScrollToTopStatusBarHandler> {
@override
void initState() {
super.initState();
... ...
... ... @@ -60,6 +60,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
lints:
dependency: "direct dev"
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
matcher:
dependency: transitive
description:
... ...
... ... @@ -13,4 +13,5 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
\ No newline at end of file
sdk: flutter
lints: ^2.0.0
... ...
... ... @@ -12,34 +12,34 @@ void main() {
Future<void> Function(BuildContext context, WidgetBuilder builder)
onPressed,
) async {
int _initState = 0, _dispose = 0;
int initState = 0, dispose = 0;
await _pumpWidget(
tester: tester,
onPressed: (context) => onPressed(
context,
(_) => _TestWidget(
onInitState: () => _initState++,
onDispose: () => _dispose++,
onInitState: () => initState++,
onDispose: () => dispose++,
),
),
);
expect(_initState, 0);
expect(initState, 0);
await tester.tap(_textButtonWithText('Press me'));
await tester.pumpAndSettle();
expect(_initState, 1);
expect(_dispose, 0);
expect(initState, 1);
expect(dispose, 0);
await tester.tap(_textButtonWithText('TestWidget push'));
await tester.pumpAndSettle();
expect(_initState, 1);
expect(_dispose, 0);
expect(initState, 1);
expect(dispose, 0);
await tester.tap(_textButtonWithText('TestWidget pushed pop'));
await tester.pumpAndSettle();
expect(_initState, 1);
expect(_dispose, 0);
expect(initState, 1);
expect(dispose, 0);
await tester.tap(_textButtonWithText('TestWidget pop'));
await tester.pumpAndSettle();
expect(_initState, 1);
expect(_dispose, 1);
expect(initState, 1);
expect(dispose, 1);
}
testWidgets('with showCupertinoModalBottomSheet', (tester) {
... ...