Skip to content

Instantly share code, notes, and snippets.

View felixblaschke's full-sized avatar

Felix Blaschke felixblaschke

  • Schwerin, Germany
View GitHub Profile
class FadeInUi extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Container(
padding: EdgeInsets.all(20.0),
child: Column(
children: <Widget>[
HeaderPlaceholder(),
WhitespaceSeparator(),
class FadeIn extends StatelessWidget {
final double delay;
final Widget child;
FadeIn(this.delay, this.child);
@override
Widget build(BuildContext context) {
final tween = MultiTrackTween([
Track("opacity")
@felixblaschke
felixblaschke / fade-in-ui-demo-2.dart
Created April 11, 2019 16:34
Fade-in UI Demo - Animated
class FadeInUi extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Container(
padding: EdgeInsets.all(20.0),
child: Column(
children: <Widget>[
FadeIn(1.0, HeaderPlaceholder()),
WhitespaceSeparator(),
@felixblaschke
felixblaschke / animated-background.dart
Created April 14, 2019 05:33
Animated Background Gradient Widget
class AnimatedBackground extends StatelessWidget {
@override
Widget build(BuildContext context) {
final tween = MultiTrackTween([
Track("color1").add(Duration(seconds: 3),
ColorTween(begin: Color(0xffD38312), end: Colors.lightBlue.shade900)),
Track("color2").add(Duration(seconds: 3),
ColorTween(begin: Color(0xffA83279), end: Colors.blue.shade600))
]);
@felixblaschke
felixblaschke / animated-wave.dart
Created April 14, 2019 06:19
Animated Wave and it's Painter class
class AnimatedWave extends StatelessWidget {
final double height;
final double speed;
final double offset;
AnimatedWave({this.height, this.speed, this.offset = 0.0});
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, constraints) {
@felixblaschke
felixblaschke / fancy-background-app.dart
Created April 14, 2019 06:28
Fancy Background Animation
class FancyBackgroundApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Stack(
children: <Widget>[
Positioned.fill(child: AnimatedBackground()),
onBottom(AnimatedWave(
height: 180,
speed: 1.0,
)),
@felixblaschke
felixblaschke / switchlike-checkbox-part1.dart
Created April 17, 2019 14:40
Switchlike Checkbox (Part 1)
class SwitchlikeCheckbox extends StatelessWidget {
final bool checked;
SwitchlikeCheckbox({this.checked});
@override
Widget build(BuildContext context) {
var tween = MultiTrackTween([
Track("paddingLeft")
.add(Duration(milliseconds: 1000), Tween(begin: 0.0, end: 20.0)),
@felixblaschke
felixblaschke / switchlike-checkbox-part2.dart
Last active April 17, 2019 15:46
Switchlike Checkbox Part 2
class SwitchlikeCheckbox extends StatelessWidget {
// ...
// all code from part 1
Widget _buildCheckbox(context, animation) {
return Container(
decoration: _outerBoxDecoration(animation["color"]),
width: 50,
height: 30,
padding: const EdgeInsets.all(3.0),
@felixblaschke
felixblaschke / example-form-for-switchlike-checkbox.dart
Created April 17, 2019 15:20
Example Form for Switchlike Checkbox
class ExampleForm extends StatefulWidget {
@override
_ExampleFormState createState() => _ExampleFormState();
}
class _ExampleFormState extends State<ExampleForm> {
bool enableCoolStuff = false;
@override
Widget build(BuildContext context) {
@felixblaschke
felixblaschke / load-stuff-1.dart
Last active April 22, 2019 10:02
load-stuff-1.dart
class LoadStuffButton extends StatefulWidget {
@override
_LoadStuffButtonState createState() => _LoadStuffButtonState();
}
class _LoadStuffButtonState extends State<LoadStuffButton> {
bool _startedLoading = false;
bool _firstAnimationFinished = false;
bool _dataAvailable = false;