Source Code:
import 'package:flutter/material.dart';
void main(){
runApp(MaterialApp(
home: Animation(),
theme: ThemeData.dark(),
));
}
class Animation extends StatefulWidget {
@override
_AnimationState createState() => _AnimationState();
}
class _AnimationState extends State<Animation> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Animation'),),
);
}
}
Step 1: Let's first Import the package
import 'package:flutter/material.dart';
Step 2: Now adding a statefulwidget and naming it as Animation
class Animation extends StatefulWidget {
@override
_AnimationState createState() => _AnimationState();
}
class _AnimationState extends State<Animation> {
@override
Widget build(BuildContext context) {
return Scaffold(
);
}
}
Step 3: Adding AppBar in statefulwidget
class Animation extends StatefulWidget {
@override
_AnimationState createState() => _AnimationState();
}
class _AnimationState extends State<Animation> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Animation'),),
);
}
}
step 4: To Execte adding main class on MaterialApp
void main(){
runApp(MaterialApp(
));
}
step 5: Adding the Animation class in main class
void main(){
runApp(MaterialApp(
home: Animation(),
));
}
step 6: Making The Theme as Dark Theme in main class
void main(){
runApp(MaterialApp(
home: Animation(),
theme: ThemeData.dark(),
));
}