Skip to content

Instantly share code, notes, and snippets.

@IsmailAlamKhan
Last active October 6, 2021 10:28
Show Gist options
  • Save IsmailAlamKhan/e819e5521673b71499f9d673c0af25dc to your computer and use it in GitHub Desktop.
Save IsmailAlamKhan/e819e5521673b71499f9d673c0af25dc to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(title: 'Material App', home: Home());
}
}
class Home extends StatefulWidget {
const Home({
Key? key,
}) : super(key: key);
@override
State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
late final animationController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 500),
);
@override
void dispose() {
animationController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Stack(
children: [
Scaffold(
appBar: AppBar(title: const Text('Material App Bar')),
body: const Center(child: Text('Hello World')),
),
Align(
alignment: Alignment.bottomCenter,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
height: 40,
width: double.infinity,
child: Material(
color: Colors.green,
child: InkWell(
onTap: () {
if (animationController.isCompleted) {
animationController.reverse();
} else {
animationController.forward();
}
},
child: RotationTransition(
turns: Tween(begin: .0, end: 0.5)
.animate(animationController),
child: const Icon(Icons.keyboard_arrow_up),
),
),
),
),
SizeTransition(
sizeFactor: animationController,
axis: Axis.vertical,
axisAlignment: 1.0,
child: const SizedBox(
height: 200,
width: double.infinity,
child: Material(
color: Colors.blue,
),
),
),
],
),
)
],
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment