skip to Main Content

How to use a method in a Stateful Widget from another Widget – Flutter

So i have this toggle() method in the Stateful SideBar class class SideBar extends StatefulWidget { const SideBar({super.key}); @override State<SideBar> createState() => _SideBarState(); } class _SideBarState extends State<SideBar> with SingleTickerProviderStateMixin{ void toggle() { if (_controller.isCompleted) { _controller.reverse(); } else {_controller.forward();}…

VIEW QUESTION

How can I create a random color Linear Gradient so that the random color generated is constant for each profile? – Flutter

body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( decoration: const BoxDecoration( shape: BoxShape.circle, gradient: LinearGradient( begin: Alignment.bottomCenter, end: Alignment.topRight, colors: [ Colors.orange, Colors.red, ], ), ), child: const CircleAvatar( radius: 70, backgroundColor: Colors.transparent, child: Text( "S", style: TextStyle( color:…

VIEW QUESTION
Back To Top
Search