diff --git a/example/lib/bounce_demo.dart b/example/lib/bounce_demo.dart index e4809f7..0afff6b 100644 --- a/example/lib/bounce_demo.dart +++ b/example/lib/bounce_demo.dart @@ -12,73 +12,59 @@ class SimpleBounceDemoState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar( - title: Text('Simple Bounce Demo', - style: TextStyle(color: Colors.white)), - centerTitle: true - ), - body: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Bounce( - onPressed: null, - duration: Duration(milliseconds: _duration), - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - shape: BoxShape.circle, - ), - child: Padding( - padding: const EdgeInsets.all(12.0), - child: Icon(Icons.add, color: Colors.white) - ), + appBar: AppBar( + title: Text('Simple Bounce Demo', + style: TextStyle(color: Colors.white)), + centerTitle: true), + body: Center( + child: + Column(mainAxisAlignment: MainAxisAlignment.center, children: [ + Bounce( + onPressed: () {}, + duration: Duration(milliseconds: _duration), + child: Container( + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + shape: BoxShape.circle, ), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Icon(Icons.add, color: Colors.white)), ), - SizedBox(height: 30.0), - Bounce( - duration: Duration(milliseconds: _duration), - onPressed: null, + ), + SizedBox(height: 30.0), + Bounce( + duration: Duration(milliseconds: _duration), + onPressed: () {}, child: Container( - height: 50.0, - width: MediaQuery.of(context).size.width * 0.5, - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.circular(80.0) - ), - child: Center( - child: Text('Click to bounce', - style: TextStyle(color: Colors.white, fontSize: 18.0) - )) - ) - ), - SizedBox(height: 20.0), - Container( + height: 50.0, + width: MediaQuery.of(context).size.width * 0.5, + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, + borderRadius: BorderRadius.circular(80.0)), + child: Center( + child: Text('Click to bounce', + style: TextStyle( + color: Colors.white, fontSize: 18.0))))), + SizedBox(height: 20.0), + Container( width: MediaQuery.of(context).size.width * .5, child: Slider( - activeColor: Theme.of(context).primaryColor, - min: 50, - max: 300, - value: _duration.toDouble(), - onChanged: (newValue) { - setState(() { - _duration = newValue.toInt(); - }); - } - ) - ), - Center( - child: Text( - "Duration = $_duration ms", - style: TextStyle( - color: Theme.of(context).primaryColor, - fontSize: 18, - ) - ) - ) - ] - ) - ) - ); + activeColor: Theme.of(context).primaryColor, + min: 50, + max: 300, + value: _duration.toDouble(), + onChanged: (newValue) { + setState(() { + _duration = newValue.toInt(); + }); + })), + Center( + child: Text("Duration = $_duration ms", + style: TextStyle( + color: Theme.of(context).primaryColor, + fontSize: 18, + ))) + ]))); } -} \ No newline at end of file +} diff --git a/example/lib/bounce_scroll.dart b/example/lib/bounce_scroll.dart index 3a8a911..bc6d27c 100644 --- a/example/lib/bounce_scroll.dart +++ b/example/lib/bounce_scroll.dart @@ -2,12 +2,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_bounce/flutter_bounce.dart'; class BounceScroll extends StatelessWidget { - //This is the widget for showing up in scroll - List get verticalList{ + List get verticalList { List _widget = [SizedBox(height: 20.0)]; - for(int i=0; i<10; i++){ + for (int i = 0; i < 10; i++) { _widget.add(verticalListCards); _widget.add(SizedBox(height: 10.0)); } @@ -16,25 +15,22 @@ class BounceScroll extends StatelessWidget { } //This is the widget - Widget get verticalListCards{ + Widget get verticalListCards { return Bounce( - duration: Duration(milliseconds: 110), - onPressed: null, - child: Container( - height: 80.0, - decoration: BoxDecoration( - color: Colors.indigo[400], - borderRadius: BorderRadius.circular(10.0) - ) - ) - ); + duration: Duration(milliseconds: 110), + onPressed: () {}, + child: Container( + height: 80.0, + decoration: BoxDecoration( + color: Colors.indigo[400], + borderRadius: BorderRadius.circular(10.0)))); } //This is for horizontal list - List get horizontalList{ + List get horizontalList { List _view = [SizedBox(width: 20.0)]; - for(int i=0; i<10; i++){ + for (int i = 0; i < 10; i++) { _view.add(horizontalListWidget); _view.add(SizedBox(width: 10.0)); } @@ -42,54 +38,43 @@ class BounceScroll extends StatelessWidget { return _view; } - Widget get horizontalListWidget{ + Widget get horizontalListWidget { return Bounce( - duration: Duration(milliseconds: 110), - onPressed: null, - child: Container( - height: 70.0, - width: 200.0, - decoration: BoxDecoration( - color: Colors.indigo[400], - borderRadius: BorderRadius.circular(10.0) - ) - ) - ); + duration: Duration(milliseconds: 110), + onPressed: () {}, + child: Container( + height: 70.0, + width: 200.0, + decoration: BoxDecoration( + color: Colors.indigo[400], + borderRadius: BorderRadius.circular(10.0)))); } @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar( - title: Text('Bounce with Scroll Demo', - style: TextStyle(color: Colors.white)), - centerTitle: true - ), - body: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Container( - padding: EdgeInsets.symmetric(horizontal: 15.0), - height: MediaQuery.of(context).size.height * 0.5, - child: ListView( - shrinkWrap: true, - scrollDirection: Axis.vertical, - children: this.verticalList - ) - ), - Expanded( - child: Container( - padding: EdgeInsets.symmetric(vertical: 15.0), - child: ListView( - shrinkWrap: true, - scrollDirection: Axis.horizontal, - children: this.horizontalList - ) - ) - ) - ] - ) - ); + appBar: AppBar( + title: Text('Bounce with Scroll Demo', + style: TextStyle(color: Colors.white)), + centerTitle: true), + body: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Container( + padding: EdgeInsets.symmetric(horizontal: 15.0), + height: MediaQuery.of(context).size.height * 0.5, + child: ListView( + shrinkWrap: true, + scrollDirection: Axis.vertical, + children: this.verticalList)), + Expanded( + child: Container( + padding: EdgeInsets.symmetric(vertical: 15.0), + child: ListView( + shrinkWrap: true, + scrollDirection: Axis.horizontal, + children: this.horizontalList))) + ])); } -} \ No newline at end of file +} diff --git a/example/lib/main.dart b/example/lib/main.dart index becc1ac..acc7ff9 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -23,7 +23,7 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - MyHomePage({Key key, this.title}) : super(key: key); + MyHomePage({Key? key, required this.title}) : super(key: key); final String title; @override @@ -31,40 +31,35 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { - @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - centerTitle: true, - title: Text(widget.title), - ), - body: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - RaisedButton( - onPressed: (){ Navigator.push(context, new MaterialPageRoute( - builder: (context) => SimpleBounceDemo()) - ); }, - elevation: 5.0, - color: Theme.of(context).primaryColor, - textColor: Colors.white, - child: Text('Simple Bounce Demo') - ), - SizedBox(height: 20.0), - RaisedButton( - elevation: 5.0, - onPressed: (){ Navigator.push(context, new MaterialPageRoute( - builder: (context) => BounceScroll())); }, - textColor: Colors.white, - color: Theme.of(context).primaryColor, - child: Text('Bounce with Scroll') - ) - ] - ) - ) // This trailing comma makes auto-formatting nicer for build methods. - ); + appBar: AppBar( + centerTitle: true, + title: Text(widget.title), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ElevatedButton( + onPressed: () { + Navigator.push( + context, + new MaterialPageRoute( + builder: (context) => SimpleBounceDemo())); + }, + child: Text('Simple Bounce Demo')), + SizedBox(height: 20.0), + ElevatedButton( + onPressed: () { + Navigator.push( + context, + new MaterialPageRoute( + builder: (context) => BounceScroll())); + }, + child: Text('Bounce with Scroll')) + ])) // This trailing comma makes auto-formatting nicer for build methods. + ); } } diff --git a/example/pubspec.lock b/example/pubspec.lock index 8fa65e4..c623f2a 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,58 +5,50 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" + version: "1.3.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + url: "https://pub.dev" source: hosted - version: "1.15.0" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.3" + version: "1.17.2" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -78,23 +70,34 @@ packages: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" source: hosted - version: "0.12.10" + version: "0.12.16" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" + source: hosted + version: "0.5.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.9.1" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.8.3" sky_engine: dependency: transitive description: flutter @@ -104,57 +107,65 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + url: "https://pub.dev" source: hosted - version: "0.3.0" - typed_data: + version: "0.6.0" + vector_math: dependency: transitive description: - name: typed_data - url: "https://pub.dartlang.org" + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "1.3.0" - vector_math: + version: "2.1.4" + web: dependency: transitive description: - name: vector_math - url: "https://pub.dartlang.org" + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "0.1.4-beta" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=3.1.0-185.0.dev <4.0.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index feeb282..7c8b210 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -3,7 +3,7 @@ description: A new Flutter project. # The following line prevents the package from being accidentally published to # pub.dev using `pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev +publish_to: "none" # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 @@ -18,18 +18,17 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: ">=3.0.6 <4.0.0" dependencies: flutter: sdk: flutter # Importing the package locally - flutter_bounce: - path: ../ + flutter_bounce: + 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 dev_dependencies: flutter_test: @@ -40,7 +39,6 @@ dev_dependencies: # The following section is specific to Flutter. flutter: - # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart deleted file mode 100644 index 747db1d..0000000 --- a/example/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:example/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} diff --git a/pubspec.lock b/pubspec.lock index ad6d1df..a0798dc 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,51 +5,50 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" + version: "1.3.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.17.2" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -64,23 +63,34 @@ packages: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" source: hosted - version: "0.12.10" + version: "0.12.16" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" + source: hosted + version: "0.5.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.9.1" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.8.3" sky_engine: dependency: transitive description: flutter @@ -90,57 +100,65 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + url: "https://pub.dev" source: hosted - version: "0.3.0" - typed_data: + version: "0.6.0" + vector_math: dependency: transitive description: - name: typed_data - url: "https://pub.dartlang.org" + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "1.3.0" - vector_math: + version: "2.1.4" + web: dependency: transitive description: - name: vector_math - url: "https://pub.dartlang.org" + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "0.1.4-beta" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=3.1.0-185.0.dev <4.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index ee28170..9c76c3e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ author: Alok Kumar homepage: https://github.com/aloklearning/flutter_bounce environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=3.0.6 <4.0.0" dependencies: flutter: