refactored

This commit is contained in:
Ayan Das
2023-04-23 12:08:42 +05:30
parent a54a1cd8ef
commit 919b584a2c
2 changed files with 13 additions and 17 deletions

View File

@ -26,13 +26,13 @@ class _Lecture3State extends State<Lecture3> with TickerProviderStateMixin {
super.initState();
_xController =
AnimationController(vsync: this, duration: Duration(seconds: 10));
AnimationController(vsync: this, duration: const Duration(seconds: 10));
_yController =
AnimationController(vsync: this, duration: Duration(seconds: 15));
AnimationController(vsync: this, duration: const Duration(seconds: 15));
_zController =
AnimationController(vsync: this, duration: Duration(seconds: 20));
AnimationController(vsync: this, duration: const Duration(seconds: 20));
_animation = Tween<double>(begin: 0, end: pi * 2);
}
@ -81,7 +81,7 @@ class _Lecture3State extends State<Lecture3> with TickerProviderStateMixin {
child: Container(
height: 100,
width: 100,
color: Color.fromARGB(255, 93, 171, 236),
color: const Color.fromARGB(255, 93, 171, 236),
),
),
@ -92,7 +92,7 @@ class _Lecture3State extends State<Lecture3> with TickerProviderStateMixin {
child: Container(
height: 100,
width: 100,
color: Color.fromARGB(255, 98, 176, 240),
color: const Color.fromARGB(255, 98, 176, 240),
)),
// Right Side
@ -102,7 +102,7 @@ class _Lecture3State extends State<Lecture3> with TickerProviderStateMixin {
child: Container(
height: 100,
width: 100,
color: Color.fromARGB(255, 77, 144, 199),
color: const Color.fromARGB(255, 77, 144, 199),
)),
// Top Side
@ -112,7 +112,7 @@ class _Lecture3State extends State<Lecture3> with TickerProviderStateMixin {
child: Container(
height: 100,
width: 100,
color: Color.fromARGB(255, 111, 190, 255),
color: const Color.fromARGB(255, 111, 190, 255),
)),
// Top Side
@ -122,14 +122,14 @@ class _Lecture3State extends State<Lecture3> with TickerProviderStateMixin {
child: Container(
height: 100,
width: 100,
color: Color.fromARGB(255, 52, 157, 243),
color: const Color.fromARGB(255, 52, 157, 243),
)),
// Front
Container(
height: 100,
width: 100,
color: Color.fromARGB(255, 114, 185, 247),
color: const Color.fromARGB(255, 114, 185, 247),
),
],
),

View File

@ -1,7 +1,5 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
class Person {
final String name;
@ -52,7 +50,7 @@ class _Lecture4State extends State<Lecture4> {
tag: person.name,
child: Text(
person.emoji,
style: TextStyle(fontSize: 30),
style: const TextStyle(fontSize: 30),
),
),
title: Text(person.name),
@ -82,28 +80,26 @@ class Details extends StatelessWidget {
case HeroFlightDirection.push:
return Material(
color: Colors.transparent, child: fromHeroContext.widget);
break;
case HeroFlightDirection.pop:
return Material(
color: Colors.transparent, child: toHeroContext.widget);
break;
}
},
tag: person.name,
child: Text(
person.emoji,
style: TextStyle(fontSize: 40),
style: const TextStyle(fontSize: 40),
),
),
),
body: Center(
child: Column(
children: [
SizedBox(
const SizedBox(
height: 20,
),
Text(person.name),
SizedBox(
const SizedBox(
height: 20,
),
Text("${person.age} years old")