Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
86 changes: 0 additions & 86 deletions example/example.dart

This file was deleted.

57 changes: 42 additions & 15 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:math';
import 'package:flutter/material.dart';

import 'im_animations.dart';
import 'src/color_sonar.dart';

void main() {
runApp(const MyApp());
Expand All @@ -23,24 +22,52 @@ class MyApp extends StatelessWidget {
}
}

class Homepage extends StatelessWidget {
class Homepage extends StatefulWidget {
const Homepage({Key? key}) : super(key: key);

@override
State<Homepage> createState() => _HomepageState();
}

class _HomepageState extends State<Homepage> {
bool changeAnim = true;
@override
Widget build(BuildContext context) {
return const Scaffold(
return Scaffold(
body: SafeArea(
child: ColorSonar(
// wavesDisabled: true,
// waveMotion: WaveMotion.synced,
contentAreaRadius: 48.0,
// waveFall: 100.0,
// waveMotionEffect: Curves.elasticIn,
waveMotion: WaveMotion.synced,
// duration: Duration(milliseconds: 2000),
child: CircleAvatar(
radius: 48.0,
backgroundImage: AssetImage('assets/avatars/man.png'),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
changeAnim
? HeartBeat(
child: const CircleAvatar(
radius: 48.0,
backgroundImage: AssetImage('assets/avatars/man.png'),
),
)
: Rotate(
repeat: Random().nextBool(),
child: const CircleAvatar(
radius: 48.0,
backgroundImage: AssetImage('assets/avatars/man.png'),
),
),
const SizedBox(
height: 25,
),
ElevatedButton(
onPressed: () => setState(() => changeAnim = !changeAnim),
child: const Text('Change animation')),
const SizedBox(
height: 25,
),
ElevatedButton(
onPressed: () => setState(
() {},
),
child: const Text('Testing didUpdateWidget method'))
],
),
),
),
Expand Down
11 changes: 5 additions & 6 deletions lib/src/fade.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,18 @@ class _FadeState extends State<Fade> with SingleTickerProviderStateMixin {
});

widget.fadeEffect == FadeEffect.fadeIn
? _fadeAnimation.forward(from: 0.0).orCancel
: _fadeAnimation.reverse(from: 1.0).orCancel;
? _fadeAnimation.forward(from: 0.0)
: _fadeAnimation.reverse(from: 1.0);
}

@override
void didUpdateWidget(Fade oldWidget) {
super.didUpdateWidget(oldWidget);
_fadeAnimation.reset();

widget.fadeEffect == FadeEffect.fadeIn
? _fadeAnimation.forward(from: 0.0).orCancel
: _fadeAnimation.reverse(from: 1.0).orCancel;

super.didUpdateWidget(oldWidget);
? _fadeAnimation.forward(from: 0.0)
: _fadeAnimation.reverse(from: 1.0);
}

@override
Expand Down
6 changes: 3 additions & 3 deletions lib/src/heartbeat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ class _HeartBeatState extends State<HeartBeat>
);

// Since a heartbeat, so repeats infinitely.
_controller.repeat().orCancel;
_controller.repeat();
}

@override
void didUpdateWidget(HeartBeat oldWidget) {
_controller.reset();
_controller.repeat().orCancel;
super.didUpdateWidget(oldWidget);
_controller.reset();
_controller.repeat();
}

@override
Expand Down
8 changes: 5 additions & 3 deletions lib/src/rotate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,17 @@ class _RotateState extends State<Rotate> with SingleTickerProviderStateMixin {
.animate(_animationController);

widget.repeat
? _animationController.repeat().orCancel
? _animationController.repeat()
: _animationController.forward();
}

@override
void didUpdateWidget(Rotate oldWidget) {
_animationController.reset();
_animationController.forward().orCancel;
super.didUpdateWidget(oldWidget);
_animationController.reset();
widget.repeat
? _animationController.repeat()
: _animationController.forward();
}

@override
Expand Down
31 changes: 12 additions & 19 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
version: "2.9.0"
boolean_selector:
dependency: transitive
description:
Expand All @@ -21,21 +21,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.2.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
collection:
dependency: transitive
description:
Expand All @@ -49,7 +42,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
flutter:
dependency: "direct main"
description: flutter
Expand Down Expand Up @@ -80,28 +73,28 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -113,7 +106,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.9.0"
stack_trace:
dependency: transitive
description:
Expand All @@ -134,21 +127,21 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.9"
version: "0.4.12"
vector_math:
dependency: transitive
description:
Expand Down