-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
163 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
.buildlog/ | ||
.history | ||
.svn/ | ||
go/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,93 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:ripple_effect/ripple_effect.dart'; | ||
|
||
void main() => runApp(MyApp()); | ||
|
||
class MyApp extends StatelessWidget { | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
title: 'Ripple Effect Demo', | ||
theme: ThemeData( | ||
primarySwatch: Colors.blue, | ||
theme: new ThemeData( | ||
primarySwatch: Colors.purple, | ||
primaryColor: Colors.blue, | ||
fontFamily: 'Museo Sans', | ||
), | ||
home: MyHomePage(title: 'Ripple Effect Demo Home Page'), | ||
debugShowCheckedModeBanner: false, | ||
home: HomePage(), | ||
); | ||
} | ||
} | ||
|
||
class MyHomePage extends StatefulWidget { | ||
MyHomePage({Key key, this.title}) : super(key: key); | ||
|
||
final String title; | ||
|
||
class HomePage extends StatefulWidget { | ||
@override | ||
_MyHomePageState createState() => _MyHomePageState(); | ||
_HomePageState createState() => _HomePageState(); | ||
} | ||
|
||
class _MyHomePageState extends State<MyHomePage> { | ||
int _counter = 0; | ||
class _HomePageState extends State<HomePage> { | ||
final pageKey = RipplePage.createGlobalKey(); | ||
final effectKey = RippleEffect.createGlobalKey(); | ||
|
||
void _incrementCounter() { | ||
setState(() { | ||
_counter++; | ||
}); | ||
@override | ||
Widget build(BuildContext context) { | ||
return RipplePage( | ||
pageKey: pageKey, | ||
child: Scaffold( | ||
appBar: AppBar( | ||
title: Center(child: Text('Home')), | ||
), | ||
body: Center(), | ||
floatingActionButton: RippleEffect( | ||
pageKey: pageKey, | ||
effectKey: effectKey, | ||
color: Colors.purple, | ||
child: FloatingActionButton( | ||
onPressed: () => RippleEffect.start(effectKey, toNextPage), | ||
child: Icon(Icons.cake), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
|
||
Future<void> toNextPage() => Navigator.of(context).push( | ||
FadeRouteBuilder( | ||
page: SecondPage(), | ||
), | ||
); | ||
} | ||
|
||
class SecondPage extends StatelessWidget { | ||
final pageKey = RipplePage.createGlobalKey(); | ||
final effectKey = RippleEffect.createGlobalKey(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text(widget.title), | ||
), | ||
body: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: <Widget>[ | ||
Text( | ||
'You have pushed the button this many times:', | ||
), | ||
Text( | ||
'$_counter', | ||
style: Theme.of(context).textTheme.display1, | ||
return RipplePage( | ||
pageKey: pageKey, | ||
child: Scaffold( | ||
appBar: AppBar( | ||
backgroundColor: Colors.purple, | ||
title: Center(child: Text('Second Page')), | ||
), | ||
body: Center(), | ||
floatingActionButton: RippleEffect( | ||
pageKey: pageKey, | ||
effectKey: effectKey, | ||
color: Colors.blue, | ||
child: FloatingActionButton( | ||
backgroundColor: Colors.blue, | ||
onPressed: () => | ||
RippleEffect.start(effectKey, () => toNextPage(context)), | ||
child: Icon(Icons.arrow_back), | ||
), | ||
], | ||
), | ||
), | ||
floatingActionButton: FloatingActionButton( | ||
onPressed: _incrementCounter, | ||
tooltip: 'Increment', | ||
child: Icon(Icons.add), | ||
), | ||
)), | ||
); | ||
} | ||
|
||
Future<void> toNextPage(BuildContext context) => Navigator.of(context).push( | ||
FadeRouteBuilder( | ||
page: HomePage(), | ||
), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import 'package:flutter/foundation.dart' | ||
show debugDefaultTargetPlatformOverride; | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'main.dart' as original_main; | ||
|
||
void main() { | ||
debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; | ||
original_main.main(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
library ripple_effect; | ||
|
||
export 'src/ripple_effect.dart' show Ripple, RippleEffect; | ||
export 'src/ripple_effect.dart' show RipplePage, RippleEffect; | ||
export 'src/transition.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters