Skip to main content

Posts

Showing posts from December 25, 2022

How To Change Value In Appbar Text Flutter On Button Click From Other class

  How to Update State of Parent StatefulWidget from other Child StatefulWidget in Flutter? Hi! all today we going to learn how we can update or change text of parent StatefulWidget in appbar from the child StatefulWidget in flutter. Same as we can also change any color, icon or other data of parent widget. class ParentWidget extends StatelessWidget {    int cartitem = 0 ; @override Widget build ( BuildContext context) { return Scaffold ( appBar: AppBar ( titleSpacing: 0 , leading: Icon ( Icons .location_on, size: 20 , color: Colors .white, ), title: Text ( "Title" ), actions: < Widget >[ Stack ( children: [ IconButton ( icon: Icon ( Icons .shopping_cart), color: Colors .white, ), Positioned . directional ( textDirection: Directionality . of (context), ...