Created with <3 with dartpad.dev.
Open with https://dartpad.dev/810896d72765464fbfc8a4179b1be96c
Created with <3 with dartpad.dev.
Open with https://dartpad.dev/810896d72765464fbfc8a4179b1be96c
import 'package:flutter/material.dart'; | |
const 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: const Scaffold( | |
body: Center( | |
child: MyHomePage(), | |
), | |
), | |
); | |
} | |
} | |
class MyHomePage extends StatefulWidget { | |
const MyHomePage({Key? key}) : super(key: key); | |
@override | |
State<MyHomePage> createState() => _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> | |
with SingleTickerProviderStateMixin { | |
late final AnimationController _controller = AnimationController( | |
vsync: this, | |
duration: const Duration(milliseconds: 800), | |
)..forward(); | |
late final Animation<Offset> _slideAnimation = Tween<Offset>( | |
begin: const Offset(0, -0.5), | |
end: Offset.zero, | |
).animate(CurvedAnimation(parent: _controller, curve: Curves.easeInOut)); | |
@override | |
void dispose() { | |
_controller.dispose(); | |
super.dispose(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: SlideTransition( | |
position: _slideAnimation, | |
child: FadeTransition( | |
opacity: _controller, | |
child: Text('Hello World', style: textStyle), | |
), | |
)), | |
); | |
} | |
TextStyle? get textStyle => Theme.of(context).textTheme.headlineMedium; | |
} |