Skip to content

Commit

Permalink
chore: removed irrelevant dependency on package sensors_plus (#5040)
Browse files Browse the repository at this point in the history
* chore: removed irrelevant dependency on package sensors_plus

* Minor refactoring
  • Loading branch information
monsieurtanuki authored May 30, 2024
1 parent 529fe8f commit c8b72e0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 51 deletions.
41 changes: 7 additions & 34 deletions packages/smooth_app/lib/pages/onboarding/reinvention_page.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import 'dart:async';
import 'dart:io';

import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:rive/rive.dart';
import 'package:sensors_plus/sensors_plus.dart';
import 'package:smooth_app/generic_lib/design_constants.dart';
import 'package:smooth_app/generic_lib/duration_constants.dart';
import 'package:smooth_app/helpers/app_helper.dart';
Expand Down Expand Up @@ -41,7 +39,7 @@ class ReinventionPage extends StatelessWidget {
right: 0.0,
bottom: 0.0,
top: screenSize.height * 0.75,
child: Background(
child: _Background(
screenWidth: screenSize.width,
),
),
Expand Down Expand Up @@ -134,30 +132,11 @@ class ReinventionPage extends StatelessWidget {
}
}

class Background extends StatefulWidget {
const Background({required this.screenWidth});
class _Background extends StatelessWidget {
const _Background({required this.screenWidth});

final double screenWidth;

@override
State<Background> createState() => _BackgroundState();
}

class _BackgroundState extends State<Background> {
StreamSubscription<GyroscopeEvent>? _subscription;
double parallax = 0.0;

@override
void initState() {
super.initState();

if (Platform.isAndroid || Platform.isIOS) {
_subscription = gyroscopeEvents.listen((GyroscopeEvent event) {
setState(() => parallax = event.y);
});
}
}

@override
Widget build(BuildContext context) {
return SizedBox.expand(
Expand All @@ -166,8 +145,8 @@ class _BackgroundState extends State<Background> {
children: <Widget>[
AnimatedPositioned(
bottom: 0.0,
right: (-15.0 * parallax).clamp(-30.0, 0.0),
width: widget.screenWidth * 0.808,
right: 0.0,
width: screenWidth * 0.808,
duration: SmoothAnimationsDuration.short,
child: SvgPicture.asset(
'assets/onboarding/hill_end.svg',
Expand All @@ -176,8 +155,8 @@ class _BackgroundState extends State<Background> {
),
AnimatedPositioned(
bottom: 0.0,
left: (-10.0 * parallax).clamp(-20.0, 0.0),
width: widget.screenWidth * 0.855,
left: 0.0,
width: screenWidth * 0.855,
duration: SmoothAnimationsDuration.short,
child: SvgPicture.asset(
'assets/onboarding/hill_start.svg',
Expand All @@ -189,10 +168,4 @@ class _BackgroundState extends State<Background> {
),
);
}

@override
void dispose() {
_subscription?.cancel();
super.dispose();
}
}
16 changes: 0 additions & 16 deletions packages/smooth_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1399,22 +1399,6 @@ packages:
relative: true
source: path
version: "1.0.0"
sensors_plus:
dependency: "direct main"
description:
name: sensors_plus
sha256: a1e461f28a8e8d3f81feb07d5c4e87e948379ea91f0b5131266bb79f72b38acb
url: "https://pub.dev"
source: hosted
version: "3.1.0"
sensors_plus_platform_interface:
dependency: transitive
description:
name: sensors_plus_platform_interface
sha256: bc472d6cfd622acb4f020e726433ee31788b038056691ba433fec80e448a094f
url: "https://pub.dev"
source: hosted
version: "1.2.0"
sentry:
dependency: transitive
description:
Expand Down
1 change: 0 additions & 1 deletion packages/smooth_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ dependencies:
fimber: 0.7.0
shimmer: ^3.0.0
rive: 0.13.4
sensors_plus: 3.1.0
webview_flutter: 4.7.0
webview_flutter_android: 3.16.1
webview_flutter_wkwebview: 3.13.0
Expand Down

0 comments on commit c8b72e0

Please sign in to comment.