import
'package:flutter/material.dart'
;
import
'package:permission_handler/permission_handler.dart'
;
void
main() {
runApp(
const
MyApp());
}
class
MyApp extends StatelessWidget {
const
MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return
MaterialApp(
title:
'Flutter Demo'
,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: GFG(),
debugShowCheckedModeBanner:
false
,
);
}
}
class
GFG extends StatefulWidget {
const
GFG({Key? key}) : super(key: key);
@override
State<GFG> createState() => _GFGState();
}
class
_GFGState extends State<GFG> with TickerProviderStateMixin {
late AnimationController _controller;
bool
_bool =
true
;
@override
Widget build(BuildContext context) {
return
Scaffold(
appBar: AppBar(
title: Text(
"GeeksForGeeks"
),
actions: [
TextButton(
onPressed: () {
setState(
() {
_bool = !_bool;
},
);
},
child: Text(
"Switch"
, style: TextStyle(color: Colors.white)),
),
],
),
body: Center(
child: AnimatedCrossFade(
firstChild: Container(
height: 230,
width: 250,
color: Colors.blue,
),
secondChild: Container(
height: 250,
width: 230,
color: Colors.green,
),
crossFadeState:
_bool ? CrossFadeState.showFirst : CrossFadeState.showSecond,
duration: Duration(seconds: 1)),
),
);
}
}