Skip to content

Instantly share code, notes, and snippets.

@itog
Created June 3, 2020 11:22
Show Gist options
  • Save itog/8258f0752dbb8e487b2d353fc67cebed to your computer and use it in GitHub Desktop.
Save itog/8258f0752dbb8e487b2d353fc67cebed to your computer and use it in GitHub Desktop.
Overflow widget can be visible with 'Overflow.visible' but untouchable.
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(child: AnimationTest());
}
}
class AnimationTest extends StatefulWidget {
_AnimationTestState createState() => _AnimationTestState();
}
class _AnimationTestState extends State<AnimationTest> {
bool toggle = false;
@override
Widget build(BuildContext context) {
return Container(
width: 200,
height: 200,
color: Colors.grey,
child: Stack(
overflow: Overflow.visible,
children: [
AnimatedPositioned(
duration: Duration(milliseconds: 300),
left: toggle ? -100 : 0,
bottom: 50.0,
child: RaisedButton(
child: Text("hello"),
onPressed: () => setState(() {
toggle = !toggle;
print(toggle);
})))
]));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment